Snakemake: How to specify absolute path to shell command


Vkkodali

I'm writing a snakemake rule that uses multiple commands like this:

rule RULE1:
  input: 'path/to/input.file'
  output: 'path/to/output.file'
  shell: 'path/to/command1 {input} | /path/to/command2 | /path/to/command3 {output}'

If /path/to/command1it's really long, the rules get a little unwieldy. Is there a way to specify it elsewhere cmd1='/path/to/command1'and use it {cmd1}in the rule ? I know, I can use something like params: cmd1='/path/to/command1'this and use it as follows:

rule RULE1:
  input: 'path/to/input.file'
  output: 'path/to/output.file'
  params: 
    cmd1='/path/to/command1',
    cmd2='/path/to/command2',
    cmd3='/path/to/command3'
  shell: '{cmd1} {input} | {cmd2}| {cmd3} {output}'

But the workaround requires me to specify it separately for each rule and cannot use relative paths.

What is the standard way to do this kind of thing?

Dariober

The shelldirective takes a string as an argument, you can construct it, but you prefer e.g.

cmd1= 'foo'
cmd2= 'bar'

rule one:
    ...
    shell:
        cmd1 + ' {input}' + ' | ' + cmd2 + ' > {output}'

Related


Snakemake: How to specify absolute path to shell command

Vkkodali I'm writing a snakemake rule that uses multiple commands like this: rule RULE1: input: 'path/to/input.file' output: 'path/to/output.file' shell: 'path/to/command1 {input} | /path/to/command2 | /path/to/command3 {output}' If /path/to/command1it'

Snakemake: How to specify absolute path to shell command

Vkkodali I'm writing a snakemake rule that uses multiple commands like this: rule RULE1: input: 'path/to/input.file' output: 'path/to/output.file' shell: 'path/to/command1 {input} | /path/to/command2 | /path/to/command3 {output}' If /path/to/command1it'

Snakemake: How to specify absolute path to shell command

Vkkodali I'm writing a snakemake rule that uses multiple commands like this: rule RULE1: input: 'path/to/input.file' output: 'path/to/output.file' shell: 'path/to/command1 {input} | /path/to/command2 | /path/to/command3 {output}' If /path/to/command1it'

Shell command to output binary absolute path

Dr. Strangelove Is there a shell command for outputting the absolute path of a specified program? I would like to know where the executable binary is. username Attempt to which lsdiscover the full path lsof the command

How to specify absolute path in logback.xml?

Dustin <?xml version="1.0" encoding="UTF-8"?> <configuration debug="true"> <include resource="/opt/logback/logback_mobile.xml"></include> </configuration> Could not find resource corresponding to [/opt/logback/logback_mobile.xml] But the file does exist.

How to specify absolute path in logback.xml?

Dustin <?xml version="1.0" encoding="UTF-8"?> <configuration debug="true"> <include resource="/opt/logback/logback_mobile.xml"></include> </configuration> Could not find resource corresponding to [/opt/logback/logback_mobile.xml] But the file does exist.

How to specify absolute path in logback.xml?

Dustin <?xml version="1.0" encoding="UTF-8"?> <configuration debug="true"> <include resource="/opt/logback/logback_mobile.xml"></include> </configuration> Could not find resource corresponding to [/opt/logback/logback_mobile.xml] But the file does exist.

How to specify absolute path in logback.xml?

Dustin <?xml version="1.0" encoding="UTF-8"?> <configuration debug="true"> <include resource="/opt/logback/logback_mobile.xml"></include> </configuration> Could not find resource corresponding to [/opt/logback/logback_mobile.xml] But the file does exist.

How to specify absolute path in logback.xml?

Dustin <?xml version="1.0" encoding="UTF-8"?> <configuration debug="true"> <include resource="/opt/logback/logback_mobile.xml"></include> </configuration> Could not find resource corresponding to [/opt/logback/logback_mobile.xml] But the file does exist.

Linux, how to display absolute path in shell promt?

Elsonwx Now my case shows a short circuit like this I want to show the full absolute path in front. How to change it? dEIM Append the PS1variable \wand store it in your e.g..bash_profile one example export PS1="\u@\h \w> " Where \u- username \h- CPU name \w– C

Linux, how to display absolute path in shell promt?

