# HG changeset patch # User mmonot # Date 1516959805 18000 # Node ID 9f98d8d4af7577ff9aa694c49bd2651a55e1bc19 # Parent 5c5c2011b0ed2b2904d38bc7dc77b4bd09dc5d27 Uploaded diff -r 5c5c2011b0ed -r 9f98d8d4af75 phageterm/._.DS_Store Binary file phageterm/._.DS_Store has changed diff -r 5c5c2011b0ed -r 9f98d8d4af75 phageterm/._PhageTerm.py Binary file phageterm/._PhageTerm.py has changed diff -r 5c5c2011b0ed -r 9f98d8d4af75 phageterm/._PhageTerm.xml Binary file phageterm/._PhageTerm.xml has changed diff -r 5c5c2011b0ed -r 9f98d8d4af75 phageterm/._READ_ME.txt Binary file phageterm/._READ_ME.txt has changed diff -r 5c5c2011b0ed -r 9f98d8d4af75 phageterm/.__modules Binary file phageterm/.__modules has changed diff -r 5c5c2011b0ed -r 9f98d8d4af75 phageterm/PhageTerm.py --- a/phageterm/PhageTerm.py Mon Jan 08 10:52:24 2018 -0500 +++ b/phageterm/PhageTerm.py Fri Jan 26 04:43:25 2018 -0500 @@ -46,7 +46,7 @@ usage = """\n\nUsage: %prog -f reads.fastq -r phage_sequence.fasta [-n phage_name -p reads_paired -s seed_lenght -d surrounding -t installation_test -c nbr_core -g host.fasta (warning increase process time)] Program: PhageTerm - Analyze phage termini and packaging mode using reads from high-throughput sequenced phage data - Version: 1.0.10 + Version: 1.0.11 Contact: Julian Garneau Contact: David Bikard Contact: Marc Monot diff -r 5c5c2011b0ed -r 9f98d8d4af75 phageterm/PhageTerm.xml --- a/phageterm/PhageTerm.xml Mon Jan 08 10:52:24 2018 -0500 +++ b/phageterm/PhageTerm.xml Fri Jan 26 04:43:25 2018 -0500 @@ -1,4 +1,4 @@ - + Determine Bacteriophage Termini and Packaging Mode using randomly fragmented NGS data. python diff -r 5c5c2011b0ed -r 9f98d8d4af75 phageterm/_modules/.___init__.py Binary file phageterm/_modules/.___init__.py has changed diff -r 5c5c2011b0ed -r 9f98d8d4af75 phageterm/_modules/._functions_PhageTerm.py Binary file phageterm/_modules/._functions_PhageTerm.py has changed diff -r 5c5c2011b0ed -r 9f98d8d4af75 phageterm/_modules/functions_PhageTerm.py --- a/phageterm/_modules/functions_PhageTerm.py Mon Jan 08 10:52:24 2018 -0500 +++ b/phageterm/_modules/functions_PhageTerm.py Fri Jan 26 04:43:25 2018 -0500 @@ -38,6 +38,7 @@ import struct import heapq import itertools +import gzip import matplotlib matplotlib.use('Agg') @@ -109,21 +110,6 @@ else: return "Phage" -def openFastq(filin): - """Return reads from a fastq file.""" - readList = [] - test_read_seq = 0 - infil = open(filin, 'r') - for i in infil: - if test_read_seq: - readList.append(i.split("\n")[0].split("\r")[0]) - test_read_seq = 0 - else: - if i[0] == "@": - test_read_seq = 1 - infil.close() - return readList - ### UTILITY function def chunks(l, n): @@ -182,11 +168,17 @@ sys.stdout.flush() # Mapping - filin = open(fastq) + if fastq.endswith('.gz'): + filin = gzip.open(fastq, 'rb') + else: + filin = open(fastq) line = filin.readline() if paired != "": - filin_paired = open(paired) + if paired.endswith('.gz'): + filin_paired = gzip.open(paired, 'rb') + else: + filin_paired = open(paired) line_paired = filin_paired.readline() @@ -520,8 +512,12 @@ ### READS Functions def totReads(filin): """Verify and retrieve the number of reads in the fastq file before alignment""" + if filin.endswith('.gz'): + filein = gzip.open(filin, 'rb') + else: + filein = open(filin, 'r') + line = 0 - filein = open(filin, 'r') while filein.readline(): line += 1 seq = float(round(line / 4)) @@ -1328,7 +1324,7 @@ # PAC elif isinstance(P_left, int) or isinstance(P_right, int): if P_orient == "Reverse": - seq_out = reverseComplement(refseq[:P_right-1]) + reverseComplement(refseq[P_right-1:]) + seq_out = reverseComplement(refseq[:P_right]) + reverseComplement(refseq[P_right:]) else: seq_out = refseq[P_left-1:] + refseq[:P_left-1]