Skip to content

Commit

Permalink
fix(backend): fix unclassified not being processable
Browse files Browse the repository at this point in the history
  • Loading branch information
t03i committed Nov 28, 2024
1 parent 3a61ba8 commit 1023e59
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion backend/app/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
)
from .core.config import settings
from .definitions import Topology
from .taxonomy_enums import SuperKingdom

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -172,7 +173,13 @@ def get_proteins_by_lineage(
count_only: bool = False,
) -> ProteinResponse | ProteinCount | None:
query = build_base_query(filter, for_count=count_only)
query = query.where(Organism.super_kingdom == taxonomy.super_kingdom)

# Handle unclassified sequences by mapping them to "Unknown"
if taxonomy.super_kingdom == SuperKingdom.unclassified_sequences:
query = query.where(Organism.super_kingdom == "Unknown")
else:
query = query.where(Organism.super_kingdom == taxonomy.super_kingdom)

if taxonomy.clade:
query = query.where(Organism.clade == taxonomy.clade)

Expand Down

0 comments on commit 1023e59

Please sign in to comment.