File: RegionUtils.hpp

package info (click to toggle)
pbseqlib 5.3.1%2Bdfsg-2.1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,136 kB
  • sloc: cpp: 77,246; python: 570; makefile: 312; sh: 111; ansic: 9
file content (74 lines) | stat: -rw-r--r-- 3,484 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
#ifndef _BLASR_REGION_UTILS_HPP_
#define _BLASR_REGION_UTILS_HPP_

#include <algorithm>
#include <cmath>

#include <alignment/statistics/StatUtils.hpp>
#include <pbdata/SMRTSequence.hpp>
#include <pbdata/reads/ReadInterval.hpp>
#include <pbdata/reads/RegionTable.hpp>

bool LookupHQRegion(int holeNumber, RegionTable &regionTable, int &start, int &end, int &score);

template <typename T_Sequence>
bool MaskRead(T_Sequence &fastaRead, ZMWGroupEntry &zmwData, RegionTable &regionTable);

template <typename T_Sequence>
bool GetReadTrimCoordinates(T_Sequence &fastaRead, ZMWGroupEntry &zmwData, RegionTable &regionTable,
                            DNALength &readStart, DNALength &readEnd, int &score);

// Given a vecotr of ReadInterval objects and their corresponding
// directions, intersect each object with an interval
// [hqStart, hqEnd), if there is no intersection or the intersected
// interval is less than minIntervalLength, remove this object and
// their corresponding directions; otherwise, replace this object
// with the intersected interval and keep their directions.
// Return index of the (left-most) longest subread interval in the
// updated vector.
int GetHighQualitySubreadsIntervals(std::vector<ReadInterval> &subreadIntervals,
                                    std::vector<int> &subreadDirections, int hqStart, int hqEnd,
                                    int minIntervalLength = 0);

// Given a vector of subreads and a vector of adapters, return
// indices of all full-pass subreads.
std::vector<int> GetFullPassSubreadIndices(std::vector<ReadInterval> &subreadIntervals,
                                           std::vector<ReadInterval> &adapterIntervals);

// Given a vector of subreads and a vector of adapters, return
// index of the (left-most) longest subread which has both
// adapters before & after itself. If no full-pass subreads are
// available, return -1.
int GetLongestFullSubreadIndex(std::vector<ReadInterval> &subreadIntervals,
                               std::vector<ReadInterval> &adapterIntervals);

// Given a vector of subreads and a vector of adapters, return
// index of the median length subread which has both
// adapters before & after itself. If no full-pass subreads are
// available, return -1.
int GetMedianLengthFullSubreadIndex(std::vector<ReadInterval> &subreadIntervals,
                                    std::vector<ReadInterval> &adapterIntervals);

// Given a vector of subreads and a vector of adapters, return
// index of the typical fullpass subread which can represent subreads
// of this zmw.
// * if there is no fullpass subread, return -1;
// * if number of fullpass subreads is less than 4, return index of the
//   left-most longest subread
// * if number of fullpass subreads is greater than or equal 4,
//   * if length of the longest read does not exceed
//      meanLength + 1.96 * deviationLength
//     then, return index of the longest left-most subread
//   * otherwise, return index of the second longest left-most subread
int GetTypicalFullSubreadIndex(std::vector<ReadInterval> &subreadIntervals,
                               std::vector<ReadInterval> &adapterIntervals);

// Create a vector of n directions consisting of interleaved 0 and 1s.
void CreateDirections(std::vector<int> &directions, const int &n);

// Flop all directions in the given vector, if flop is true.
void UpdateDirections(std::vector<int> &directions, bool flop = false);

#include "RegionUtilsImpl.hpp"

#endif