From 45fe3dd0a74048b40a91dd58f8f008e66dae3b58 Mon Sep 17 00:00:00 2001 From: Alexander Dobin Date: Wed, 1 Mar 2023 12:55:59 -0500 Subject: [PATCH] 2.7.10b_alpha_230301: Issue #1763: Fixed a bug causing segnmentation fault in rare cases for 2-pass mapping. --- CHANGES.md | 1 + source/ReadAlign.cpp | 7 +++++++ source/ReadAlign.h | 4 ++++ source/ReadAlign_oneRead.cpp | 7 +++++++ source/VERSION | 2 +- source/sjdbBuildIndex.cpp | 4 ++-- 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index ed480043..96d8c9f7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,4 @@ +* Issue #1763: Fixed a bug causing segnmentation fault in rare cases for 2-pass mapping. * Issue #1733: Fixed the issue with counting of intronicAS reads in STARsolo CellReads.stats output with --soloFeatures GeneFull_Ex50pAS option. STAR 2.7.10b --- 2022/11/01 ::: Bug-fix release. diff --git a/source/ReadAlign.cpp b/source/ReadAlign.cpp index e2a8a3c8..44dd1d4d 100755 --- a/source/ReadAlign.cpp +++ b/source/ReadAlign.cpp @@ -101,6 +101,13 @@ ReadAlign::ReadAlign (Parameters& Pin, Genome &genomeIn, Transcriptome *TrIn, in //clipping P.pClip.initializeClipMates(clipMates); + + //debug + { + #ifdef DEBUG_OutputLastRead + lastReadStream.open((P.outFileTmp+"/lastRead_"+to_string(iChunk)).c_str()); + #endif + }; }; void ReadAlign::resetN () {//reset resets the counters to 0 for a new read diff --git a/source/ReadAlign.h b/source/ReadAlign.h index 7fcba404..452b6cbf 100755 --- a/source/ReadAlign.h +++ b/source/ReadAlign.h @@ -177,6 +177,10 @@ class ReadAlign { //read annotations ReadAnnotations readAnnot; + #ifdef DEBUG_OutputLastRead + ofstream lastReadStream; + #endif + /////////////////////////////////////////////////////////////////// METHODS void resetN();//resets the counters to 0 void multMapSelect(); diff --git a/source/ReadAlign_oneRead.cpp b/source/ReadAlign_oneRead.cpp index 92d644ef..90b902e1 100755 --- a/source/ReadAlign_oneRead.cpp +++ b/source/ReadAlign_oneRead.cpp @@ -110,6 +110,13 @@ int ReadAlign::oneRead() {//process one read: load, map, write //write out alignments outputAlignments(); + { + #ifdef DEBUG_OutputLastRead + lastReadStream.seekp(ios::beg); + lastReadStream << iReadAll <<" "<< readName <0 ) {//- strand uint ind1s = mapGen1.nGenome - (ind1 & strandMask); - if (ind1s>mapGen.chrStart[mapGen.nChrReal]) + if (ind1s>=mapGen.chrStart[mapGen.nChrReal]) {//this index was an old sj, may need to shift it uint sj1 = (ind1s-mapGen.chrStart[mapGen.nChrReal])/mapGen.sjdbLength;//old junction index ind1s += (oldSJind[sj1]-sj1)*mapGen.sjdbLength; @@ -172,7 +172,7 @@ void sjdbBuildIndex (Parameters &P, char *Gsj, char *G, PackedArray &SA, PackedA }; } else {//+ strand - if (ind1>mapGen.chrStart[mapGen.nChrReal]) + if (ind1>=mapGen.chrStart[mapGen.nChrReal]) {//this index was an old sj, may need to shift it uint sj1 = (ind1-mapGen.chrStart[mapGen.nChrReal])/mapGen.sjdbLength;//old junction index ind1 += (oldSJind[sj1]-sj1)*mapGen.sjdbLength;