snakemake input wildcards
0
0
Entering edit mode
3.1 years ago
ohu20a ▴ 10

Please, can anybody explain what the **wildcards in the code below does. Also, I have come across both *wildcards and **wildcards, how are they different?

In this case, does **wildcards mean wildcards.sample?

def STAR_input(wildcards):
        if config["PE_or_SE"] == "SE":
            fq1="analysis/trimmed_data/{sample}_R1_trimmed.fq.gz".format(**wildcards)
            return fq1
        elif config["PE_or_SE"] == "PE":
            fq1 = "analysis/trimmed_data/{sample}_R1_val_1.fq.gz".format(**wildcards)
            fq2 = "analysis/trimmed_data/{sample}_R2_val_2.fq.gz".format(**wildcards)
            return [fq1,fq2]
python Snakemake • 746 views
ADD COMMENT
0
Entering edit mode

**wildcards notation is for kwargs e.g: https://realpython.com/python-kwargs-and-args/

ADD REPLY
0
Entering edit mode
def STAR_input(wildcards):
    # ** is named parameters
    # statements below all accomplish the same thing
    fq1="analysis/trimmed_data/{sample}_R1_trimmed.fq.gz".format(**wildcards)
    fq1="analysis/trimmed_data/{}_R1_trimmed.fq.gz".format(wildcards.sample)
    fq1=f"analysis/trimmed_data/{wildcards.sample}_R1_trimmed.fq.gz"

rule:
  input: STAR_input
  output: '{sample}.do.something.txt'
ADD REPLY

Login before adding your answer.

Traffic: 1973 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