1
1
import argparse
2
2
import subprocess
3
+ from tools import run_command
3
4
4
5
def parseargs ():
5
6
parser = argparse .ArgumentParser (description = 'Download and dump HiC data' )
@@ -9,6 +10,7 @@ def parseargs():
9
10
parser .add_argument ('--outdir' , default = "." )
10
11
parser .add_argument ('--include_raw' , action = "store_true" , help = "Download raw matrix in addtion to KR" )
11
12
parser .add_argument ('--chromosomes' , default = "all" , help = "comma delimited list of chromosomes to download" )
13
+ parser .add_argument ('--skip_gzip' , action = "store_true" , help = "dont gzip hic files" )
12
14
13
15
return parser .parse_args ()
14
16
@@ -29,17 +31,23 @@ def main(args):
29
31
command = args .juicebox + " dump observed KR {0} {1} {1} BP {3} {2}/chr{1}.KRobserved" .format (args .hic_file , chromosome , outdir , args .resolution )
30
32
print (command )
31
33
out = subprocess .getoutput (command )
34
+ if not args .skip_gzip :
35
+ run_command ("gzip {0}/chr{1}.KRobserved" .format (outdir , chromosome ))
32
36
33
37
## Download KR norm file
34
38
command = args .juicebox + " dump norm KR {0} {1} BP {3} {2}/chr{1}.KRnorm" .format (args .hic_file , chromosome , outdir , args .resolution )
35
39
out = subprocess .getoutput (command )
36
- print (out )
40
+ print (command )
41
+ if not args .skip_gzip :
42
+ run_command ("gzip {0}/chr{1}.KRnorm" .format (outdir , chromosome ))
37
43
38
44
if args .include_raw :
39
- ## Download raw observed matrix
40
- command = args .juicebox + " dump observed NONE {0} {1} {1} BP {3} {2}/chr{1}.RAWobserved" .format (args .hic_file , chromosome , outdir , args .resolution )
41
- print (command )
42
- out = subprocess .getoutput (command )
45
+ ## Download raw observed matrix
46
+ command = args .juicebox + " dump observed NONE {0} {1} {1} BP {3} {2}/chr{1}.RAWobserved" .format (args .hic_file , chromosome , outdir , args .resolution )
47
+ print (command )
48
+ out = subprocess .getoutput (command )
49
+ if not args .skip_gzip :
50
+ run_command ("gzip {0}/chr{1}.RAWobserved" .format (outdir , chromosome ))
43
51
44
52
if __name__ == '__main__' :
45
53
args = parseargs ()
0 commit comments