Skip to content

Commit

Permalink
Added GZ compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-la committed Jun 19, 2018
1 parent 655b5b5 commit af5955b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions prince/match_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from prince.fine_filtering import fine_filtering
from itertools import chain
import gzip
import os.path

def check_file_exists(itr8tr):
first=next(itr8tr)
Expand All @@ -26,11 +27,11 @@ def compute_match_score(genome, templates, templateKmers, kmerLength):
reads2 = check_file_exists(SeqIO.parse(genome + "_2.fastq", "fastq"))
except:
try:
with gzip.open(genome + "_1.fastq.gz", "rt") as handle:
reads1 = check_file_exists(SeqIO.parse(handle, "fastq"))
handle1 = gzip.open(genome + "_1.fastq.gz", "rt")
reads1 = check_file_exists(SeqIO.parse(handle1, "fastq"))

with gzip.open(genome + "_2.fastq.gz", "rt") as handle:
reads2 = check_file_exists(SeqIO.parse(handle, "fastq"))
handle2 = gzip.open(genome + "_2.fastq.gz", "rt")
reads2 = check_file_exists(SeqIO.parse(handle2, "fastq"))
except:
try:
reads1 = check_file_exists(SeqIO.parse(genome, "fastq"))
Expand Down

0 comments on commit af5955b

Please sign in to comment.