Mito_Assembler_Megahit.snakefile 3.11 KB
Newer Older
1
{import global_imports}
2
3
4
5
6

##########
# Inputs #
##########

7
8
# raw_inputs function call
raw_reads = raw_reads(config['results_dir'], config['sample_dir'], config['SeOrPe'])
mmassaviol's avatar
mmassaviol committed
9
config.update(raw_reads)
10
SAMPLES = raw_reads['samples']
11
12
13

# Tools inputs functions

14
def quality_check__fastqc_SE_inputs():
mmassaviol's avatar
mmassaviol committed
15
16
17
18
	inputs = dict()
	inputs["read"] = raw_reads["read"]
	return inputs

19
def quality_check__fastqc_PE_inputs():
mmassaviol's avatar
mmassaviol committed
20
21
22
23
	inputs = dict()
	inputs["read"] = raw_reads["read"]
	inputs["read2"] = raw_reads["read2"]
	return inputs
24

mmassaviol's avatar
mmassaviol committed
25
def assembling__megahit_SE_inputs():
26
    inputs = dict()
27
    inputs["read"] = expand(raw_reads["read"],sample=SAMPLES)
mmassaviol's avatar
mmassaviol committed
28
29
30
31
32
33
    return inputs

def assembling__megahit_PE_inputs():
    inputs = dict()
    inputs["read"] = expand(raw_reads["read"],sample=SAMPLES)
    inputs["read2"] = expand(raw_reads["read2"],sample=SAMPLES)
34
35
    return inputs

36
def find_mitoscaf__mitoz_findmitoscaf_inputs():
37
    inputs = dict()
mmassaviol's avatar
mmassaviol committed
38
    if (config["SeOrPe"] == "PE"):
39
        inputs["fasta"] = rules.assembling__megahit_PE.output.contigs
mmassaviol's avatar
mmassaviol committed
40
    else:
41
        inputs["fasta"] = rules.assembling__megahit_SE.output.contigs
42
43
    return inputs

44
def annotate__mitoz_annotate_inputs():
45
    inputs = dict()
46
    inputs["fastafile"] = rules.find_mitoscaf__mitoz_findmitoscaf.output.mitogenome
47
    inputs["read"] = expand(raw_reads["read"],sample=SAMPLES)
mmassaviol's avatar
mmassaviol committed
48
    if (config["SeOrPe"] == "PE"):
49
        inputs["read2"] = expand(raw_reads["read2"],sample=SAMPLES)
50
51
    return inputs

52
def visualize__igv_visualize_inputs():
53
    inputs = dict()
54
    inputs["genome"] = rules.find_mitoscaf__mitoz_findmitoscaf.output.mitogenome
mmassaviol's avatar
mmassaviol committed
55
    if (config["SeOrPe"] == "PE"):
56
        inputs["circos_bam"] = rules.annotate__mitoz_annotate_PE.output.circos_bam
mmassaviol's avatar
mmassaviol committed
57
    else:
58
        inputs["circos_bam"] = rules.annotate__mitoz_annotate_SE.output.circos_bam
59
60
    return inputs

mmassaviol's avatar
mmassaviol committed
61

62
{import global_functions}
63
64
65
66
67
68
69
70
71
72

###########
# Outputs #
###########

def step_outputs(step):
    outputs = list()
    if (step == "quality_check"):
        if (config[step] == "fastqc"):
            if(config["SeOrPe"] == "PE"):
73
                outputs = expand(rules.quality_check__fastqc_PE.output,sample=SAMPLES)
74
            else:
75
                outputs = expand(rules.quality_check__fastqc_SE.output,sample=SAMPLES)
76
77

    if (step == "assembling"):
mmassaviol's avatar
mmassaviol committed
78
        if(config["SeOrPe"] == "PE"):
79
            outputs = rules.assembling__megahit_PE.output
mmassaviol's avatar
mmassaviol committed
80
        else:
81
            outputs = rules.assembling__megahit_SE.output
82
    
mmassaviol's avatar
mmassaviol committed
83
    if (step == "find_mitoscaf"):
84
        outputs = rules.find_mitoscaf__mitoz_findmitoscaf.output
mmassaviol's avatar
mmassaviol committed
85
86
87

    if (step == "annotate"):
        if(config["SeOrPe"] == "PE"):
88
            outputs = rules.annotate__mitoz_annotate_PE.output
mmassaviol's avatar
mmassaviol committed
89
        else:
90
            outputs = rules.annotate__mitoz_annotate_SE.output
91

mmassaviol's avatar
mmassaviol committed
92
93
    if (step == "visualize"):
        if(config["SeOrPe"] == "PE"):
94
            outputs = rules.visualize__igv_visualize.output
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112

    elif (step == "all"):
        outputs = list(rules.multiqc.output)

    return outputs

# get outputs for each choosen tools
def workflow_outputs(step):
    outputs = list()
    outputs.extend(step_outputs(step))
    return outputs

#########
# Rules #
#########

{import rules}

113
{import global_rules}