当前位置: 首页>>代码示例>>Python>>正文


Python Faidx.fetch方法代码示例

本文整理汇总了Python中pyfaidx.Faidx.fetch方法的典型用法代码示例。如果您正苦于以下问题:Python Faidx.fetch方法的具体用法?Python Faidx.fetch怎么用?Python Faidx.fetch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyfaidx.Faidx的用法示例。


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

示例1: test_fetch_border

# 需要导入模块: from pyfaidx import Faidx [as 别名]
# 或者: from pyfaidx.Faidx import fetch [as 别名]
 def test_fetch_border(self):
     """ Fetch past the end of a gene entry """
     faidx = Faidx('data/genes.fasta')
     expect = 'TC'
     result = faidx.fetch('gi|557361099|gb|KF435150.1|',
                          480, 500)
     assert str(result) == expect
开发者ID:mdshw5,项目名称:pyfaidx,代码行数:9,代码来源:test_feature_bounds_check.py

示例2: __init__

# 需要导入模块: from pyfaidx import Faidx [as 别名]
# 或者: from pyfaidx.Faidx import fetch [as 别名]
class TestFeatureKeyFunction:
    def __init__(self):
        self.fasta = os.path.join(path, 'data/genes.fasta')
        self.faidx = Faidx(self.fasta, key_function=get_gene_name)
        self.genes = Fasta(self.fasta, key_function=get_gene_name)

    def test_keys(self):
        expect = ['BARD1', 'FGFR2', 'KF435149.1', 'MDM4', 'NM_000465.3', 'NM_001282543.1', 'NM_001282545.1', 'NM_001282548.1', 'NM_001282549.1', 'NR_104212.1', 'NR_104215.1', 'XM_005249642.1', 'XM_005249643.1', 'XM_005249644.1', 'XM_005249645.1', 'XM_005265507.1', 'XM_005265508.1', 'XR_241079.1', 'XR_241080.1', 'XR_241081.1']
        result = sorted(self.genes.keys())
        assert result == expect

    def test_key_function_by_dictionary_get_key(self):
        expect = 'TTGAAGATTTTGCATGCAGCAGGTGCGCAAGGTGAAATGTTCACTGTTAAA'
        result = self.genes['MDM4'][100-1:150]
        assert str(result) == expect

    def test_key_function_by_fetch(self):
        expect = 'TTGAAGATTTTGCATGCAGCAGGTGCGCAAGGTGAAATGTTCACTGTTAAA'
        result = self.faidx.fetch('MDM4',
                             100, 150)
        assert str(result) == expect

    @raises(ValueError)
    def test_duplicated_keys(self):
        genes = Fasta(self.fasta, key_function=get_duplicated_gene_name)
开发者ID:jsilter,项目名称:pyfaidx,代码行数:27,代码来源:test_feature_key_function.py

示例3: test_fetch_border_padded

# 需要导入模块: from pyfaidx import Faidx [as 别名]
# 或者: from pyfaidx.Faidx import fetch [as 别名]
 def test_fetch_border_padded(self):
     """ Fetch past the end of a gene entry """
     faidx = Faidx('data/genes.fasta.gz', default_seq='N')
     expect = 'TCNNNNNNNNNNNNNNNNNNN'
     result = faidx.fetch('gi|557361099|gb|KF435150.1|',
                          480, 500)
     print(result)
     assert str(result) == expect
开发者ID:mdshw5,项目名称:pyfaidx,代码行数:10,代码来源:test_Fasta_bgzip.py

示例4: __init__

# 需要导入模块: from pyfaidx import Faidx [as 别名]
# 或者: from pyfaidx.Faidx import fetch [as 别名]
class TestFeatureBoundsCheck:
    def __init__(self):
        self.fasta = os.path.join(path, 'data/genes.fasta')
        self.faidx = Faidx(self.fasta, default_seq='N')

    def test_fetch_border_padded(self):
        """ Fetch past the end of a gene entry """
        expect = 'TCNNNNNNNNNNNNNNNNNNN'
        result = self.faidx.fetch('KF435150.1',
                             480, 500)
        assert str(result) == expect
开发者ID:jsilter,项目名称:pyfaidx,代码行数:13,代码来源:test_feature_default_seq.py

示例5: test_fetch_whole_entry

# 需要导入模块: from pyfaidx import Faidx [as 别名]
# 或者: from pyfaidx.Faidx import fetch [as 别名]
 def test_fetch_whole_entry(self):
     faidx = Faidx('data/genes.fasta.gz')
     expect = ('ATGACATCATTTTCCACCTCTGCTCAGTGTTCAACATCTGA'
             'CAGTGCTTGCAGGATCTCTCCTGGACAAATCAATCAGGTACGACCA'
             'AAACTGCCGCTTTTGAAGATTTTGCATGCAGCAGGTGCGCAAGG'
             'TGAAATGTTCACTGTTAAAGAGGTCATGCACTATTTAGGTCAGTACAT'
             'AATGGTGAAGCAACTTTATGATCAGCAGGAGCAGCATATGGTATATTG'
             'TGGTGGAGATCTTTTGGGAGAACTACTGGGACGTCAGAGCTTCTCCGTG'
             'AAAGACCCAAGCCCTCTCTATGATATGCTAAGAAAGAATCTTGTCACTTT'
             'AGCCACTGCTACTACAGCAAAGTGCAGAGGAAAGTTCCACTTCCAGAAAAA'
             'GAACTACAGAAGACGATATCCCCACACTGCCTACCTCAGAGCATAAATGCA'
             'TACATTCTAGAGAAGGTGATTGAAGTGGGAAAAAATGATGACCTGGAGGACTC')
     result = faidx.fetch('gi|557361099|gb|KF435150.1|',
                          1, 481)
     assert str(result) == expect
