Beispiel #1
0
 def WillItPCR(self, amplicon, f_primer, r_primer):
     for_wip = self.SWTm_WillItPCR_primer(amplicon, MB.Antisense(f_primer))
     rev_wip = self.SWTm_WillItPCR_primer(amplicon, r_primer)
     ret = {}
     if for_wip['TmAB'] > 0:
         ret['for_Tm'] = for_wip['TmAB']
         ret['for_align_score'] = for_wip['align_score']
         ret['for_match'] = for_wip['match_str']
         ret['for_mis_matches'] = for_wip['mis_matches']
     if rev_wip['TmAB'] > 0:
         ret['rev_Tm'] = rev_wip['TmAB']
         ret['rev_align_score'] = rev_wip['align_score']
         ret['rev_match'] = rev_wip['match_str']
         ret['rev_mis_matches'] = rev_wip['mis_matches']
     return ret
Beispiel #2
0
    def Score(
        self,
        scoreMatrix={
            'HP': 1000,
            'PD': 10,
            'GC': 10000,
            'rep': 10000,
            'Tm': 100,
            'CyclePenalty': 1000
        }):
        ###score is from best to worst highest score is worst probe
        score = 0
        if 'Tm' in scoreMatrix:
            score = score + abs(self.Params['TmMin'] -
                                self.Tm) * scoreMatrix['Tm']
        if 'HP' in scoreMatrix:
            score = score + self.HPScore * scoreMatrix['HP']
        if 'PD' in scoreMatrix:
            score = score + self.PDScore * scoreMatrix['PD']
        if 'GC' in scoreMatrix:
            score = score + self.GCScore * scoreMatrix['GC']
        if 'rep' in scoreMatrix:
            score = score + self.repScore * scoreMatrix['rep']
        if 'PCRGC' in scoreMatrix:
            gcpcr = MB.perGC(self.seq[-6:]) / 100 * 6
            gcpcr = int(gcpcr)
            gcpcrScore = 0
            if gcpcr == 0:
                gcpcrScore = 3
            if gcpcr == 1 or gcpcr == 6:
                gcpcrScore = 2
            if gcpcr == 2 or gcpcr == 5:
                gcpcrScore = 1
            score = score + gcpcrScore * scoreMatrix['PCRGC']
            ##print self.seq + 'gcpcr is ' + str(gcpcr) + ' score = ' + str(score)
#         if 'self-Anneal' in scoreMatrix:
#             val = self.ComputeSelfAnneal()
#             val = max(0, val -30000)
#             score = score + val*scoreMatrix['self-Anneal']
        if 'CyclePenalty' in scoreMatrix:
            cycleIndex = max(
                0, (self.SynthCycles - self.Params['MaxSynthCycles']))
            score = score + cycleIndex * scoreMatrix['CyclePenalty']
        self.score = score
        return score
Beispiel #3
0
 def PureSeqCompare(self, seqA, seqB):
     hit = MB.SW(seqA,
                 seqB,
                 match=1,
                 MM=-1,
                 gapOpen=-2,
                 gapExtend=-1,
                 Verbose=Verbose,
                 DEBUG=0)
     #You cannot allow gaps into this formula it does not support it yet.
     if Verbose:
         sA = hit[0]
         sB = hit[1]
         matchLst = []
         for i in range(len(sA)):
             if sA[i] == hit[1][i]:
                 matchLst.append('|')
             else:
                 matchLst.append('x')
         print('PureSeqComparison:\t%s\n%s\n%s\n%s\n' %
               (seqA, sA, ''.join(matchLst), sB))
     return hit
Beispiel #4
0
TM = ThermoVals()

if __name__ == '__main__':
    Verbose = 1

    s = 'GATCGTAGCTGATCGTAGCTAT'
    print('\n\n\nSequenceSimilarity start:' + s)
    r = TM.SWTm_SequenceSimilarity('GATCGTAGCTGATCGTAGCTAT',
                                   'GATCGTAGCTTCGTAGCTAT')
    print('r is :' + str(r) + '\n\n\n')
    t = TM.AreTheySimilar('GATCGTAGCTGATCGTAGCTAT',
                          'GATCGTAGGGTTCGTAGCTAT',
                          DNAConc=None,
                          dTm=10.0)
    print('AreTheySimilar: %s' % str(t))

    s = 'GATCGTAGCTGATCGTAGCTAT'
    print('\n\n\nWillItHyb start:' + s)
    r = TM.SWTm_WillItHyb('GATCGTAGCTGATCGTAGCTAT', 'ATAGCTACGA-CAGCTACGATC')
    print('r is :' + str(r) + '\n\n\n')
    t = TM.MMHybTm(s, Antisense(s), DNAConc=None)
    print('MMHybTm: %.2f' % t)

    seq = 'CGGGGCGGAAGgactgctccgctccgcgttgacatca'
    r = TM.SecStructTm(seq, windowSize=15)
    print(str(r))
    sTm = MB.HairpinTm(
        seq, MinAnneal=4)  #This version does not see gaps or mismatches
    print(str(sTm))
