Beispiel #1
0
# file header
#print "Label\tForward Primer\tFP Bind\tFP Hang\tFP Tmelting\tFP Int Stab 3\tFP Int Stab 5\tFP GC content\tFP GC Diff\tReverse Primer\tRP Bind\tRP Hang\tRP Tmelting\tRP Int Stab 3\tRP Int Stab 5\tRP GC content\tTemplate\tPCR Product\tProduct Tmelting\tProduct GC\tProduct TaOpt\tProduct AUCGC\tProduct Ratio GC\tProduct NormAUCGC\tProduct AUCTM\tProduct Ratio TM\tProduct NormAUCTM\tPrimer Dimer\tPrimer Tmelting diff\tPrimer GC Diff"
Header = ["Label",
"Forward Primer", "FP Bind", "FP Hang", "FP Tmelting", "FP Int Stab 3", "FP Int Stab 5", "FP GC content", "FP GC Diff",
"Reverse Primer", "RP Bind", "RP Hang", "RP Tmelting", "RP Int Stab 3", "RP Int Stab 5", "RP GC content", "RP GC Diff",
"Template", "PCR Product", "Product Tmelting", "Product GC", "Product TaOpt", "Product AUCGC", "Product Ratio GC", "Product NormAUCGC", "Product AUCTM", "Product Ratio TM", "Product NormAUCTM",
"Primer Dimer", "Primer Tmelting diff"]

print MakeString(Header)

for mybuffer in file.xreadlines():
	Label, FP, RP, Template = mybuffer.split()

	X = VirtualPCR.PcrMachine(FP, RP, Template)
	# make an instance of PCR_Product
	P = VirtualPCR.PCR_Product(X.MakePCR())
	P.CalcTaOpt(X.FP.Tm, X.RP.Tm)
	P.AUCGC()
	P.AUCTM()
	Dimer =	VirtualPCR.primerDimer(X.FP.Seq, X.RP.Seq)
	Dimer.sort(lambda x,y: cmp(-x.Stability, -y.Stability))
	
	if len(Dimer)>=1:
		PrimerDimer = Dimer[0].Stability
	else:
		PrimerDimer = 0.0

	Data = [Label,
			FP, X.FP.Bind, X.FP.Hang, X.FP.Tm, X.FP.IntStab3, X.FP.IntStab5, X.FP.GC,X.FP.GC/P.GC,
			RP, X.RP.Bind, X.RP.Hang, X.RP.Tm, X.RP.IntStab3, X.RP.IntStab5, X.RP.GC,X.RP.GC/P.GC,
			Template, P.sequence, P.Tm, P.GC, P.TaOpt, P.AUCGC, P.RatioGC, P.NormAUCGC, P.AUCTM, P.RatioTM, P.NormAUCTM,
Beispiel #2
0
def runCheckPCR(input_filename, Outflank=0):
    '''
	Runs the program to check in-silico PCR stats for an input file modeled after cip_test; 
	Outflank parameter specifies an area upstream and downstream from gene's coding region that will also be downloaded. 
	The purpose of this feature is if you want primers that bind to non-coding regions to flank the entire gene 
	NOTE: outflank is different from the target_region, which is the mutation of interest	
	Program does not design primers, it just compiles their detailed chracteristics to assist in picking. 
	For primer design, run the PickPCR module, which will return a file that looks like cip_test_pr3
	'''
    #input_filename = cip_test_lit
    IntermInputCompile(input_filename, Outflank)
    interm_input_filename = '_Interm_Output' + input_filename + '.txt'
    infile = open(interm_input_filename, "rU")
    Header = [
        "Label", "Forward Primer", "FP Bind", "FP Hang", "FP Tmelting",
        "FP Int Stab 3", "FP Int Stab 5", "FP GC content", "FP GC Diff",
        "Reverse Primer", "RP Bind", "RP Hang", "RP Tmelting", "RP Int Stab 3",
        "RP Int Stab 5", "RP GC content", "RP GC Diff", "Template",
        "Template filename", "PCR Product", "Product length",
        "Product lcoation", "Product Tmelting", "Product GC", "Product TaOpt",
        "Product AUCGC", "Product Ratio GC", "Product NormAUCGC",
        "Product AUCTM", "Product Ratio TM", "Product NormAUCTM",
        "Primer Dimer Max Stability", "Primer Dimers", "Primer Tmelting diff",
        "Template AA sequence", "Product AA sequence"
    ]
    outfile = open('_PCR_result_' + input_filename + '.txt', 'w')
    outfile.write(MakeString(Header) + '\n')
    for line in infile:
        Label, Template, AASequence, FP, RP, PosSense, PosAnitsense, TemplFile = line.split(
            '\t')
        X = VirtualPCR.PcrMachine(FP, RP, Template.upper())
        # make an instance of PCR_Product
        P = VirtualPCR.PCR_Product(X.MakePCR())
        if P.sequence == 'No Product':
            Data = [Label, FP, RP, '-> **** FAIL. No Product. Nice try.****']
        else:
            P.CalcTaOpt(X.FP.Tm, X.RP.Tm)
            P.AUCGC()
            P.AUCTM()
            Dimer = VirtualPCR.primerDimer(X.FP.Seq, X.RP.Seq)
            Dimer.sort(lambda x, y: cmp(-x.Stability, -y.Stability))
            if len(Dimer) >= 1:
                PrimerDimerStab = Dimer[0].Stability
                PrimerDimerSeq = Dimer[0].MatchString.replace('\n', '')
            else:
                PrimerDimer = 0.0
                PrimerDimerSeq = 'No dimers'
            #the sequence and positon of amplified region
            product_lookup = re.search(P.sequence, Template.upper(), flags=0)
            if product_lookup == None:
                P_location = "Not found"
                AAproduct = "Not found"
            else:
                P_location = str(product_lookup.span())
                AAproduct = AASequence[int(product_lookup.span()[0] / 3) -
                                       5:int(product_lookup.span()[1] / 3) + 5]
            Data = [
                Label, FP, X.FP.Bind, X.FP.Hang, X.FP.Tm, X.FP.IntStab3,
                X.FP.IntStab5, X.FP.GC, X.FP.GC / P.GC, RP, X.RP.Bind,
                X.RP.Hang, X.RP.Tm, X.RP.IntStab3, X.RP.IntStab5, X.RP.GC,
                X.RP.GC / P.GC, Template,
                TemplFile.strip('\n'), P.sequence,
                len(P.sequence), P_location, P.Tm, P.GC, P.TaOpt, P.AUCGC,
                P.RatioGC, P.NormAUCGC, P.AUCTM, P.RatioTM, P.NormAUCTM,
                PrimerDimerStab, PrimerDimerSeq,
                abs(X.FP.Tm - X.RP.Tm), AASequence, AAproduct
            ]
        outfile.write(MakeString(Data) + '\n')
    outfile.close()
    infile.close()