monarch-initiative / biolink-api

API for linked biological knowledge
https://api.monarchinitiative.org/api/
BSD 3-Clause "New" or "Revised" License
63 stars 25 forks source link

Improve performance when fetching associations; updated counts and json schema #280

Closed deepakunni3 closed 5 years ago

deepakunni3 commented 5 years ago

This PR aims at improving performance for some of the routes in the API:

Note: This PR depends on https://github.com/biolink/ontobio/pull/323

New format for counts:

{
    "taxon": {
        "id": "NCBITaxon:9606",
        "label": "Homo sapiens"
    },
    "association_counts": {
        "homolog": {
            "counts": 31,
            "counts_by_taxon": {
                "NCBITaxon:9606": 16,
                "NCBITaxon:28377": 2,
                "NCBITaxon:6239": 2,
                "NCBITaxon:10090": 1,
                "NCBITaxon:10116": 1,
                "NCBITaxon:7227": 1,
                "NCBITaxon:7955": 1,
                "NCBITaxon:8364": 1,
                "NCBITaxon:9031": 1,
                "NCBITaxon:9544": 1,
                "NCBITaxon:9598": 1,
                "NCBITaxon:9796": 1,
                "NCBITaxon:9823": 1,
                "NCBITaxon:9913": 1
            }
        },
        "phenotype": {
            "counts": 21
        },
        "anatomy": {
            "counts": 20
        },
        "function": {
            "counts": 13
        },
        "interaction": {
            "counts": 14,
            "counts_by_taxon": {
                "NCBITaxon:9606": 14
            }
        },
        "disease": {
            "counts": 4
        },
        "variant": {
            "counts": 38,
            "counts_by_taxon": {
                "NCBITaxon:9606": 38
            }
        },
        "publication": {
            "counts": 33
        },
        "ortholog-phenotype": {
            "counts": 113
        },
        "ortholog-function": {
            "counts": 39
        },
        "ortholog-anatomy": {
            "counts": 57
        },
        "ortholog-interaction": {
            "counts": 41,
            "counts_by_taxon": {
                "NCBITaxon:7227": 26,
                "NCBITaxon:6239": 7,
                "NCBITaxon:10090": 4,
                "NCBITaxon:10116": 3,
                "NCBITaxon:7955": 1
            }
        },
        "ortholog-pathway": {
            "counts": 1
        }
    },
    "xrefs": null,
    "description": null,
    "categories": [
        "gene",
        "sequence feature"
    ],
    "types": null,
    "synonyms": null,
    "deprecated": null,
    "replaced_by": null,
    "consider": null,
    "id": "HGNC:11603",
    "label": "TBX4"
}
deepakunni3 commented 5 years ago

@kshefchek This PR is ready for review. This should address the requirement of getting association counts by taxon via the API