This repository has been archived by the owner on Dec 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Snakefile
75 lines (63 loc) · 2.22 KB
/
Snakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import os
from os import path
if not workflow.overwrite_configfile:
configfile: "config.yml"
workdir: path.join(config["workdir_top"], config["pipeline"])
if(config["heu_mode"]):
config["heu_mode"] = "true"
WORKDIR = path.join(config["workdir_top"], config["pipeline"])
SNAKEDIR = path.dirname(workflow.snakefile)
include: "snakelib/utils.snake"
rule dump_versions:
output:
ver = "versions.txt"
conda: "env.yml"
shell:"""
command -v conda > /dev/null && conda list > {output.ver}
"""
rule make_fastq:
input:
fqd = config["fastq_dir"]
output:
fastq = "input/reads.fastq"
shell:"""
find -L {input.fqd} -type f -name "*.fastq" -exec cat {{}} \; > {output.fastq}
"""
rule run_pychopper:
input:
fastq = rules.make_fastq.output.fastq
output:
out_fastq = "output/full_length_reads.fastq",
unclass_fastq = "output/unclassified_reads.fastq",
stats = "output/stats.tsv",
scores = "output/alignment_scores.tsv",
pdf = "output/pychopper_report.pdf",
params:
primers = config["primers"],
aln_params = config["aln_params"],
target_length = config["target_length"],
sample_size = config["sample_size"],
score_percentile = config["score_percentile"],
heu_mode = config["heu_mode"],
heu_stringency = config["heu_stringency"],
conda: "env.yml"
shell: """
X=""
if [ {params.heu_mode} == "true" ];
then
X="-x"
fi
echo '{params.primers}' > input/primers.fas
cdna_classifier.py -b input/primers.fas -g {params.aln_params} -t {params.target_length} \
-n {params.sample_size} -s {params.score_percentile} -r {output.pdf} -u {output.unclass_fastq} -S {output.stats} \
-A {output.scores} $X -l {params.heu_stringency} {input.fastq} {output.out_fastq}
"""
rule all:
input:
ver = rules.dump_versions.output.ver,
fastq = rules.make_fastq.output.fastq,
out_fastq = rules.run_pychopper.output.out_fastq,
unclass_fastq = rules.run_pychopper.output.unclass_fastq,
stats = rules.run_pychopper.output.stats,
scores = rules.run_pychopper.output.scores,
pdf = rules.run_pychopper.output.pdf,