forked from Sage-Bionetworks/rnaseqSim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_job.py
executable file
·64 lines (57 loc) · 1.94 KB
/
generate_job.py
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
#!/usr/bin/env python
import os
import yaml
import argparse
import json
import synapseclient
import subprocess
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--simName")
parser.add_argument("--numEvents")
parser.add_argument("--targetDepth")
parser.add_argument("--expressionProfile")
parser.add_argument("--RSEMmodel")
parser.add_argument("--genome", default='syn5923671')
parser.add_argument("--gtf", default='syn7989163')
parser.add_argument("--dipGenome", default="GRCh37v75_STAR.tar.gz")
parser.add_argument("--inputDir", default="/home/ubuntu/inputs")
parser.add_argument("--bucket", default="gs://smc-rna-eval")
args = parser.parse_args()
syn = synapseclient.Synapse()
syn.login()
expressionProfile = syn.get(args.expressionProfile)
RSEMmodel = syn.get(args.RSEMmodel)
genome = syn.get(args.genome)
gtf = syn.get(args.gtf)
dipGenome = '/'.join([args.bucket,args.dipGenome])
subprocess.check_call(["gsutil", "cp", "-r", dipGenome, args.inputDir])
dipGenome = '/'.join([args.inputDir,args.dipGenome])
job = {
"SIM_NAME" : "%s" % (args.simName),
"GTF" : {
"class" : "File",
"path" : "%s" % (gtf.path)
},
"NUM_EVENTS" : int(args.numEvents),
"TARGET_DEPTH" : int(args.targetDepth),
"GENOME" : {
"class" : "File",
"path" : "%s" % (genome.path)
},
"EXPRESSION_PROFILE" : {
"class" : "File",
"path" : "%s" % (expressionProfile.path)
},
"RSEM_MODEL" : {
"class" : "File",
"path" : "%s" % (RSEMmodel.path)
},
"DIP_GENOME": {
"class" : "File",
"path" : "%s" % (dipGenome)
}
}
input_path = os.path.join(args.inputDir, "input.json")
with open(input_path, "w") as handle:
handle.write(json.dumps(job, indent=4))