-
Notifications
You must be signed in to change notification settings - Fork 0
/
Snakefile
executable file
·59 lines (49 loc) · 2.51 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
import pandas as pd
from snakemake.utils import validate
validate(config, "schema/config.schema.yaml")
units = pd.read_table(config["general"]["units"], index_col=["sample", "unit"],
dtype=str)
units.index = units.index.set_levels([i.astype(str) for i in units.index.levels])
name_ext = config["general"]["name_ext"][:-1]
def is_single_end(sample, unit):
return pd.isnull(units.loc[(sample,unit), "fq2"])
if config["general"]["paired_End"]:
reads = [1,2]
else:
reads = 1
CONSTRAINT_FILTER = '_constraint_filtered' if config['constraint_filtering']['after_assembly'] else ''
CONSTRAINT_REPAIRED = '_constraint_repaired' if config['constraint_filtering']['repair_after_assembly'] else ''
RES_STR = f"{CONSTRAINT_FILTER}{CONSTRAINT_REPAIRED}"
if config["general"]["in_vivo"]:
rule all:
input:
expand("results/contig_assembly/assemblies/{unit.sample}_{unit.unit}_assembled.fasta", unit=units.reset_index().itertuples())
elif config['constraint_filtering']['repair_after_assembly']:
rule all:
input:
expand("results/assembly/{unit.sample}_{unit.unit}/{unit.sample}_{unit.unit}_repaired.fasta", unit=units.reset_index().itertuples())
elif config['constraint_filtering']['after_assembly']:
if config['general']['clustering']:
rule all:
input:
expand("results/assembly/{unit.sample}_{unit.unit}/{unit.sample}_{unit.unit}_filtered.fastq", unit=units.reset_index().itertuples()),
expand("results/assembly/{unit.sample}_{unit.unit}/{unit.sample}_{unit.unit}_cluster.fasta",unit=units.reset_index().itertuples())
else:
rule all:
input:
expand("results/assembly/{unit.sample}_{unit.unit}/{unit.sample}_{unit.unit}_filtered.fastq",unit=units.reset_index().itertuples()),
expand("results/assembly/{unit.sample}_{unit.unit}/{unit.sample}_{unit.unit}_derep.fasta",unit=units.reset_index().itertuples())
elif config["general"]["clustering"]:
rule all:
input:
expand("results/assembly/{unit.sample}_{unit.unit}/{unit.sample}_{unit.unit}_cluster.fasta",unit=units.reset_index().itertuples())
else:
rule all:
input:
expand("results/assembly/{unit.sample}_{unit.unit}/{unit.sample}_{unit.unit}_derep.fasta",unit=units.reset_index().itertuples())
ruleorder: assembly > prinseq
include: "rules/demultiplexing.smk"
include: "rules/read_assembly.smk"
include: "rules/dereplication.smk"
include: "rules/constraint_filtering.smk"
include: "rules/contig_assembly.smk"