running mapping with Bowtie2 in Snakemake

35 views Asked by At

Im a bioinformatics student and Im trying to use snakemake to do the mapping step. Im using Linux environment. It's the first time i use snakemake, and im having issue in the code that I'm not understanding. Here's my snakemakefile;

# samples, = glob_wildcards('/../data/01-trimmed/-{sample}_S0.fastq.gz') 

samples = ["Input_Si_B-Catenin_HepG2_S0"]

#reads = ["1","2"]

rule all:
    input:
#       QCreads= expand("..*(I specified the right path)*/data/QC-{s}_L001_R1_001_fastqc.html",s=samples),
#       trimmed=expand("../data/fastq/{s}_R1_trimmed.fastq.gz",s=samples),
#       QCreads2= expand("../data/QC/{s}_R2_trimmed_fastqc.html",s=samples),
        map=expand("../data/04-mapped/{s}.bam",s=samples),
        #insertsize=expand("../data/QC/{s}.insert.metric.tab",s=samples)
#
rule bowtie2:
    input:
        R1="../data/01-trimmed/{sample}_R1.fq.gz",
        R2="../data/01-trimmed/{sample}_R2.fq.gz"
    output:
        "../04-mapped/{sample}.bam"
    threads: 10
    shell:
        """
        module load bowtie2/2.4.4
        module load samtools/1.15.1
        bowtie2 --phred33 --local -p {threads} -x /../hg38 -1 {input.R1} -2 {input.R2} | samtools view -bhS > {output}
        samtools stats {output} > ../04-mapped/{wildcards.sample}_raw_stats.txt
        """ 

and it's always giving me this error:

Building DAG of jobs...
MissingInputException in rule bowtie2 in file /../data/snakefile_mapping, line 15:
Missing input files for rule bowtie2:
    output: ../04-mapped/Input_Si_B-Catenin_HepG2_S0.bam
    wildcards: sample=Input_Si_B-Catenin_HepG2_S0
    affected files:
        ../Input_Si_B-Catenin_HepG2_S0_R2.fq.gz
        ../Input_Si_B-Catenin_HepG2_S0_R1.fq.gz

Can someone explain to me please! Thanks in advance! :)

I tried to correcte the path but its always giving this same issue. I am doing mapping in paired end with bowtie2 and tried to do dry run on one sample just to test but always error! and i specified the .yaml and its good

1

There are 1 answers

0
kEks On

snakemake does not find the files ../Input_Si_B-Catenin_HepG2_S0_R2.fq.gz and ../Input_Si_B-Catenin_HepG2_S0_R1.fq.gz

You could try absolute paths just to get it running (Use the -n flag to check if its working without actually running it). If this works, you could either change the relative paths, or set the working directory in the snakefile with

workdir: "path/to/workdir"

so the relative path do point to the right location.