This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to access STAR index loaded into shared memory

I am trying to run STAR in a shared memory environment. I want to load a single copy of the genome index and then run star multiple times using that pre-loaded index. However I don't seem to be passing the pre-loaded index to STAR correctly. When I run the following, one index is loaded for each input.fastq and the system runs out of memory.

STAR --genomeLoad LoadAndExit --genomeDir $STARINDEX
for file in $(ls myFastqs/); do
    STAR --runThreadN 5 \
    --readFilesIn $file \
    --outFilterMismatchNoverLmax 0.05 \
    --alignIntronMax 20000 \
    --genomeDir $STARINDEX \
    --outSAMstrandField intronMotif \
    --quantMode GeneCounts \
    --sjdbGTFfile $STARGTF
STAR --genomeLoad Remove --genomeDir $STARINDEX

However when I don't provide the --genomeDir $STARINDEX argument as below... I get an error indicating that STAR can't find the genome index.

STAR --genomeLoad LoadAndExit --genomeDir $STARINDEX
for file in $(ls myFastqs/); do
    STAR --runThreadN 5 \
    --readFilesIn $file \
    --outFilterMismatchNoverLmax 0.05 \
    --alignIntronMax 20000 \
    --outSAMstrandField intronMotif \
    --quantMode GeneCounts \
    --sjdbGTFfile $STARGTF
STAR --genomeLoad Remove --genomeDir $STARINDEX

How can I properly provide the genome loaded into memory to each looped run of STAR? A related thread that does not answer this question is here: STAR genomeLoad issue

star rna-seq alignment

1 answer

Your code for alignment would contain: --genomeLoad LoadAndKeep and --limitBAMsortRAM

STAR --genomeLoad LoadAndExit --genomeDir $STARINDEX
for file in $(ls myFastqs/); do
    STAR --runThreadN 5 \
    --readFilesIn $file \
    --outFilterMismatchNoverLmax 0.05 \
    --alignIntronMax 20000 \
    --genomeDir $STARINDEX \
    --outSAMstrandField intronMotif \
    --quantMode GeneCounts \
    --sjdbGTFfile $STARGTF \
    --genomeLoad LoadAndKeep \
    --limitBAMsortRAM 5000000000
STAR --genomeLoad Remove --genomeDir $STARINDEX

Log in to answer this question.