-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremote_sifit_true_monovar.snake
More file actions
91 lines (80 loc) · 4.74 KB
/
remote_sifit_true_monovar.snake
File metadata and controls
91 lines (80 loc) · 4.74 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
"""
Run SIFIT with data from MONOVAR with true parameters remotely.
"""
configfile: "config.yaml"
include: "scripts/constants.py"
include: "scripts/utils.py"
########################################################
# Get the working directory of SNAKEMAKE #
########################################################
SNAKEMAKEDIR = get_abs_working_dir()
#########################################################
# All rules #
#########################################################
rule all:
input:
expand(SIFITGITSKELETONTRUEMONOVARREMOTEDIR + config["benchmark"]["paramTypes"]["fromTrueParamsDir"] + "{dataType}/{datasetName}/true_out", dataType=config["benchmark"]["simulation"]["dataTypeNames"], datasetName=config["benchmark"]["simulation"]["datasetNames"]),
expand(SIFITGITSKELETONTRUEMONOVARREMOTEDIR + config["benchmark"]["paramTypes"]["fromTrueParamsDir"] + "{dataType}/{datasetName}/data_mlTree.newick", dataType=config["benchmark"]["simulation"]["dataTypeNames"], datasetName=config["benchmark"]["simulation"]["datasetNames"])
output:
protected(config["benchmark"]["paramTypes"]["fromTrueParamsDir"] + "done")
params:
dataDir=SIFITGITSKELETONTRUEMONOVARREMOTEDIR,
remoteUserName=config["benchmark"]["git"]["remote"]["userName"],
remoteUserEmail=config["benchmark"]["git"]["remote"]["userEmail"],
folderName=config["benchmark"]["paramTypes"]["fromTrueParamsDir"],
commitMSG="[remote] added results of " + config["benchmark"]["phyloInf"]["fromTrueMonovarDir"].rstrip("/")
shell:
"cd {params.dataDir}; "
"git config --local user.name \"{params.remoteUserName}\"; "
"git config --local user.email \"{params.remoteUserEmail}\"; "
"git add {params.folderName}; "
"git commit -m \"{params.commitMSG}\"; "
"cd {SNAKEMAKEDIR}; "
"touch {output}"
# Rule: copy data from git repository to local folder
rule copyDataFromGit2Local:
input:
data=SIFITGITSKELETONTRUEMONOVARREMOTEDIR + config["benchmark"]["paramTypes"]["fromTrueParamsDir"] + "{dataType}/{datasetName}/data",
cellNames=SIFITGITSKELETONTRUEMONOVARREMOTEDIR + config["benchmark"]["paramTypes"]["fromTrueParamsDir"] + "{dataType}/{datasetName}/cell_names"
output:
dataTrueParams=protected(config["benchmark"]["paramTypes"]["fromTrueParamsDir"] + "{dataType}/{datasetName}/data"),
cellNamesTrueParams=protected(config["benchmark"]["paramTypes"]["fromTrueParamsDir"] + "{dataType}/{datasetName}/cell_names")
shell:
"cp -f {input.data} {output.dataTrueParams}; "
"cp -f {input.cellNames} {output.cellNamesTrueParams}"
# Rule: run SIFIT with TRUE parameters and SNVs called by Monovar with true parameters on remote server
rule runSifitWithTrueMonovarSNVsTrueParams:
input:
data=config["benchmark"]["paramTypes"]["fromTrueParamsDir"] + "{dataType}/{datasetName}/data",
cellNames=config["benchmark"]["paramTypes"]["fromTrueParamsDir"] + "{dataType}/{datasetName}/cell_names"
output:
out=protected(config["benchmark"]["paramTypes"]["fromTrueParamsDir"] + "{dataType}/{datasetName}/true_out"),
tree=protected(config["benchmark"]["paramTypes"]["fromTrueParamsDir"] + "{dataType}/{datasetName}/data_mlTree.newick")
params:
sifit=config["tools"]["sifitRemote"],
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)
shell:
"java -jar {params.sifit} "
"-m {params.cellNum} "
"-n {params.siteNum} "
"-fp {params.fp} "
"-fn {params.fn} "
"-iter {params.loops} "
"-df 1 -ipMat {input.data} "
"-cellNames {input.cellNames} "
"&>{output.out}"
# Rule: copy results from remote server to local server
rule copyResultsToLocal:
input:
outTrueParams=config["benchmark"]["paramTypes"]["fromTrueParamsDir"] + "{dataType}/{datasetName}/true_out",
treeTrueParams=config["benchmark"]["paramTypes"]["fromTrueParamsDir"] + "{dataType}/{datasetName}/data_mlTree.newick"
output:
outTrueParams=protected(SIFITGITSKELETONTRUEMONOVARREMOTEDIR + config["benchmark"]["paramTypes"]["fromTrueParamsDir"] + "{dataType}/{datasetName}/true_out"),
treeTrueParams=protected(SIFITGITSKELETONTRUEMONOVARREMOTEDIR + config["benchmark"]["paramTypes"]["fromTrueParamsDir"] + "{dataType}/{datasetName}/data_mlTree.newick")
shell:
"cp -f {input.outTrueParams} {output.outTrueParams}; "
"cp -f {input.treeTrueParams} {output.treeTrueParams}"