File: RegionUtilsImpl.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 (51 lines) | stat: -rw-r--r-- 1,667 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
#ifndef _BLASR_REGION_UTILS_IMPL_HPP
#define _BLASR_REGION_UTILS_IMPL_HPP

//FIXME: move all functions to class SMRTSequence
template <typename T_Sequence>
bool MaskRead(T_Sequence &fastaRead, ZMWGroupEntry &zmwData, RegionTable &regionTable)
{
    if (not regionTable.HasHoleNumber(zmwData.holeNumber)) {
        return false;
    } else {
        RegionAnnotations regions = regionTable[zmwData.holeNumber];

        // Mask off the low quality portion of this read.
        DNALength readPos;
        for (readPos = 0; readPos < std::min(regions.HQStart(), fastaRead.length); readPos++) {
            fastaRead.seq[readPos] = 'N';
        }
        for (readPos = regions.HQEnd(); readPos < fastaRead.length; readPos++) {
            fastaRead.seq[readPos] = 'N';
        }
        return regions.HasHQRegion();
    }
}

/// \params[in]  - fastaRead, zmwData, regionTable
/// \params[out] - readStart
/// \params[out] - readEnd
/// \params[out] - score
/// \returns Whether or not read coordinate trimmed according to HQRegion
template <typename T_Sequence>
bool GetReadTrimCoordinates(T_Sequence &fastaRead, ZMWGroupEntry &zmwData, RegionTable &regionTable,
                            DNALength &readStart, DNALength &readEnd, int &score)
{

    if (regionTable.HasHoleNumber(zmwData.holeNumber)) {
        RegionAnnotations regions = regionTable[zmwData.holeNumber];
        if (regions.HasHQRegion()) {
            readStart = regions.HQStart();
            readEnd = regions.HQEnd();
            score = regions.HQScore();
            return true;
        }
    }

    readStart = 0;
    readEnd = fastaRead.length;
    score = 0;
    return false;
}

#endif