From d4567a17293930f7c36577d2e8b63a4cf1e69593 Mon Sep 17 00:00:00 2001 From: earonesty Date: Fri, 5 Sep 2014 16:45:13 +0000 Subject: [PATCH] fix dup filter... speed it up too --- clipper/varcall.cpp | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/clipper/varcall.cpp b/clipper/varcall.cpp index 33c5c4f..e43bbad 100644 --- a/clipper/varcall.cpp +++ b/clipper/varcall.cpp @@ -234,7 +234,7 @@ class PileupSummary { int RepeatCount; char RepeatBase; - PileupSummary(char *line, PileupReads &reads, tidx *annot=NULL, char annot_type='\0'); + void Parse(char *line, PileupReads &reads, tidx *annot=NULL, char annot_type='\0'); PileupSummary() { Base = '\0'; Pos=-1; }; }; @@ -256,7 +256,7 @@ friend class PileupSubscriber; private: void Visit(PileupSummary &dat); void VisitX(PileupSummary &dat, int windex); - PileupSummary *CurrentSummary; + PileupSummary Pileup; protected: vector Kids; @@ -942,7 +942,7 @@ typedef struct { } ChrRange; -PileupSummary::PileupSummary(char *line, PileupReads &rds, tidx *adex, char atype) { +void PileupSummary::Parse(char *line, PileupReads &rds, tidx *adex, char atype) { vector d=split(line, '\t'); @@ -953,6 +953,8 @@ PileupSummary::PileupSummary(char *line, PileupReads &rds, tidx *adex, char atyp const char * p_qual=d[5]; + Calls.resize(0); + Chr=d[0]; Pos=atoi(d[1]); Base=*(d[2]); @@ -973,7 +975,7 @@ PileupSummary::PileupSummary(char *line, PileupReads &rds, tidx *adex, char atyp const char *cur_p = d[4]; list::iterator read_i = rds.ReadList.begin(); - + memset(depthbypos.data(),0,depthbypos.size()*sizeof(depthbypos[0])); memset(depthbyposbycall.data(),0,depthbyposbycall.size()*sizeof(depthbyposbycall[0])); @@ -1088,6 +1090,16 @@ PileupSummary::PileupSummary(char *line, PileupReads &rds, tidx *adex, char atyp } } +/* + if (debug_xpos) { + if (Pos == debug_xpos && !strcmp(debug_xchr,Chr.data())) { + fprintf(stderr, "DEBUG: PIA: %d, DBP: %d, rrou: %d, nonRR: %f, maxdbp: %d, filt: %d, f1: %d, f2: %d\n", pia, + depthbypos[pia], max(1,rand_round(0.5 + artifact_filter * (Depth/rds.MeanReadLen()))), artifact_filter * (Depth/rds.MeanReadLen()), + maxdepthbypos, (10*depthbypos[pia])+(i%10), ((10*depthbypos[pia])+(i%10)) > maxdepthbypos, depthbypos[pia] > max(1,rand_round(0.5+artifact_filter * (Depth/rds.MeanReadLen()))) ); + } + } +*/ + if (!ampok) { // warn("SKIP: %d-%d, %c\n", read_i->Pos, (int)(read_i->Pos+rds.MeanReadLen()), o); ++SkipAmp; @@ -1231,7 +1243,7 @@ PileupSummary::PileupSummary(char *line, PileupReads &rds, tidx *adex, char atyp if (debug_xpos) { if (Pos == debug_xpos && !strcmp(debug_xchr,Chr.data())) { - fprintf(stderr,"xpos-max-per-pos\t%d\n", maxdepthbypos); + fprintf(stderr,"xpos-max-per-pos\t%f\n", maxdepthbypos/10.0); fprintf(stderr,"xpos-mean-readlen\t%f\n", rds.MeanReadLen()); fprintf(stderr,"xpos-depth-list\t"); for (i=0;iChr, CurrentSummary->Pos-flank-1, CurrentSummary->Pos+flank-1); + faidx.Fetch((char *)Reference.data(), Pileup.Chr, Pileup.Pos-flank-1, Pileup.Pos+flank-1); } } else { - faidx.Fetch((char *)Reference.data(), CurrentSummary->Chr, CurrentSummary->Pos-flank-1, CurrentSummary->Pos+flank-1); + faidx.Fetch((char *)Reference.data(), Pileup.Chr, Pileup.Pos-flank-1, Pileup.Pos+flank-1); } }