• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python testutil.datafile函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中testlib.testutil.datafile函数的典型用法代码示例。如果您正苦于以下问题:Python datafile函数的具体用法?Python datafile怎么用?Python datafile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了datafile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_multiblast_parser_long

    def test_multiblast_parser_long(self):
        "Testing multiblast parser with long input"
        longerFile = testutil.datafile("sp_all_hbb")
        sp_all_hbb = seqdb.SequenceFileDB(longerFile)

        filename = testutil.datafile("multiblast_long_output.txt")
        multiblast_output = open(filename, "r")
        try:
            al = cnestedlist.NLMSA("blasthits", "memory", pairwiseMode=True, bidirectional=False)
            al = blast.read_blast_alignment(multiblast_output, sp_all_hbb, self.prot, al)
        finally:
            multiblast_output.close()
        al.build()

        results = []
        for seq in sp_all_hbb.values():
            try:
                results.append(al[seq])
            except KeyError:
                pass
        correctfile = file(testutil.datafile("multiblast_long_correct.txt"), "r")
        try:
            correct = []
            for line in correctfile:
                t = line.split()
                correct.append((t[0], t[1], float(t[2])))
        finally:
            correctfile.close()
        check_results(results, correct, pair_identity_tuple)
开发者ID:Open-Technology,项目名称:Graph-Database,代码行数:29,代码来源:blast_test.py


示例2: trash_intermediate_files

 def trash_intermediate_files(self):
     seqlen = testutil.datafile('dnaseq.fasta.seqlen')
     pureseq = testutil.datafile('dnaseq.fasta.pureseq')
     try:
         os.unlink(seqlen)
         os.unlink(pureseq)
     except OSError:
         pass
开发者ID:Open-Technology,项目名称:Graph-Database,代码行数:8,代码来源:seqdb_test.py


示例3: setUp

    def setUp(self):
        if not testutil.blast_enabled():
            raise SkipTest, "no BLAST installed"
        
        hbb1_mouse = testutil.datafile('hbb1_mouse.fa')
        sp_hbb1 = testutil.datafile('sp_hbb1')

        self.dna = seqdb.SequenceFileDB(hbb1_mouse)
        self.prot = seqdb.SequenceFileDB(sp_hbb1)
开发者ID:opierce,项目名称:pygr,代码行数:9,代码来源:blast_test.py


示例4: setUp

    def setUp(self):
        hbb1_mouse = testutil.datafile("hbb1_mouse.fa")
        hbb1_mouse_rc = testutil.datafile("hbb1_mouse_rc.fa")
        sp_hbb1 = testutil.datafile("sp_hbb1")
        gapping = testutil.datafile("gapping.fa")

        self.dna = seqdb.SequenceFileDB(hbb1_mouse)
        self.dna_rc = seqdb.SequenceFileDB(hbb1_mouse_rc)
        self.prot = seqdb.SequenceFileDB(sp_hbb1)
        self.gapping = seqdb.SequenceFileDB(gapping)
开发者ID:Open-Technology,项目名称:Graph-Database,代码行数:10,代码来源:blast_test.py


示例5: test_do_gunzip

 def test_do_gunzip(self):
     "test do_gunzip"
     zipfile = testutil.datafile("test.gz")
     outfile = testutil.tempdatafile("test4.out")
     do_gunzip(zipfile, outfile)
     h = testutil.get_file_md5(outfile)
     self.assertEqual(h.hexdigest(), "1db5a21a01ba465fd26c3203d6589b0e")
开发者ID:antonwang,项目名称:pygr,代码行数:7,代码来源:metabase_test.py


