comparison albacore_1D.py @ 3:d561e3f9ccbb draft

planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/albacore commit d8cc434bd1704b2834f89b7d91370f356e3ac85a
author jdv
date Tue, 03 Oct 2017 20:12:09 -0400
parents 0a4f83207e53
children 8a9f61d08201
comparison
equal deleted inserted replaced
2:b658298e65d8 3:d561e3f9ccbb
5 import tarfile 5 import tarfile
6 import subprocess 6 import subprocess
7 import shutil 7 import shutil
8 import h5py 8 import h5py
9 import numpy as np 9 import numpy as np
10 import tarfile
11 from distutils.util import strtobool 10 from distutils.util import strtobool
12 11
13 def main(): 12 def main():
14 tar_file = sys.argv[1] 13 tar_file = sys.argv[1]
15 out_file = sys.argv[2] 14 out_file = sys.argv[2]
91 try: 90 try:
92 in_dir = "in_dir" 91 in_dir = "in_dir"
93 if not os.path.exists(in_dir): 92 if not os.path.exists(in_dir):
94 os.makedirs(in_dir) 93 os.makedirs(in_dir)
95 94
96 tar = tarfile.open(fn, mode='r') 95 # python's tarfile interface does not sanitize file paths within
97 tar.extractall(path=in_dir) 96 # tarballs, which can be a big security risk. GNU tar does sanitize by
97 # default, so it's easier/safer here just to call the system tar
98 subprocess.call([
99 "tar",
100 "-xf",
101 fn,
102 "-C",
103 in_dir])
98 104
99 files = glob.glob( 105 files = glob.glob(
100 os.path.join(in_dir, "**", "*.fast5"), 106 os.path.join(in_dir, "**", "*.fast5"),
101 recursive=True 107 recursive=True
102 ) 108 )