Skip to content
Snippets Groups Projects
Commit bec64eda authored by Veronique Legrand's avatar Veronique Legrand
Browse files

added gzip format support for genome

parent 293c946d
No related branches found
No related tags found
No related merge requests found
Pipeline #109541 failed with stage
in 3 minutes and 33 seconds
...@@ -304,7 +304,8 @@ def genomeFastaRecovery(filin, limit_reference, edge, host_test = 0): ...@@ -304,7 +304,8 @@ def genomeFastaRecovery(filin, limit_reference, edge, host_test = 0):
if filin == "": if filin == "":
return "", "", "" return "", "", ""
infile = open(filin, 'r') #infile = open(filin, 'r')
infile = gzip.open(filin, "rt") if filin.endswith(".gz") else open(filin, 'r')
name = [] name = []
genome = [] genome = []
genome_line = "" genome_line = ""
......
...@@ -11,6 +11,7 @@ from __future__ import print_function ...@@ -11,6 +11,7 @@ from __future__ import print_function
from time import gmtime, strftime from time import gmtime, strftime
import sys import sys
import gzip
from optparse import OptionParser, OptionGroup from optparse import OptionParser, OptionGroup
from _modules.utilities import checkReportTitle,changeCase from _modules.utilities import checkReportTitle,changeCase
from _modules.IData_handling import totReads,genomeFastaRecovery from _modules.IData_handling import totReads,genomeFastaRecovery
...@@ -47,7 +48,7 @@ usage = """\n\nUsage: %prog -f reads.fastq -r phage_sequence.fasta [--report_tit ...@@ -47,7 +48,7 @@ usage = """\n\nUsage: %prog -f reads.fastq -r phage_sequence.fasta [--report_tit
def checkFastaFile(filin): def checkFastaFile(filin):
"""Check sequence Fasta file given by user""" """Check sequence Fasta file given by user"""
first_line = 1 first_line = 1
infil = open(filin, 'r') infil = gzip.open(filin, "rt") if filin.endswith(".gz") else open(filin, 'r')
try: try:
for line in infil: for line in infil:
# Test '>' # Test '>'
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment