GithubHelp home page GithubHelp logo

metabomapr's Introduction

output
html_document
keep_md
true

Metabolomic network edge list generation

Install

if (!require("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("ChemmineR")

devtools::install_github('dgrapov/metabomapr')

Supported connections:

  • structural similarity based on pubChem CID
  • biochemical connections based on KEGG

See MetaMapR for more features.

Examples

#devtools::install_github("dgrapov/metabomapr")
library(metabomapr)
library(dplyr)

Demo data

main<-test_data() 
head(main)
##   id   KEGG    CID                            name
## 1 N1 C15973     [] Enzyme N6-(dihydrolipoyl)lysine
## 2 N2 C00026     51                  2-Oxoglutarate
## 3 N3 C05381 440649  3-Carboxy-1-hydroxypropyl-ThPP
## 4 N4 C15972     []        Enzyme N6-(lipoyl)lysine
## 5 N5 C00091 439161                    Succinyl-CoA
## 6 N6 C00042   1110                       Succinate

Convert PubChem CID to tanimoto based chemical similarity

type<-'CID'
id<-main[,type]
cid_el<-CID_tanimoto(id,as='edge.list')
head(cid_el)
##    source target     value
## 16     51 440649 0.1584699
## 31     51 439161 0.1711230
## 32 440649 439161 0.6467890
## 46     51   1110 0.7027027
## 47 440649   1110 0.1468927
## 48 439161   1110 0.1475410

get KEGG based biochemical connections

type<-'KEGG'
id<-main[,type]
kegg_el<-get_KEGG_edgeList(id)
head(kegg_el)
##   source target
## 1 C15972 C15973
## 2 C15973 C16254
## 3 C15973 C16255
## 4 C00026 C00091
## 5 C00026 C00311
## 6 C00026 C05381

Combine edge lists using a common index

type<-'CID'
cid_el<- cid_el %>%
  convert_edgeIndex(.,start=type,end='id',db=main) %>%
  data.frame(.,cid_el %>% select(-source,-target),type=type)

type<-'KEGG'
kegg_el<- kegg_el %>%
  convert_edgeIndex(.,start=type,end='id',db=main) %>%
  data.frame(.,kegg_el %>% select(-source,-target),value=1,type=type)

#combined edge list
el<-rbind(kegg_el,cid_el)
head(el)
##   source target value type
## 1     N4     N1     1 KEGG
## 2     N1    N16     1 KEGG
## 3     N1    N18     1 KEGG
## 4     N2     N5     1 KEGG
## 5     N2     N8     1 KEGG
## 6     N2     N3     1 KEGG

Using opencpu API

Define server

options('open_cpu_url' = 'http://localhost/ocpu/')
options('metabomapr_url' = 'library/metabomapr/R/' )

Make call using simple opencpuclient

library(ocpuclient)
type<-'CID'
id<-main[,type]

body<-list(type=type,cids=id,as='edge.list')

fun<-'CID_tanimoto'

x<-ocpuclient:::ocpu_post(fun,body=body,pkg_url = getOption('metabomapr_url'), base_url=getOption('open_cpu_url'))

x$results 

About

metabomapr's People

Contributors

dgrapov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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.