Skip to content

Commit b59eca2

Browse files
committed
gzip hic files by default
1 parent e56a1c3 commit b59eca2

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/juicebox_dump.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse
22
import subprocess
3+
from tools import run_command
34

45
def parseargs():
56
parser = argparse.ArgumentParser(description='Download and dump HiC data')
@@ -9,6 +10,7 @@ def parseargs():
910
parser.add_argument('--outdir', default=".")
1011
parser.add_argument('--include_raw', action="store_true", help="Download raw matrix in addtion to KR")
1112
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")
1214

1315
return parser.parse_args()
1416

@@ -29,17 +31,23 @@ def main(args):
2931
command = args.juicebox + " dump observed KR {0} {1} {1} BP {3} {2}/chr{1}.KRobserved".format(args.hic_file, chromosome, outdir, args.resolution)
3032
print(command)
3133
out = subprocess.getoutput(command)
34+
if not args.skip_gzip:
35+
run_command("gzip {0}/chr{1}.KRobserved".format(outdir, chromosome))
3236

3337
## Download KR norm file
3438
command = args.juicebox + " dump norm KR {0} {1} BP {3} {2}/chr{1}.KRnorm".format(args.hic_file, chromosome, outdir, args.resolution)
3539
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))
3743

3844
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))
4351

4452
if __name__ == '__main__':
4553
args = parseargs()

0 commit comments

Comments
 (0)