Mercurial > repos > jdv > nanonet
comparison nanonet_1D.py @ 2:3f35881c2e25 draft default tip
planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/nanonet commit d8cc434bd1704b2834f89b7d91370f356e3ac85a
author | jdv |
---|---|
date | Tue, 03 Oct 2017 20:51:59 -0400 |
parents | decd5688d719 |
children |
comparison
equal
deleted
inserted
replaced
1:57447db0ec78 | 2:3f35881c2e25 |
---|---|
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 |
26 try: | 25 try: |
27 in_dir = "in_dir" | 26 in_dir = "in_dir" |
28 if not os.path.exists(in_dir): | 27 if not os.path.exists(in_dir): |
29 os.makedirs(in_dir) | 28 os.makedirs(in_dir) |
30 | 29 |
31 tar = tarfile.open(fn, mode='r') | 30 # python's tarfile interface does not sanitize file paths within |
32 tar.extractall(path=in_dir) | 31 # tarballs, which can be a big security risk. GNU tar does sanitize by |
32 # default, so it's easier/safer here just to call the system tar | |
33 subprocess.call([ | |
34 "tar", | |
35 "-xf", | |
36 fn, | |
37 "-C", | |
38 in_dir]) | |
33 | 39 |
34 files = glob.glob( | 40 files = glob.glob( |
35 os.path.join(in_dir, "**", "*.fast5"), | 41 os.path.join(in_dir, "**", "*.fast5"), |
36 recursive=True | 42 recursive=True |
37 ) | 43 ) |