Skip to content

Commit

Permalink
feat(IPVC-2471): fix tests to cover codon_table values
Browse files Browse the repository at this point in the history
  • Loading branch information
bsgiles73 committed May 23, 2024
1 parent a739ee4 commit 445ca1c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
Binary file modified tests/data/txinfo.gz
Binary file not shown.
18 changes: 18 additions & 0 deletions tests/test_uta_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,24 @@ def test_load_txinfo(self):
},
)

transcript.self.session.query(usam.Transcript).filter(usam.Transcript.ac == 'NC_012920.1_09206_09990').one()
self.assertEqual(
{
'ac': transcript.ac,
'gene_id': transcript.gene_id,
'cds_start_i': transcript.cds_start_i,
'cds_end_i': transcript.cds_end_i,
'codon_table': transcript.codon_table,
},
{
'ac': 'NC_012920.1_09206_09990',
'gene_id': '4514',
'cds_start_i': 0,
'cds_end_i': 784,
'codon_table': 2,
},
)

exon_set = self.session.query(usam.ExonSet).filter(usam.ExonSet.tx_ac == 'NM_080430.4').one()
exons = self.session.query(usam.Exon).filter(usam.Exon.exon_set_id == exon_set.exon_set_id).all()
self.assertEqual(len(exons), 5)
Expand Down
16 changes: 6 additions & 10 deletions tests/test_uta_parsers_seqrecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class TestSeqRecordFacade(unittest.TestCase):
expected_cds_translation="MAESGRPWAQARSAYRASEVLRRGTGRRRDPGPQSNGPGQEDARAPGRMARLRGQLRAEAASRSEVPRLLKLVERAGAG" \
"AAGAGERTGAHSRGSVCSVCGEPRGGATYPAGVLEVSERRLQEGLAAVREELGAGIEALRAELRAELDALRALLPPPPSPPARREPRAVPRAAPRGPTLP" \
"RTLGTVSALVAASRPADDAPDGPAECGAHRAPARKNHKKMPVPPGAPQGGGD",
expected_codon_table=1,
expected_exons_se_i=[(0, 696)],
),
param(
Expand All @@ -49,6 +50,7 @@ class TestSeqRecordFacade(unittest.TestCase):
"EDIDECALPTGGHICSYRCINIPGSFQCSCPSSGYRLAPNGRNCQDIDECVTGIHNCSINETCFNIQGGFRCLAFECPENYRRSAATRCERLPCHENREC" \
"SKLPLRITYYHLSFPTNIQAPAVVFRMGPSSAVPGDSMQLAITGGNEEGFFTTRKVSPHSGVVALTKPVPEPRDLLLTVKMDLSRHGTVSSFVAKLFIFV" \
"SAEL",
expected_codon_table=1,
expected_exons_se_i=[
(0, 182),
(182, 288),
Expand Down Expand Up @@ -80,6 +82,7 @@ class TestSeqRecordFacade(unittest.TestCase):
expected_cds_product=None,
expected_cds_protein_id=None,
expected_cds_translation=None,
expected_codon_table=None,
expected_exons_se_i=[],
),
param(
Expand All @@ -95,6 +98,7 @@ class TestSeqRecordFacade(unittest.TestCase):
expected_cds_product=None,
expected_cds_protein_id=None,
expected_cds_translation=None,
expected_codon_table=None,
expected_exons_se_i=[],
),
])
Expand All @@ -112,6 +116,7 @@ def test_seq_record_facade(
expected_cds_product,
expected_cds_protein_id,
expected_cds_translation,
expected_codon_table,
expected_exons_se_i,
):
gbff_file = os.path.join(self.test_data_dir, file_name)
Expand All @@ -127,18 +132,9 @@ def test_seq_record_facade(
assert self.seq_record_facade.cds_product == expected_cds_product
assert self.seq_record_facade.cds_protein_id == expected_cds_protein_id
assert self.seq_record_facade.cds_translation == expected_cds_translation
assert self.seq_record_facade.codon_table == expected_codon_table
assert self.seq_record_facade.exons_se_i == expected_exons_se_i

# @parameterized.expand([ @parameterized.expand([
# param('no genes', features={}),
# param('no genes', features={'gene': []}),
# param('more than one gene', features={'gene': [Mock(), Mock()]}),
# param('more than one CDS', features={'CDS': [Mock(), Mock()]}),
# ])
# def test_validate_features_by_type_invalid(self, test_name, features):
# with self.assertRaises(SeqRecordFeatureError):
# SeqRecordFacade.validate_features_by_type(features)

@parameterized.expand([
param("no gene feature", gene_feature_mock={}),
param("gene feature is None", gene_feature_mock={"gene": None}),
Expand Down

0 comments on commit 445ca1c

Please sign in to comment.