This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Use part of the name of the input file in the Snakemake

I have two input files in SAMPLES folder:

SRR13510812_1.fastq SRR13510812_2.fastq But I need the input files to have the following names to run the bash script in the shell snakemake line:

SRR13510812

I would be grateful for an example of a suitable working code in this situation

Thanks!

snakemake

use glob_wildcards

Example directory structure:

$ tree .
.
├── list.smk
├── SRR13510812_1.fastq
├── SRR13510812_2.fastq
├── SRR13510813_1.fastq
├── SRR13510813_2.fastq
├── SRR13510814_1.fastq
└── SRR13510814_2.fastq

output:

$ snakemake -s list.smk -j 1

['SRR13510812', 'SRR13510813', 'SRR13510814']
['SRR13510812_1.fastq,SRR13510812_2.fastq', 'SRR13510813_1.fastq,SRR13510813_2.fastq', 'SRR13510814_1.fastq,SRR13510814_2.fastq']
Building DAG of jobs...
Nothing to be done.

Example code:

$ cat list.smk

samples,=glob_wildcards("{sample}_1.fastq")
print(samples)
print(expand('{sample}_1.fastq,{sample}_2.fastq', sample=samples))

0 answers

No answers yet.

Log in to answer this question.