示例6: setUp

    def setUp(self,**kwargs):
        TestBase.setUp(self)
        dnaseq = testutil.datafile('dnaseq.fasta')
        tryannot = testutil.tempdatafile('tryannot')

        db = seqdb.BlastDB(dnaseq)
        try:
            db.__doc__ = 'little dna'

            worldbase.Bio.Test.dna = db
            annoDB = seqdb.AnnotationDB({1:('seq1',5,10,'fred'),
                                         2:('seq1',-60,-50,'bob'),
                                         3:('seq2',-20,-10,'mary')},
                                        db,
                                  sliceAttrDict=dict(id=0, start=1, stop=2,
                                                     name=3))
            annoDB.__doc__ = 'trivial annotation'
            worldbase.Bio.Test.annoDB = annoDB
            nlmsa = cnestedlist.NLMSA(tryannot,'w',pairwiseMode=True,
                                      bidirectional=False)
            try:
                for annID in annoDB:
                    nlmsa.addAnnotation(annoDB[annID])

                nlmsa.build(verbose=False)
                nlmsa.__doc__ = 'trivial map'
                worldbase.Bio.Test.map = nlmsa
                worldbaseSchema.Bio.Test.map = metabase.ManyToManyRelation(db,
                                                       annoDB,bindAttrs=('exons',))
                worldbase.commit()
                worldbase.clear_cache()
            finally:
                nlmsa.close()
        finally:
            db.close()
开发者ID:eloseden,项目名称:pygr,代码行数:35,代码来源:worldbase_test.py


示例7: test_schema

    def test_schema(self):
        "Test schema"
        sp_hbb1 = testutil.datafile("sp_hbb1")
        sp2 = seqdb.BlastDB(sp_hbb1)
        sp2.__doc__ = "another sp"
        self.pygrData.Bio.Seq.sp2 = sp2
        sp = self.pygrData.Bio.Seq.Swissprot.sp42()
        m = mapping.Mapping(sourceDB=sp, targetDB=sp2)
        m.__doc__ = "sp -> sp2"
        self.pygrData.Bio.Seq.testmap = m
        self.schema.Bio.Seq.testmap = metabase.OneToManyRelation(sp, sp2)
        self.metabase.commit()

        self.metabase.clear_cache()

        sp3 = seqdb.BlastDB(sp_hbb1)
        sp3.__doc__ = "sp number 3"
        self.pygrData.Bio.Seq.sp3 = sp3
        sp2 = self.pygrData.Bio.Seq.sp2()
        m = mapping.Mapping(sourceDB=sp3, targetDB=sp2)
        m.__doc__ = "sp3 -> sp2"
        self.pygrData.Bio.Seq.testmap2 = m
        self.schema.Bio.Seq.testmap2 = metabase.OneToManyRelation(sp3, sp2)
        l = self.metabase.resourceCache.keys()
        l.sort()
        assert l == ["Bio.Seq.sp2", "Bio.Seq.sp3", "Bio.Seq.testmap2"]
        self.metabase.commit()
        g = self.metabase.writer.storage.graph
        expected = set(["Bio.Annotation.annoDB", "Bio.Seq.Swissprot.sp42", "Bio.Seq.sp2", "Bio.Seq.sp3"])
        found = set(g.keys())
        self.EQ(len(expected - found), 0)
开发者ID:antonwang,项目名称:pygr,代码行数:31,代码来源:metabase_test.py


示例8: test_basic_iadd

    def test_basic_iadd(self):
        dnaseq = testutil.datafile('dnaseq.fasta')
        seqdb = SequenceFileDB(dnaseq)
        try:
            new_seq = seqdb['seq1']

            self.db += new_seq

            assert new_seq in self.db
            name = (~self.db)[new_seq]
            assert name == 'dnaseq.seq1', name

            ###

            seqdb2 = SequenceFileDB(dnaseq)
            try:
                # Munge the filepath for testing.
                seqdb2.filepath = 'foo'
                new_seq2 = seqdb2['seq1']

                self.db += new_seq2
                name2 = (~self.db)[new_seq2]
                assert name2 == 'foo.seq1', name2
            finally:
                seqdb2.close()
        finally:
            seqdb.close()
