-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from mdshw5/mutable_FastaRecord
Mutable fasta record
- Loading branch information
Showing
5 changed files
with
169 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
setup( | ||
name='pyfaidx', | ||
provides='pyfaidx', | ||
version='0.2.9', | ||
version='0.3.0', | ||
author='Matthew Shirley', | ||
author_email='[email protected]', | ||
url='http://mattshirley.com', | ||
|
@@ -27,9 +27,10 @@ | |
"Intended Audience :: Science/Research", | ||
"Natural Language :: English", | ||
"Operating System :: Unix", | ||
"Programming Language :: Python :: 2.7", | ||
"Programming Language :: Python :: 3.3", | ||
"Programming Language :: Python :: 3.4", | ||
"Programming Language :: Python :: 3.3", | ||
"Programming Language :: Python :: 3.2", | ||
"Programming Language :: Python :: 2.7", | ||
"Programming Language :: Python :: 2.6", | ||
"Programming Language :: Python :: Implementation :: PyPy", | ||
"Topic :: Scientific/Engineering :: Bio-Informatics" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import os | ||
from pyfaidx import Fasta | ||
from tempfile import NamedTemporaryFile | ||
|
||
path = os.path.dirname(__file__) | ||
os.chdir(path) | ||
|
||
class TestMutableFastaRecord: | ||
def __init__(self): | ||
self.genes = os.path.join(path, 'data/genes.fasta') | ||
self.fasta = Fasta(self.genes) | ||
|
||
def setup(self): | ||
self.genes_copy = NamedTemporaryFile(mode='rb+') | ||
self.genes_copy.write(open(self.genes, 'rb').read()) | ||
self.genes_copy.seek(0) | ||
self.mutable_fasta = Fasta(self.genes_copy.name, mutable=True) | ||
|
||
def teardown(self): | ||
self.genes_copy.close() # deletes temporary file | ||
|
||
def test_mutate_fasta_to_same(self): | ||
chunk = self.fasta['KF435150.1'][0:100] | ||
self.mutable_fasta['KF435150.1'][0:100] = chunk.seq | ||
assert str(self.fasta['KF435150.1']) == str(self.mutable_fasta['KF435150.1']) | ||
|
||
def test_mutate_fasta_to_N(self): | ||
chunk = 100 * 'N' | ||
self.mutable_fasta['KF435150.1'][0:100] = chunk | ||
assert self.mutable_fasta['KF435150.1'][0:100].seq == chunk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters