Snakemake "MissingRuleException" - Cannot Figure Out
0
0
Entering edit mode
19 months ago
Aryan ▴ 30

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 enter image description here.

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,

enter image description here

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.
ChIP-seq bash snakemake RNA-seq • 750 views
ADD COMMENT
1
Entering edit mode

-n is --dry-run so not sure why you would put an argument 1 after it

ADD REPLY
1
Entering edit mode

I see what you're saying! I meant for it to be "-c 1" - I suppose that should work?

ADD REPLY
0
Entering edit mode

right, Snakemake thinks you are trying to build a file called "1"

ADD REPLY

Login before adding your answer.

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