deweylab / RSEM

RSEM: accurate quantification of gene and isoform expression from RNA-Seq data
http://deweylab.biostat.wisc.edu/rsem/
GNU General Public License v3.0
408 stars 118 forks source link

fatal error: buffer size for SJ output is too small Solution: increase input parameter --limitOutSJcollapsed #218

Closed sopenaml closed 3 days ago

sopenaml commented 1 month ago

I've been trying to run RSEM using STAR as aligner to quantify transcripts in a 30X human sample and I have encountered that the following error:

EXITING because of fatal error: buffer size for SJ output is too small
 Solution: increase input parameter --limitOutSJcollapsed

That's a flag on STAR aligner to increase the maximum number of splice junction. Is there a way that RSEM would accept extra STAR parameters? Thank you very much for your help,

Miriam

pliu55 commented 1 month ago

@sopenaml, what command did you use when you got this error?

sopenaml commented 1 month ago

It's a bit convoluted, but I'm running the nfcore/rnaseq pipeline using STAR-rsem to align/quantify counts per gene and my fastq files are quite big. Below is the error obtained that also includes the step where the error occurred.

Error executing process > 'NFCORE_RNASEQ:RNASEQ:QUANTIFY_RSEM:RSEM_CALCULATEEXPRESSION (HepG2_Rep3)'

Caused by:
 Process `NFCORE_RNASEQ:RNASEQ:QUANTIFY_RSEM:RSEM_CALCULATEEXPRESSION (HepG2_Rep3)` terminated with an error exit status (255)

Command executed:

 INDEX=`find -L ./ -name "*.grp" | sed 's/\.grp$//'`
 rsem-calculate-expression \
   --num-threads 12 \
   --temporary-folder ./tmp/ \
   --strandedness forward \
   --paired-end \
   --star --star-output-genome-bam --star-gzipped-read-file --estimate-rspd --seed 1 \
   HepG2_Rep3_1_val_1.fq.gz HepG2_Rep3_2_val_2.fq.gz \
   $INDEX \
   HepG2_Rep3

 cat <<-END_VERSIONS > versions.yml
 "NFCORE_RNASEQ:RNASEQ:QUANTIFY_RSEM:RSEM_CALCULATEEXPRESSION":
   rsem: $(rsem-calculate-expression --version | sed -e "s/Current version: RSEM v//g")
   star: $(STAR --version | sed -e "s/STAR_//g")
 END_VERSIONS

Command exit status:
 255

Command output:
 STAR --genomeDir ./rsem --outSAMunmapped Within --outFilterType BySJout --outSAMattributes NH HI AS NM MD --outFilterMultimapNmax 20 --outFilterMismatchNmax 999 --outFilterMismatchNoverLmax 0.04 --alignIntronMin 20 --alignIntronMax 1000000 --alignMatesGapMax 1000000 --alignSJoverhangMin 8 --alignSJDBoverhangMin 1 --sjdbScore 1 --runThreadN 12 --genomeLoad NoSharedMemory --outSAMtype BAM Unsorted --quantMode TranscriptomeSAM --outSAMheaderHD @HD VN:1.4 SO:unsorted --outFileNamePrefix ./tmp//HepG2_Rep3 --readFilesCommand zcat --readFilesIn HepG2_Rep3_1_val_1.fq.gz HepG2_Rep3_2_val_2.fq.gz
    STAR --genomeDir ./rsem --outSAMunmapped Within --outFilterType BySJout --outSAMattributes NH HI AS NM MD --outFilterMultimapNmax 20 --outFilterMismatchNmax 999 --outFilterMismatchNoverLmax 0.04 --alignIntronMin 20 --alignIntronMax 1000000 --alignMatesGapMax 1000000 --alignSJoverhangMin 8 --alignSJDBoverhangMin 1 --sjdbScore 1 --runThreadN 12 --genomeLoad NoSharedMemory --outSAMtype BAM Unsorted --quantMode TranscriptomeSAM --outSAMheaderHD @HD VN:1.4 SO:unsorted --outFileNamePrefix ./tmp//HepG2_Rep3 --readFilesCommand zcat --readFilesIn HepG2_Rep3_1_val_1.fq.gz HepG2_Rep3_2_val_2.fq.gz
    STAR version: 2.7.10a  compiled: 2022-01-14T18:50:00-05:00 :/home/dobin/data/STAR/STARcode/STAR.master/source
 Jul 12 17:07:07 ..... started STAR run
 Jul 12 17:07:07 ..... loading genome
 Jul 12 17:07:43 ..... started mapping
 "STAR --genomeDir ./rsem --outSAMunmapped Within --outFilterType BySJout --outSAMattributes NH HI AS NM MD --outFilterMultimapNmax 20 --outFilterMismatchNmax 999 --outFilterMismatchNoverLmax 0.04 --alignIntronMin 20 --alignIntronMax 1000000 --alignMatesGapMax 1000000 --alignSJoverhangMin 8 --alignSJDBoverhangMin 1 --sjdbScore 1 --runThreadN 12 --genomeLoad NoSharedMemory --outSAMtype BAM Unsorted --quantMode TranscriptomeSAM --outSAMheaderHD @HD VN:1.4 SO:unsorted --outFileNamePrefix ./tmp//HepG2_Rep3 --readFilesCommand zcat --readFilesIn HepG2_Rep3_1_val_1.fq.gz HepG2_Rep3_2_val_2.fq.gz" failed! Plase check if you provide correct parameters/options for the pipeline!

Command error:

 EXITING because of fatal error: buffer size for SJ output is too small
 Solution: increase input parameter --limitOutSJcollapsed

 Jul 12 17:35:08 ...... FATAL ERROR, exiting
pliu55 commented 1 month ago

STAR's default buffer size for SJ output is usually fine for human data. Just for testing and perhaps as a temporary fix, would you like to replace rsem-calculate-expression's line 489 by the following?

" --outSAMheaderHD \@HD VN:1.4 SO:unsorted --limitOutSJcollapsed 2000000 ".

assuming you want to increase it to 2000000.