Skip to content

Commit

Permalink
Remove bedmask script #38. Add tests to close #35.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdshw5 committed Jan 12, 2015
1 parent bae0a9f commit 11c20ac
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
29 changes: 0 additions & 29 deletions pyfaidx/bedmask.py

This file was deleted.

29 changes: 29 additions & 0 deletions tests/test_feature_split_char.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import os
from pyfaidx import Faidx, Fasta
from nose.tools import raises

path = os.path.dirname(__file__)
os.chdir(path)


class TestFeatureSplitChar:
def __init__(self):
self.fasta = os.path.join(path, 'data/genes.fasta')
self.faidx = Faidx(self.fasta, split_char='.')
self.genes = Fasta(self.fasta, split_char='.')

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

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

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

0 comments on commit 11c20ac

Please sign in to comment.