Skip to content

Commit

Permalink
contig classification test changes
Browse files Browse the repository at this point in the history
  • Loading branch information
colinvwood committed Oct 4, 2023
1 parent ddd96dc commit 999349b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions q2_moshpit/kraken2/tests/test_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,19 +435,24 @@ def test_classify_kraken2_contigs(self):
for path, df in output_views:
sample_id = str(path).rsplit('.output.txt')[0]

# the expected number of records are in the output
self.assertEqual(len(df), 20)

# no sequences are unclassified
self.assertNotIn('U', list(df['classification']))

# all classifications are correct
taxon_ids = [
sample_id_to_ncbi_id[sample_id] for _ in range(len(df))
]
self.assertEqual(taxon_ids, list(df['taxon_id']))
self.assertEqual(
pd.unique(df['taxon_id']), [sample_id_to_ncbi_id[sample_id]]
)

report_views = reports.reports.iter_views(pd.DataFrame)
for path, df in report_views:
sample_id = str(path).rsplit('.report.txt')[0]

# the dataframe is non-empty
self.assertGreater(len(df), 0)

# the correct taxonomy id (feature id) is present somewhere in the
# classification tree, and none of the others are present
for current_sample_id, taxon_id in sample_id_to_ncbi_id.items():
Expand Down

0 comments on commit 999349b

Please sign in to comment.