Mercurial > repos > mmonot > phageterm
changeset 13:b9e4dea1c49a draft
Uploaded
author | mmonot |
---|---|
date | Wed, 20 Dec 2017 05:13:37 -0500 |
parents | fab295449424 |
children | a55814feb02e |
files | phageterm/._.DS_Store phageterm/._PhageTerm.py phageterm/._PhageTerm.xml phageterm/._READ_ME.txt phageterm/.__modules phageterm/PhageTerm.py phageterm/PhageTerm.xml phageterm/READ_ME.txt phageterm/_modules/.___init__.py phageterm/_modules/._functions_PhageTerm.py phageterm/_modules/functions_PhageTerm.py |
diffstat | 11 files changed, 45 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/phageterm/PhageTerm.py Thu Jul 13 09:29:44 2017 -0400 +++ b/phageterm/PhageTerm.py Wed Dec 20 05:13:37 2017 -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.8 + Version: 1.0.9 Contact: Julian Garneau <julian.garneau@usherbrooke.ca> Contact: David Bikard <david.bikard@pasteur.fr> Contact: Marc Monot <marc.monot@pasteur.fr>
--- a/phageterm/PhageTerm.xml Thu Jul 13 09:29:44 2017 -0400 +++ b/phageterm/PhageTerm.xml Wed Dec 20 05:13:37 2017 -0500 @@ -1,4 +1,4 @@ -<tool id="PhageTerm" name="PhageTerm" version="1.0.8"> +<tool id="PhageTerm" name="PhageTerm" version="1.0.9"> <description>Determine Bacteriophage Termini and Packaging Mode using randomly fragmented NGS data.</description> <requirements> <requirement type="package" version="2.7">python</requirement>
--- a/phageterm/READ_ME.txt Thu Jul 13 09:29:44 2017 -0400 +++ b/phageterm/READ_ME.txt Wed Dec 20 05:13:37 2017 -0500 @@ -7,7 +7,7 @@ VERSION ======= -Version 1.0.8 +Version 1.0.9 INTRODUCTION
--- a/phageterm/_modules/functions_PhageTerm.py Thu Jul 13 09:29:44 2017 -0400 +++ b/phageterm/_modules/functions_PhageTerm.py Wed Dec 20 05:13:37 2017 -0500 @@ -756,13 +756,8 @@ elif ( dist_peak < 20 and dist_peak > 2 ) or ( dist_peak_over < 20 and dist_peak_over > 2 ): Redundant = 0 Permuted = "No" + P_class, P_type = typeCOS(plus_significant["Position"][0], minus_significant["Position"][0], gen_len/2 ) P_seqcoh, packstat = sequenceCohesive("COS", refseq, [((plus_significant["SPC"][0]),(plus_significant["Position"][0])-1)], [((minus_significant["SPC"][0]),(minus_significant["Position"][0])-1)], gen_len/2) - if plus_significant["Position"][0] < minus_significant["Position"][0] and abs(plus_significant["Position"][0]-minus_significant["Position"][0]) < ( gen_len / 2 ): - P_class = "COS (5')" - P_type = "Lambda" - else: - P_class = "COS (3')" - P_type = "HK97" # DTR elif ( dist_peak <= 1000 ) or ( dist_peak_over <= 1000 ): Redundant = 1 @@ -885,20 +880,35 @@ """Return cohesive sequence for COS phages.""" if Packmode != 'COS': return '', Packmode - gen_len = nbr_lim*2 PosPlus = picMaxPlus[0][1] PosMinus = picMaxMinus[0][1] - if abs(PosMinus - PosPlus) < nbr_lim: - seqcoh = refseq[min(PosPlus, PosMinus):max(PosPlus,PosMinus)+1] - if len(seqcoh) > ( 0.1 * gen_len ): - return '', "OTHER" - return seqcoh, Packmode + + SC_class, SC_type = typeCOS(PosPlus, PosMinus, nbr_lim) + + if SC_class == "COS (5')": + if abs(PosMinus - PosPlus) < nbr_lim: + seqcoh = refseq[min(PosPlus, PosMinus):max(PosPlus,PosMinus)+1] + return seqcoh, Packmode + else: + seqcoh = refseq[max(PosPlus,PosMinus)+1:] + refseq[:min(PosPlus, PosMinus)] + return seqcoh, Packmode + + elif SC_class == "COS (3')": + if abs(PosMinus - PosPlus) < nbr_lim: + seqcoh = reverseComplement(refseq[min(PosPlus, PosMinus)+1:max(PosPlus,PosMinus)]) + return seqcoh, Packmode + else: + seqcoh = refseq[max(PosPlus,PosMinus)+1:] + refseq[:min(PosPlus, PosMinus)] + return seqcoh, Packmode else: - seqcoh = refseq[max(PosPlus,PosMinus)+1:] + refseq[:min(PosPlus, PosMinus)] - if len(seqcoh) > ( 0.1 * gen_len ): - return '', "OTHER" - return seqcoh, Packmode + return '', Packmode +def typeCOS(PosPlus, PosMinus, nbr_lim): + """ Return type of COS sequence.""" + if PosPlus < PosMinus and abs(PosPlus-PosMinus) < nbr_lim: + return "COS (5')", "Lambda" + else: + return "COS (3')", "HK97" ### IMAGE Functions def GraphCov(termini_coverage, picMaxPlus, picMaxMinus, phagename, norm, draw, hybrid = 0): @@ -1271,9 +1281,7 @@ """Export the phage sequence reorganized and completed if needed.""" if test_run: return - seq_out = "" - # Mu-like if Mu_like: if P_orient == "Forward": @@ -1295,19 +1303,25 @@ # COS elif isinstance(P_left, int) and isinstance(P_right, int): - # Genome - if abs(P_left-P_right) > len(refseq)/2: - seq_out = refseq[min(P_left,P_right)-1:max(P_left,P_right)] - else: - seq_out = refseq[max(P_left,P_right):] + refseq[:min(P_left,P_right)-1] # Cos or DTR - if P_class == "COS (5')": - seq_out = P_seqcoh + seq_out - elif P_class == "COS (3')": + if P_class == "COS (3')": + if abs(P_left-P_right) > len(refseq)/2: + seq_out = refseq[min(P_left,P_right)-1:max(P_left,P_right)] + else: + seq_out = refseq[max(P_left,P_right)-1:] + refseq[:min(P_left,P_right)] seq_out = seq_out + P_seqcoh else: - seq_out = P_seqcoh + seq_out + P_seqcoh - + # Genome + if abs(P_left-P_right) > len(refseq)/2: + seq_out = refseq[min(P_left,P_right)-1:max(P_left,P_right)] + else: + seq_out = refseq[max(P_left,P_right):] + refseq[:min(P_left,P_right)-1] + # COS 5' + if P_class == "COS (5')": + seq_out = P_seqcoh + seq_out + # DTR + else: + seq_out = P_seqcoh + seq_out + P_seqcoh # PAC elif isinstance(P_left, int) or isinstance(P_right, int): if P_orient == "Reverse":