Entering edit mode
2.3 years ago
Aryan
▴
40
Hello, I am looking for some help with Snakemake. I am getting a weird error which I am unable to figure out.
I have a Snakefile (at the bottom), and my directory looks like .
When I execute a dry run with,
snakemake -np -s Snakefile.txt
I get no errors. However, when I run,
snakemake -n 1 -p -s Snakefile.txt,
I get the error,
My Snakefile:
import os
sra_codes = ["SRR502329", "SRR502327","SRR502228","SRR502225"]
# Go from SRA code to fastq
# Go from fastq to bam via alignment
rule all:
input:
expand("./bams/{name}.bam", name = sra_codes)
rule fastq:
output:
"./fastqs/{name}.fastq"
log:
stderr = "./logs/{name}.log"
shell:
"""
ml sra-tools
fastq-dump -Z {wildcards.name} > {output}
2> {log.stderr}
"""
rule bowtie:
input:
"./fastqs/{name}.fastq"
output:
"./sams/{name}.sam"
log:
stderr = "./logs/{name}_bt.log"
shell:
"""
ml bowtie2
bowtie2 -q -p 4 -k 1 --local --no-unal -x hg19 {input} > {output}
2> {log.stderr}
"""
rule filter:
input:
"./sams/{name}.sam"
output:
"./bams/{name}.bam"
log:
stderr = "./logs/{name}_filt.log"
shell:
"""
ml samtools
./process.sh {wildcards.name}
2> {log.stderr}
"""
Everything was working fine till I tried to include the last rule, filter. Here is the process.sh script,
#!/bin/bash
sed '/chrM/d;/random/d;/chrUn/d' ./sams/$1.sam > ./filt_sams/$1_filtered.sam # This filters
# mitochondrial genes + unaligned genes.
ml samtools
samtools view -S -b ./filt_sams/$1_filtered.sam > ./bams/$1.bam
# This converts filtered sam file to bam file.
samtools view -c ./bams/$1.bam # Print count of reads.
-n
is--dry-run
so not sure why you would put an argument 1 after itI see what you're saying! I meant for it to be "-c 1" - I suppose that should work?
right, Snakemake thinks you are trying to build a file called "1"