R/buildSBMLFromPathways.R

Defines functions buildSBMLFromPathways

Documented in buildSBMLFromPathways

##construct an SBML model for (a) given pathway(s) 
buildSBMLFromPathways <- function(query, database, match.exact=TRUE){
model <- database@model
all.pathways <- extractPathways(database)   
##Get all reactions in specific pathway(s)
relevant.reaction.ids <- unique(unlist(lapply(query, function(x){
if (match.exact)
  names(model@reactions[names(which(all.pathways==x))])
else
  names(model@reactions[grep(x, all.pathways, ignore.case=TRUE)])
})))         
if (length(relevant.reaction.ids)==0){
message("No Recon Pathways found for query ", query, "\n")
return(NULL)
}
.buildSubModel(model, relevant.reaction.ids)
}

Try the BiGGR package in your browser

Any scripts or data that you put into this service are public.

BiGGR documentation built on Nov. 8, 2020, 5:38 p.m.