예제 #1
0
 def get_characteristics(self,primer,Tm_method):
     """Get the characteristics (hairpin prop, selfcomplementarity) of a primer"""
     #
     # Extract the DNA sequence
     #
     primer_seq=primer['sequence']
     import mutation
     ok,primer_seq=mutation.check_DNA(primer_seq)
     if ok:
         #
         # Hairpin propensity
         #
         prop,numscore=mutation.hairpin_propensity(primer_seq)
         if numscore < 8:
             score = 'OK'
         elif numscore >= 8:
             score = 'BAD'
         text_hairpin='%s (%2d matches)' %(score,numscore)
         #
         # Self complementarity
         #
         complementarity_dict,maxselfscore = mutation.self_complementarity_propensity(primer_seq)
         if maxselfscore < 8:
             text = 'OK'
         elif maxselfscore >= 8:
             text = 'BAD'
         text_selfcompl='%s (%2d matches)' %(text,maxselfscore)
         #
         # Melting temperature
         #
         Tm,mismatches,Tm_method_used=mutation.get_primer_Tm(DNAseq=primer['template_DNA'],primer=primer_seq,primer_start=primer['startpos'],method=Tm_method)
         return text_hairpin,text_selfcompl,Tm,Tm_method_used,mismatches
     return 'DNA sequenece not ok','DNA sequence not ok','DNA sequenece not ok','DNA sequence not ok'
예제 #2
0
 def get_characteristics(self, primer, Tm_method):
     """Get the characteristics (hairpin prop, selfcomplementarity) of a primer"""
     #
     # Extract the DNA sequence
     #
     primer_seq = primer['sequence']
     import mutation
     ok, primer_seq = mutation.check_DNA(primer_seq)
     if ok:
         #
         # Hairpin propensity
         #
         prop, numscore = mutation.hairpin_propensity(primer_seq)
         if numscore < 8:
             score = 'OK'
         elif numscore >= 8:
             score = 'BAD'
         text_hairpin = '%s (%2d matches)' % (score, numscore)
         #
         # Self complementarity
         #
         complementarity_dict, maxselfscore = mutation.self_complementarity_propensity(
             primer_seq)
         if maxselfscore < 8:
             text = 'OK'
         elif maxselfscore >= 8:
             text = 'BAD'
         text_selfcompl = '%s (%2d matches)' % (text, maxselfscore)
         #
         # Melting temperature
         #
         Tm, mismatches, Tm_method_used = mutation.get_primer_Tm(
             DNAseq=primer['template_DNA'],
             primer=primer_seq,
             primer_start=primer['startpos'],
             method=Tm_method)
         return text_hairpin, text_selfcompl, Tm, Tm_method_used, mismatches
     return 'DNA sequenece not ok', 'DNA sequence not ok', 'DNA sequenece not ok', 'DNA sequence not ok'
