-
Notifications
You must be signed in to change notification settings - Fork 2
/
SoloCB.cpp
55 lines (47 loc) · 1.76 KB
/
SoloCB.cpp
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
#include "SoloCB.h"
#include "streamFuns.h"
SoloCB::SoloCB(int32 feTy, Parameters &Pin, int iChunk)
: featureType(feTy), P(Pin), pSolo(P.pSolo)
{
if (pSolo.type==0 || !pSolo.featureYes[featureType])
return;
for (uint32 ii=0; ii<stats.nStats; ii++)
stats.V[ii]=0;
cbReadCount = new uint32[pSolo.cbWL.size()];
cbReadCountExact = new uint32[pSolo.cbWL.size()];
for (uint32 ii=0; ii<pSolo.cbWL.size(); ii++) {
cbReadCount[ii]=0;
cbReadCountExact[ii]=0;
};
if (iChunk>=0) {
strU_0 = &fstrOpen(P.outFileTmp+"/solo"+pSolo.featureNames[featureType]+"_0_"+std::to_string(iChunk),ERROR_OUT, P);
strU_1 = &fstrOpen(P.outFileTmp+"/solo"+pSolo.featureNames[featureType]+"_1_"+std::to_string(iChunk),ERROR_OUT, P);
strU_2 = &fstrOpen(P.outFileTmp+"/solo"+pSolo.featureNames[featureType]+"_2_"+std::to_string(iChunk),ERROR_OUT, P);
};
for (uint32 jj=0;jj<4;jj++) {
homoPolymer[jj]=0;
for (uint32 ii=0; ii<pSolo.umiL;ii++) {
homoPolymer[jj]=(homoPolymer[jj]<<2)+jj;
};
};
};
void SoloCB::addSoloCBcounts(const SoloCB &soloCBin)
{
for (uint32 ii=0; ii<pSolo.cbWL.size(); ii++) {
cbReadCount[ii] += soloCBin.cbReadCount[ii];
cbReadCountExact[ii] += soloCBin.cbReadCountExact[ii];
};
};
void SoloCB::addSoloCBstats(const SoloCB &soloCBin)
{
for (uint32 ii=0; ii<stats.nStats; ii++)
stats.V[ii] += soloCBin.stats.V[ii];
};
void SoloCB::statsOut(ofstream &streamOut)
{
//streamOut << setw(50) << "CELL BARCODES IN READS:\n"
for (uint32 ii=0; ii<stats.nStats; ii++) {
streamOut << setw(50) << stats.names.at(ii) << setw(15) << stats.V[ii] << '\n';
};
streamOut.flush();
};