开发者ID:Open-Technology,项目名称:Graph-Database,代码行数:27,代码来源:seqdb_test.py


示例9: test_schema

    def test_schema(self):
        "Test schema"
        sp_hbb1 = testutil.datafile('sp_hbb1')
        sp2 = seqdb.BlastDB(sp_hbb1)
        sp2.__doc__ = 'another sp'
        pygr.Data.Bio.Seq.sp2 = sp2
        sp = pygr.Data.Bio.Seq.Swissprot.sp42()
        m = mapping.Mapping(sourceDB=sp, targetDB=sp2)
        m.__doc__ = 'sp -> sp2'
        pygr.Data.Bio.Seq.testmap = m
        pygr.Data.schema.Bio.Seq.testmap = pygr.Data.OneToManyRelation(sp, sp2)
        pygr.Data.save()

        pygr.Data.clear_cache()

        sp3 = seqdb.BlastDB(sp_hbb1)
        sp3.__doc__ = 'sp number 3'
        pygr.Data.Bio.Seq.sp3 = sp3
        sp2 = pygr.Data.Bio.Seq.sp2()
        m = mapping.Mapping(sourceDB=sp3, targetDB=sp2)
        m.__doc__ = 'sp3 -> sp2'
        pygr.Data.Bio.Seq.testmap2 = m
        pygr.Data.schema.Bio.Seq.testmap2 = pygr.Data.OneToManyRelation(sp3,
                                                                        sp2)
        # List all cached resources.
        l = pygr.Data.getResource.resourceCache.keys()
        l.sort()
        assert l == ['Bio.Seq.sp2', 'Bio.Seq.sp3', 'Bio.Seq.testmap2']
        pygr.Data.save()
        g = pygr.Data.getResource.writer.storage.graph
        expected = set(['Bio.Annotation.annoDB',
                     'Bio.Seq.Swissprot.sp42', 'Bio.Seq.sp2', 'Bio.Seq.sp3'])
        found = set(g.keys())
        self.EQ(len(expected - found), 0)
开发者ID:Open-Technology,项目名称:Graph-Database,代码行数:34,代码来源:pygrdata_test.py


示例10: test_do_unzip

 def test_do_unzip(self):
     'test do_unzip'
     zipfile = testutil.datafile('test.zip')
     outfile = testutil.tempdatafile('test2.out')
     do_unzip(zipfile, outfile, singleFile=True)
     h = testutil.get_file_md5(outfile)
     self.assertEqual(h.hexdigest(), '12ada4c51ccb4c7277c16f1a3c000b90')
开发者ID:Open-Technology,项目名称:Graph-Database,代码行数:7,代码来源:metabase_test.py


示例11: test_run_gunzip

 def test_run_gunzip(self):
     'test uncompress_file gunzip'
     zipfile = testutil.datafile('test.gz')
     outfile = testutil.tempdatafile('test3.out')
     uncompress_file(zipfile, newpath=outfile)
     h = testutil.get_file_md5(outfile)
     self.assertEqual(h.hexdigest(), '1db5a21a01ba465fd26c3203d6589b0e')
开发者ID:Open-Technology,项目名称:Graph-Database,代码行数:7,代码来源:metabase_test.py


示例12: test_run_unzip

 def test_run_unzip(self):
     'test uncompress_file unzip'
     zipfile = testutil.datafile('test.zip')
     outfile = testutil.tempdatafile('test.out')
     uncompress_file(zipfile, newpath=outfile, singleFile=True)
     h = testutil.get_file_md5(outfile)
     self.assertEqual(h.hexdigest(), '12ada4c51ccb4c7277c16f1a3c000b90')
开发者ID:Open-Technology,项目名称:Graph-Database,代码行数:7,代码来源:metabase_test.py


