-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsifit_local.snake
More file actions
152 lines (133 loc) · 7.55 KB
/
sifit_local.snake
File metadata and controls
152 lines (133 loc) · 7.55 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
"""
Explanation of wildcards:
dataType: input data types, e.g., no CNVs, including CNVs, excluding CNVs, etc.
datasetName: simulated dataset names, e.g., 0001, 0002, 0003...
"""
include: "scripts/constants.py"
include: "scripts/utils.py"
#########################################################
# Get categories of wildcards #
#########################################################
SIMUDATASETNAMES = get_dataset_names(SIMUSNVSITESDIR, config["fineTune"]["indelsieve_simulator"]["subsample"])
SIMUDATATYPES = get_data_types(
config["benchmark"]["simulatedDataTypes"],
config["benchmark"]["simulation"]["dataTypes"]["CNVTypes"]
)
########################################################
# SIFIT - From Monovar #
########################################################
# Rule: run SIFIT with TRUE parameters and filtered SNVs called by Monovar working with TRUE parameters
rule runSifitWithTrueMonovarSNVsTrueParams:
input:
cellNames=MONOVARTRUEPARAMSDIR + "{dataType}/{datasetName}/post_processed/filtered.sifit_cell_names",
data=MONOVARTRUEPARAMSDIR + "{dataType}/{datasetName}/post_processed/filtered.sifit_data"
output:
cellNames=protected(SIFITTRUEMONOVARSNVSTRUEPARAMSLOCALDIR + "{dataType}/{datasetName}/filtered.sifit_cell_names"),
data=protected(SIFITTRUEMONOVARSNVSTRUEPARAMSLOCALDIR + "{dataType}/{datasetName}/filtered.sifit_data"),
out=protected(SIFITTRUEMONOVARSNVSTRUEPARAMSLOCALDIR + "{dataType}/{datasetName}/true_out"),
tree=protected(SIFITTRUEMONOVARSNVSTRUEPARAMSLOCALDIR + "{dataType}/{datasetName}/filtered.sifit_data_mlTree.newick")
params:
sifit=config["tools"]["sifitLocal"],
loops=config["fineTune"]["sifit"]["loops"],
fp=config["benchmark"]["analysis"]["effSeqErrRate"],
fn=config["benchmark"]["analysis"]["adoRate"],
cellNum=lambda wildcards, input: get_item_num(input.cellNames),
siteNum=lambda wildcards, input: get_line_num(input.data)
priority:
100
benchmark:
repeat(EFFICIENCYSIFITDIR + "{dataType}/{datasetName}.tsv", config["benchmark"]["efficiency"]["repetition"])
shell:
"cp -f {input.cellNames} {output.cellNames}; "
"cp -f {input.data} {output.data}; "
"java -jar {params.sifit} "
"-m {params.cellNum} "
"-n {params.siteNum} "
"-fp {params.fp} "
"-fn {params.fn} "
"-iter {params.loops} "
"-df 1 -ipMat {output.data} "
"-cellNames {output.cellNames} "
"&>{output.out}"
#######################################################
# Gather trees from SIFIT #
#######################################################
# Rule: gather inferred trees from SIFIT with TRUE parameters and filtered SNVs called by Monovar working with TRUE parameters
rule gatherSifitTreesTrueMonovarSNVsTrueParams:
input:
inferredTrees = expand(SIFITTRUEMONOVARSNVSTRUEPARAMSLOCALDIR + "{dataType}/{datasetName}/filtered.sifit_data_mlTree.newick", dataType=SIMUDATATYPES, datasetName=SIMUDATASETNAMES),
trueTrees = expand(SIMUCONVERTEDTRUETREEDIR + config["benchmark"]["simulation"]["treesWithoutTrunkWithoutNormalDir"] + config["benchmark"]["simulation"]["treesPre"] + ".{datasetName}", datasetName=SIMUDATASETNAMES)
output:
protected(ANALYSISTREECOMPDIR + "from_sifit_" + config["benchmark"]["analysis"]["trueMonovarSNVs"] + "_" + config["benchmark"]["analysis"]["trueParameters"] + ".tsv")
params:
datasetNames=SIMUDATASETNAMES,
trueTreesDir=SIMUCONVERTEDTRUETREEDIR + config["benchmark"]["simulation"]["treesWithoutTrunkWithoutNormalDir"],
trueTreesPre=config["benchmark"]["simulation"]["treesPre"],
tool="sifit",
snvType=config["benchmark"]["analysis"]["trueMonovarSNVs"],
toolSetup=config["benchmark"]["analysis"]["trueParameters"],
fineTuneType=None,
cnvRate=str(config["fineTune"]["simulateCNVs"]["prob"]),
dataType=SIMUDATATYPES,
cellNum=config["benchmark"]["analysis"]["cellNum"],
covMean=config["benchmark"]["analysis"]["covMean"],
covVariance=config["benchmark"]["analysis"]["covVariance"],
effSeqErrRate=config["benchmark"]["analysis"]["effSeqErrRate"],
adoRate=config["benchmark"]["analysis"]["adoRate"],
mutationRate=config["benchmark"]["analysis"]["mutationRate"],
deletionRate=config["benchmark"]["analysis"]["deletionRate"],
insertionRate=config["benchmark"]["analysis"]["insertionRate"],
doubletRate=config["benchmark"]["analysis"]["doubletRate"]
script:
"scripts/gather_inferred_trees_part.py"
########################################################
# Get estimates from SIFIT #
########################################################
# Rule: get parameter estimates from SIFIT with TRUE parameters and filtered SNVs called by Monovar working with TRUE parameters
rule getSifitParamsWithTrueMonovarSNVsTrueParams:
input:
expand(SIFITTRUEMONOVARSNVSTRUEPARAMSLOCALDIR + "{dataType}/{datasetName}/true_out", dataType=SIMUDATATYPES, datasetName=SIMUDATASETNAMES)
output:
protected(ANALYSISPARAMSDIR + "from_sifit_" + config["benchmark"]["analysis"]["trueMonovarSNVs"] + "_" + config["benchmark"]["analysis"]["trueParameters"] + ".tsv")
params:
cellNum=config["benchmark"]["analysis"]["cellNum"],
covMean=config["benchmark"]["analysis"]["covMean"],
covVariance=config["benchmark"]["analysis"]["covVariance"],
mutationRate=config["benchmark"]["analysis"]["mutationRate"],
datasetNames=SIMUDATASETNAMES,
tool="sifit",
snvType=config["benchmark"]["analysis"]["trueMonovarSNVs"],
toolSetup=config["benchmark"]["analysis"]["trueParameters"],
fineTuneType=None,
dataType=SIMUDATATYPES,
cnvRate=str(config["fineTune"]["simulateCNVs"]["prob"]),
doubletRate=config["benchmark"]["analysis"]["doubletRate"]
script:
"scripts/get_param_estimates_sifit.py"
#######################################################
# Gather the number of sites from SIFIT #
#######################################################
# Rule: gather the number of variant sites as input to SIFIT
rule gatherSifitSitesInfoWithTrueMonovarSNVsTrueParams:
input:
data=expand(MONOVARTRUEPARAMSDIR + "{dataType}/{datasetName}/post_processed/filtered.sifit_data", dataType=SIMUDATATYPES, datasetName=SIMUDATASETNAMES)
output:
protected(ANALYSISSITESINFODIR + "from_sifit_" + config["benchmark"]["analysis"]["trueMonovarSNVs"] + "_" + config["benchmark"]["analysis"]["trueParameters"] + ".tsv")
params:
datasetNames=SIMUDATASETNAMES,
tool="sifit",
snvType=config["benchmark"]["analysis"]["trueMonovarSNVs"],
toolSetup=config["benchmark"]["analysis"]["trueParameters"],
fineTuneType=None,
cnvRate=str(config["fineTune"]["simulateCNVs"]["prob"]),
dataType=SIMUDATATYPES,
cellNum=config["benchmark"]["analysis"]["cellNum"],
covMean=config["benchmark"]["analysis"]["covMean"],
covVariance=config["benchmark"]["analysis"]["covVariance"],
effSeqErrRate=config["benchmark"]["analysis"]["effSeqErrRate"],
adoRate=config["benchmark"]["analysis"]["adoRate"],
deletionRate=config["benchmark"]["analysis"]["deletionRate"],
insertionRate=config["benchmark"]["analysis"]["insertionRate"],
doubletRate=config["benchmark"]["analysis"]["doubletRate"]
script:
"scripts/gather_sites_info_part.py"