コード例 #1
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
コード例 #2
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