Skip to content

Commit

Permalink
Adds a docstring with some horrendous html for better documentation o…
Browse files Browse the repository at this point in the history
…n simsearch api endpoint, plus constraints
  • Loading branch information
kevinschaper committed Sep 21, 2023
1 parent d67f60c commit 870fa00
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions backend/src/monarch_py/api/semsim.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List

from fastapi import APIRouter
from fastapi import APIRouter, Query
from monarch_py.api.config import oak
from monarch_py.implementations.oak.oak_implementation import SemsimSearchCategory

Expand Down Expand Up @@ -56,10 +56,27 @@ def _post_compare(

@router.get("/search")
def _search(
subjects: str = "",
target_group: SemsimSearchCategory = None,
limit: int = 10,
subjects: str = Query(...),
target_group: SemsimSearchCategory = Query(...),
limit: int = Query(default=10, ge=1, le=500)
):
"""
Search for genes or diseases by phenotype similarity<br>
Args:<br>
subjects (str, optional): A comma separated list of phenotypes, genes or diseases for comparison.<br>
Examples:
<ul>
<li>MONDO:0019391,</li>
<li>MP:0010771,MP:0002169,MP:0005391,MP:0005389,MP:0005367</li>
<li>HGNC:10848,HGNC:1101</li>
</ul>
<br>
target_group (SemsimSearchCategory, optional): The target group to search for, diseases, or genes
from a specific taxon<br>
limit: The maximum number of results to return (default 10, maximum of 500) <br>
"""
# TODO: subjects as an argument to this api method is consistent with compare,
# but obviously bizarre to have objects=subjects in the translation to oaklib
return oak().search(objects=subjects.split(","), target_groups=[target_group], limit=limit)

0 comments on commit 870fa00

Please sign in to comment.