22
22
23
23
__version__ = get_distribution ("novartis_pisces" ).version
24
24
25
- unique_id = '' .join (random .choice (string .digits ) for _ in range (10 ))
25
+ unique_id = '' .join (random .choice (string .digits ) for _ in range (10 ))
26
26
27
27
def find_data_directory ():
28
28
""" Returns the path to the module directory """
@@ -36,10 +36,10 @@ def install_salmon():
36
36
from urllib .request import urlopen
37
37
from shutil import rmtree
38
38
from subprocess import call
39
-
39
+
40
40
redist = os .path .join (find_data_directory (), 'redist' )
41
41
rmtree (os .path .join (redist , "salmon" ), ignore_errors = True )
42
-
42
+
43
43
if platform .system () == "Linux" :
44
44
salmon_url = "https://anaconda.org/bioconda/salmon/1.3.0/download/linux-64/salmon-1.3.0-hf69c8f4_0.tar.bz2"
45
45
elif platform .system () == "Darwin" :
@@ -51,15 +51,15 @@ def install_salmon():
51
51
tar_file .seek (0 )
52
52
with tarfile .open (fileobj = tar_file ) as tar :
53
53
tar .extractall (path = os .path .join (redist , "salmon" ))
54
-
54
+
55
55
def install_r_dependencies ():
56
56
"""Install R dependencies"""
57
57
cmd = [
58
58
'Rscript' ,
59
59
os .path .join (find_data_directory (), 'R/set_up_dependencies.R' )
60
60
]
61
61
call (cmd )
62
-
62
+
63
63
def install_dependencies ():
64
64
install_salmon ()
65
65
install_r_dependencies ()
@@ -69,7 +69,7 @@ def sra_valid_accession(accession):
69
69
if accession .startswith ('SRR' ) and len (accession ) == 10 :
70
70
return True
71
71
return False
72
-
72
+
73
73
def long_substr (data ):
74
74
""" http://stackoverflow.com/questions/2892931/longest-common-substring-from-more-than-two-strings-python """
75
75
substr = ''
@@ -149,15 +149,15 @@ def fingerprint_sample(args, fastq_1, fastq_2, data_dir, output_dir,
149
149
kmers2_outname , 'w' ) as kmers2_out :
150
150
p1 = Popen (
151
151
[
152
- 'fgrep ' , '-h' , '-o' , '-f' ,
152
+ 'zgrep ' , '-h' , '-o' , '-f' ,
153
153
os .path .join (data_dir , 'data/fp_kmers_col1.txt' ),
154
154
' ' .join (fastq_1 )
155
155
],
156
156
stdout = kmers1_out ,
157
157
stderr = PIPE )
158
158
p2 = Popen (
159
159
[
160
- 'fgrep ' , '-h' , '-o' , '-f' ,
160
+ 'zgrep ' , '-h' , '-o' , '-f' ,
161
161
os .path .join (data_dir , 'data/fp_kmers_col1.txt' ),
162
162
' ' .join (fastq_2 )
163
163
],
@@ -169,7 +169,7 @@ def fingerprint_sample(args, fastq_1, fastq_2, data_dir, output_dir,
169
169
with open (kmers1_outname , 'w' ) as kmers1_out :
170
170
p1 = Popen (
171
171
[
172
- 'fgrep ' , '-h' , '-o' , '-f' ,
172
+ 'zgrep ' , '-h' , '-o' , '-f' ,
173
173
os .path .join (data_dir , 'data/fp_kmers_col1.txt' ),
174
174
' ' .join (fastq_1 )
175
175
],
0 commit comments