Git Product home page Git Product logo

monarchr's Introduction

monarchr

License: MIT + file LICENSE
R build status

Authors: Shawn O’Neil, Brian Schilder

README updated: Apr-15-2024

monarchr: Monarch Knowledge Graph Queries

R package for easy access, manipulation, and analysis of Monarch KG data Resources.

MonarchR provides a tidy interface to data hosted at https://monarchinitiative.org. It is an alpha: functionality is in early testing, the API is likely to change, and the code and documentation are incomplete.

Installation

if(!require("remotes")) install.packages("remotes")

remotes::install_github("https://github.com/monarch-initiative/monarchr")
library(monarchr)

Documentation


monarchr's People

Contributors

oneilsh avatar bschilder avatar

Stargazers

Alejandro Martinez avatar  avatar Harry Caufield avatar  avatar Sarah Gehrke avatar

Watchers

Monica Munoz-Torres avatar Nico Matentzoglu avatar  avatar  avatar

Forkers

bschilder

monarchr's Issues

Some ideas for strategy

original doc: https://docs.google.com/document/d/1cbNP45X32G8BEoJgpX91gUANB5_CVCZARPh51RVgBA8/edit

This document is for rough notes on approaches for exposing Monarch via R

  1. Fully featured R library with graph logic in R
  2. thin wrapper onto new Monarch API
  3. This wrapper onto OAK, which itself wraps Monarch API

Fully featured R library

The idea would be to have lots of ontology logic implemented in R. This would essentially be OAK in R.

I don’t think we should pursue this unless there is someone who has the time and resources, a strong vision and extensive experience of building similar libraries

Thin wrapper onto Monarch API

This would be a very lightweight layer that would mostly be geared around obtaining dataframes for genes, diseases, etc. It would have minimal logic. It could even be autoderived via swagger2R.

All logic would be server side. The R would mostly be retrieval

Thin wrapper onto OAK

This would require two new pieces
FastAPI layer onto OAK
An OAK adapter for the new Monarch API

However, both of these are already things we want.

There may be efficiency considerations with so many layers. There would need to be some thinking about the generic FastAPI layer for OAK (e.g. OAK is naturally sync; things like connecting to a sqlite for the first time incur an initial time overhead)

Error when `limit>500`

Trying to mass query all phenotypes in the KG by setting query to NULL and raising limit.

Running with limit<=500 works fine:

out <- monarchr::monarch_search(query = NULL,
                                      category = "biolink:PhenotypicFeature", 
                                      limit = 500)

Screenshot 2024-04-15 at 14 05 18

But after some trial and error, I found out that anything >500 causes an error:

out <- monarchr::monarch_search(query = NULL,
                                      category = "biolink:PhenotypicFeature", 
                                      limit = 501)
Error in response_content$total : 
  $ operator is invalid for atomic vectors

Is this something caused by monarchR or the KG API itself?

Thanks!
Brian

Session info

R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.4.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/London
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] monarchr_0.2.1

loaded via a namespace (and not attached):
 [1] vctrs_0.6.5       httr_1.4.7        cli_3.6.2         knitr_1.45        rlang_1.1.3       xfun_0.43         purrr_1.0.2      
 [8] generics_0.1.3    assertthat_0.2.1  jsonlite_1.8.8    glue_1.7.0        htmltools_0.5.8.1 fansi_1.0.6       rmarkdown_2.26   
[15] neo2R_2.4.2       evaluate_0.23     tibble_3.2.1      base64enc_0.1-3   fastmap_1.1.1     yaml_2.3.8        lifecycle_1.0.4  
[22] compiler_4.3.1    dplyr_1.1.4       igraph_2.0.3      pkgconfig_2.0.3   tidyr_1.3.1       rstudioapi_0.16.0 digest_0.6.35    
[29] R6_2.5.1          tidyselect_1.2.1  utf8_1.2.4        curl_5.2.1        pillar_1.9.0      magrittr_2.0.3    tidygraph_1.3.1  
[36] tools_4.3.1    

Coordinating R package projects

Hi there,

I'm in the process of developing another R package, KGExplorer, which seeks to merge knowledge graphs from multiple biomedical resources, with a special focus on Monarch to start. I'm quite partial to the tidygraph representation and plan to use that as one of the primary object classes, in addition to the ontology_DAG class within simona for ontologies.

Some potential integrations:


I was also just having a discussion with @charlieccarey about their R package of the same name:

@charlieccarey's package has some nice functionalities like searching for specific types of interactions, e.g. bioentity_interactions_assoc_w_gene

I'm mainly posting here to see if there's way we could coordinate our efforts. I haven't explored the package in your repo yet but would be happy to make contributions if there's room for it.

All the best,
Brian


Brian M. Schilder
PhD Candidate
Neurogenomics Lab
Faculty of Medicine, Department of Brain Sciences
UK Dementia Research Institute, Imperial College London
CV | bschilder.github.io/CV/CV
LinkedIn | linkedin.com/in/brian-schilder
Website I | bschilder.github.io/BMSchilder
Twitter | twitter.com/BMSchilder
Lab | neurogenomics.co.uk

fetch_edges fails with 0 new results

Example:

eds_hits <- query_ids(c("MONDO:0007525", "MONDO:0020066", "MONDO:0034021"))
fetch_edges(eds_hits, result_categories = "biolink:Gene")

Warning: Unknown or uninitialised column: id.Error in tbl_kgx(nodes_df) :
Error: tbl_kgx nodes must have an 'id' column.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.