Ejemplo n.º 1
0
def output_primers(primers,names):
    datum = ('name','sequence','len','Tm',r'%GC','ss-dG','BLAT')
    header = "\n%-25s %-30s %-4s %-5s %-4s %-7s %-5s\n" % datum
    sys.stdout.write(header)
    
    lens = map(len,primers)
    Tms = map(oligoTm.oligo_Tm,primers)
    gcs = map(lambda p: seqtools.gc_content(p)*100,primers)
    dGs = map(lambda p: unafold.hybrid_ss_min(p,NA='DNA',sodium=0.05),primers)
    # trunc_primers = [p[-min(18,min(lens)):] for p in primers]
    trunc_primers = primers # NO TRUNCATION
    seqrecords = map(lambda t: seqtools.make_SeqRecord(*t),zip(names,trunc_primers))
    # blat_hits = map(blat.search_sequence,seqrecords)
    
    for datum in zip(names,primers,lens,Tms,gcs,dGs): #,blat_hits):
        primer_string = "%-25s %-30s %-4i %-5.1f %-4.0f %-7.1f\n" % datum
        sys.stdout.write(primer_string)
    
    summary_data = lambda d: (np.mean(d),np.std(d),np.min(d),np.max(d))
    
    sys.stdout.write('\nsummary:\n')
    sys.stdout.write('num primers: %i\n' % len(primers))
    sys.stdout.write('len    mean: %5.1f    std: %5.1f    min: %5.1f    max %5.1f\n' % summary_data(lens))
    sys.stdout.write('Tm     mean: %5.1f    std: %5.1f    min: %5.1f    max %5.1f\n' % summary_data(Tms))
    sys.stdout.write('%%GC    mean: %5.1f    std: %5.1f    min: %5.1f    max %5.1f\n' % summary_data(gcs))
    sys.stdout.write('dGs    mean: %5.1f    std: %5.1f    min: %5.1f    max %5.1f\n' % summary_data(dGs))
Ejemplo n.º 2
0
def choose_PCR_primer(seq,target_Tm=62.):
    candidates = generate_candidates(seq)
    
    # filter for Tm
    candidates = filter(lambda s: abs(oligoTm.oligoTm(s) - target_Tm) <= 2, candidates)
    if len(candidates) == 0:
        raise ValueError, "No primer candidates meet Tm cutoffs"
    
    # filter for 0.4-0.6 GC content
    candidates = filter(lambda s: abs(seqtools.gc_content(s) - 0.5) <= 0.1,candidates)
    if len(candidates) == 0:
        raise ValueError, "No primer candidates meet GC content cutoffs"
    
    # rank on secondary structure minimization
    candidates.sort(key=unafold.hybrid_ss_min)
    
    return candidates[0]
Ejemplo n.º 3
0
def choose_PCR_primer(seq, target_Tm=62.):
    candidates = generate_candidates(seq)

    # filter for Tm
    candidates = filter(lambda s: abs(oligoTm.oligoTm(s) - target_Tm) <= 2,
                        candidates)
    if len(candidates) == 0:
        raise ValueError, "No primer candidates meet Tm cutoffs"

    # filter for 0.4-0.6 GC content
    candidates = filter(lambda s: abs(seqtools.gc_content(s) - 0.5) <= 0.1,
                        candidates)
    if len(candidates) == 0:
        raise ValueError, "No primer candidates meet GC content cutoffs"

    # rank on secondary structure minimization
    candidates.sort(key=unafold.hybrid_ss_min)

    return candidates[0]