當前位置: 首頁>>代碼示例>>Python>>正文


Python Primer3.parse方法代碼示例

本文整理匯總了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")
開發者ID:anntzer,項目名稱:biopython,代碼行數:29,代碼來源:test_EmbossPrimer.py

示例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
開發者ID:davejacobs,項目名稱:dna,代碼行數:37,代碼來源:sequence.py

示例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()
開發者ID:HuttonICS,項目名稱:biopython,代碼行數:13,代碼來源:test_EmbossPrimer.py

示例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
開發者ID:prheenan,項目名稱:Research,代碼行數:24,代碼來源:EmbossUtil.py


注:本文中的Bio.Emboss.Primer3.parse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。