Elsonwx Now my case shows a short circuit like this I want to show the full absolute path in front. How to change it? dEIM Append the PS1variable \wand store it in your e.g..bash_profile one example export PS1="\u@\h \w> " Where \u- username \h- CPU name \w– C

Genake in Snakemake's shell command

Elysee # md5sum on fastq folder on cluster rule md5sum_fastq_cluster: input: path_cluster+'/'+project_name+'/'+project_name+'.csv' output: path_cluster+'/'+project_name+'/'+'md5sum.txt' shell: """find {path_cluster}/{p

Genake in Snakemake's shell command

Elysee # md5sum on fastq folder on cluster rule md5sum_fastq_cluster: input: path_cluster+'/'+project_name+'/'+project_name+'.csv' output: path_cluster+'/'+project_name+'/'+'md5sum.txt' shell: """find {path_cluster}/{p

Combine shell command line in snakemake

User 3224522 I would like to combine the two command lines into one to avoid intermediate files. workdir: "/path/to/workdir/" rule all: input: "my.filtered.vcf.gz" rule bedtools: input: invcf="/path/to/my.vcf.gz", bedgz="/pat

Genake in Snakemake's shell command

Elysee # md5sum on fastq folder on cluster rule md5sum_fastq_cluster: input: path_cluster+'/'+project_name+'/'+project_name+'.csv' output: path_cluster+'/'+project_name+'/'+'md5sum.txt' shell: """find {path_cluster}/{p

Genake in Snakemake's shell command

Elysee # md5sum on fastq folder on cluster rule md5sum_fastq_cluster: input: path_cluster+'/'+project_name+'/'+project_name+'.csv' output: path_cluster+'/'+project_name+'/'+'md5sum.txt' shell: """find {path_cluster}/{p

Genake in Snakemake's shell command

Elysee # md5sum on fastq folder on cluster rule md5sum_fastq_cluster: input: path_cluster+'/'+project_name+'/'+project_name+'.csv' output: path_cluster+'/'+project_name+'/'+'md5sum.txt' shell: """find {path_cluster}/{p

Genake in Snakemake's shell command

Elysee # md5sum on fastq folder on cluster rule md5sum_fastq_cluster: input: path_cluster+'/'+project_name+'/'+project_name+'.csv' output: path_cluster+'/'+project_name+'/'+'md5sum.txt' shell: """find {path_cluster}/{p

Genake in Snakemake's shell command

Elysee # md5sum on fastq folder on cluster rule md5sum_fastq_cluster: input: path_cluster+'/'+project_name+'/'+project_name+'.csv' output: path_cluster+'/'+project_name+'/'+'md5sum.txt' shell: """find {path_cluster}/{p

maven must specify an absolute path

tian I have the following in my settings.xml <profile> <id>default</id> <activation> <activeByDefault>true></activeByDefault> </activation> <properties> <eclipse.location>/Applications/eclipse</eclipse.location> </properties> </profile> But

Java SFTP specify absolute path

Filip Kraus I have used this code for SFTP Java upload package com.as400samplecode; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemOptions;

Java SFTP specify absolute path

Filip Kraus I have used this code for SFTP Java upload package com.as400samplecode; import java.io.File; import java.io.FileInputStream; import java.util.Properties; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemOptions;

maven must specify an absolute path

tian I have the following in my settings.xml <profile> <id>default</id> <activation> <activeByDefault>true></activeByDefault> </activation> <properties> <eclipse.location>/Applications/eclipse</eclipse.location> </properties> </profile> But

How to specify gcc path in pip command?

Baswati Saha I am trying to install cupy 5.0.0. cupy5.0.0 requires a gcc version up to 7. My default gcc is gcc-9. I can't use conda environment. Also, I don't have sudo rights to change /usr/bin/gcc to point to gcc-7. Is there a way to pass the gcc path to th

How to get absolute path by using find unix command

Shiva Sharma How to get absolute path using find command. Actually I am running the following script: find . -size +20M | while read a do i=$(echo $a | sed 's:/: :g') echo $a; j=($i) fileName=${j[${#j[@]}-1]} userName=${j[${#j[@]}-3]}

How to get absolute path by using find unix command

Shiva Sharma How to get absolute path using find command. Actually I am running the following script: find . -size +20M | while read a do i=$(echo $a | sed 's:/: :g') echo $a; j=($i) fileName=${j[${#j[@]}-1]} userName=${j[${#j[@]}-3]}