Beispiel #5
0
 def InitializeProbeObjectFromFAObj(self):
     if Verbose: print(' InitializeProbeObjectFromFAObj():')
     self.probeLst = [
         self.probeLst[0], self.probeLst[1], self.probeLst[2],
         MB.Tm(self.probeLst[1]), 0, 0, 'No_LabelRoot', 'No_OrigFASTALabel'
     ]
Beispiel #6
0
 def Antisense(self):
     self.label = self.label + '|as'
     self.seq = MB.Antisense(self.seq)
Beispiel #7
0
def CharacterizeProbe(probeSeq, filtparams={}):
    """CharacterizeProbe
    |(probeObj, FilterParams = None, returnLabel = None, Verbose = 1)
    |probe object needs to be of the form [label, seq, len, anything else, , , ]
    |
    |"""
    Limits = DefaultProbeFilterParameters
    Limits.update(
        filtparams)  ##this is if you have a special set of conditions

    #['ProbeGood','HP','PD','repeatNum','GC','HPstruct','PDstruct','failreason']
    MaxHPTm = float(Limits['MaxHPTm'])
    MaxPalindrome = float(Limits['MaxPalindrome'])
    MaxRepeats = int(Limits['MaxRepeats'])
    MaxGC = float(Limits['MaxGC'])
    MinGC = float(Limits['MinGC'])
    if 'MaxSynthCycles' in Limits:
        MaxSynthCycles = int(Limits['MaxSynthCycles'])
    else:
        MaxSynthCycles = 160

    failreason = 'good'
    ProbeGood = 1

    for base in probeSeq:
        if not (base in 'GATCgatc'):
            ProbeGood = 0
            failreason = 'badBase'
            break
    if failreason == 'badBase':
        return [0, 0, 0, 0, 0, 0, 0, 0, 0]

    probeSeqSSLst = MB.SecStruct(probeSeq, MinAnneal=4)
    HPLst = []
    PDLst = []
    for obj in probeSeqSSLst:
        if obj[2] > 0:
            HPLst.append(obj)
        else:
            PDLst.append(obj)
    PDobj = MB.StabSecStruct(PDLst, Pal=1, OutType=1)
    PD = PDobj[0]
    PDstruct = PDobj[1]
    HPobj = MB.StabSecStruct(HPLst, OutType=1)
    HP = HPobj[0]
    HPstruct = HPobj[1]

    if PD > MaxPalindrome:
        ProbeGood = 0
        failreason = 'PD > ' + str(MaxPalindrome)
    if HP > MaxHPTm:
        ProbeGood = 0
        failreason = 'HP > ' + str(MaxHPTm)
    GC = MB.perGC(probeSeq)
    if GC > MaxGC:
        ProbeGood = 0
        failreason = '%GC > ' + str(MaxGC)
    if GC < MinGC:
        ProbeGood = 0
        failreason = '%GC < ' + str(MinGC)
    repeatNum = MB.repeats(probeSeq)

    repeatType = int((repeatNum - math.floor(repeatNum)) * 10)
    if repeatNum > MaxRepeats:
        ProbeGood = 0
        failreason = 'repeats > ' + str(MaxRepeats) + '-' + str(repeatType)
    SynthCycles = CyclesToSynth(probeSeq)
    if SynthCycles > MaxSynthCycles:
        ProbeGood = 0
        failreason = 'SynthCycles %i>%i(max)' % (SynthCycles, MaxSynthCycles)

    probeObj = [
        SynthCycles, ProbeGood, HP, PD, repeatNum, GC, HPstruct, PDstruct,
        failreason
    ]
    #print str(probeObj)
    return probeObj