From 67ae775ae5059d0be12300bf60835803f0e4db8e Mon Sep 17 00:00:00 2001 From: donkirkby Date: Mon, 26 Apr 2021 14:55:11 -0700 Subject: [PATCH] Close #7 by accepting a few missing bases in a primer. Also search for 250 bases from each end. --- gene_splicer/primer_finder.py | 2 +- gene_splicer/primer_finder_class.py | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/gene_splicer/primer_finder.py b/gene_splicer/primer_finder.py index 13fecdc..d4a5bbc 100644 --- a/gene_splicer/primer_finder.py +++ b/gene_splicer/primer_finder.py @@ -104,7 +104,7 @@ def find_primers( # The sequence type, can be either 'contigs' or 'conseqs' seqtype, sample_size=50, - extended_length=200, + extended_length=250, force_all_proviral=False): proviral_helper = ProviralHelper(force_all_proviral=force_all_proviral) errors = PrimerFinderErrors() diff --git a/gene_splicer/primer_finder_class.py b/gene_splicer/primer_finder_class.py index c119957..d5f8cd5 100644 --- a/gene_splicer/primer_finder_class.py +++ b/gene_splicer/primer_finder_class.py @@ -58,17 +58,13 @@ def find_longest_primer(self): else: hxb2_start_offset = 0 hxb2_end_offset = 0 - # Minus min_primer_length because the smallest primer we want to try looking for is min_primer_length nucleotides + # Minus min_primer_length because the smallest primer we want to try + # looking for is min_primer_length nucleotides for i in range(len(self.primer) - self.min_primer_length): - # print('i', i) - primer_substring = None - - # If fwd if self.direction == 'fwd': primer_substring = self.primer[i:] hxb2_start_offset += 1 - # If rev elif self.direction == 'rev': if i == 0: primer_substring = self.primer[:] @@ -96,9 +92,8 @@ def validate(self): return elif len(self.sample_primer) >= 7: self.is_valid = True - if len(self.sample_primer) == self.primer_length: + if len(self.sample_primer) >= self.primer_length - 3: self.is_full_length = True - # TODO: I should probably check that if the primer is not full length, that the start index is 0 for fwd and is len-1 for rev return else: sample_slice, hxb2_slice = self.get_slices()