Esempio n. 1
0
 def find(self, counter, template, primer, mismatches):
     """Find occurrences of a degenerate primer in a template sequence.
     Return positions and Duplexes formed. This method uses 
     multiprocessing to speedup the search process. Use it to perform 
     search in a long sequence."""
     t_len = len(template)
     counter.set_subwork(2, (t_len, t_len * primer.num_components))
     matches = self.find_matches(counter[0], template, primer, mismatches)
     if matches is None:
         return None
     duplexes = self.compile_duplexes_mp(counter[1], *matches)
     return to_shelf(duplexes) if duplexes else None
Esempio n. 2
0
 def _batch_find(self, template, primer, p_len, mismatches):
     matches = self._find(WorkCounter(), template, primer, len(template), p_len, mismatches)
     if matches is None:
         return None
     duplexes = self.compile_duplexes(WorkCounter(), *matches)
     return (template.id, to_shelf(duplexes)) if duplexes else None