ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/tophat_cpp/prep_reads.cpp
(Generate patch)
# Line 154 | Line 154
154  
155   void writePrepBam(GBamWriter* wbam, Read& read, uint32_t rid, char trashcode=0) {
156    if (wbam==NULL) return;
157 <  string rname;
158 <  str_appendInt(rname,rid);
159 <  GBamRecord bamrec(rname.c_str(), -1, 0, false, read.seq.c_str(), NULL, read.qual.c_str());
160 <  bamrec.add_aux("ZN", 'Z',read.name.length(),(uint8_t*)read.name.c_str());
157 >  string rnum;
158 >  str_appendInt(rnum,rid);
159 >  string rname(read.name);
160 >  size_t pl=rname.length()-1;
161 >  GBamRecord bamrec(rnum.c_str(), -1, 0, false, read.seq.c_str(), NULL, read.qual.c_str());
162 >  int matenum=0;
163 >  if (rname[pl-1]=='/') {
164 >                if (rname[pl]=='1') {
165 >                    bamrec.set_flag(BAM_FREAD1);
166 >                        matenum=1;
167 >                }
168 >                else if (rname[pl]=='2') {
169 >                    bamrec.set_flag(BAM_FREAD2);
170 >                        matenum=2;
171 >                }
172 >                if (matenum) rname.resize(pl-1);
173 >        }
174 >
175 >  bamrec.add_aux("ZN", 'Z',read.name.length(),(uint8_t*)rname.c_str());
176    if (trashcode) {
177           bamrec.set_flag(BAM_FQCFAIL);
178       bamrec.add_aux("ZT", 'A', 1, (uint8_t*)&trashcode);
# Line 266 | Line 281
281          // Chuck the read if there are at least 5 'N's or if it's mostly
282          // (>90%) 'N's and 'A's
283          char trash_code=0;
284 <        if (percent_A > 0.9 ||
285 <            percent_C > 0.9 ||
286 <            percent_G > 0.9 ||
287 <            percent_T > 0.9)
284 >        if (percent_A > 0.8 ||
285 >            percent_C > 0.8 ||
286 >            percent_G > 0.8 ||
287 >            percent_T > 0.8)
288                trash_code='L';
289          else if (percent_N >= 0.1 || percent_4 >=0.1)
290                trash_code='N';

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines