Skip to content

Commit

Permalink
Merge pull request #252 from iomega/Fix_empty_class_annotation_bug
Browse files Browse the repository at this point in the history
Fix empty class annotation bug
  • Loading branch information
niekdejonge authored Aug 9, 2024
2 parents fe1ac2b + 64824e7 commit 7f5fd8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def select_compound_classes(spectra):
break
if cf_classes is None:
print(f"no classyfire annotation was found for inchikey {inchikey14}")
inchikey_results_list[i].append([inchikey14, "", "", "", "", ""])
inchikey_results_list[i] += ["", "", "", "", ""]

# select NPC classes
npc_results = None
Expand Down
7 changes: 7 additions & 0 deletions tests/test_add_classifier_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ def test_add_classifier_annotation(spectra):
result = select_compound_classes(spectra)
assert sorted(result) == [['WRIPSIKIDAUKBP', 'Organic compounds', 'Phenylpropanoids and polyketides', 'Macrolactams', '', 'Macrolactams', '', '', 'Alkaloids', 'False'],
['WXDBUBIFYCCNLE', 'Organic compounds', 'Organoheterocyclic compounds', 'Oxepanes', '', 'Oxepanes', 'Lipopeptides', 'Oligopeptides', 'Amino acids and Peptides', 'False']]


def test_add_classifier_annotation_unknown_inchikey(spectra):
"""This tests that when no compound class annotation is found, that it is correctly filled with empty strings"""
spectra[1].set("inchikey", "AAAAAAAAAAAAAA")
result = select_compound_classes(spectra)
assert len(result[0]) == len(result[1])

0 comments on commit 7f5fd8f

Please sign in to comment.