File: AlignmentSetToCmpH5Adapter.hpp

package info (click to toggle)
pbseqlib 5.3.5%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,020 kB
  • sloc: cpp: 77,250; python: 331; sh: 103; makefile: 41
file content (81 lines) | stat: -rw-r--r-- 2,604 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef _BLASR_ALIGNMENT_SET_TO_CMPH5_ADAPTER_HPP_
#define _BLASR_ALIGNMENT_SET_TO_CMPH5_ADAPTER_HPP_

#include <alignment/datastructures/alignment/ByteAlignment.h>
#include <alignment/algorithms/alignment/DistanceMatrixScoreFunction.hpp>
#include <alignment/datastructures/alignment/AlignmentCandidate.hpp>
#include <hdf/HDFCmpFile.hpp>
#include <pbdata/sam/AlignmentSet.hpp>
#include <pbdata/utils/SMRTReadUtils.hpp>

class RefGroupNameId
{
public:
    std::string name;
    unsigned int id;
    RefGroupNameId()
    {
        id = 0;
        name = "";
    }

    RefGroupNameId(std::string n, unsigned int i)
    {
        name = n;
        id = i;
    }

    RefGroupNameId(const RefGroupNameId &rhs)
    {
        name = rhs.name;
        id = rhs.id;
    }
};

// number of zmws per SMRTCell for springfield: 163482
const unsigned int numZMWsPerMovieSpringField = 163482;

template <typename T_CmpFile>
class AlignmentSetToCmpH5Adapter
{
public:
    // Map reference name to reference group (/RefGroup) name and ID.
    std::map<std::string, RefGroupNameId> refNameToRefGroupNameandId;
    std::map<std::string, unsigned int> knownMovies;
    std::map<std::string, unsigned int> knownPaths;
    unsigned int numAlignments;
    std::map<std::string, int> refNameToRefInfoIndex;

    void Initialize() { numAlignments = 0; }

    template <typename T_Reference>
    void StoreReferenceInfo(std::vector<T_Reference> &references, T_CmpFile &cmpFile);

    unsigned int StoreMovieInfo(std::string movieName, T_CmpFile &cmpFile);

    // Given a reference name, find whether there exists a refGroup
    // (e.g. /ref000001) associated with it.
    // If not, create a refGroup and update refNameToRefGroupNameandId.
    // Finally, return its associated refGroup ID.
    unsigned int StoreRefGroup(std::string refName, T_CmpFile &cmpFile);

    unsigned int StorePath(std::string &path, T_CmpFile &cmpFile);

    void RemoveGapsAtEndOfAlignment(AlignmentCandidate<> &alignment);

    void StoreAlignmentCandidate(AlignmentCandidate<> &alignment, int alnSegment,
                                 T_CmpFile &cmpFile, int moleculeNumber = -1, bool copyQVs = false);

    void StoreAlignmentCandidateList(std::vector<AlignmentCandidate<> > &alignments,
                                     T_CmpFile &cmpFile, int moleculeNumber = -1,
                                     bool copyQVs = false);

    void StoreAlignmentCandidate(AlignmentCandidate<> alignment, T_CmpFile &cmpFile)
    {
        StoreAlignmentCandidate(alignment, 0, cmpFile);
    }
};

#include "AlignmentSetToCmpH5AdapterImpl.hpp"

#endif