I'm running scRNA-seq and am trying to create a loop for all samples to run alignment. However, the loop stops about 20 or so samples later. Am I missing something from code? The alignment works fine without the loop.
for i in *.fastq.gz
do
STAR --genomeDir ./human_index \
--runMode alignReads \
--readFilesIn $i \
--runThreadN 10 \
--readFilesCommand zcat \
--outSAMtype BAM SortedByCoordinate \
--chimSegmentMin 20 \
--quantMode GeneCounts \
--outReadsUnmapped Fastx \
--outFileNamePrefix ./star_out/$i
done
EDIT by @RamRS: I formatted the code to be more readable. Original code copy-pasted below:
for i in *.fastq.gz; do STAR --genomeDir ./human_index --runMode alignReads --readFilesIn $i --runThreadN 10 --readFilesCommand zcat --outSAMtype BAM SortedByCoordinate --chimSegmentMin 20 --quantMode GeneCounts --outReadsUnmapped Fastx --outFileNamePrefix ./star_out/$i; done
Look at the log files of the iteration at which the loop breaks. I suspect that you run out of memory when sorting the bam file.
there is a possibility that you're running out of storage space to store the results?
Did this not produce any errors then?
I had a slightly different code where the --runThreadN was set to 20 and it was aborting but now with it set to 10 its coming up with error message about not enough space for bam - however this time its continuing onto the next sample despite the error message
Do you really need
--outReadsUnmapped Fastx
? Since you are running out of disk space (could you copy the exact error message?), you could save space by not outputting unmapped reads..The error comes after sorting out the bam files. I previously used
--outReadsUnmapped Fastx?
and thought to keep it incase I wanted to know the reads that were unmapped. That is a good idea to save space, thank you.