开发者ID:mdshw5,项目名称:pyfaidx,代码行数:17,代码来源:test_Fasta_bgzip.py

示例6: test_fetch_whole_entry

# 需要导入模块: from pyfaidx import Faidx [as 别名]
# 或者: from pyfaidx.Faidx import fetch [as 别名]
 def test_fetch_whole_entry(self):
     faidx = Faidx("data/genes.fasta")
     expect = (
         "ATGACATCATTTTCCACCTCTGCTCAGTGTTCAACATCTGA"
         "CAGTGCTTGCAGGATCTCTCCTGGACAAATCAATCAGGTACGACCA"
         "AAACTGCCGCTTTTGAAGATTTTGCATGCAGCAGGTGCGCAAGG"
         "TGAAATGTTCACTGTTAAAGAGGTCATGCACTATTTAGGTCAGTACAT"
         "AATGGTGAAGCAACTTTATGATCAGCAGGAGCAGCATATGGTATATTG"
         "TGGTGGAGATCTTTTGGGAGAACTACTGGGACGTCAGAGCTTCTCCGTG"
         "AAAGACCCAAGCCCTCTCTATGATATGCTAAGAAAGAATCTTGTCACTTT"
         "AGCCACTGCTACTACAGCAAAGTGCAGAGGAAAGTTCCACTTCCAGAAAAA"
         "GAACTACAGAAGACGATATCCCCACACTGCCTACCTCAGAGCATAAATGCA"
         "TACATTCTAGAGAAGGTGATTGAAGTGGGAAAAAATGATGACCTGGAGGACTC"
     )
     result = faidx.fetch("gi|557361099|gb|KF435150.1|", 1, 482)
     assert str(result) == expect
开发者ID:AntonioGPS,项目名称:pyfaidx,代码行数:18,代码来源:test_feature_bounds_check.py

示例7: __init__

# 需要导入模块: from pyfaidx import Faidx [as 别名]
# 或者: from pyfaidx.Faidx import fetch [as 别名]
class TestFeatureBoundsCheck:
    def __init__(self):
        self.fasta = os.path.join(path, 'data/genes.fasta')
        self.faidx = Faidx(self.fasta)
        self.faidx_strict = Faidx(self.fasta, strict_bounds=True)

    def test_fetch_whole_entry(self):
        expect = ('ATGACATCATTTTCCACCTCTGCTCAGTGTTCAACATCTGA'
                'CAGTGCTTGCAGGATCTCTCCTGGACAAATCAATCAGGTACGACCA'
                'AAACTGCCGCTTTTGAAGATTTTGCATGCAGCAGGTGCGCAAGG'
                'TGAAATGTTCACTGTTAAAGAGGTCATGCACTATTTAGGTCAGTACAT'
                'AATGGTGAAGCAACTTTATGATCAGCAGGAGCAGCATATGGTATATTG'
                'TGGTGGAGATCTTTTGGGAGAACTACTGGGACGTCAGAGCTTCTCCGTG'
                'AAAGACCCAAGCCCTCTCTATGATATGCTAAGAAAGAATCTTGTCACTTT'
                'AGCCACTGCTACTACAGCAAAGTGCAGAGGAAAGTTCCACTTCCAGAAAAA'
                'GAACTACAGAAGACGATATCCCCACACTGCCTACCTCAGAGCATAAATGCA'
                'TACATTCTAGAGAAGGTGATTGAAGTGGGAAAAAATGATGACCTGGAGGACTC')
        result = self.faidx.fetch('KF435150.1',
                             1, 482)
        assert str(result) == expect

    def test_fetch_middle(self):
        expect = 'TTGAAGATTTTGCATGCAGCAGGTGCGCAAGGTGAAATGTTCACTGTTAAA'
        result = self.faidx.fetch('KF435150.1',
                             100, 150)
        assert str(result) == expect

    def test_fetch_end(self):
        expect = 'TC'
        result = self.faidx.fetch('KF435150.1',
                             480, 482)
        assert str(result) == expect

    def test_fetch_border(self):
        """ Fetch past the end of a gene entry """
        expect = 'TC'
        result = self.faidx.fetch('KF435150.1',
                             480, 500)
        assert str(result) == expect

    def test_rev(self):
        expect = 'GA'
        result = self.faidx.fetch('KF435150.1',
                             480, 482)
        assert str(-result) == expect, result

    @raises(FetchError)
    def test_fetch_past_bounds(self):
        """ Fetch past the end of a gene entry """
        expect = 'TC'
        result = self.faidx_strict.fetch('KF435150.1',
                                         480, 5000)