示例13: test_schema

    def test_schema(self):
        "Test schema"
        sp_hbb1 = testutil.datafile('sp_hbb1') 
        sp2 = seqdb.BlastDB(sp_hbb1)
        sp2.__doc__ = 'another sp'
        worldbase.Bio.Seq.sp2 = sp2
        sp = worldbase.Bio.Seq.Swissprot.sp42()
        m = mapping.Mapping(sourceDB=sp,targetDB=sp2)
        m.__doc__ = 'sp -> sp2'
        worldbase.Bio.Seq.testmap = m
        worldbaseSchema.Bio.Seq.testmap = metabase.OneToManyRelation(sp, sp2)
        worldbase.commit()

        worldbase.clear_cache()

        sp3 = seqdb.BlastDB(sp_hbb1)
        sp3.__doc__ = 'sp number 3'
        worldbase.Bio.Seq.sp3 = sp3
        sp2 = worldbase.Bio.Seq.sp2()
        m = mapping.Mapping(sourceDB=sp3,targetDB=sp2)
        m.__doc__ = 'sp3 -> sp2'
        worldbase.Bio.Seq.testmap2 = m
        worldbaseSchema.Bio.Seq.testmap2 = metabase.OneToManyRelation(sp3, sp2)
        l = worldbase._mdb.resourceCache.keys()
        l.sort()
        assert l == ['Bio.Seq.sp2', 'Bio.Seq.sp3', 'Bio.Seq.testmap2']
        worldbase.commit()
        g = worldbase._mdb.writer.storage.graph
        expected = set(['Bio.Annotation.annoDB',
                     'Bio.Seq.Swissprot.sp42', 'Bio.Seq.sp2', 'Bio.Seq.sp3'])
        found = set(g.keys()) 
        self.EQ(len(expected - found), 0) 
开发者ID:eloseden,项目名称:pygr,代码行数:32,代码来源:worldbase_test.py


示例14: test_blastx_parser

    def test_blastx_parser(self):
        "Testing blastx parser"
        blastx_output = open(testutil.datafile("blastx_output.txt"), "r")
        seq_dict = {"gi|171854975|dbj|AB364477.1|": self.dna["gi|171854975|dbj|AB364477.1|"]}
        try:
            results = blast.read_blast_alignment(
                blastx_output, seq_dict, blast.BlastIDIndex(self.prot), translateSrc=True
            )
        finally:
            blastx_output.close()
        correct = [
            (143, 143, 429, 0.53146853146853146),
            (143, 145, 429, 0.28275862068965518),
            (143, 145, 429, 0.28965517241379313),
            (143, 145, 429, 0.29655172413793102),
            (143, 145, 429, 0.30344827586206896),
            (144, 144, 432, 0.4513888888888889),
            (144, 144, 432, 0.4513888888888889),
            (145, 145, 435, 0.45517241379310347),
            (145, 145, 435, 0.51034482758620692),
            (146, 142, 438, 0.35616438356164382),
            (146, 146, 438, 0.4589041095890411),
            (146, 146, 438, 0.46575342465753422),
            (146, 146, 438, 0.4726027397260274),
            (146, 146, 438, 0.4726027397260274),
            (146, 146, 438, 0.4863013698630137),
            (146, 146, 438, 0.59589041095890416),
            (146, 146, 438, 0.62328767123287676),
            (146, 146, 438, 0.66438356164383561),
            (146, 146, 438, 0.74657534246575341),
            (146, 146, 438, 0.91095890410958902),
            (146, 146, 438, 0.97945205479452058),
        ]

        check_results([results], correct, lambda t: (len(t[0]), len(t[1]), len(t[0].sequence), t[2].pIdentity()))
开发者ID:Open-Technology,项目名称:Graph-Database,代码行数:35,代码来源:blast_test.py


