Skip to content

MetExplore/metexplore3api_client_r

Repository files navigation

R API client for metexplore3api

Rest API for MetExplore content.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI spec from a remote server, you can easily generate an API client.

  • API version: 0.29.0
  • Package version: 1.0.0
  • Generator version: 7.9.0
  • Build package: org.openapitools.codegen.languages.RClientCodegen

Installation

Prerequisites

Install the dependencies

install.packages("jsonlite")
install.packages("httr")
install.packages("base64enc")

Build the package

git clone https://github.com/GIT_USER_ID/GIT_REPO_ID
cd GIT_REPO_ID
R CMD build .
R CMD check metexplore3api_1.0.0.tar.gz --no-manual
R CMD INSTALL --preclean metexplore3api_1.0.0.tar.gz

Install the package

install.packages("metexplore3api")

To install directly from Github:

install.packages("remotes") 
remotes::install_github("MetExplore/metexplore3api_client_r")

To install the package from a local file:

install.packages("metexplore3api_1.0.0.tar.gz", repos = NULL, type = "source")

Usage

library(metexplore3api)

  # Spécifier l'identifiant du réseau
  network_id <- 1
  
  ###########################
  ### Genes
  ###########################
    
  # #Créer une instance de la classe GenesApi
  api <- GenesApi$new()

  # Appel de l’API pour récuperer les genes du réseau
  result <- api$GETGENES(network_id)
  results <- result$results


  df_genes <- data.frame(
    name = sapply(result$results, function(x) if (!is.null(x$name)) x$name else NA),
    identifier = sapply(result$results, function(x) if (!is.null(x$db_identifier)) x$db_identifier else NA),
    stringsAsFactors = FALSE)

  View(df_genes)

  ###########################
  ### Proteins
  ###########################
  api <- ProteinsApi$new()
  result <- api$GETPROTEINS(NULL,network_id,NULL)
  results <- result$results


  df_proteins <- data.frame(
    name = sapply(result$results, function(x) if (!is.null(x$name)) x$name else NA),
    identifier = sapply(result$results, function(x) if (!is.null(x$db_identifier)) x$name else NA),
    stringsAsFactors = FALSE)

  View(df_proteins)


  ###########################
  ### Enzymes
  ###########################

  api <- EnzymesApi$new()
  #print(api$GETENZYMES)
  result <- api$GETENZYMES(network_id)
  results <- result$results


  df_enzymes <- data.frame(
    name = sapply(result$results, function(x) if (!is.null(x$name)) x$name else NA),
    identifier = sapply(result$results, function(x) if (!is.null(x$db_identifier)) x$db_identifier else NA),
    stringsAsFactors = FALSE)

  View(df_enzymes)

  ###########################
  ### Reactions
  ###########################

  api <- ReactionsApi$new()

  result <- api$GETREACTIONS(network_id)
  results <- result$results


  df_reactions <- data.frame(
    name = sapply(result$results, function(x) if (!is.null(x$name)) x$name else NA),
    identifier = sapply(result$results, function(x) if (!is.null(x$db_identifier)) x$db_identifier else NA),
    ec   = sapply(result$results, function(x) if (!is.null(x$ec)) x$ec else NA),
    stringsAsFactors = FALSE)

  View(df_reactions)
  
  ###########################
  ### Metabolites
  ###########################

  api <- MetabolitesApi$new()
  response <- api$GETMETABOLITESWithHttpInfo(id_network = network_id)
  if (response$status_code >= 200 && response$status_code < 300) {
     json <- response$response_as_text()
     parsed <- jsonlite::fromJSON(json, simplifyDataFrame = TRUE)
  }
  else {
     stop("Erreur lors de l'appel API : ", response$status_code)
  }
  df_metabolites <- parsed$results
  View(df_metabolites)
  
  ###########################
  ### Pathways
  ###########################
  
  api <- PathwaysApi$new()

  result <- api$GETPATHWAYS(NULL,network_id, NULL)
  results <- result$results


  df_pathways <- data.frame(
    name = sapply(result$results, function(x) if (!is.null(x$name)) x$name else NA),
    identifier = sapply(result$results, function(x) if (!is.null(x$db_identifier)) x$db_identifier else NA),
    stringsAsFactors = FALSE)

  View(df_pathways)

Documentation for API Endpoints

All URIs are relative to https://metexplore.toulouse.inrae.fr/metexplore3-api

Class Method HTTP request Description
CollectionsApi GETCOLLECTIONS GET /collections get Metabolic Network Collections
CompartmentsApi GETCOMPARTMENTS GET /compartments get compartments in a network
EnzymesApi GETENZYMES GET /enzymes get Enzyme
GenesApi GETGENES GET /genes get Gene
MappingApi MAPPINGGENESIDS POST /mapping/genes/ids Map genes ids onto a metabolic Network
MappingApi MAPPINGMETABOLITESIDS POST /mapping/metabolites/ids Map metabolic ids onto a metabolic Network
MappingApi MAPPINGREACTIONSIDS POST /mapping/reactions/ids Map reactions ids onto a metabolic Network
MetabolitesApi GETMETABOLITES GET /metabolites get Metabolite
NetworksApi GETNETWORKS GET /networks Get all networks or one network
NetworksApi NETWORKCOUNT GET /networks/count get the number of all biodatas in a network
PathwaysApi GETPATHWAYS GET /pathways get Pathway
ProteinsApi GETPROTEINS GET /proteins get Protein
ReactionsApi GETREACTIONS GET /reactions get Reaction

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

userAuth

  • Type: Bearer authentication
  • Bearer Format: JWT

appAuth

  • Type: API key
  • API key parameter name: x-app-key
  • Location: HTTP header

Author

contact-metexplore@inrae.fr

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published