This looks to be exactly what I'm looking for.. If this was a very obvious question I apologise, I am relatively new to bioinformatics. I am still unsure how I could use this to streamline downloading SRA data in batches though? I would still have to manually change a download rule to get the next files down my list each time wouldn't I? Thanks again for the help.
I am using a SLURM HPC to run jobs and have ran into issues with storage. I have 3TB storage, and want to run over 1000 publicly available RNAseq data through my pipeline, which includes aligning with STAR. Obviously I must download the data in sections and run the pipeline multiple times.
Does anybody know any clever tricks to streamline this process?
Is there any way to configure a snakemake/slurm pipeline to lets say, run for 30 files, with all files expect counts being temp files, then once completed, run again for the next 30 files in a download list, and so on?
Any advice or guidance would be greatly appreciated !
1 answer
Have you tried --batch?
Consider this contrived example.
(base) [~/Downloads/scratch/biostar/use_batch_flag]$ cat Snakefile
# arbitrarily define some sra numbers
sra = range(0, 10)
rule run_workflow:
input: expand('{sra}/{sra}.bam', sra=sra)
rule download_src:
output:
fq = touch('{sra}/{sra}.fq.gz')
run:
# implement code to download fq
pass
rule run_star:
input:
fq = '{sra}/{sra}.fq.gz'
output:
bam = touch('{sra}/{sra}.bam')
run:
# implement code to run star alignment
pass
Without --batch, snakemake would attempt to run all the samples.
(base) [~/Downloads/scratch/biostar/use_batch_flag]$ snakemake run_workflow --summary
Building DAG of jobs...
output_file date rule version log-file(s) status plan
0/0.bam - - - - missing update pending
0/0.fq.gz - - - - missing update pending
1/1.bam - - - - missing update pending
1/1.fq.gz - - - - missing update pending
2/2.bam - - - - missing update pending
2/2.fq.gz - - - - missing update pending
3/3.bam - - - - missing update pending
3/3.fq.gz - - - - missing update pending
4/4.bam - - - - missing update pending
4/4.fq.gz - - - - missing update pending
5/5.bam - - - - missing update pending
5/5.fq.gz - - - - missing update pending
6/6.bam - - - - missing update pending
6/6.fq.gz - - - - missing update pending
7/7.bam - - - - missing update pending
7/7.fq.gz - - - - missing update pending
8/8.bam - - - - missing update pending
8/8.fq.gz - - - - missing update pending
9/9.bam - - - - missing update pending
9/9.fq.gz - - - - missing update pending
With --batch run_workflow=1/10, snakemake will run what's needed to generate 1 bam.
(base) [~/Downloads/scratch/biostar/use_batch_flag]$ snakemake run_workflow --batch run_workflow=1/10 --summary
Building DAG of jobs...
Considering only batch 1/10 (rule run_workflow) for DAG computation.
All jobs beyond the batching rule are omitted until the final batch.
Don't forget to run the other batches too.
output_file date rule version log-file(s) status plan
0/0.bam - - - - missing update pending
0/0.fq.gz - - - - missing update pending
In addition to --batch, you can also use temp in your Snakefile to automatically delete your intermediate files. https://snakemake.readthedocs.io/en/stable/tutorial/short.html?highlight=temp#temporary-files
Hope this is helpful.
Log in to answer this question.
Do you need the alignments or just counts?
I only need the count files.. I have maybe 6 rules, a few of which have STAR alignment steps.
Then look at recount3: http://rna.recount.bio/
Maybe you don't have to align alything yourself. And even if then use a fast lightweight aligner such as
salmonwhich takes a fraction of time and memory compared to STAR. But really, use recount.Salmon isn't appropriate for the analysis I am trying to do unfortunately. Neither are already processed counts.. Very interesting resource though, thanks for the tip !