开发者ID:jsilter,项目名称:pyfaidx,代码行数:54,代码来源:test_feature_bounds_check.py

示例8: test_fetch_keyerror

# 需要导入模块: from pyfaidx import Faidx [as 别名]
# 或者: from pyfaidx.Faidx import fetch [as 别名]
 def test_fetch_keyerror(self):
     """ Fetch a key that does not exist """
     faidx = Faidx("data/genes.fasta", strict_bounds=True)
     result = faidx.fetch("gi|joe|gb|KF435150.1|", 1, 10)
开发者ID:AntonioGPS,项目名称:pyfaidx,代码行数:6,代码来源:test_feature_bounds_check.py

示例9: test_fetch_reversed_coordinates

# 需要导入模块: from pyfaidx import Faidx [as 别名]
# 或者: from pyfaidx.Faidx import fetch [as 别名]
 def test_fetch_reversed_coordinates(self):
     """ Fetch starting with a negative coordinate """
     faidx = Faidx("data/genes.fasta", strict_bounds=True)
     result = faidx.fetch("gi|557361099|gb|KF435150.1|", 50, 10)
开发者ID:AntonioGPS,项目名称:pyfaidx,代码行数:6,代码来源:test_feature_bounds_check.py

示例10: test_fetch_past_bounds

# 需要导入模块: from pyfaidx import Faidx [as 别名]
# 或者: from pyfaidx.Faidx import fetch [as 别名]
 def test_fetch_past_bounds(self):
     """ Fetch past the end of a gene entry """
     faidx = Faidx("data/genes.fasta", strict_bounds=True)
     result = faidx.fetch("gi|557361099|gb|KF435150.1|", 480, 5000)
开发者ID:AntonioGPS,项目名称:pyfaidx,代码行数:6,代码来源:test_feature_bounds_check.py

示例11: test_rev

# 需要导入模块: from pyfaidx import Faidx [as 别名]
# 或者: from pyfaidx.Faidx import fetch [as 别名]
 def test_rev(self):
     faidx = Faidx("data/genes.fasta")
     expect = "GA"
     result = faidx.fetch("gi|557361099|gb|KF435150.1|", 480, 482)
     assert str(-result) == expect, result
开发者ID:AntonioGPS,项目名称:pyfaidx,代码行数:7,代码来源:test_feature_bounds_check.py

示例12: test_fetch_border

# 需要导入模块: from pyfaidx import Faidx [as 别名]
# 或者: from pyfaidx.Faidx import fetch [as 别名]
 def test_fetch_border(self):
     """ Fetch past the end of a gene entry """
     faidx = Faidx("data/genes.fasta")
     expect = "TC"
     result = faidx.fetch("gi|557361099|gb|KF435150.1|", 480, 500)
     assert str(result) == expect
开发者ID:AntonioGPS,项目名称:pyfaidx,代码行数:8,代码来源:test_feature_bounds_check.py

示例13: test_fetch_end

# 需要导入模块: from pyfaidx import Faidx [as 别名]
# 或者: from pyfaidx.Faidx import fetch [as 别名]
 def test_fetch_end(self):
     faidx = Faidx("data/genes.fasta")
     expect = "TC"
     result = faidx.fetch("gi|557361099|gb|KF435150.1|", 480, 482)
     assert str(result) == expect
开发者ID:AntonioGPS,项目名称:pyfaidx,代码行数:7,代码来源:test_feature_bounds_check.py

示例14: test_key_function_by_fetch

# 需要导入模块: from pyfaidx import Faidx [as 别名]
# 或者: from pyfaidx.Faidx import fetch [as 别名]
 def test_key_function_by_fetch(self):
     faidx = Faidx('data/genes.fasta', key_function=get_gene_name)
     expect = 'TTGAAGATTTTGCATGCAGCAGGTGCGCAAGGTGAAATGTTCACTGTTAAA'
     result = faidx.fetch('MDM4',
                          100, 150)
     assert str(result) == expect
开发者ID:mdshw5,项目名称:pyfaidx,代码行数:8,代码来源:test_feature_key_function.py

示例15: test_issue_74_end_faidx

# 需要导入模块: from pyfaidx import Faidx [as 别名]
# 或者: from pyfaidx.Faidx import fetch [as 别名]
 def test_issue_74_end_faidx(self):
     f0 = Faidx('data/genes.fasta.gz', one_based_attributes=False)
     f1 = Faidx('data/genes.fasta.gz', one_based_attributes=True)
     end0 = f0.fetch('gi|557361099|gb|KF435150.1|', 1, 90).end
     end1 = f1.fetch('gi|557361099|gb|KF435150.1|', 1, 90).end
     assert end0 == end1
开发者ID:mdshw5,项目名称:pyfaidx,代码行数:8,代码来源:test_Fasta_bgzip.py


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