Commit c6afcd22 authored by WJH58's avatar WJH58
Browse files

solved an error in rule trimmomatic

parent fcde192a
......@@ -26,3 +26,12 @@ trimmomatic:
avgMinQual: '15'
minReadLength: '40'
phred: '-phred33'
# bowtie2 parameters
bowtie2:
params:
mode: "--local"
sensitivity: "--very-sensitive-local"
max_fragment_len: "--maxins 500" # maximum fragment length for valid paired-end alignments
min_fragment_len: "--minins 80" # minimum fragment length for valid paired-end alignments
verbose: "-q"
......@@ -2,3 +2,4 @@ channels:
- bioconda
dependencies:
- bowtie2=2.3.5
- samtools=1.9
......@@ -47,7 +47,8 @@ FASTQC = expand(RESULT_DIR + "fastqc/{samples}_{R}_2000reads_fastqc.htm
FORWARD_READS = expand(WORKING_DIR + "trimmed/{samples}_forward.fastq.gz", samples = SAMPLES),
REVERSE_READS = expand(WORKING_DIR + "trimmed/{samples}_reverse.fastq.gz", samples = SAMPLES),
TRIMMED_FASTQC = expand(RESULT_DIR + "fastqc/{samples}_{R}_trimmed_fastqc.html", samples = SAMPLES, R=['R1', 'R2']),
MAPPED = expand(WORKING_DIR + "mapped/{samples}.bam", samples = SAMPLES),
UNMAPPED = [WORKING_DIR + "unmapped/{samples}.fq." + str(i) +".gz" for i in range(1,2)],
rule all:
input:
......@@ -58,7 +59,9 @@ rule all:
WORKING_DIR + "genome.rev.2.bt2",
FORWARD_READS,
REVERSE_READS,
TRIMMED_FASTQC,
#TRIMMED_FASTQC,
#MAPPED,
#UNMAPPED
message : "Analysis is complete!"
shell:""
......@@ -110,7 +113,7 @@ rule trimmomatic:
"envs/trimmomatic.yaml"
shell:
"""
java -jar trimmomatic-0.32.jar PE \
trimmomatic PE \
-threads 10 \
-phred33 \
{input.reads} \
......@@ -148,3 +151,27 @@ rule fastqc:
"envs/fastqc.yaml"
shell:
"fastqc --outdir={params} {input.fwd} {input.rev} &>{log}"
rule mapping:
input:
foward = WORKING_DIR + "trimmed/{samples}_forward.fastq.gz",
reverse = WORKING_DIR + "trimmed/{samples}_reverse.fastq.gz",
forwardUnpaired = WORKING_DIR + "trimmed/{samples}_forward_unpaired.fastq.gz",
reverseUnpaired = WORKING_DIR + "trimmed/{samples}_reverse_unpaired.fastq.gz",
index = [WORKING_DIR + "genome." + str(i) + ".bt2" for i in range(1,4)]
output:
mapped = WORKING_DIR + "mapped/{samples}.bam",
unmapped = [WORKING_DIR + "unmapped/{samples}.fq." + str(i) +".gz" for i in range(1,2)],
params:
bowtie = " ".join(config["bowtie2"]["params"].values()), #take argument separated as a list separated with a space
index = WORKING_DIR + "genome",
unmapped = WORKING_DIR + "unmapped/{samples}.fq.gz"
threads: 10
conda:
"../envs/samtools_bowtie.yaml"
log:
RESULT_DIR + "logs/bowtie/{samples}.log"
shell:
"""
bowtie2 {params.bowtie} --threads {threads} -x {params.index} -1 {input.forward} -2 {input.reverse} -U {input.forwardUnpaired},{input.reverseUnpaired} --un-conc-gz {params.unmapped} | samtools view -Sb - > {output.mapped} 2>{log}
"""
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment