user3224522
user3224522

Reputation: 1149

Snakemake with specific combination of files as input

Do you know how to run snakemake with specific combination of files? i.e. In this txt files I have list of sequence ID's:

bob.txt 
steve.txt 
john.txt

From these files I want to extract the sequences of the ID's in the above files:

bob.fa
steve.fa
john.fa

So sequence ID's from bob should look for sequences in bob.fa, while john in john.fa and so on.

workdir: "/path/to/dir/"
(SAMPLES,) =glob_wildcards('path/to/dir/{sample}.fa')

rule all:
    input: 
        expand("{sample}.unique.fa", sample=SAMPLES)

rule seqkit:
    input:
        infa ="path/to/dir/{sample}.fa"
        intxt = "path/to/dir/{sample}.txt
    output:
        outfa = "{sample}.unique.fa"
    shell:
        ("/Tools/seqkit grep -f {input.intxt} {input.infa} > {output.outfa}")

So I do not need all combinations, but only specific, like bob.txt and bob.fa, steve.txt and steve.fa. Because my current code will also do bob.txt in steve.fa

Upvotes: 0

Views: 193

Answers (1)

Manavalan Gajapathy
Manavalan Gajapathy

Reputation: 4089

Comma is missing in rule seqkit input.

rule seqkit:
    input:
        infa ="path/to/dir/{sample}.fa",
        intxt = "path/to/dir/{sample}.txt

Upvotes: 1

Related Questions