Snakemake command line arguments
2
0
Entering edit mode
4 months ago
blackadder • 0

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!

Snakemake • 597 views
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
3
Entering edit mode
4 months ago
gb ★ 2.1k

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.

ADD COMMENT
0
Entering edit mode

Thank you for the reply! I will give it a try!

ADD REPLY
0
Entering edit mode

I also suggest that if there many parameters to be set by the user, use --configfile instead of --config. But it's basically the same. This page should have the documentation you need.

ADD REPLY
0
Entering edit mode
4 months ago
Eric Lim ★ 1.9k

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
ADD COMMENT

Login before adding your answer.

Traffic: 867 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6