4 Oct 2004 03:44
[BioPython] running primer3 with multiple sequences
Maqbool, Nauman <nauman.maqbool <at> agresearch.co.nz>
2004-10-04 01:44:33 GMT
2004-10-04 01:44:33 GMT
Hi
I am trying to run eprimer3 using biopython and am not sure how to input
multiple options. E.g. if I am reading in a fasta file with hundreds of
sequences with different primer design parameters for each sequence, do
I have to hard code the parameters individually for each sequence?
In the example below:
from Bio.Emboss.Applications import Primer3Commandline
from Bio.Emboss.Primer import Primer3Parser
from Bio.Application import generic_run
def get_primers(fasta_record, start, end):
open("in.pr3", "w").write(str(fasta_record) + "\n")
primer_cl = Primer3Commandline()
primer_cl.set_parameter("-sequence", "in.pr3")
primer_cl.set_parameter("-outfile", "out.pr3")
primer_cl.set_parameter("-productsizerange", "350,500")
primer_cl.set_parameter("-target", "%s,%s" % (start, end))
result, r, e = generic_run(primer_cl)
parser = Primer3Parser()
return parser.parse(open("out.pr3"))
def main(fasta_file, output_file):
output_handle = open(output_file, "w")
output_handle.write("name,forward_primer,reverse_primer\n")
parser = Fasta.RecordParser()
iterator = Fasta.Iterator(open(fasta_file), parser)
while 1:
(Continue reading)
RSS Feed