alexdobin / STAR

RNA-seq aligner
MIT License
1.77k stars 497 forks source link

STAR Diploid 2.7.11b Segmentation fault (core dumped) after 1st PASS mapping for a subset of samples. #2090

Open archanaraja opened 3 months ago

archanaraja commented 3 months ago

Hi, I was trying to process blood samples using STAR diploid, and the aligner seems to fail on subset of samples. We notice that these samples had paired-end reads <35 million and RIN mostly < 8. We are also wondering if the quality of VCFs could be an issue and if you have any guidelines on the VCF pre-processing that has to be done before passing input to the aligner. We used gencode v45 gtf along with genome vcf to generate the reference and the command used to run the STAR aligner is listed below. It would be great if you can let us know if we require any parameter tweaking to get the aligner to work on all samples. On the other hand we were able to process these samples successfully with earlier versions of STAR without using the personal VCFs.

STAR version used 2.7.11b

Segmentation fault      (core dumped) 
STAR --runMode alignReads --runThreadN 12 --genomeDir star_index --twopassMode Basic --outFilterMultimapNmax 20 --alignSJoverhangMin 8 --alignSJDBoverhangMin 1 --outFilterMismatchNmax 999 --outFilterMismatchNoverLmax 0.1 --alignIntronMin 20 --alignIntronMax 1000000 --alignMatesGapMax 1000000 --outFilterType BySJout --outFilterScoreMinOverLread 0.33 --outFilterMatchNmin 0 --outFilterMatchNminOverLread 0.33 --limitSjdbInsertNsj 1200000 --readFilesIn /cromwell_root/fastq_trim/11200020401_R1.fastq.gz /cromwell_root/fastq_trim/11200020401_R2.fastq.gz --readFilesCommand zcat --outFileNamePrefix star_out/11200020401. --outSAMstrandField intronMotif --outFilterIntronMotifs None --alignSoftClipAtReferenceEnds Yes --quantMode TranscriptomeSAM GeneCounts --outSAMtype BAM Unsorted --outSAMunmapped Within --genomeLoad NoSharedMemory --quantTranscriptomeSAMoutput BanSingleEnd_ExtendSoftclip --winAnchorMultimapNmax 100 --genomeTransformOutput SAM SJ Quant --outSAMattributes NH HI AS nM NM MD ha --outSAMattrRGline ID:rg1 SM:sm1

It seems to fail after the first PASS mapping has finished

STAR version: 2.7.11b   compiled: 2024-01-25T16:12:02-05:00 :/home/dobin/data/STAR/STARcode/STAR.master/source
Mar 09 17:39:05 ..... started STAR run
Mar 09 17:39:05 ..... loading genome
Mar 09 17:41:42 ..... started 1st pass mapping
Mar 09 17:53:53 ..... finished 1st pass mapping
Mar 09 17:53:55 ..... inserting junctions into the genome indices
Mar 09 17:56:45 ..... started mapping
Segmentation fault      (core dumped)
Command 'STAR --runMode alignReads --runThreadN 12 --genomeDir star_index --twopassMode Basic --outFilterMultimapNmax 20 --alignSJoverhangMin 8 --alignSJDBoverhangMin 1 --outFilterMismatchNmax 999 --outFilterMismatchNoverLmax 0.1 --alignIntronMin 20 --alignIntronMax 1000000 --alignMatesGapMax 1000000 --outFilterType BySJout --outFilterScoreMinOverLread 0.33 --outFilterMatchNmin 0 --outFilterMatchNminOverLread 0.33 --limitSjdbInsertNsj 1200000 --readFilesIn /cromwell_root/fastq_trim/11200020401_R1.fastq.gz /cromwell_root/fastq_trim/11200020401_R2.fastq.gz --readFilesCommand zcat --outFileNamePrefix star_out/11200020401. --outSAMstrandField intronMotif --outFilterIntronMotifs None --alignSoftClipAtReferenceEnds Yes --quantMode TranscriptomeSAM GeneCounts --outSAMtype BAM Unsorted --outSAMunmapped Within --genomeLoad NoSharedMemory --quantTranscriptomeSAMoutput BanSingleEnd_ExtendSoftclip --winAnchorMultimapNmax 100 --genomeTransformOutput SAM SJ Quant --outSAMattributes NH HI AS nM NM MD ha --outSAMattrRGline ID:rg1 SM:sm1' 

