本文整理汇总了Python中Bio.Emboss.Primer3.parse方法的典型用法代码示例。如果您正苦于以下问题:Python Primer3.parse方法的具体用法?Python Primer3.parse怎么用?Python Primer3.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bio.Emboss.Primer3
的用法示例。
在下文中一共展示了Primer3.parse方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_mutli_record_fwd
# 需要导入模块: from Bio.Emboss import Primer3 [as 别名]
# 或者: from Bio.Emboss.Primer3 import parse [as 别名]
def test_mutli_record_fwd(self):
"""Test parsing multiple primer sets (NirK forward)"""
h = open(os.path.join("Emboss", "NirK.primer3"))
targets = list(Primer3.parse(h))
h.close()
self.assertEqual(len(targets), 16)
for target in targets:
self.assertEqual(len(target.primers), 5)
self.assertEqual(targets[0].primers[0].forward_seq, "GCAAACTGAAAAGCGGACTC")
self.assertEqual(targets[0].primers[1].forward_seq, "GGGACGTACTTTCGCACAAT")
self.assertEqual(targets[0].primers[2].forward_seq, "GTCTTATGCGTGGTGGAGGT")
self.assertEqual(targets[0].primers[3].forward_seq, "GTACATCAACATCCGCAACG")
self.assertEqual(targets[0].primers[4].forward_seq, "CGTACATCAACATCCGCAAC")
self.assertEqual(targets[1].primers[0].forward_seq, "GGAAGTGCTTCTCGTTTTCG")
self.assertEqual(targets[1].primers[1].forward_seq, "TACAGAGCGTCACGGATGAG")
self.assertEqual(targets[1].primers[2].forward_seq, "TTGTCATCGTGCTCTTCGTC")
self.assertEqual(targets[1].primers[3].forward_seq, "GACTCCAACCTCAGCTTTCG")
self.assertEqual(targets[1].primers[4].forward_seq, "GGCACGAAGAAGGACAGAAG")
self.assertEqual(targets[15].primers[0].forward_seq, "TGCTTGAAAATGACGCACTC")
self.assertEqual(targets[15].primers[1].forward_seq, "CTCGCTGGCTAGGTCATAGG")
self.assertEqual(targets[15].primers[2].forward_seq, "TATCGCACCAAACACGGTAA")
self.assertEqual(targets[15].primers[3].forward_seq, "CGATTACCCTCACCGTCACT")
self.assertEqual(targets[15].primers[4].forward_seq, "TATCGCAACCACTGAGCAAG")
示例2: primer
# 需要导入模块: from Bio.Emboss import Primer3 [as 别名]
# 或者: from Bio.Emboss.Primer3 import parse [as 别名]
def primer(self, direction='forward'):
tmp_file = '/tmp/' + self.gi + '-' + \
self.strand + str(self.start) + str(self.end)
primer3_input_file = tmp_file
primer3_output_file = tmp_file + '-output'
record = SeqRecord(Seq(self.sequence), id='', description='')
with open(primer3_input_file, 'w') as f:
SeqIO.write(record, f, 'fasta')
primercl = Primer3Commandline(sequence=primer3_input_file, auto=True,
hybridprobe=True)
primercl.osizeopt = 20
primercl.psizeopt = 200
primercl.outfile = primer3_output_file
stdout, stderr = primercl()
unpack = lambda r: [[p.forward_seq, p.reverse_seq] for p in r.primers]
with open(primer3_output_file, 'r') as f:
record = Primer3.parse(f).next()
all_primers = [[p.forward_seq, p.reverse_seq] for p in record.primers]
if direction == 'forward':
return all_primers[0][0]
elif direction == 'reverse':
return all_primers[0][1]
else:
return None
示例3: test_simple_parse
# 需要导入模块: from Bio.Emboss import Primer3 [as 别名]
# 或者: from Bio.Emboss.Primer3 import parse [as 别名]
def test_simple_parse(self):
"""Make sure that we can use all single target primer3 files."""
for file in self.test_files:
# First using read...
h = open(file, "r")
Primer3.read(h)
h.close()
# Now using parse...
h = open(file, "r")
self.assertEqual(1, len(list(Primer3.parse(h))))
h.close()
示例4: GetPrimersFromFasta
# 需要导入模块: from Bio.Emboss import Primer3 [as 别名]
# 或者: from Bio.Emboss.Primer3 import parse [as 别名]
def GetPrimersFromFasta(inputFile):
"""
Reads in the sequences and melting temperatures of an eprimer32 fasta file
Args:
inputFile: where to look for the file
Returns:
list of <PrimerPair> objects, which have the information we need
"""
primerList = []
with open(inputFile) as fileHandle:
record = Primer3.parse(fileHandle)
# XXX check is len>0
primers = record.next().primers
numPrimers = len(primers)
size=(numPrimers*2,1)
seqs= []
temps = []
for i,p in enumerate(primers):
primerList.append(PrimerPair(p.forward_seq,p.reverse_tm,
p.forward_seq,p.reverse_tm))
return primerList