示例15: setUp

    def setUp(self, **kwargs):
        TestBase.setUp(self)
        dnaseq = testutil.datafile("dnaseq.fasta")
        tryannot = testutil.tempdatafile("tryannot")

        db = seqdb.BlastDB(dnaseq)
        try:
            db.__doc__ = "little dna"

            self.pygrData.Bio.Test.dna = db
            annoDB = seqdb.AnnotationDB(
                {1: ("seq1", 5, 10, "fred"), 2: ("seq1", -60, -50, "bob"), 3: ("seq2", -20, -10, "mary")},
                db,
                sliceAttrDict=dict(id=0, start=1, stop=2, name=3),
            )
            annoDB.__doc__ = "trivial annotation"
            self.pygrData.Bio.Test.annoDB = annoDB
            nlmsa = cnestedlist.NLMSA(tryannot, "w", pairwiseMode=True, bidirectional=False)
            try:
                for annID in annoDB:
                    nlmsa.addAnnotation(annoDB[annID])

                nlmsa.build()
                nlmsa.__doc__ = "trivial map"
                self.pygrData.Bio.Test.map = nlmsa
                self.schema.Bio.Test.map = metabase.ManyToManyRelation(db, annoDB, bindAttrs=("exons",))
                self.metabase.commit()
                self.metabase.clear_cache()
            finally:
                nlmsa.close()
        finally:
            db.close()
开发者ID:antonwang,项目名称:pygr,代码行数:32,代码来源:metabase_test.py


示例16: test_headerfile_create_with_trypath

 def test_headerfile_create_with_trypath(self):
     header = testutil.datafile('prefixUnionDict-1.txt')
     db = PrefixUnionDict(filename=header,
                          trypath=[os.path.dirname(header)])
     try:
         assert len(db) == 2, db.prefixDict
     finally:
         close_pud_dicts(db)
开发者ID:Open-Technology,项目名称:Graph-Database,代码行数:8,代码来源:seqdb_test.py


示例17: test_headerfile_create

 def test_headerfile_create(self):
     header = testutil.datafile('prefixUnionDict-1.txt')
     db = PrefixUnionDict(filename=header)
     try:
         assert len(db) == 2
         assert 'a.seq1' in db
     finally:
         close_pud_dicts(db)
开发者ID:Open-Technology,项目名称:Graph-Database,代码行数:8,代码来源:seqdb_test.py


示例18: test_funny_key2

 def test_funny_key2(self):
     "check handling of ID containing multiple separators"
     dnaseq = testutil.datafile('funnyseq.fasta')
     seqdb = SequenceFileDB(dnaseq)     # contains 'seq1', 'seq2'
     try:
         pudb = PrefixUnionDict({'prefix': seqdb})
         seq = pudb['prefix.seq.2.even.longer']
     finally:
         seqdb.close()
开发者ID:Open-Technology,项目名称:Graph-Database,代码行数:9,代码来源:seqdb_test.py


示例19: test_inverse_add_behavior

    def test_inverse_add_behavior(self):
        dnaseq = testutil.datafile('dnaseq.fasta')
        seqdb = SequenceFileDB(dnaseq)
        try:
            seq = seqdb['seq1']

            name = (~self.db)[seq]
        finally:
            seqdb.close() # only need to close if exception occurs
开发者ID:Open-Technology,项目名称:Graph-Database,代码行数:9,代码来源:seqdb_test.py


示例20: test_multiblast_long

    def test_multiblast_long(self):
        "testing multi sequence blast with long db to assess thread safety, see issue 79"
        longerFile = testutil.datafile('sp_all_hbb')

        sp_all_hbb = seqdb.SequenceFileDB(longerFile)
        blastmap = blast.BlastMapping(self.prot, verbose=False)
        al = cnestedlist.NLMSA('blasthits', 'memory', pairwiseMode=True,
                               bidirectional=False)
        blastmap(None, al, queryDB=sp_all_hbb) # all vs all
        al.build() # construct the alignment indexes
开发者ID:deepreds,项目名称:pygr,代码行数:10,代码来源:blast_test.py



注:本文中的testlib.testutil.datafile函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python testlink.TestLinkHelper类代码示例发布时间:2022-05-27
下一篇:
Python testing.eq_函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap