Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix empty class annotation bug #252

Merged
merged 2 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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])
Loading