Thank you for the reply! I will give it a try!
Hello and Happy New Year to everyone!
I am a novice snakemake/programming user and I am still trying to figure some things out. So bare with me!
I am trying to make a pipeline with various steps that run different programs. In each step I would like to give the option to the user to choose which program to use.
In my mind I have it like this:
Snakemake --cores 10 --assembly metaspades --binning metabat --trimming trimmomatic
I would like the user to choose which software to run at each step. Is that possible or I am talking nonsense?And if yes, how can I do this?
Thanking you in advance!
2 answers
It is a bit of a broad question but for inspiration:
Snakemake --cores 10 --config assembly="metaspades" binning="metabat" trimming="trimmomatic"
And sometinhg like:
rule assembly:
input:
fastq = "yourinput.fq",
output:
bam = "youroutput.bam"
run:
if config["assembly"] == "metaspades":
shell("metaspades command")
if config["assembly"] == "bowtie":
shell("bowtie command")
Ofcourse there is much more to it to make a snakemake pipeline but just as inspiration.
As @gb and @liorglic mentioned, using --config or --configfile is a good option. I personally prefer to leave a footprint of what was done in the file names. For example,
rule trimmomatic:
output: touch('{prefix}.trimmomatic.txt')
rule trim_galore:
output: touch('{prefix}.trim_galore.txt')
rule star:
input: '{prefix}.{trim}.txt'
output: touch('{prefix}.{trim}.star.txt')
rule bowtie:
input: '{prefix}.{trim}.txt'
output: touch('{prefix}.{trim}.bowtie.txt')
Then I use the output file name to direct Snakemake on what rules to use.
To combine trimmomatic and star:
(base) [~/Downloads/scratch/biostar/tmp]$ snakemake my_sample.trimmomatic.star.txt --summary
Building DAG of jobs...
output_file date rule version log-file(s) status plan
my_sample.trimmomatic.star.txt - - - - missing update pending
my_sample.trimmomatic.txt - - - - missing update pending
To combine trim_galore and bowtie:
(base) [~/Downloads/scratch/biostar/tmp]$ snakemake my_sample.trim_galore.bowtie.txt --summary
Building DAG of jobs...
output_file date rule version log-file(s) status plan
my_sample.trim_galore.bowtie.txt - - - - missing update pending
my_sample.trim_galore.txt - - - - missing update pending
Log in to answer this question.
Hello,
Thank you guys for your input! Your suggestions helped a lot! I am sure that I will have more questions in the near future, but I managed to move forward with my pipeline.
Until next time!
Thanks