comparison cpt.py @ 3:08499fbf8697 draft

planemo upload commit 96d9c038cdd9f83fcc55d2f20ab1057129d11589-dirty
author cpt
date Wed, 18 Sep 2024 04:02:06 +0000
parents 4e02e6e9e77d
children bc16792ecfd2
comparison
equal deleted inserted replaced
2:0a02ef22ce17 3:08499fbf8697
2 from Bio.Seq import Seq, reverse_complement, translate 2 from Bio.Seq import Seq, reverse_complement, translate
3 from Bio.SeqRecord import SeqRecord 3 from Bio.SeqRecord import SeqRecord
4 from Bio import SeqIO 4 from Bio import SeqIO
5 from Bio.Data import CodonTable 5 from Bio.Data import CodonTable
6 import logging 6 import logging
7 import re
7 8
8 logging.basicConfig() 9 logging.basicConfig()
9 log = logging.getLogger() 10 log = logging.getLogger()
10 11
11 PHAGE_IN_MIDDLE = re.compile("^(?P<host>.*)\s*phage (?P<phage>.*)$") 12 PHAGE_IN_MIDDLE = re.compile("^(?P<host>.*)\s*phage (?P<phage>.*)$")
145 for match in self.re_stops.finditer(s, overlapped=True): 146 for match in self.re_stops.finditer(s, overlapped=True):
146 index = match.start() + 3 147 index = match.start() + 3
147 if index % 3 != 0: 148 if index % 3 != 0:
148 continue 149 continue
149 n = s[start:index] 150 n = s[start:index]
150 for (offset, n, t) in self.start_chop_and_trans(n): 151 for offset, n, t in self.start_chop_and_trans(n):
151 if n and len(t) >= self.min_len: 152 if n and len(t) >= self.min_len:
152 yield start + offset, n, t 153 yield start + offset, n, t
153 start = index 154 start = index
154 155
155 def putative_genes_in_sequence(self, nuc_seq): 156 def putative_genes_in_sequence(self, nuc_seq):
292 for match in self.re_stops.finditer(s, overlapped=True): 293 for match in self.re_stops.finditer(s, overlapped=True):
293 index = match.start() + 3 294 index = match.start() + 3
294 if index % 3 != 0: 295 if index % 3 != 0:
295 continue 296 continue
296 n = s[start:index] 297 n = s[start:index]
297 for (offset, n, t) in self.start_chop_and_trans(n): 298 for offset, n, t in self.start_chop_and_trans(n):
298 if n and len(t) >= self.min_len: 299 if n and len(t) >= self.min_len:
299 yield start + offset, n, t 300 yield start + offset, n, t
300 start = index 301 start = index
301 302
302 def putative_genes_in_sequence(self, nuc_seq): 303 def putative_genes_in_sequence(self, nuc_seq):