File: ReaderAgglomerateImpl.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 (45 lines) | stat: -rw-r--r-- 1,063 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
#ifndef _BLASR_READER_AGGLOMERATE_IMPL_HPP_
#define _BLASR_READER_AGGLOMERATE_IMPL_HPP_

template <typename T_Sequence>
int ReaderAgglomerate::GetNext(T_Sequence &seq, int &randNum)
{
    randNum = rand();
    return GetNext(seq);
}

template <typename T_Sequence>
int ReadChunkByNReads(ReaderAgglomerate &reader, std::vector<T_Sequence> &reads, int maxNReads)
{
    T_Sequence seq;
    int nReads = 0;
    while (nReads < maxNReads) {
        if (reader.GetNext(seq)) {
            reads.push_back(seq);
            ++nReads;
        } else {
            break;
        }
    }
    return nReads;
}

template <typename T_Sequence>
int ReadChunkBySize(ReaderAgglomerate &reader, std::vector<T_Sequence> &reads, int maxMemorySize)
{
    T_Sequence seq;
    int nReads = 0;
    int totalStorage = 0;
    while (totalStorage < maxMemorySize) {
        if (reader.GetNext(seq)) {
            reads.push_back(seq);
            totalStorage += seq.GetStorageSize();
            nReads++;
        } else {
            break;
        }
    }
    return nReads;
}

#endif