Thanks, Archana

boyanboyue commented 3 months ago

I met the same condition and have tried many different version software but it doesn't work.

archanaraja commented 3 weeks ago

@boyanboyue : Are you also trying to run using the personal VCF for the sample? Were you able to find a fix?

migbro commented 1 week ago

Hi @alexdobin , continuing the conversation, I've been collaborating with @archanaraja and @abhiachoudhary on using this feature. I too am experiencing a seg fault issue. On a cohort of a handful of tumor samples, align step always seg faults on second pass map using a Diploid genome. For a larger cohort of 300+ samples, we had a ~87% success rate. Hopefully, to help debug, I compiled your pre-release that was the latest attempt to address this issue with CXXFLAGSextra+=-g flag, ran gdb, and got this stack trace on the tumor sample:

#0  __memmove_avx_unaligned () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:222
#1  0x000060d8db42e99e in std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<std::array<unsigned int, 2ul> > (__result=<optimized out>, __last=0x97a8518f, __first=0x94)
    at /usr/include/c++/11/bits/stl_algobase.h:431
#2  std::__copy_move_a2<false, std::array<unsigned int, 2ul> const*, std::array<unsigned int, 2ul>*> (__result=<optimized out>, __last=0x97a8518f, __first=0x94) at /usr/include/c++/11/bits/stl_algobase.h:495
#3  std::__copy_move_a1<false, std::array<unsigned int, 2ul> const*, std::array<unsigned int, 2ul>*> (__result=<optimized out>, __last=0x97a8518f, __first=0x94) at /usr/include/c++/11/bits/stl_algobase.h:522
#4  std::__copy_move_a<false, __gnu_cxx::__normal_iterator<std::array<unsigned int, 2ul> const*, std::vector<std::array<unsigned int, 2ul>, std::allocator<std::array<unsigned int, 2ul> > > >, __gnu_cxx::__normal_iterator<std::array<unsigned int, 2ul>*, std::vector<std::array<unsigned int, 2ul>, std::allocator<std::array<unsigned int, 2ul> > > > > (__result=..., __last=..., __first=...) at /usr/include/c++/11/bits/stl_algobase.h:529
#5  std::copy<__gnu_cxx::__normal_iterator<std::array<unsigned int, 2ul> const*, std::vector<std::array<unsigned int, 2ul>, std::allocator<std::array<unsigned int, 2ul> > > >, __gnu_cxx::__normal_iterator<std::array<unsigned int, 2ul>*, std::vector<std::array<unsigned int, 2ul>, std::allocator<std::array<unsigned int, 2ul> > > > > (__result=..., __last=..., __first=...) at /usr/include/c++/11/bits/stl_algobase.h:620
#6  std::vector<std::array<unsigned int, 2ul>, std::allocator<std::array<unsigned int, 2ul> > >::operator= (__x=std::vector of length 318048799, capacity -18 = {...}, this=0x60d8f1afe350)
    at /usr/include/c++/11/bits/vector.tcc:238
#7  Transcript::operator= (this=0x60d8f1afe030) at /root/STAR_pre_releases/source/Transcript.h:10
#8  0x000060d8db42f4b8 in ReadAlign::transformGenome (this=this@entry=0x60d8eddebb80) at ReadAlign_transformGenome.cpp:62
#9  0x000060d8db4b62df in ReadAlign::oneRead (this=0x60d8eddebb80) at ReadAlign_oneRead.cpp:93
#10 0x000060d8db4ad369 in ReadAlignChunk::mapChunk (this=0x60d8debc0f10) at ReadAlignChunk_mapChunk.cpp:32
#11 0x000060d8db4a91f7 in ReadAlignChunk::processChunks (this=0x60d8debc0f10) at ReadAlignChunk_processChunks.cpp:249
#12 0x000060d8db4ebe8d in mapThreadsSpawn (P=..., RAchunk=RAchunk@entry=0x7fffdcce99e0) at mapThreadsSpawn.cpp:19
#13 0x000060d8db3c1c19 in main (argInN=<optimized out>, argIn=<optimized out>) at STAR.cpp:201