예제 #3
0
 def update_eval(self,event=None):
     #
     # Calculate primer-dimer and secondary structure
     #
     import mutation
     primer_seq=self.eval_var.get()
     ok,primer_seq=mutation.check_DNA(primer_seq)
     #
     # Score the sequence
     #
     if ok:
         prop,numscore=mutation.hairpin_propensity(primer_seq)
         if numscore < 8:
             score = 'OK'
             # score = numscore
         elif numscore >= 8:
             score = 'BAD'
             #score = numscore
         self.eval_hairpin.set('%s (%2d matches)' %(score,numscore))
         #
         # Primer-Dimer
         #
         complementarity_dict,maxselfscore = mutation.self_complementarity_propensity (primer_seq)
         if maxselfscore < 8:
             text = 'OK'
         elif maxselfscore >= 8:
             text = 'BAD'
         self.eval_primerdimer.set('%s (%2d matches)' %(text,maxselfscore))
         #
         # Tm
         #
         # See if we can align the primer
         #
         Tm=None
         if self.data.has_key('DNAseq'):
             if self.data['DNAseq']:
                 import primer_alignment
                 A=primer_alignment.dummy_align_primer(self)
                 #
                 # Find all possible binding sites for the primer
                 #
                 sites=A.find_primer_binding_sites(primer_seq,self.data['DNAseq'])
                 #
                 # Print the number of binding sites
                 #
                 best_score=0
                 best_position=None
                 scores=[]
                 first_neg=1
                 for position,score in sites:
                     scores.append(score)
                     #
                     # Find the best position
                     #
                     if score>best_score:
                         best_score=score
                         best_position=position
                 Tm,mistmatches,Tm_method_used=mutation.get_primer_Tm(DNAseq=self.data['DNAseq'],
                                           primer=primer_seq,
                                           primer_start=best_position,
                                           method=self.Tm_method.get())
                 #
                 # Draw the primer on the screen in the best position
                 #
                 this_primer={}
                 this_primer['sequence']=primer_seq
                 this_primer['startpos']=best_position
                 #
                 # Draw the new primer
                 #
                 self.pDB.display_primer(this_primer)
         if not Tm:
             Tm,mistmatches,Tm_method_used=mutation.get_primer_Tm(DNAseq=None,
                                                      primer=primer_seq,
                                                      primer_start=None,
                                                      method=self.Tm_method.get())
         self.eval_Tm.set('%5.2f' %Tm)
         self.eval_Tm_method.set(Tm_method_used)
     else:
         self.eval_hairpin.set('Invalid DNA sequence')
         self.eval_primerdimer.set('Invalid DNA sequence')
         self.eval_Tm.set('Invalid DNA sequence')
     return
예제 #4
0
 def update_eval(self, event=None):
     #
     # Calculate primer-dimer and secondary structure
     #
     import mutation
     primer_seq = self.eval_var.get()
     ok, primer_seq = mutation.check_DNA(primer_seq)
     #
     # Score the sequence
     #
     if ok:
         prop, numscore = mutation.hairpin_propensity(primer_seq)
         if numscore < 8:
             score = 'OK'
             # score = numscore
         elif numscore >= 8:
             score = 'BAD'
             #score = numscore
         self.eval_hairpin.set('%s (%2d matches)' % (score, numscore))
         #
         # Primer-Dimer
         #
         complementarity_dict, maxselfscore = mutation.self_complementarity_propensity(
             primer_seq)
         if maxselfscore < 8:
             text = 'OK'
         elif maxselfscore >= 8:
             text = 'BAD'
         self.eval_primerdimer.set('%s (%2d matches)' %
                                   (text, maxselfscore))
         #
         # Tm
         #
         # See if we can align the primer
         #
         Tm = None
         if self.data.has_key('DNAseq'):
             if self.data['DNAseq']:
                 import primer_alignment
                 A = primer_alignment.dummy_align_primer(self)
                 #
                 # Find all possible binding sites for the primer
                 #
                 sites = A.find_primer_binding_sites(
                     primer_seq, self.data['DNAseq'])
                 #
                 # Print the number of binding sites
                 #
                 best_score = 0
                 best_position = None
                 scores = []
                 first_neg = 1
                 for position, score in sites:
                     scores.append(score)
                     #
                     # Find the best position
                     #
                     if score > best_score:
                         best_score = score
                         best_position = position
                 Tm, mistmatches, Tm_method_used = mutation.get_primer_Tm(
                     DNAseq=self.data['DNAseq'],
                     primer=primer_seq,
                     primer_start=best_position,
                     method=self.Tm_method.get())
                 #
                 # Draw the primer on the screen in the best position
                 #
                 this_primer = {}
                 this_primer['sequence'] = primer_seq
                 this_primer['startpos'] = best_position
                 #
                 # Draw the new primer
                 #
                 self.pDB.display_primer(this_primer)
         if not Tm:
             Tm, mistmatches, Tm_method_used = mutation.get_primer_Tm(
                 DNAseq=None,
                 primer=primer_seq,
                 primer_start=None,
                 method=self.Tm_method.get())
         self.eval_Tm.set('%5.2f' % Tm)
         self.eval_Tm_method.set(Tm_method_used)
     else:
         self.eval_hairpin.set('Invalid DNA sequence')
         self.eval_primerdimer.set('Invalid DNA sequence')
         self.eval_Tm.set('Invalid DNA sequence')
     return