File: HDFSMRTSequenceReader.hpp

package info (click to toggle)
pbseqlib 5.3.5%2Bdfsg-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,152 kB
  • sloc: cpp: 77,259; python: 331; sh: 103; makefile: 41
file content (75 lines) | stat: -rw-r--r-- 2,167 bytes parent folder | download | duplicates (5)
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
#ifndef _BLASR_HDF_SMRT_SEQUENCE_READER_HPP_
#define _BLASR_HDF_SMRT_SEQUENCE_READER_HPP_

#error "Where is data/*? Apparently this header is no longer used."

#include <hdf/HDFBasReader.h>
#include <hdf/HDFZMWReader.h>
#include <pbdata/SMRTSequence.h>

template <typename T_SMRT_Sequence>
class HDFSMRTSequenceReader : public HDFBasReader
{
public:
    HDFZMWReader zmwReader;
    bool readQuality;
    int Initialize(std::string hdfBasFileName, bool _readQuality = true,
                   const H5::FileAccPropList &fileAccProplist = H5::FileAccPropList::DEFAULT)
    {
        HDFBasReader::Initialize(hdfBasFileName, fileAccPropList);
        zmwReader.Initialize(hdfBasFile);
        readQuality = _readQuality;
        if (baseCallsGroup.ContainsObject("WidthInFrames")) {
            useWidthInFrames = InitializeField(baseCallsGroup, "WidthInFrames");
        }
        if (baseCallsGroup.ContainsObject("PreBaseFrames")) {
            usePreBaseFrames = InitializeField(baseCallsGroup, "PreBaseFrames");
        }
        if (baseCallsGroup.ContainsObject("PulseIndex")) {
            usePulseIndex = InitializeField(baseCallsGroup, "PulseIndex");
        }
    }

    int GetNext(T_SMRT_Sequence &seq)
    {
        int retVal;
        //
        // Copy the curBasePos from the bas reader since it gets advanced
        // in the GetNext function.
        //
        DNALength curBasePosCopy = curBasePos;
        retVal = HDFBasReader::GetNext(seq);
        //
        // Bail now if the file is already done
        if (retVal == 0) {
            return retVal;
        }
        zmwReader.GetNext(seq.zmwData);
        return retVal;
    }
    int Advance(int nSteps)
    {
        int retVal;
        retVal = HDFBasReader::Advance(nSteps);
        zmwReader.Advance(nSteps);
        return retVal;
    }
};

template <>
int HDFSMRTSequenceReader<FASTASequence>::GetNext(FASTASequence &seq)
{
    int retVal;
    if (readQuality) {
        retVal = HDFBasReader::GetNext(seq);
    }
    //
    // Bail now if the file is already done
    if (retVal == 0) {
        return retVal;
    }
    zmwReader.GetNext(seq.zmwData);
    return retVal;
}

#endif