Skip to content

Commit

Permalink
Change sequence attribute of DnaSpeciesType to sequence_path attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
YinHoon committed Dec 11, 2018
1 parent 8a97e59 commit 63470b0
Show file tree
Hide file tree
Showing 10 changed files with 160 additions and 240 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ cement >= 3.0.0
enum34
git+https://github.com/KarrLab/obj_model.git#egg=obj_model-0.0.5
openbabel
pyfaidx
setuptools
git+https://github.com/KarrLab/wc_utils.git#egg=wc_utils-0.0.1a5
Binary file modified tests/fixtures/core.xlsx
Binary file not shown.
Binary file modified tests/fixtures/eukaryote_core.xlsx
Binary file not shown.
1 change: 1 addition & 0 deletions tests/fixtures/seq.fna.fai
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chromosome 21000 12 70 71
2 changes: 0 additions & 2 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
mendeleev

pyfaidx
22 changes: 20 additions & 2 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
import Bio.SeqUtils
import mendeleev
import numpy
import os
import shutil
import tempfile
import unittest


Expand Down Expand Up @@ -166,7 +169,12 @@ def get_seq(self): return Bio.Seq.Seq(

class DnaSpeciesTypeTestCase(unittest.TestCase):
def test(self):
dna = core.DnaSpeciesType(id='dna1', name='dna1', seq=Bio.Seq.Seq('ACGTACGT', alphabet=Bio.Alphabet.DNAAlphabet()),
self.tmp_dirname = tempfile.mkdtemp()
filepath = os.path.join(self.tmp_dirname, 'test_seq.fasta')
with open(filepath, 'w') as f:
f.write('>dna1\nACGTACGT\n')

dna = core.DnaSpeciesType(id='dna1', name='dna1', sequence_path=filepath,
circular=False, double_stranded=False, ploidy=2)

self.assertEqual(dna.id, 'dna1')
Expand Down Expand Up @@ -262,11 +270,19 @@ def test(self):

self.assertAlmostEqual(dna.get_mol_wt(), exp_mol_wt, places=0)

shutil.rmtree(self.tmp_dirname)


class PolymerLocusTestCase(unittest.TestCase):
def test_constructor(self):
cell1 = core.Cell()
dna1 = core.DnaSpeciesType(id='dna1', seq=Bio.Seq.Seq('ACGTACGTACGTACG', alphabet=Bio.Alphabet.DNAAlphabet()),

self.tmp_dirname = tempfile.mkdtemp()
filepath = os.path.join(self.tmp_dirname, 'test_seq.fasta')
with open(filepath, 'w') as f:
f.write('>dna1\nACGTACGTACGTACG\n')

dna1 = core.DnaSpeciesType(id='dna1', sequence_path=filepath,
circular=False, double_stranded=False)

locus1 = core.PolymerLocus(id='locus1', cell=cell1, name='locus1', polymer=dna1,
Expand All @@ -291,6 +307,8 @@ def test_constructor(self):
self.assertEqual(locus1.get_seq(), rev_comp_seq)
self.assertEqual(locus1.get_len(), 15)

shutil.rmtree(self.tmp_dirname)


class MetaboliteSpeciesTypeTestCase(unittest.TestCase):
def test_constructor(self):
Expand Down
Loading

0 comments on commit 63470b0

Please sign in to comment.