Commit c0085bb1 authored by WJH58's avatar WJH58
Browse files

Successuful running on mac

parent c5de0d34
```
rule trimmomatic:
input:
reads = get_fastq,
adapters = config['trimmomatic']["adapters"]
output:
forward_reads = WORKING_DIR + "trimmed/{samples}_forward.fastq.gz",
reverse_reads = WORKING_DIR + "trimmed/{samples}_reverse.fastq.gz",
forwardUnpaired = temp(WORKING_DIR + "trimmed/{samples}_forward_unpaired.fastq.gz"),
reverseUnpaired = temp(WORKING_DIR + "trimmed/{samples}_reverse_unpaired.fastq.gz"),
log:
RESULT_DIR + "logs/trimmomatic/{samples}.log"
params:
seedMisMatches = str(config['trimmomatic']['seedMisMatches']),
palindromeClipTreshold = str(config['trimmomatic']['palindromeClipTreshold']),
simpleClipThreshhold = str(config['trimmomatic']['simpleClipThreshold']),
LeadMinTrimQual = str(config['trimmomatic']['LeadMinTrimQual']),
TrailMinTrimQual = str(config['trimmomatic']['TrailMinTrimQual']),
windowSize = str(config['trimmomatic']['windowSize']),
avgMinQual = str(config['trimmomatic']['avgMinQual']),
minReadLen = str(config['trimmomatic']['minReadLength']),
phred = str(config["trimmomatic"]["phred"])
threads: 10
conda:
"envs/trimmomatic.yaml"
shell:
"""
trimmomatic PE \
-threads 10 \
-phred33 \
{input.reads} \
{output.forward_reads} {output.forwardUnpaired} {output.reverse_reads} {output.reverseUnpaired} \
ILLUMINACLIP:{input.adapters}:{params.seedMisMatches}:{params.palindromeClipTreshold}:{params.simpleClipThreshhold} \
LEADING:3 \
TRAILING:3 \
SLIDINGWINDOW:4:15 \
MINLEN:40 &>{log}
"""
```
####Trimmomatic Arguments####
......@@ -46,9 +46,11 @@ wildcard_constraints:
FASTQC = expand(RESULT_DIR + "fastqc/{samples}_{R}_2000reads_fastqc.html", samples = SAMPLES, R=['R1', 'R2']),
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']),
TRIMMED_FASTQC = expand(RESULT_DIR + "trimmed_fastqc/WT8_{direction}_fastqc.html", direction=['forward', 'reverse']),
MAPPED = expand(WORKING_DIR + "mapped/{samples}.bam", samples = SAMPLES),
UNMAPPED = expand([WORKING_DIR + "unmapped/{samples}.fq." + str(i) +".gz" for i in range(1,2)], samples = SAMPLES),
MAP_SORTED = expand(WORKING_DIR + "sort/{samples}.sorted.bam", samples = SAMPLES),
SORTED_INDEXED = expand(WORKING_DIR + "index/{samples}.sorted.bam.bai", samples = SAMPLES)
rule all:
input:
......@@ -61,7 +63,9 @@ rule all:
REVERSE_READS,
TRIMMED_FASTQC,
MAPPED,
UNMAPPED
UNMAPPED,
MAP_SORTED,
SORTED_INDEXED
message : "Analysis is complete!"
shell:""
......@@ -127,18 +131,18 @@ rule trimmomatic:
rule trimmed_fastqc:
input:
forward_reads = WORKING_DIR + "trimmed/{samples}_forward.fastq.gz",
reverse_reads = WORKING_DIR + "trimmed/{samples}_reverse.fastq.gz"
WT8forward = WORKING_DIR + "trimmed/WT8_forward.fastq.gz",
WT8reverse = WORKING_DIR + "trimmed/WT8_reverse.fastq.gz"
output:
RESULT_DIR + "fastqc/{samples}_{R}_trimmed_fastqc.html"
log:
RESULT_DIR + "logs/fastqc/{samples}.trimmed_fastqc.log"
RESULT_DIR + "trimmed_fastqc/WT8_{direction}_fastqc.html"
params:
RESULT_DIR + "fastqc/"
RESULT_DIR + "trimmed_fastqc/"
conda:
"envs/fastqc.yaml"
log:
RESULT_DIR + "logs/trimmed_fastqc/WT8_{direction}.fastqc.log"
shell:
"fastqc --outdir={params} {input.forward_reads} {input.reverse_reads} &>{log}"
"fastqc --outdir={params} {input.WT8forward} {input.WT8reverse} &>{log}"
rule fastqc:
input:
......@@ -178,3 +182,27 @@ rule mapping:
"""
bowtie2 {params.bowtie} --threads {threads} -x {params.index} -1 {input.forward_reads} -2 {input.reverse_reads} -U {input.forwardUnpaired},{input.reverseUnpaired} --un-conc-gz {params.unmapped} | samtools view -Sb - > {output.mapped} 2>{log}
"""
rule sort:
input:
mapped = WORKING_DIR + "mapped/{samples}.bam"
output:
map_sorted = WORKING_DIR + "sort/{samples}.sorted.bam"
conda:
"envs/samtools_bowtie.yaml"
log:
RESULT_DIR + "logs/sort/{samples}.log"
shell:
"samtools sort {input} -o {output}"
rule index:
input:
map_sorted = WORKING_DIR + "sort/{samples}.sorted.bam"
output:
sorted_indexed = WORKING_DIR + "index/{samples}.sorted.bam.bai"
conda:
"envs/samtools_bowtie.yaml"
log:
RESULT_DIR + "logs/index/{samples}.log"
shell:
"samtools index {input} {output}"
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