本文整理汇总了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
示例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)
示例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
示例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
示例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
示例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
示例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)
示例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)
示例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)
示例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)
示例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
示例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
示例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
示例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
示例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