comparison scrappie_raw.py @ 3:632c50fe83ba draft default tip

planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/scrappie commit d8cc434bd1704b2834f89b7d91370f356e3ac85a
author jdv
date Tue, 03 Oct 2017 21:50:49 -0400
parents 30c2b84b4117
children
comparison
equal deleted inserted replaced
2:b4721d6ecae2 3:632c50fe83ba
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2 2
3 import sys, os 3 import sys, os
4 import glob 4 import glob
5 import tarfile
6 import subprocess 5 import subprocess
7 import shutil 6 import shutil
8 import h5py 7 import h5py
9 import numpy as np 8 import numpy as np
10 9
27 try: 26 try:
28 in_dir = "in_dir" 27 in_dir = "in_dir"
29 if not os.path.exists(in_dir): 28 if not os.path.exists(in_dir):
30 os.makedirs(in_dir) 29 os.makedirs(in_dir)
31 30
32 tar = tarfile.open(fn, mode='r') 31 # python's tarfile interface does not sanitize file paths within
33 tar.extractall(path=in_dir) 32 # tarballs, which can be a big security risk. GNU tar does sanitize by
33 # default, so it's easier/safer here just to call the system tar
34 subprocess.call([
35 "tar",
36 "-xf",
37 fn,
38 "-C",
39 in_dir])
34 40
35 files = glob.glob( 41 files = glob.glob(
36 os.path.join(in_dir, "**", "*.fast5"), 42 os.path.join(in_dir, "**", "*.fast5"),
37 recursive=True 43 recursive=True
38 ) 44 )