And looking in frame 8, this read:

(gdb) select-frame 8
(gdb) p readName
$6 = 0x60d8f1b06650 "@E00417:50:H5MJWALXX:6:1104:11008:28435"

20 reads including problem read for context: tumor_tissue_fail_1.fastq.gz tumor_tissue_fail_2.fastq.gz

Seemed to be the culprit. For the normal sample, stack trace:

#0  __memmove_avx_unaligned () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:222
#1  0x0000636000f7499e in std::__copy_move<false, true, std::random_access_iterator_tag>::__copy_m<std::array<unsigned int, 2ul> > (__result=<optimized out>, __last=0x1e4a5181, __first=0xbe)
    at /usr/include/c++/11/bits/stl_algobase.h:431
#2  std::__copy_move_a2<false, std::array<unsigned int, 2ul> const*, std::array<unsigned int, 2ul>*> (__result=<optimized out>, __last=0x1e4a5181, __first=0xbe) at /usr/include/c++/11/bits/stl_algobase.h:495
#3  std::__copy_move_a1<false, std::array<unsigned int, 2ul> const*, std::array<unsigned int, 2ul>*> (__result=<optimized out>, __last=0x1e4a5181, __first=0xbe) at /usr/include/c++/11/bits/stl_algobase.h:522
#4  std::__copy_move_a<false, __gnu_cxx::__normal_iterator<std::array<unsigned int, 2ul> const*, std::vector<std::array<unsigned int, 2ul>, std::allocator<std::array<unsigned int, 2ul> > > >, __gnu_cxx::__normal_iterator<std::array<unsigned int, 2ul>*, std::vector<std::array<unsigned int, 2ul>, std::allocator<std::array<unsigned int, 2ul> > > > > (__result=..., __last=..., __first=...) at /usr/include/c++/11/bits/stl_algobase.h:529
#5  std::copy<__gnu_cxx::__normal_iterator<std::array<unsigned int, 2ul> const*, std::vector<std::array<unsigned int, 2ul>, std::allocator<std::array<unsigned int, 2ul> > > >, __gnu_cxx::__normal_iterator<std::array<unsigned int, 2ul>*, std::vector<std::array<unsigned int, 2ul>, std::allocator<std::array<unsigned int, 2ul> > > > > (__result=..., __last=..., __first=...) at /usr/include/c++/11/bits/stl_algobase.h:620
#6  std::vector<std::array<unsigned int, 2ul>, std::allocator<std::array<unsigned int, 2ul> > >::operator= (__x=std::vector of length 63523352, capacity -22 = {...}, this=0x636056a57870) at /usr/include/c++/11/bits/vector.tcc:238
#7  Transcript::operator= (this=0x636056a57550) at /root/STAR_pre_releases/source/Transcript.h:10
#8  0x0000636000f754b8 in ReadAlign::transformGenome (this=this@entry=0x636052d45070) at ReadAlign_transformGenome.cpp:62
#9  0x0000636000ffc2df in ReadAlign::oneRead (this=0x636052d45070) at ReadAlign_oneRead.cpp:93
#10 0x0000636000ff3369 in ReadAlignChunk::mapChunk (this=0x636051434430) at ReadAlignChunk_mapChunk.cpp:32
#11 0x0000636000fef1f7 in ReadAlignChunk::processChunks (this=0x636051434430) at ReadAlignChunk_processChunks.cpp:249
#12 0x00006360010322bf in ThreadControl::threadRAprocessChunks (RAchunk=<optimized out>) at /root/STAR_pre_releases/source/ThreadControl.h:22
#13 0x0000773644f94ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#14 0x0000773645025a04 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:100

With read culprit @HHHHVDSX3220518:4:1106:28438:24220. 20 reads including the problem read for context: blood_normal_fail_1.fastq.gz blood_normal_fail_2.fastq.gz I am uncertain whether I can also provide the input VCF as it is germline data. I will update if this project allows for that. Thanks in advance for your help!