本文整理汇总了Python中pyfaidx.Faidx类的典型用法代码示例。如果您正苦于以下问题:Python Faidx类的具体用法?Python Faidx怎么用?Python Faidx使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Faidx类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_fetch_border
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,代码行数:7,代码来源:test_feature_bounds_check.py
示例2: test_fetch_border_padded
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,代码行数:8,代码来源:test_Fasta_bgzip.py
示例3: test_reindex_on_modification
def test_reindex_on_modification(self):
""" This test ensures that the index is regenerated when the FASTA
modification time is newer than the index modification time.
mdshw5/pyfaidx#50 """
faidx = Faidx('data/genes.fasta')
index_mtime = getmtime(faidx.indexname)
faidx.close()
os.utime('data/genes.fasta', (index_mtime + 10, ) * 2)
time.sleep(2)
faidx = Faidx('data/genes.fasta')
assert getmtime(faidx.indexname) > index_mtime
开发者ID:jrderuiter,项目名称:pyfaidx,代码行数:11,代码来源:test_feature_indexing.py
示例4: test_fetch_whole_entry
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,代码行数:15,代码来源:test_Fasta_bgzip.py
示例5: test_fetch_whole_entry
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,代码行数:16,代码来源:test_feature_bounds_check.py
示例6: __init__
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,代码行数:25,代码来源:test_feature_key_function.py
示例7: __init__
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,代码行数:11,代码来源:test_feature_default_seq.py
示例8: __init__
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,代码行数:52,代码来源:test_feature_bounds_check.py
示例9: test_fetch_end
def test_fetch_end(self):
faidx = Faidx('data/genes.fasta')
expect = 'TC'
result = faidx.fetch('gi|557361099|gb|KF435150.1|',
480, 481)
assert str(result) == expect
开发者ID:mdshw5,项目名称:pyfaidx,代码行数:6,代码来源:test_feature_bounds_check.py
示例10: test_fetch_keyerror
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,代码行数:4,代码来源:test_feature_bounds_check.py
示例11: test_fetch_past_bounds
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,代码行数:4,代码来源:test_feature_bounds_check.py
示例12: test_fetch_reversed_coordinates
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,代码行数:4,代码来源:test_feature_bounds_check.py
示例13: test_fetch_border
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,代码行数:6,代码来源:test_feature_bounds_check.py
示例14: test_rev
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,代码行数:5,代码来源:test_feature_bounds_check.py
示例15: test_key_function_by_fetch
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,代码行数:6,代码来源:test_feature_key_function.py
示例16: test_fetch_middle
def test_fetch_middle(self):
faidx = Faidx('data/genes.fasta.gz')
expect = 'TTGAAGATTTTGCATGCAGCAGGTGCGCAAGGTGAAATGTTCACTGTTAAA'
result = faidx.fetch('gi|557361099|gb|KF435150.1|',
100, 150)
assert str(result) == expect
开发者ID:mdshw5,项目名称:pyfaidx,代码行数:6,代码来源:test_Fasta_bgzip.py
示例17: test_samtools_compare
def test_samtools_compare(self):
with open(self.samtools, 'r') as expect:
expect = expect.read()
index = Faidx.build_fai(self.fasta)
result = ''.join(index)
assert result == expect
开发者ID:jsilter,项目名称:pyfaidx,代码行数:6,代码来源:test_feature_indexing.py
示例18: test_issue_74_end_faidx
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,代码行数:6,代码来源:test_Fasta_bgzip.py
示例19: test_fetch_negative
def test_fetch_negative(self):
""" Fetch starting with a negative coordinate """
faidx = Faidx('data/genes.fasta.gz', strict_bounds=True)
result = faidx.fetch('gi|557361099|gb|KF435150.1|',
-10, 10)
开发者ID:mdshw5,项目名称:pyfaidx,代码行数:5,代码来源:test_Fasta_bgzip.py
示例20: test_rev
def test_rev(self):
faidx = Faidx('data/genes.fasta.gz')
expect = 'GA'
result = faidx.fetch('gi|557361099|gb|KF435150.1|',
480, 481)
assert str(-result) == expect, result
开发者ID:mdshw5,项目名称:pyfaidx,代码行数:6,代码来源:test_Fasta_bgzip.py
注:本文中的pyfaidx.Faidx类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论