Skip to content

Commit

Permalink
Add ploidy attribute to DNA species type
Browse files Browse the repository at this point in the history
  • Loading branch information
YinHoon committed Nov 25, 2018
1 parent e5834e7 commit be574a7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
Binary file modified tests/fixtures/core.xlsx
Binary file not shown.
Binary file modified tests/fixtures/eukaryote_core.xlsx
Binary file not shown.
3 changes: 2 additions & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,13 @@ 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()),
circular=False, double_stranded=False)
circular=False, double_stranded=False, ploidy=2)

self.assertEqual(dna.id, 'dna1')
self.assertEqual(dna.name, 'dna1')
self.assertEqual(dna.circular, False)
self.assertEqual(dna.double_stranded, False)
self.assertEqual(dna.ploidy, 2)

L = dna.get_len()
self.assertEqual(dna.get_empirical_formula(),
Expand Down
7 changes: 4 additions & 3 deletions wc_kb/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ class PolymerSpeciesType(SpeciesType):
double_stranded = obj_model.BooleanAttribute()

class Meta(obj_model.Model.Meta):
attribute_order = ('id', 'name', 'circular', 'double_stranded',
attribute_order = ('id', 'name', 'circular', 'double_stranded',
'half_life', 'comments', 'references', 'database_references')

@abc.abstractmethod
Expand Down Expand Up @@ -1559,10 +1559,11 @@ class DnaSpeciesType(PolymerSpeciesType):
"""

seq = obj_model.extra_attributes.BioSeqAttribute(verbose_name='Sequence')
ploidy = obj_model.IntegerAttribute(min=0)

class Meta(obj_model.Model.Meta):
attribute_order = ('id', 'name', 'seq', 'circular',
'double_stranded', 'half_life', 'comments', 'references', 'database_references')
attribute_order = ('id', 'name', 'seq', 'circular', 'double_stranded',
'ploidy', 'half_life', 'comments', 'references', 'database_references')
verbose_name = 'DNA species type'

def get_seq(self, start=None, end=None):
Expand Down

0 comments on commit be574a7

Please sign in to comment.