Skip to content

Commit 80f99f8

Browse files
authored
Merge pull request #28 from Novartis/genotype_fix
Fix the genotyping process to work with gzipped input files
2 parents fb1115a + fc09cc1 commit 80f99f8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

pisces/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
__version__ = get_distribution("novartis_pisces").version
2424

25-
unique_id = ''.join(random.choice(string.digits) for _ in range(10))
25+
unique_id = ''.join(random.choice(string.digits) for _ in range(10))
2626

2727
def find_data_directory():
2828
""" Returns the path to the module directory """
@@ -36,10 +36,10 @@ def install_salmon():
3636
from urllib.request import urlopen
3737
from shutil import rmtree
3838
from subprocess import call
39-
39+
4040
redist = os.path.join(find_data_directory(), 'redist')
4141
rmtree(os.path.join(redist, "salmon"), ignore_errors=True)
42-
42+
4343
if platform.system() == "Linux":
4444
salmon_url = "https://anaconda.org/bioconda/salmon/1.3.0/download/linux-64/salmon-1.3.0-hf69c8f4_0.tar.bz2"
4545
elif platform.system() == "Darwin":
@@ -51,15 +51,15 @@ def install_salmon():
5151
tar_file.seek(0)
5252
with tarfile.open(fileobj=tar_file) as tar:
5353
tar.extractall(path=os.path.join(redist, "salmon"))
54-
54+
5555
def install_r_dependencies():
5656
"""Install R dependencies"""
5757
cmd = [
5858
'Rscript',
5959
os.path.join(find_data_directory(), 'R/set_up_dependencies.R')
6060
]
6161
call(cmd)
62-
62+
6363
def install_dependencies():
6464
install_salmon()
6565
install_r_dependencies()
@@ -69,7 +69,7 @@ def sra_valid_accession(accession):
6969
if accession.startswith('SRR') and len(accession) == 10:
7070
return True
7171
return False
72-
72+
7373
def long_substr(data):
7474
""" http://stackoverflow.com/questions/2892931/longest-common-substring-from-more-than-two-strings-python """
7575
substr = ''
@@ -149,15 +149,15 @@ def fingerprint_sample(args, fastq_1, fastq_2, data_dir, output_dir,
149149
kmers2_outname, 'w') as kmers2_out:
150150
p1 = Popen(
151151
[
152-
'fgrep', '-h', '-o', '-f',
152+
'zgrep', '-h', '-o', '-f',
153153
os.path.join(data_dir, 'data/fp_kmers_col1.txt'),
154154
' '.join(fastq_1)
155155
],
156156
stdout=kmers1_out,
157157
stderr=PIPE)
158158
p2 = Popen(
159159
[
160-
'fgrep', '-h', '-o', '-f',
160+
'zgrep', '-h', '-o', '-f',
161161
os.path.join(data_dir, 'data/fp_kmers_col1.txt'),
162162
' '.join(fastq_2)
163163
],
@@ -169,7 +169,7 @@ def fingerprint_sample(args, fastq_1, fastq_2, data_dir, output_dir,
169169
with open(kmers1_outname, 'w') as kmers1_out:
170170
p1 = Popen(
171171
[
172-
'fgrep', '-h', '-o', '-f',
172+
'zgrep', '-h', '-o', '-f',
173173
os.path.join(data_dir, 'data/fp_kmers_col1.txt'),
174174
' '.join(fastq_1)
175175
],

0 commit comments

Comments
 (0)