Use part of the name of the input file in the Snakemake
0
0
Entering edit mode
3.4 years ago
kamanovae ▴ 100

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 • 597 views
ADD COMMENT
0
Entering edit mode

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))
ADD REPLY

Login before adding your answer.

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