本文整理汇总了Python中Bio.Emboss.Primer3.read方法的典型用法代码示例。如果您正苦于以下问题:Python Primer3.read方法的具体用法?Python Primer3.read怎么用?Python Primer3.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bio.Emboss.Primer3
的用法示例。
在下文中一共展示了Primer3.read方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_simple_parse
# 需要导入模块: from Bio.Emboss import Primer3 [as 别名]
# 或者: from Bio.Emboss.Primer3 import read [as 别名]
def test_simple_parse(self):
"""Make sure that we can parse all primer3 files.
"""
for file in self.test_files:
h = open(file, "r")
Primer3.read(h)
h.close()
示例2: test_simple_parse
# 需要导入模块: from Bio.Emboss import Primer3 [as 别名]
# 或者: from Bio.Emboss.Primer3 import read [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()
示例3: test_indepth_regular_parse
# 需要导入模块: from Bio.Emboss import Primer3 [as 别名]
# 或者: from Bio.Emboss.Primer3 import read [as 别名]
def test_indepth_regular_parse(self):
"""Make sure we get the data from normal primer3 files okay.
"""
regular_file = self.test_files[0]
h = open(regular_file, "r")
primer_info = Primer3.read(h)
h.close()
self.assertEqual(len(primer_info.primers), 5)
self.assertEqual(primer_info.comments,
"# PRIMER3 RESULTS FOR AC074298\n")
self.assertEqual(primer_info.primers[1].forward_seq,
"CCGGTTTCTCTGGTTGAAAA")
self.assertEqual(primer_info.primers[2].reverse_seq,
"TCACATTCCCAAATGTAGATCG")
self.assertEqual(primer_info.primers[0].size, 218)
self.assertEqual(len(primer_info.primers[0]), 218)
self.assertEqual(primer_info.primers[3].forward_start, 112)
self.assertEqual(primer_info.primers[3].forward_length, 20)
self.assertEqual(primer_info.primers[3].forward_tm, 59.57)
self.assertEqual(primer_info.primers[3].forward_gc, 45.00)
self.assertEqual(primer_info.primers[4].reverse_start, 304)
self.assertEqual(primer_info.primers[4].reverse_length, 22)
self.assertEqual(primer_info.primers[4].reverse_tm, 59.61)
self.assertEqual(primer_info.primers[4].reverse_gc, 40.91)
示例4: test_indepth_regular_parse
# 需要导入模块: from Bio.Emboss import Primer3 [as 别名]
# 或者: from Bio.Emboss.Primer3 import read [as 别名]
def test_indepth_regular_parse(self):
"""Make sure we get the data from normal primer3 files okay.
"""
regular_file = self.test_files[0]
h = open(regular_file, "r")
primer_info = Primer3.read(h)
h.close()
assert len(primer_info.primers) == 5, \
"Wrong number of primers: %s" % len(primer_info.primers)
assert primer_info.primers[1].forward_seq \
== "CCGGTTTCTCTGGTTGAAAA"
assert primer_info.primers[2].reverse_seq == \
"TCACATTCCCAAATGTAGATCG"
assert primer_info.primers[0].size == 218
assert primer_info.primers[3].forward_start == 112
assert primer_info.primers[3].forward_length == 20
assert primer_info.primers[3].forward_tm == 59.57
assert primer_info.primers[3].forward_gc == 45.00
assert primer_info.primers[4].reverse_start == 304
assert primer_info.primers[4].reverse_length == 22
assert primer_info.primers[4].reverse_tm == 59.61
assert primer_info.primers[4].reverse_gc == 40.91
示例5: parse_primer3
# 需要导入模块: from Bio.Emboss import Primer3 [as 别名]
# 或者: from Bio.Emboss.Primer3 import read [as 别名]
def parse_primer3(keys):
''' '''
flagged=[]
dic={}
regexp = re.compile('[RrYyKkMmSsWwNn]')
for key in keys:
filename='primer3_results/'+key+'_primer3.txt'
open_handle=open(filename,'r')
dic[key]=Primer3.read(open_handle)
open_handle.close()
if dic[key].primers==[]:
flagged.append(key)
del dic[key]
#Added: Also remove if there are polymorphic/divergent sites w/in primer:
else:
try:
if regexp.search(str(dic[key].primers[0].forward_seq)) is not None:
flagged.append(key)
del dic[key]
elif regexp.search(str(dic[key].primers[0].reverse_seq)) is not None:
flagged.append(key)
del dic[key]
except:
print dic[key].primers[0]
exit(1)
for x in flagged:
keys.remove(x)
return keys, dic
示例6: test_in_depth_single_parse
# 需要导入模块: from Bio.Emboss import Primer3 [as 别名]
# 或者: from Bio.Emboss.Primer3 import read [as 别名]
def test_in_depth_single_parse(self):
"""Make sure we get info right from a single primer find.
"""
file = self.test_files[1]
h = open(file, "r")
primer_info = Primer3.read(h)
h.close()
assert len(primer_info.primers) == 5
assert primer_info.primers[1].reverse_seq == ""
assert primer_info.primers[3].forward_seq == "TGTGATTGCTTGAGCTGGAC"
assert primer_info.primers[3].forward_start == 253
示例7: test_in_depth_single_parse
# 需要导入模块: from Bio.Emboss import Primer3 [as 别名]
# 或者: from Bio.Emboss.Primer3 import read [as 别名]
def test_in_depth_single_parse(self):
"""Make sure we get info right from a single primer find.
"""
file = self.test_files[1]
h = open(file, "r")
primer_info = Primer3.read(h)
h.close()
self.assertEqual(len(primer_info.primers), 5)
self.assertEqual(primer_info.comments,
"# PRIMER3 RESULTS FOR 26964-28647#\n")
self.assertEqual(primer_info.primers[1].reverse_seq, "")
self.assertEqual(primer_info.primers[3].forward_seq, "TGTGATTGCTTGAGCTGGAC")
self.assertEqual(primer_info.primers[3].forward_start, 253)
示例8: test_internal_oligo_single_parse
# 需要导入模块: from Bio.Emboss import Primer3 [as 别名]
# 或者: from Bio.Emboss.Primer3 import read [as 别名]
def test_internal_oligo_single_parse(self):
''' Make sure we can parse an internal oligo file correctly '''
# these files are generated when designing hybridization probes.
file = self.test_files[4]
h = open(file, "r")
primer_info = Primer3.read(h)
h.close()
assert len(primer_info.primers) == 5
assert primer_info.primers[0].internal_length == 22
assert primer_info.primers[1].internal_seq == 'TTGCGCTTTAGTTTGAATTGAA'
assert primer_info.primers[2].internal_tm == 58.62
assert primer_info.primers[3].internal_start == 16
assert primer_info.primers[4].internal_gc == 35.00
示例9: test_internal_oligo_single_parse
# 需要导入模块: from Bio.Emboss import Primer3 [as 别名]
# 或者: from Bio.Emboss.Primer3 import read [as 别名]
def test_internal_oligo_single_parse(self):
""" Make sure we can parse an internal oligo file correctly """
# these files are generated when designing hybridization probes.
file = self.test_files[4]
h = open(file, "r")
primer_info = Primer3.read(h)
h.close()
self.assertEqual(len(primer_info.primers), 5)
self.assertEqual(primer_info.comments, "# EPRIMER3 RESULTS FOR YNL138W-A\n")
self.assertEqual(primer_info.primers[0].internal_length, 22)
self.assertEqual(primer_info.primers[1].internal_seq, "TTGCGCTTTAGTTTGAATTGAA")
self.assertEqual(primer_info.primers[2].internal_tm, 58.62)
self.assertEqual(primer_info.primers[3].internal_start, 16)
self.assertEqual(primer_info.primers[4].internal_gc, 35.00)
示例10: parse_primer3
# 需要导入模块: from Bio.Emboss import Primer3 [as 别名]
# 或者: from Bio.Emboss.Primer3 import read [as 别名]
def parse_primer3(self):
self.p3 = P3.read(self.setup_primer3()).primers
示例11: open
# 需要导入模块: from Bio.Emboss import Primer3 [as 别名]
# 或者: from Bio.Emboss.Primer3 import read [as 别名]
#specify maximum different of tm
primer_cl.set_parameter("-maxdifftm",max_tm_diff )
#other useful parameters
primer_cl.set_parameter("-ogcpercent", opt_GC_percent)
primer_cl.set_parameter("-opolyxmax", maxpolyx)
primer_cl.set_parameter("-osize", optimum_length)
primer_cl.set_parameter("-otm", optimum_tm)
primer_cl.set_parameter("-gcclamp", gc_clamp)
#set product size range
primer_cl.set_parameter("-prange", productsizerange)
#using python subprocess method to run emboss command line programe with the parameters given
fnull = open(os.devnull, 'w')
result=subprocess.check_call(str(primer_cl),shell=True ,stdout = fnull, stderr = fnull)
#read temporary outputfile
handle = open(tempproutfile)
record = Primer3.read(handle)
if len(record.primers) > 0:
primer = record.primers[:5] # We want 5 primer results per target
for index, p in enumerate(primer):
# Start postition of feature i.e. where the SNP is, to know where to insert mt_base for mt_amplicon
startposition = [f for f in targetRec.features if f.id==target_ID][0].location.start.position
# The SNP wt/mu base
wtbase = [f for f in targetRec.features if f.id==target_ID][0].qualifiers.get('Reference_seq')
mubase = [f for f in targetRec.features if f.id==target_ID][0].qualifiers.get('Variant_seq')
wt_base = ''.join(c for c in wtbase if c not in '[]') # Removes the [''] from wtbase
mu_base = ''.join(c for c in mubase if c not in '[]') # Removes the [''] from mubase
# Wild-type amplicon
# NOTE: Due to the script's 1 and 0 indexing inconsistencies, the amplicon starts 1 bp later than the primer forward start, hence the "forward_start-1" required
# ADDENDUM: record.primers[0].reverse_start indicates the primer start FROM LEFT TO RIGHT (3' -> 5') hence reverse_start is actually the END position of the reverse primer if reading from 5' -> 3' and therefore not a good basis for determining exactly where to splice for amplicon, hence the following changes:
wt_amplicon = targetRec.seq[record.primers[index].forward_start-1:record.primers[index].forward_start-1+record.primers[index].size]