@@ -406,7 +406,6 @@ if (tstackSize<DEF_TSTACK_SIZE) defStackSize=DEF_TSTACK_SIZE;
406406 bool chr_changed=false ;
407407 int pos=0 ;
408408 const char * refseqName=NULL ;
409- // char strand=0;
410409 char xstrand=0 ;
411410 int nh=1 ;
412411 int hi=0 ;
@@ -441,7 +440,8 @@ if (tstackSize<DEF_TSTACK_SIZE) defStackSize=DEF_TSTACK_SIZE;
441440 }
442441 if (xstrand==' .' && brec->exons .Count ()>1 ) {
443442 no_xs++;
444- continue ; // skip spliced alignments lacking XS tag (e.g. HISAT alignments)
443+ // continue; //skip spliced alignments lacking XS tag (e.g. HISAT alignments) ?
444+ // this is changed in StringTie 2 !
445445 }
446446 if (refseqName==NULL ) GError (" Error: cannot retrieve target seq name from BAM record!\n " );
447447 pos=brec->start ; // BAM is 0 based, but GBamRecord makes it 1-based
@@ -461,10 +461,12 @@ if (tstackSize<DEF_TSTACK_SIZE) defStackSize=DEF_TSTACK_SIZE;
461461 if (alncounts.Count ()<=gseq_id) {
462462 alncounts.Resize (gseq_id+1 , 0 );
463463 }
464- else if (alncounts[gseq_id]>0 ) GError (ERR_BAM_SORT);
464+ else if (alncounts[gseq_id]>0 )
465+ GError (ERR_BAM_SORT);
465466 prev_pos=0 ;
466467 }
467- if (pos<prev_pos) GError (ERR_BAM_SORT);
468+ if (pos<prev_pos)
469+ GError (ERR_BAM_SORT);
468470 prev_pos=pos;
469471 if (skipGseq) continue ;
470472 alncounts[gseq_id]++;
@@ -657,19 +659,18 @@ if (tstackSize<DEF_TSTACK_SIZE) defStackSize=DEF_TSTACK_SIZE;
657659 }
658660 } while (cend_changed);
659661 }
660- } // adjusted currentend and checked for overlapping reference transcripts
662+ } // adjusted currentend ; selected overlapping reference transcripts
661663 GReadAlnData alndata (brec, 0 , nh, hi, tinfo);
662664 bool ovlpguide=bundle->evalReadAln (alndata, xstrand);
663- if (!eonly || ovlpguide) { // in eonly case consider read only if it overlaps guide
664- // check for overlaps with ref transcripts which may set xstrand
665+ // overlaps with ref transcripts may set xstrand if needed
666+ if (!eonly || ovlpguide) {
667+ // in -e mode: a read alignment is discarded if it doesn't overlap a reference transcript!
665668 if (xstrand==' +' ) alndata.strand =1 ;
666669 else if (xstrand==' -' ) alndata.strand =-1 ;
667- // GMessage("%s\t%c\t%d\thi=%d\n",brec->name(), xstrand, alndata.strand,hi);
668- // countFragment(*bundle, *brec, hi,nh); // we count this in build_graphs to only include mapped fragments that we consider correctly mapped
669- // fprintf(stderr,"fragno=%d fraglen=%lu\n",bundle->num_fragments,bundle->frag_len);if(bundle->num_fragments==100) exit(0);
670- // if (!ballgown || ref_overlap)
671- processRead (currentstart, currentend, *bundle, hashread, alndata);
672- // *brec, strand, nh, hi);
670+ // this is changed in StringTie 2 ! (improved transcription strand guessing)
671+ bool XSmissing=(alndata.strand ==0 && brec->exons .Count ()>1 );
672+ if (!XSmissing)
673+ processRead (currentstart, currentend, *bundle, hashread, alndata);
673674 }
674675 } // for each read alignment
675676
0 commit comments