Title: | Parses BioPax files and represents them in R |
---|---|
Description: | Parses BioPAX files and represents them in R, at the moment BioPAX level 2 and level 3 are supported. |
Authors: | Frank Kramer |
Maintainer: | Frank Kramer <[email protected]> |
License: | GPL (>= 2) |
Version: | 2.47.0 |
Built: | 2024-10-31 04:37:23 UTC |
Source: | https://github.com/bioc/rBiopaxParser |
Parses BioPax files and represents them in R
rBiopaxParser is a...
Package: | rBiopaxParser |
Type: | Package |
Version: | 0.15 |
Date: | 2012-08-22 |
License: | GPL (>= 2) |
Frank Kramer [email protected]
## Not run: biopax = readBiopax(file="biopaxmodel.owl")
## Not run: biopax = readBiopax(file="biopaxmodel.owl")
This function adds a new biochemical reaction of class biochemicalReaction to the biopax model. This is a convenience function, internally the function addBiopaxInstance is called with properties LEFT and RIGHT set.
addBiochemicalReaction(biopax, LEFT = c(), RIGHT = c(), id = NULL)
addBiochemicalReaction(biopax, LEFT = c(), RIGHT = c(), id = NULL)
biopax |
A biopax model |
LEFT |
vector of strings. IDs of the physicalEntityParticipant instances that are on the left side of this reaction. |
RIGHT |
vector of strings. IDs of the physicalEntityParticipant instances that are on the right side of this reaction. |
id |
string. ID for the control. If NULL a new ID is generated with prefix "biochemicalReaction". |
Returns the biopax model with the added pathway.
fkramer
biopax = createBiopax(level=2) biopax = addPhysicalEntity(biopax, class="protein", id="p_id1", NAME="protein1") biopax = addPhysicalEntityParticipant(biopax, "p_id1", id="PEP_p_id1") biopax = addPhysicalEntity(biopax, class="protein", id="p_id2", NAME="protein2") biopax = addPhysicalEntityParticipant(biopax, "p_id2", id="PEP_p_id2") biopax = addBiochemicalReaction(biopax, LEFT=c("PEP_p_id1"), RIGHT=c("PEP_p_id2"), id="biochem_id_1") biopax$dt
biopax = createBiopax(level=2) biopax = addPhysicalEntity(biopax, class="protein", id="p_id1", NAME="protein1") biopax = addPhysicalEntityParticipant(biopax, "p_id1", id="PEP_p_id1") biopax = addPhysicalEntity(biopax, class="protein", id="p_id2", NAME="protein2") biopax = addPhysicalEntityParticipant(biopax, "p_id2", id="PEP_p_id2") biopax = addBiochemicalReaction(biopax, LEFT=c("PEP_p_id1"), RIGHT=c("PEP_p_id2"), id="biochem_id_1") biopax$dt
This function adds a new instance to an existing biopax model. "properties" is a named list of vectors, with the vector name as the name of the property and every entry of the vector a property value. Please note: case sensitivity! In Biopax Level 2 all properties are written in all capital letters. This will change in Biopax Level 3.
addBiopaxInstance( biopax, class, id, properties = list(NAME = c()), verbose = TRUE )
addBiopaxInstance( biopax, class, id, properties = list(NAME = c()), verbose = TRUE )
biopax |
A biopax model |
class |
string. Class name |
id |
string. ID of the instance |
properties |
named list of properties. |
verbose |
logical. Be verbose about what was added. |
Returns the supplied biopax model with the new instance added.
Frank Kramer
biopax = createBiopax(level=2) biopax = addBiopaxInstance(biopax, class="protein", id="id1", properties=list(NAME="protein1",SYNONYMS="p1")) biopax$dt
biopax = createBiopax(level=2) biopax = addBiopaxInstance(biopax, class="protein", id="id1", properties=list(NAME="protein1",SYNONYMS="p1")) biopax$dt
This function adds new instances (supplied as a compatible data.table) to an existing biopax model via rbind. Usually you want to start out at createBiopax and addPhysicalEntity and work your way up the ontology ladder.
addBiopaxInstances(biopax, newInstancesDF)
addBiopaxInstances(biopax, newInstancesDF)
biopax |
A biopax model |
newInstancesDF |
data.table or data.frame. Must be compatible with internal biopax implementation. |
Returns the supplied biopax model with the new instances added.
Frank Kramer
# load data data(biopaxexample) biopax_temp = createBiopax(level=2) biopax_temp = addBiopaxInstance(biopax_temp, class="protein", id="id1", properties=list(NAME="protein1",SYNONYMS="p1")) selectInstances(biopax_temp) biopax = addBiopaxInstances(biopax, selectInstances(biopax_temp))
# load data data(biopaxexample) biopax_temp = createBiopax(level=2) biopax_temp = addBiopaxInstance(biopax_temp, class="protein", id="id1", properties=list(NAME="protein1",SYNONYMS="p1")) selectInstances(biopax_temp) biopax = addBiopaxInstances(biopax, selectInstances(biopax_temp))
This function adds a new interaction of class control to the biopax model. This is a convenience function to add controls, internally the function addBiopaxInstance is called with properties CONTROL-TYPE, CONTROLLER and CONTROLLED set.
addControl( biopax, CONTROL_TYPE = c("ACTIVATION", "INHIBITION"), CONTROLLER = "", CONTROLLED = c(), id = NULL )
addControl( biopax, CONTROL_TYPE = c("ACTIVATION", "INHIBITION"), CONTROLLER = "", CONTROLLED = c(), id = NULL )
biopax |
A biopax model |
CONTROL_TYPE |
string. Specifies wether this is an activating or inhibiting control. |
CONTROLLER |
string. ID of the physicalEntityParticipant instance that is the controller of this interaction. |
CONTROLLED |
vector of strings. IDs of the interaction and/or pathway instances that are being controlled. |
id |
string. ID for the control. If NULL a new ID is generated with prefix "control". |
Returns the biopax model with the added pathway.
fkramer
biopax = createBiopax(level=2) biopax = addPhysicalEntity(biopax, class="protein", id="p_id1", NAME="protein1") biopax = addPhysicalEntityParticipant(biopax, "p_id1", id="PEP_p_id1") biopax = addPhysicalEntity(biopax, class="protein", id="p_id2", NAME="protein2") biopax = addPhysicalEntityParticipant(biopax, "p_id2", id="PEP_p_id2") biopax = addBiochemicalReaction(biopax, LEFT=c("PEP_p_id1"), RIGHT=c("PEP_p_id2"), id="biochem_id_1") biopax = addPhysicalEntity(biopax, class="protein", id="p_id3", NAME="controllerProtein1") biopax = addPhysicalEntityParticipant(biopax, "p_id3", id="PEP_p_id3") biopax = addControl(biopax, CONTROL_TYPE="ACTIVATION", CONTROLLER="PEP_p_id3", CONTROLLED="biochem_id_1", id="c_id1") biopax$dt
biopax = createBiopax(level=2) biopax = addPhysicalEntity(biopax, class="protein", id="p_id1", NAME="protein1") biopax = addPhysicalEntityParticipant(biopax, "p_id1", id="PEP_p_id1") biopax = addPhysicalEntity(biopax, class="protein", id="p_id2", NAME="protein2") biopax = addPhysicalEntityParticipant(biopax, "p_id2", id="PEP_p_id2") biopax = addBiochemicalReaction(biopax, LEFT=c("PEP_p_id1"), RIGHT=c("PEP_p_id2"), id="biochem_id_1") biopax = addPhysicalEntity(biopax, class="protein", id="p_id3", NAME="controllerProtein1") biopax = addPhysicalEntityParticipant(biopax, "p_id3", id="PEP_p_id3") biopax = addControl(biopax, CONTROL_TYPE="ACTIVATION", CONTROLLER="PEP_p_id3", CONTROLLED="biochem_id_1", id="c_id1") biopax$dt
Adds a hash in front of a string
addhash(x)
addhash(x)
x |
A string to be preceeded by a hash |
The supplied string with a hash "#" pasted in front of it.
Frank Kramer
This function takes the input classname, checks if it already has a namespace, and if not pastes the namespace tag with a dividing ":" in front of it.
addns(classname, namespace = "bp")
addns(classname, namespace = "bp")
classname |
A string containing a classname |
namespace |
A string containing a namespace |
If the classname is not preceeded by a namespace yet, the supplied namespace is pasted in front of it and returned.
Frank Kramer
This function adds a new pathway + its PATHWAY-COMPONENTS (references to interaction/pathways/pathwaySteps)
addPathway( biopax, NAME, PATHWAY_COMPONENTS = c(), id = NULL, ORGANISM = NULL, COMMENT = NULL )
addPathway( biopax, NAME, PATHWAY_COMPONENTS = c(), id = NULL, ORGANISM = NULL, COMMENT = NULL )
biopax |
A biopax model |
NAME |
string. Name of the pathway |
PATHWAY_COMPONENTS |
character vector. IDs of the pathway components. This must be IDs of instances of type interaction/pathway/pathwayStep (or their subclasses). |
id |
string. ID for the pathway. If NULL a new ID is generated with prefix "pathway". |
ORGANISM |
string. Organism property of the pathway. optional. |
COMMENT |
string. An optional comment |
Returns the biopax model with the added pathway.
fkramer
biopax = createBiopax(level=2) biopax = addPhysicalEntity(biopax, class="protein", id="p_id1", NAME="protein1") biopax = addPhysicalEntityParticipant(biopax, "p_id1", id="PEP_p_id1") biopax = addPhysicalEntity(biopax, class="protein", id="p_id2", NAME="protein2") biopax = addPhysicalEntityParticipant(biopax, "p_id2", id="PEP_p_id2") biopax = addBiochemicalReaction(biopax, LEFT=c("PEP_p_id1"), RIGHT=c("PEP_p_id2"), id="biochem_id_1") biopax = addPhysicalEntity(biopax, class="protein", id="p_id3", NAME="controllerProtein1") biopax = addPhysicalEntityParticipant(biopax, "p_id3", id="PEP_p_id3") biopax = addControl(biopax, CONTROL_TYPE="ACTIVATION", CONTROLLER="PEP_p_id3", CONTROLLED="biochem_id_1", id="c_id1") biopax = addPathway(biopax, NAME="mypathway1", PATHWAY_COMPONENTS=c("c_id1"), id="pw_id1") biopax$dt
biopax = createBiopax(level=2) biopax = addPhysicalEntity(biopax, class="protein", id="p_id1", NAME="protein1") biopax = addPhysicalEntityParticipant(biopax, "p_id1", id="PEP_p_id1") biopax = addPhysicalEntity(biopax, class="protein", id="p_id2", NAME="protein2") biopax = addPhysicalEntityParticipant(biopax, "p_id2", id="PEP_p_id2") biopax = addBiochemicalReaction(biopax, LEFT=c("PEP_p_id1"), RIGHT=c("PEP_p_id2"), id="biochem_id_1") biopax = addPhysicalEntity(biopax, class="protein", id="p_id3", NAME="controllerProtein1") biopax = addPhysicalEntityParticipant(biopax, "p_id3", id="PEP_p_id3") biopax = addControl(biopax, CONTROL_TYPE="ACTIVATION", CONTROLLER="PEP_p_id3", CONTROLLED="biochem_id_1", id="c_id1") biopax = addPathway(biopax, NAME="mypathway1", PATHWAY_COMPONENTS=c("c_id1"), id="pw_id1") biopax$dt
This function adds pathway components to an existing pathway. Property PATHWAY-COMPONENTS are references to IDs of interaction/pathways/pathwaySteps (or subclasses of those)
addPathwayComponents(biopax, id, PATHWAY_COMPONENTS = c())
addPathwayComponents(biopax, id, PATHWAY_COMPONENTS = c())
biopax |
A biopax model |
id |
string. ID for the pathway |
PATHWAY_COMPONENTS |
character vector. IDs of the pathway components. This must be IDs of instances of type interaction/pathway/pathwayStep (or their subclasses). |
Returns the biopax model with the pathway components added to the pathway
fkramer
biopax = createBiopax(level=2) biopax = addPhysicalEntity(biopax, class="protein", id="p_id1", NAME="protein1") biopax = addPhysicalEntityParticipant(biopax, "p_id1", id="PEP_p_id1") biopax = addPhysicalEntity(biopax, class="protein", id="p_id2", NAME="protein2") biopax = addPhysicalEntityParticipant(biopax, "p_id2", id="PEP_p_id2") biopax = addBiochemicalReaction(biopax, LEFT=c("PEP_p_id1"), RIGHT=c("PEP_p_id2"), id="biochem_id_1") biopax = addPhysicalEntity(biopax, class="protein", id="p_id3", NAME="controllerProtein1") biopax = addPhysicalEntityParticipant(biopax, "p_id3", id="PEP_p_id3") biopax = addControl(biopax, CONTROL_TYPE="ACTIVATION", CONTROLLER="PEP_p_id3", CONTROLLED="biochem_id_1", id="c_id1") biopax = addPathway(biopax, NAME="mypathway1", PATHWAY_COMPONENTS=c(), id="pw_id1") biopax = addPathwayComponents(biopax, id="pw_id1", PATHWAY_COMPONENTS=c("c_id1")) biopax$dt
biopax = createBiopax(level=2) biopax = addPhysicalEntity(biopax, class="protein", id="p_id1", NAME="protein1") biopax = addPhysicalEntityParticipant(biopax, "p_id1", id="PEP_p_id1") biopax = addPhysicalEntity(biopax, class="protein", id="p_id2", NAME="protein2") biopax = addPhysicalEntityParticipant(biopax, "p_id2", id="PEP_p_id2") biopax = addBiochemicalReaction(biopax, LEFT=c("PEP_p_id1"), RIGHT=c("PEP_p_id2"), id="biochem_id_1") biopax = addPhysicalEntity(biopax, class="protein", id="p_id3", NAME="controllerProtein1") biopax = addPhysicalEntityParticipant(biopax, "p_id3", id="PEP_p_id3") biopax = addControl(biopax, CONTROL_TYPE="ACTIVATION", CONTROLLER="PEP_p_id3", CONTROLLED="biochem_id_1", id="c_id1") biopax = addPathway(biopax, NAME="mypathway1", PATHWAY_COMPONENTS=c(), id="pw_id1") biopax = addPathwayComponents(biopax, id="pw_id1", PATHWAY_COMPONENTS=c("c_id1")) biopax$dt
This function adds a new physical entity of chosen class to the biopax model. This is a convenience function to add physical entities, internally the function addBiopaxInstance is called with properties NAME and ORGANISM set.
addPhysicalEntity( biopax, class = c("dna", "rna", "protein", "smallMolecule", "complex")[1], NAME, id = NULL, ORGANISM = NULL, COMMENT = NULL )
addPhysicalEntity( biopax, class = c("dna", "rna", "protein", "smallMolecule", "complex")[1], NAME, id = NULL, ORGANISM = NULL, COMMENT = NULL )
biopax |
A biopax model |
class |
string. Class of the physical entity to add, choose from c("dna","rna","protein","smallMolecule","complex"). |
NAME |
string. Name of the new physical entity |
id |
string. ID for the physical entity. If NULL a new ID is generated with prefix "physicalEntity". |
ORGANISM |
string. Organism property of the molecule. optional. |
COMMENT |
string. An optional comment |
Returns the biopax model with the added physical entity.
fkramer
biopax = createBiopax(level=2) biopax = addBiopaxInstance(biopax, class="protein", id="id1", properties=list(NAME="protein1",COMMENT="this is my first protein!")) biopax$dt biopax = addPhysicalEntity(biopax, class="protein", id="id2", NAME="protein2", COMMENT="This is a protein added using the convenience function addPhysicalEntitiy") biopax$dt
biopax = createBiopax(level=2) biopax = addBiopaxInstance(biopax, class="protein", id="id1", properties=list(NAME="protein1",COMMENT="this is my first protein!")) biopax$dt biopax = addPhysicalEntity(biopax, class="protein", id="id2", NAME="protein2", COMMENT="This is a protein added using the convenience function addPhysicalEntitiy") biopax$dt
This function adds a new physical entity participant instance, which is a placeholder for physicalEntity class instances in interactions. This is a convenience function to add physicalEntityParticipant instances, internally the function addBiopaxInstance is called.
addPhysicalEntityParticipant(biopax, referencedPhysicalEntityID, id = NULL)
addPhysicalEntityParticipant(biopax, referencedPhysicalEntityID, id = NULL)
biopax |
A biopax model |
referencedPhysicalEntityID |
string. ID the new physicalEntity instance to reference here. |
id |
string. ID for the physical entity participant. If NULL a new ID is generated with prefix "physicalEntityParticipant". |
Returns the biopax model with the added physicalEntityParticipant.
fkramer
biopax = createBiopax(level=2) biopax = addPhysicalEntity(biopax, class="protein", id="p_id1", NAME="protein1") biopax = addPhysicalEntityParticipant(biopax, "p_id1", id="PEP_p_id1") biopax = addPhysicalEntity(biopax, class="protein", id="p_id2", NAME="protein2") biopax = addPhysicalEntityParticipant(biopax, "p_id2", id="PEP_p_id2") biopax = addBiochemicalReaction(biopax, LEFT=c("PEP_p_id1"), RIGHT=c("PEP_p_id2"), id="biochem_id1") biopax$dt
biopax = createBiopax(level=2) biopax = addPhysicalEntity(biopax, class="protein", id="p_id1", NAME="protein1") biopax = addPhysicalEntityParticipant(biopax, "p_id1", id="PEP_p_id1") biopax = addPhysicalEntity(biopax, class="protein", id="p_id2", NAME="protein2") biopax = addPhysicalEntityParticipant(biopax, "p_id2", id="PEP_p_id2") biopax = addBiochemicalReaction(biopax, LEFT=c("PEP_p_id1"), RIGHT=c("PEP_p_id2"), id="biochem_id1") biopax$dt
This function adds new properties to an existing biopax instance.
addPropertiesToBiopaxInstance(biopax, id, properties)
addPropertiesToBiopaxInstance(biopax, id, properties)
biopax |
A biopax model |
id |
string. ID of the instance |
properties |
named list of properties. |
Returns the supplied biopax model with new properties added to this instance.
Frank Kramer
biopax = createBiopax(level=2) biopax = addBiopaxInstance(biopax, class="protein", id="id1", properties=list(NAME="protein1",SYNONYMS="p1")) biopax$dt biopax = addPropertiesToBiopaxInstance(biopax, id="id1", properties=list(COMMENT="this is my first protein!")) biopax$dt
biopax = createBiopax(level=2) biopax = addBiopaxInstance(biopax, class="protein", id="id1", properties=list(NAME="protein1",SYNONYMS="p1")) biopax$dt biopax = addPropertiesToBiopaxInstance(biopax, id="id1", properties=list(COMMENT="this is my first protein!")) biopax$dt
A dataset containing two regulatory pathways encoded in Biopax Level 2 and parsed in via readBiopax().
Another dataset containing pathways encoded in Biopax Level 2 and parsed in via readBiopax().
An example biopax model parsed in via readBiopax.
An example biopax model parsed in via readBiopax.
data(biopaxexample) biopax data(biopaxLevel3Example) biopax
data(biopaxexample) biopax data(biopaxLevel3Example) biopax
This function calculates the overlap of supplied graph1 with graph2. Layout and weights of graph1 are kept.
calcGraphOverlap(graph1, graph2)
calcGraphOverlap(graph1, graph2)
graph1 |
graphNEL |
graph2 |
graphNEL |
Returns a list containing the compared graphs and edge- and node-wise overlap between them.
Frank Kramer
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph1 = pathway2RegulatoryGraph(biopax, pwid1) mygraph2 = pathway2RegulatoryGraph(biopax, pwid2) calcGraphOverlap(mygraph1,mygraph2)
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph1 = pathway2RegulatoryGraph(biopax, pwid1) mygraph2 = pathway2RegulatoryGraph(biopax, pwid2) calcGraphOverlap(mygraph1,mygraph2)
This function checks the supplied biopax model for validity, concerning classes, properties, etc. Not yet implemented. Called internally by writeBiopax.
checkValidity(biopax)
checkValidity(biopax)
biopax |
A biopax model |
logical. Returns TRUE is the biopax model is valid Biopax Level 2, or FALSE otherwise.
Frank Kramer
Class inheritance relationships in Biopax Level 2.
CLASS_INHERITANCE_BP2
CLASS_INHERITANCE_BP2
A data frame with 46 rows and 2 columns
A data.frame listing all direct superclasses for every Biopax Level 2 class. The variables are as follows:
class. Name of the class
superclass. Name of the superclass
Class inheritance relationships in Biopax Level 3.
CLASS_INHERITANCE_BP3
CLASS_INHERITANCE_BP3
A data frame with 46 rows and 2 columns
A data.frame listing all direct superclasses for every Biopax Level 3 class. The variables are as follows:
class. Name of the class
superclass. Name of the superclass
NOT UPDATED TO BP3 yet!
Class properties in Biopax Level 2.
CLASS_PROPERTIES_BP2
CLASS_PROPERTIES_BP2
A data frame with 106 rows and 4 columns
A data.frame listing all direct properties for every Biopax Level 2 class. Together with CLASS_INHERITANCE_BP2 this allows to list all properties, including the inherited ones, of every class.
The variables are as follows:
class. Name of the class
property. Name of the superclass
property_type.Type of the property, value or reference
cardinality. Maximum allowed cardinality of a property. Many properties may only be singular.
Class properties in Biopax Level 3.
CLASS_PROPERTIES_BP3
CLASS_PROPERTIES_BP3
A data frame with 106 rows and 4 columns
A data.frame listing all direct properties for every Biopax Level 3 class. Together with CLASS_INHERITANCE_BP3 this allows to list all properties, including the inherited ones, of every class.
The variables are as follows:
class. Name of the class
property. Name of the superclass
property_type.Type of the property, value or reference
cardinality. Maximum allowed cardinality of a property. Many properties may only be singular.
This function colors nodes of a graph, usually this is used to color subgraphs or add a color hue correlating with the expression level or fold change to the molecules.
colorGraphNodes(graph1, nodes, values, colors = c("greenred", "yellowred"))
colorGraphNodes(graph1, nodes, values, colors = c("greenred", "yellowred"))
graph1 |
graphNEL |
nodes |
vector of node names specifiying which nodes to color. must be same length as parameter foldChanges |
values |
vector of values indicating fold changes, gene expression values or similar. colors are mapped linearly over the range of these values |
colors |
string. either "greenred" or "yellowred", specifying which color gradient to use. |
Returns a graph with specified nodes colored according to the foldChanges
Frank Kramer
# load data and retrieve wnt pathway data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" mygraph1 = pathway2RegulatoryGraph(biopax, pwid1) mygraph1 = layoutRegulatoryGraph(mygraph1) # retrieve all nodes nodes = nodes(mygraph1) # random expression data for your nodes values = rnorm(length(nodes), mean=6, sd=2) # color nodes of the graph mygraph1 = colorGraphNodes(mygraph1, nodes, values, colors="greenred") # plot the now colored graph plotRegulatoryGraph(mygraph1, layoutGraph=FALSE)
# load data and retrieve wnt pathway data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" mygraph1 = pathway2RegulatoryGraph(biopax, pwid1) mygraph1 = layoutRegulatoryGraph(mygraph1) # retrieve all nodes nodes = nodes(mygraph1) # random expression data for your nodes values = rnorm(length(nodes), mean=6, sd=2) # color nodes of the graph mygraph1 = colorGraphNodes(mygraph1, nodes, values, colors="greenred") # plot the now colored graph plotRegulatoryGraph(mygraph1, layoutGraph=FALSE)
This gracefully combines nodes from a regulatory graph. This is basically a wrapper for graph::combineNodes(nodes, graph, newName, collapseFunction=max). If there are duplicated edges for the nodes, the maximum edgeweight will be used for the new connection.
combineNodes(nodes, graph, newName)
combineNodes(nodes, graph, newName)
nodes |
vector of node names specifiying which nodes to combine. |
graph |
graphNEL |
newName |
string. Name of the newly created node that will combine the specified nodes. |
Returns a graph with specified nodes removed.
Frank Kramer
# load data and retrieve wnt pathway data(biopaxexample)
# load data and retrieve wnt pathway data(biopaxexample)
This function creates a new Biopax model from scratch. This is not necessary if you want to parse a BioPAX export from a file, please see: readBiopax. Returns a biopax model, which is a list with named elements:
The data.frame representing the biopax in R
RDF Namespace
OWL Namespace
Biopax Namespace
NULL
createBiopax(level = 3)
createBiopax(level = 3)
level |
integer. Specifies the BioPAX level. |
A biopax model
Frank Kramer
biopax = createBiopax(level=2)
biopax = createBiopax(level=2)
Databases available for direct download via downloadBiopaxData
DATABASE_BIOPAX
DATABASE_BIOPAX
A data frame with 46 rows and 4 columns
A data.frame listing all available databases which can be directly downloaded (Homo Sapiens only) via function downloadBiopaxData. The variables are as follows:
database. Name of the database
model. Name of the ontology model
version. Biopax level
link. Link to the direct download
This function returns the different nodes and edges between graph1 and graph2. Layout options of graph1 are kept. Coloring currently not implemented.
diffGraphs(graph1, graph2, colorNodes = TRUE, colors = c("#B3E2CD", "#FDCDAC"))
diffGraphs(graph1, graph2, colorNodes = TRUE, colors = c("#B3E2CD", "#FDCDAC"))
graph1 |
graphNEL |
graph2 |
graphNEL |
colorNodes |
logical |
colors |
character vector of colors. If colorNodes==TRUE these colors are used for graph1 and graph2 respectivley. |
Return the diff between the graphs.
Frank Kramer
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph1 = pathway2RegulatoryGraph(biopax, pwid1) mygraph2 = pathway2RegulatoryGraph(biopax, pwid2) plotRegulatoryGraph(diffGraphs(mygraph1,mygraph2))
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph1 = pathway2RegulatoryGraph(biopax, pwid1) mygraph2 = pathway2RegulatoryGraph(biopax, pwid2) plotRegulatoryGraph(diffGraphs(mygraph1,mygraph2))
This function has an internal list of download links for some online databases. It will retrieve the selected model from the selected database using RCurl. The downloaded file is (if needed) unzipped and ready to be used as input for rBiopaxParser::readBiopax. This function requires package RCurl to run. You can easily skip this step by downloading the exported file yourself and continuing with readBiopax.
downloadBiopaxData( database = "NCI", model = c("pid", "biocarta", "reactome", "kegg"), outputfile = "", version = "biopax2" )
downloadBiopaxData( database = "NCI", model = c("pid", "biocarta", "reactome", "kegg"), outputfile = "", version = "biopax2" )
database |
string. Select which database you want to download from. Currently only NCI links have been stored. |
model |
string. Select which model/file you want to download. Currently NCI versions of the Pathway Interaction Database, Biocarta, Reactome and KEGG are linked. |
outputfile |
string. The file name to save the downloaded data in. If left empty the URL file name will be used. The unzipped file name can be different from this. Check the screen output of gunzip. |
version |
string. Select which Biopax Version you want to download. |
none. Check output for the name of the unzipped biopax .owl file.
fkramer
## Not run: file = downloadBiopaxData("NCI", "biocarta", version = "biopax2") ## Not run: biopax = readBiopax(file) ## Not run: biopax
## Not run: file = downloadBiopaxData("NCI", "biocarta", version = "biopax2") ## Not run: biopax = readBiopax(file) ## Not run: biopax
This function generates a new unique id for a biopax model. Pass it an startin g point like "pathway" or "protein" to get a niceer looking id.
generateNewUniqueID(biopax, id = "")
generateNewUniqueID(biopax, id = "")
biopax |
A biopax model |
id |
string. This is used as a prefix for the id. |
Returns an unused unique ID.
fkramer
This function returns the properties of the supplied biopax class. It always considers inhertance. Every class inhertis the properties of its super classes. A table listing all available properties and their cardinalities (for Biopax Level 2).
getClassProperties(classname, biopaxlevel = 3)
getClassProperties(classname, biopaxlevel = 3)
classname |
A string containing a class name |
biopaxlevel |
Numeric. Specifies the Biopax Level to use. |
Returns a data.frame containing the properties and cardinalities of the supplied class
Frank Kramer
getClassProperties("control")
getClassProperties("control")
This function returns the class name of the instance.
getInstanceClass(biopax, id)
getInstanceClass(biopax, id)
biopax |
A biopax model |
id |
string |
Returns the class name of the biopax instance.
fkramer
# load data data(biopaxexample) getInstanceClass(biopax, id="ex_m_100650")
# load data data(biopaxexample) getInstanceClass(biopax, id="ex_m_100650")
This function returns all properties of the specified type for an instance. By default this function returns the NAME property of an instance.
getInstanceProperty( biopax, id, property = "NAME", includeAllNames = TRUE, biopaxlevel = 3 )
getInstanceProperty( biopax, id, property = "NAME", includeAllNames = TRUE, biopaxlevel = 3 )
biopax |
A biopax model |
id |
string |
property |
string. |
includeAllNames |
logical. Biopax Level 3 brought 2 new name properties: displayName and standardName. Per default this return all names of an instance. Disable if you only want the NAME property. |
biopaxlevel |
integer. Set the biopax level here if you supply a data.table directly. |
Returns a character vector with all properties of the selected type for this instance. Returns NULL if no property data is found.
fkramer
# load data data(biopaxexample) getInstanceProperty(biopax, id="ex_m_100650", property="NAME") getInstanceProperty(biopax, id="ex_m_100650", property="ORGANISM") getInstanceProperty(biopax, id="ex_m_100650", property="COMPONENTS")
# load data data(biopaxexample) getInstanceProperty(biopax, id="ex_m_100650", property="NAME") getInstanceProperty(biopax, id="ex_m_100650", property="ORGANISM") getInstanceProperty(biopax, id="ex_m_100650", property="COMPONENTS")
This function searches the supplied biopax for interactions that are connected to the molecule or within 'depth' number of steps from it.
getNeighborhood(biopax, id, depth = 1, onlyInPathways = c(), biopaxlevel = 3)
getNeighborhood(biopax, id, depth = 1, onlyInPathways = c(), biopaxlevel = 3)
biopax |
A biopax model |
id |
string. ID of a physicalEntity (dna, rna, protein, complex, smallMolecule) |
depth |
integer. Search depth, this specifies how far out from the specified molecule the neighborhood should be streched. |
onlyInPathways |
character vector of pathway IDs. Search only in these pathways for neighbors. |
biopaxlevel |
integer. Set the biopax level here if you supply a data.table directly. |
Returns ids of interactions within 'depth' number of steps of the specified physicalEntity
fkramer
This function is used internally by pathway2Graph to obtain physical entities participating in an interaction.
getParticipants( pwComponentList, instance, biopaxlevel, splitComplexMolecules = FALSE, useIDasNodenames = TRUE )
getParticipants( pwComponentList, instance, biopaxlevel, splitComplexMolecules = FALSE, useIDasNodenames = TRUE )
pwComponentList |
List of pathway components |
instance |
Biopax instance id |
biopaxlevel |
integer. Set the biopax level here if you supply a data.table directly. |
splitComplexMolecules |
logical. If TRUE complexes are split up into their components and the annotation of the components is added. |
useIDasNodenames |
logical. If TRUE nodes of the graph are named by their molecule IDs instead of using the NAME property. This can help with badly annotated/formatted databases. |
Nirupama Benis
This function takes an id and a biopax model as input. The id of every instance that is referenced is returned. If recursive == TRUE this function recurses through all referenced IDs of the referenced instances and so on. "onlyFollowProperties" limits the recursivness to only certain properties, for example follow only complexes or physicalEntities.
getReferencedIDs(biopax, id, recursive = TRUE, onlyFollowProperties = c())
getReferencedIDs(biopax, id, recursive = TRUE, onlyFollowProperties = c())
biopax |
A biopax model OR a compatible data.table |
id |
string. ID of the instance |
recursive |
logical |
onlyFollowProperties |
character vector |
Returns a character vector of IDs referenced by the supplied id in the supplied biopax model.
Frank Kramer
# load data data(biopaxexample) listComplexComponents(biopax, id="ex_m_100650") getReferencedIDs(biopax, id="ex_m_100650", recursive=FALSE) getReferencedIDs(biopax, id="ex_m_100650", recursive=TRUE)
# load data data(biopaxexample) listComplexComponents(biopax, id="ex_m_100650") getReferencedIDs(biopax, id="ex_m_100650", recursive=FALSE) getReferencedIDs(biopax, id="ex_m_100650", recursive=TRUE)
This function takes an id and a biopax model as input. The id of every instance that references the supplied id is returned. If recursive == TRUE this function recurses through all referencing IDs of the referencing instances and so on. "onlyFollowProperties" limits the recursivness to only certain properties, for example follow only complexes or physicalEntities.
getReferencingIDs(biopax, id, recursive = TRUE, onlyFollowProperties = c())
getReferencingIDs(biopax, id, recursive = TRUE, onlyFollowProperties = c())
biopax |
A biopax model |
id |
string. ID of the instance |
recursive |
logical |
onlyFollowProperties |
character vector |
Returns a character vector of IDs referencing the supplied id in the supplied biopax model.
Frank Kramer
# load data data(biopaxexample) listComplexComponents(biopax, id="ex_m_100650") getReferencingIDs(biopax, id="ex_m_100650", recursive=FALSE) getReferencingIDs(biopax, id="ex_m_100650", recursive=TRUE)
# load data data(biopaxexample) listComplexComponents(biopax, id="ex_m_100650") getReferencingIDs(biopax, id="ex_m_100650", recursive=FALSE) getReferencingIDs(biopax, id="ex_m_100650", recursive=TRUE)
This function returns the subclasses of the supplied biopax class.
getSubClasses(classname, biopaxlevel = 3)
getSubClasses(classname, biopaxlevel = 3)
classname |
A string containing a class name |
biopaxlevel |
Numeric. Specifies the Biopax Level to use. |
Returns character vector containing the subclasses of the supplied class
Frank Kramer
getSubClasses("control")
getSubClasses("control")
This function returns the superclasses of the supplied biopax class.
getSuperClasses(classname, biopaxlevel = 3)
getSuperClasses(classname, biopaxlevel = 3)
classname |
A string containing a class name |
biopaxlevel |
Numeric. Specifies the Biopax Level to use. |
Returns character vector containing the superclasses of the supplied class
Frank Kramer
getSuperClasses("control")
getSuperClasses("control")
This function returns the annotations of the supplied IDs in a data.table.
getXrefAnnotations( biopax, id, splitComplexes = FALSE, followPhysicalEntityParticipants = TRUE, biopaxlevel = 3 )
getXrefAnnotations( biopax, id, splitComplexes = FALSE, followPhysicalEntityParticipants = TRUE, biopaxlevel = 3 )
biopax |
A biopax model |
id |
vector of strings. IDs of instances to get annotations |
splitComplexes |
logical. If TRUE complexes are split up into their components and the annotation of the components is added. |
followPhysicalEntityParticipants |
logical. If TRUE physicalEntityParticipants are resolved to their corresponding physicalEntities and their annotation is added. |
biopaxlevel |
integer. Set the biopax level here if you supply a data.table directly. |
Returns data.table with annotations
fkramer
# load data data(biopaxexample) # example of annotation for a protein: getXrefAnnotations(biopax, id="ex_m_100647") # no annotations for exactly the complex getXrefAnnotations(biopax, id="ex_m_100650") # split up the complex and get annotations for all the molecules involved getXrefAnnotations(biopax, id="ex_m_100650", splitComplexes=TRUE)
# load data data(biopaxexample) # example of annotation for a protein: getXrefAnnotations(biopax, id="ex_m_100647") # no annotations for exactly the complex getXrefAnnotations(biopax, id="ex_m_100650") # split up the complex and get annotations for all the molecules involved getXrefAnnotations(biopax, id="ex_m_100650", splitComplexes=TRUE)
Checks if instances in the biopax data.table have a given property
hasProperty(df, property)
hasProperty(df, property)
df |
A data.frame with biopax instances |
property |
A string containing the name of the property to check for |
Returns TRUE for every row in the data.frame with contains the supplied property. Logical vector with length corresponding to the number of rows in the data.frame.
Frank Kramer
# load data data(biopaxexample)
# load data data(biopaxexample)
This function checks the supplied arguments if they abid to the given restrictions
internal_checkArguments( args = c(), allowedValues = list(), allowNULL = FALSE, allowNA = FALSE, allowEmptyString = TRUE, allowInf = TRUE )
internal_checkArguments( args = c(), allowedValues = list(), allowNULL = FALSE, allowNA = FALSE, allowEmptyString = TRUE, allowInf = TRUE )
args |
The vector of arguments to check |
allowedValues |
A named list of values the argument of a this name is allowed to have |
allowNULL |
Logical, allow NULL or not |
allowNA |
Logical, allow NA or not |
allowEmptyString |
Logical, allow empty strings or not |
allowInf |
Logical, allow values of +/- infinity or not |
Returns 1 if all checks completed successfully, returns error message otherwise.
Frank Kramer
This function is used internally by writeBiopax. It can also be called directly with a fitting dataframe in list(df=data.frame()), but this will probably break things.
internal_generateXMLfromBiopax(biopax, namespaces = namespaces, verbose = TRUE)
internal_generateXMLfromBiopax(biopax, namespaces = namespaces, verbose = TRUE)
biopax |
A biopax model |
namespaces |
A list of namespaces to use for the generated XML/RDF file |
verbose |
logical |
Returns the xmlTree generated from the supplied biopax model.
Frank Kramer
This internal function parses the Biopax XML of the supplied biopax model and returns it in the data.frame format.
internal_getBiopaxModelAsDataFrame(biopax, biopaxxml, verbose = TRUE)
internal_getBiopaxModelAsDataFrame(biopax, biopaxxml, verbose = TRUE)
biopax |
A biopax object |
biopaxxml |
Biopax XML file read in. See parseBiopax |
verbose |
logical |
Returns the parsed biopax model in the internal data.frame format.
Frank Kramer
This function is an internal function to count the Number of nodes and child nodes of an XMLNode.
internal_NrOfXMLNodes(myXMLNode)
internal_NrOfXMLNodes(myXMLNode)
myXMLNode |
XMLNode to analyze |
This function returns the number of Nodes and child Nodes an XMLNode has.
Frank Kramer
Internal function to build a data.frame from the list of properties for a new instance
internal_propertyListToDF( class, id, properties, namespace_rdf = "rdf", biopaxlevel = 2 )
internal_propertyListToDF( class, id, properties, namespace_rdf = "rdf", biopaxlevel = 2 )
class |
string. Class name |
id |
string. ID of the instance |
properties |
named list of properties. |
namespace_rdf |
string. This defines the rdf namespace to use. |
biopaxlevel |
integer. This sets the version of BioPAX to generate, level 2 and level 3 are supported at the moment. |
Returns a data.frame with the new properties for the given instance
Frank Kramer
This function resolves physicalEntityParticipantIDs to their corresponding physicalEntityIDs. Every physicalEntityParticipant corresponds exactly to one physicalEntity.
internal_resolvePhysicalEntityParticipant(biopax, physicalEntityId)
internal_resolvePhysicalEntityParticipant(biopax, physicalEntityId)
biopax |
A biopax model |
physicalEntityId |
string. IDs of physicalEntityParticipants to be resolved |
Returns ids of physicalEntity corresponding to the specified physicalEntityParticipantIDs
fkramer
This function is an internal function that parses a Biopax XMLNode. Do not call it manually.
internal_XMLInstance2DF(myXMLNode, namespace_rdf, ret, rowcount)
internal_XMLInstance2DF(myXMLNode, namespace_rdf, ret, rowcount)
myXMLNode |
XMLNode |
namespace_rdf |
String specifying the namespace to use for rdf:resource and rdf:datatype |
ret |
data.table object contaning the already parsed data to attach this instance to |
rowcount |
Numeric specifying the row at which further parsed data is inserted into the data.table |
Returns a list contianing the new rowcount and the instance id of the added instance
Frank Kramer
This function returns a graph computed by the insection of supplied graph1 and graph2. Layout and weights of graph1 are kept.
intersectGraphs(graph1, graph2)
intersectGraphs(graph1, graph2)
graph1 |
graphNEL |
graph2 |
graphNEL |
Returns the intersection of graph1 and graph2.
Frank Kramer
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph1 = pathway2RegulatoryGraph(biopax, pwid1) mygraph2 = pathway2RegulatoryGraph(biopax, pwid2) plotRegulatoryGraph(intersectGraphs(mygraph1,mygraph2))
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph1 = pathway2RegulatoryGraph(biopax, pwid1) mygraph2 = pathway2RegulatoryGraph(biopax, pwid2) plotRegulatoryGraph(intersectGraphs(mygraph1,mygraph2))
This function checks if instances in the supplied biopax data.table are of a given class. If considerInheritance is set to TRUE it also checks if instances are of a given class or any of its inherited classes.
isOfClass(df, class, considerInheritance = FALSE, biopaxlevel = 2)
isOfClass(df, class, considerInheritance = FALSE, biopaxlevel = 2)
df |
A data.frame with biopax instances |
class |
A string containing the class name to check for |
considerInheritance |
Logical value indicating wether to consider inheritance or not |
biopaxlevel |
Numeric. Specifies the Biopax Level to use. |
Returns TRUE for every row in the data.frame which is of the supplied class
Frank Kramer
# load data data(biopaxexample)
# load data data(biopaxexample)
This function checks if the supplied input string starts with a supplied namespace tag
isOfNamespace(classname, namespace = "bp")
isOfNamespace(classname, namespace = "bp")
classname |
A string containing the classname to check |
namespace |
A string giving the namespace to check for |
This function returns TRUE if the supplied classname string is preceeded with the supplied namespace string, and FALSE if not.
Frank Kramer
This function checks if the supplied input string starts with "http:"
isURL(string)
isURL(string)
string |
A string containing the classname to check |
This function returns TRUE if the supplied classname string starts with "http:", and FALSE if not.
Frank Kramer
This function generates a (more or less) beautiful layout for a regulatory graph. Call this after you generated a graph with pathway2RegulatoryGraph. Since beauty is always in the eye of the beholder consider this a starting point for making your graphs even nicer. Rgraphviz with dot layout is used. Edges are green/red with normal/tee arrowheads for activations/inhibitions. If you want to specifically paint subgraphs in different colors use lists of vectors with node names for parameter subgraphs and vector of color names for subgraphs.color for your choice of color. The output can be further tweaked by setting layout options using nodeRenderInfo(mygraph) <- list() ... See the Rgraphviz and Graphviz documentations.
layoutRegulatoryGraph( mygraph, label = "", node.fixedsize = FALSE, edge.weights = c("green", "black", "red"), edge.arrowheads = c("normal", "tee"), subgraphs = list(), subgraphs.colors = c("#B3E2CD", "#FDCDAC", "#F4CAE4", "#E6F5C9", "#FFF2AE") )
layoutRegulatoryGraph( mygraph, label = "", node.fixedsize = FALSE, edge.weights = c("green", "black", "red"), edge.arrowheads = c("normal", "tee"), subgraphs = list(), subgraphs.colors = c("#B3E2CD", "#FDCDAC", "#F4CAE4", "#E6F5C9", "#FFF2AE") )
mygraph |
graphNEL |
label |
Label of the graph |
node.fixedsize |
logical. If font size is fixed or variable in regards to the nodes. |
edge.weights |
vector. which colors to use for weighted edges |
edge.arrowheads |
vector. which arrowheads to use for weighted edges |
subgraphs |
A list of character vectors with node names defining the sub graphs. |
subgraphs.colors |
vector. which colors to use for subgraphs |
Returns the supplied graph in a layouted form with several parameters set for regulatory graph plotting.
Frank Kramer
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph = pathway2RegulatoryGraph(biopax, pwid1) mygraph = layoutRegulatoryGraph(mygraph) plotRegulatoryGraph(mygraph)
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph = pathway2RegulatoryGraph(biopax, pwid1) mygraph = layoutRegulatoryGraph(mygraph) plotRegulatoryGraph(mygraph)
This function returns a (unique) data.frame listing all component IDs, names and classes of the supplied complex.
listComplexComponents(biopax, id, returnIDonly = FALSE, biopaxlevel = 3)
listComplexComponents(biopax, id, returnIDonly = FALSE, biopaxlevel = 3)
biopax |
A biopax model |
id |
string. A complex ID |
returnIDonly |
logical. If TRUE only IDs of the components are returned. This saves tiem for looking up names for every single ID. |
biopaxlevel |
integer. Set the biopax level here if you supply a data.table directly. |
data.frame
Frank Kramer
# load data data(biopaxexample) listComplexComponents(biopax, id="ex_m_100650")
# load data data(biopaxexample) listComplexComponents(biopax, id="ex_m_100650")
Lists all instances that conform to the selection criteria. In contrast to selectInstances this function returns an easier to read list. This function returns an ordered data.table of class, id and name of the instances. Selection criteria are wether instances belong to a certain class or have the specified id or name. Setting a criteria to NULL ignores this criteria. If includeSubClasses is set to TRUE the class criteria is broadened to include all classes that inherit from the given class, e.g. if class="control" and includeSubClasses=TRUE the function will select catalyses and modulations too, since they are a subclass of class control.
listInstances( biopax, id = NULL, class = NULL, name = NULL, includeSubClasses = FALSE, returnIDonly = FALSE, biopaxlevel = 3 )
listInstances( biopax, id = NULL, class = NULL, name = NULL, includeSubClasses = FALSE, returnIDonly = FALSE, biopaxlevel = 3 )
biopax |
A biopax model |
id |
string. ID of the instances to select |
class |
string. Class of the instances to select |
name |
string. Name of the instances to select |
includeSubClasses |
logical. If includeSubClasses is set to TRUE the class criteria is broadened to include all classes that inherit from the given class |
returnIDonly |
logical. If TRUE only IDs of the components are returned. This saves time for looking up names for every single ID. |
biopaxlevel |
integer. Set the biopax level here if you supply a data.table directly. |
Returns a data.frame containing all instances conforming to the given selection criteria. If returnIDonly=TRUE, only the selector for the internal data.table otherwise.
Frank Kramer
# load data data(biopaxexample) # list all instances of class "protein" listInstances(biopax, class="protein") # list all instances of class "pathway" listInstances(biopax, class="pathway") # list all interaction including all subclasses of interactions listInstances(biopax, class="interaction", includeSubClasses=TRUE)
# load data data(biopaxexample) # list all instances of class "protein" listInstances(biopax, class="protein") # list all instances of class "pathway" listInstances(biopax, class="pathway") # list all interaction including all subclasses of interactions listInstances(biopax, class="interaction", includeSubClasses=TRUE)
This function returns a (unique) data.frame listing IDs, names and classes of all components of the supplied interaction.
listInteractionComponents( biopax, id, splitComplexes = TRUE, returnIDonly = FALSE, biopaxlevel = 3 )
listInteractionComponents( biopax, id, splitComplexes = TRUE, returnIDonly = FALSE, biopaxlevel = 3 )
biopax |
A biopax model |
id |
string. A complex ID |
splitComplexes |
logical. If TRUE complexes are split up into their components and the added to the listing. |
returnIDonly |
logical. If TRUE only IDs of the components are returned. This saves tiem for looking up names for every single ID. |
biopaxlevel |
integer. Set the biopax level here if you supply a data.table directly. |
data.frame
Frank Kramer
# load data data(biopaxexample) listInteractionComponents(biopax, id="ex_i_100036_activator_1")
# load data data(biopaxexample) listInteractionComponents(biopax, id="ex_i_100036_activator_1")
This function returns a (unique) data.frame listing all component IDs, names and classes of the supplied pathway.
listPathwayComponents( biopax, id, includeSubPathways = TRUE, returnIDonly = FALSE, biopaxlevel = 3 )
listPathwayComponents( biopax, id, includeSubPathways = TRUE, returnIDonly = FALSE, biopaxlevel = 3 )
biopax |
A biopax model |
id |
string. A pathway ID |
includeSubPathways |
logical. If TRUE the returned list will include subpathways and pathwaysteps as well. |
returnIDonly |
logical. If TRUE only IDs of the components are returned. This saves tiem for looking up names for every single ID. |
biopaxlevel |
integer. Set the biopax level here if you supply a data.table directly. |
data.frame
Frank Kramer
# load data data(biopaxexample) listPathwayComponents(biopax, id="pid_p_100002_wntpathway")
# load data data(biopaxexample) listPathwayComponents(biopax, id="pid_p_100002_wntpathway")
This function returns a vector of all pathway ids.
listPathways(biopax, biopaxlevel = 3)
listPathways(biopax, biopaxlevel = 3)
biopax |
A biopax model |
biopaxlevel |
integer. Set the biopax level here if you supply a data.table directly. |
Returns a character vector containing the names of all pathways.
Frank Kramer
# load data data(biopaxexample) listPathways(biopax)
# load data data(biopaxexample) listPathways(biopax)
This function merges two given pathways and appends it to the supplied biopax model. The user has to specify a new name for the pathways and can supply ID, ORGANISM and COMMENT properties for the new pathway. If no ID is supplied, a new unique ID is generated. If no organism property is supplied the organism property of the first pathway is re-used. If ORGANISM is NULL the property is not set. Optionally a comment can be added to the pathway.
mergePathways( biopax, pwid1, pwid2, NAME, id = NULL, ORGANISM = "", COMMENT = NULL )
mergePathways( biopax, pwid1, pwid2, NAME, id = NULL, ORGANISM = "", COMMENT = NULL )
biopax |
A biopax model |
pwid1 |
string. ID of first pathway to merge |
pwid2 |
string. ID of second pathway to merge |
NAME |
string. Name of the new merged pathway |
id |
string. ID for the pathway. If NULL a new ID is generated with prefix "pathway". |
ORGANISM |
string. Organism property of the pathway. By default uses the same organism as the first supplied pathway. If NULL no organism property is set. |
COMMENT |
string. An optional comment |
A biopax model with the merged pathway added.
fkramer
This function generates an adjacency matrix from the activations/inhibitions of a pathway in a biopax model.
This function internally first calls pathway2RegulatoryGraph, then converts the regulatory graph to an adjacency matrix. See pathway2RegulatoryGraph for more details.
pathway2AdjacancyMatrix( biopax, pwid, expandSubpathways = TRUE, splitComplexMolecules = TRUE, useIDasNodenames = FALSE, verbose = TRUE )
pathway2AdjacancyMatrix( biopax, pwid, expandSubpathways = TRUE, splitComplexMolecules = TRUE, useIDasNodenames = FALSE, verbose = TRUE )
biopax |
A biopax model |
pwid |
string |
expandSubpathways |
logical. If TRUE subpathways are expanded into this graph, otherwise only this very pathway is used. |
splitComplexMolecules |
logical. If TRUE every complex is split up into its components. This leads to splitting a single node with name of the complex into several nodes with names of the components, these components all have identical edges. |
useIDasNodenames |
logical. If TRUE nodes of the graph are named by their molecule IDs instead of using the NAME property. This can help with badly annotated/formatted databases. |
verbose |
logical |
Returns the adjacency matrix representing the regulatory graph of the supplied pathway.
Frank Kramer
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" pathway2AdjacancyMatrix(biopax, pwid1)
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" pathway2AdjacancyMatrix(biopax, pwid1)
This function generates the gene set of a pathway.
This function generates a gene set of all physicalEntity's of a pathway. First all interactions of the pathway are retrieved and all components of these interactions are then listed.
pathway2Geneset(biopax, pwid, returnIDonly = FALSE, biopaxlevel = 3)
pathway2Geneset(biopax, pwid, returnIDonly = FALSE, biopaxlevel = 3)
biopax |
A biopax model |
pwid |
string |
returnIDonly |
logical. If TRUE only IDs of the components are returned. This saves tiem for looking up names for every single ID. |
biopaxlevel |
integer. Set the biopax level here if you supply a data.table directly. |
Returns the gene set of the supplied pathway. Returns NULL if the pathway has no components.
Frank Kramer
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pathway2Geneset(biopax, pwid=pwid1)
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pathway2Geneset(biopax, pwid=pwid1)
This function generates a directed graph from all the interactions of a specified pathway in a biopax model. Edges with no direction are indicated by a 0 weight.
pathway2Graph( biopax, pwid, expandSubpathways = TRUE, splitComplexMolecules = FALSE, useIDasNodenames = TRUE, verbose = FALSE, withDisconnectedParts = TRUE )
pathway2Graph( biopax, pwid, expandSubpathways = TRUE, splitComplexMolecules = FALSE, useIDasNodenames = TRUE, verbose = FALSE, withDisconnectedParts = TRUE )
biopax |
A biopax model |
pwid |
string |
expandSubpathways |
logical. If TRUE subpathways are expanded into this graph, otherwise only this very pathway is used. |
splitComplexMolecules |
logical. If TRUE every complex is split up into its components. This leads to splitting a single node with name of the complex into several nodes with names of the components, these components all have identical edges. Default value is FALSE |
useIDasNodenames |
logical. If TRUE nodes of the graph are named by their molecule IDs instead of using the NAME property. This can help with badly annotated/formatted databases. |
verbose |
logical |
withDisconnectedParts |
logical. If TRUE the pathway graph is returned as such, else only the largest connected component is given back |
Returns the a graph object of the specified pathway. Edges with no direction are indicated by a 0 weight.
Nirupama Benis
# load data data(biopaxLevel3Example) # location of the data pwid <- "Pathway1019" # build pathway using pathway2Graph pathwayAsGraph <- pathway2Graph(biopax = biopaxLevel3Example, pwid = pwid, splitComplexMolecules = FALSE, useIDasNodenames = TRUE, verbose = FALSE, withDisconnectedParts = TRUE) pathwayAsGraph # should have 23 nodes, 24 edges plotRegulatoryGraph(pathwayAsGraph) # build pathway discarding the disconnected parts of the graph pathwayAsGraph <- pathway2Graph(biopax = biopaxLevel3Example, pwid = pwid, splitComplexMolecules = FALSE, useIDasNodenames = TRUE, verbose = FALSE, withDisconnectedParts = FALSE) pathwayAsGraph # should have 10 nodes, 11 edges plotRegulatoryGraph(pathwayAsGraph)
# load data data(biopaxLevel3Example) # location of the data pwid <- "Pathway1019" # build pathway using pathway2Graph pathwayAsGraph <- pathway2Graph(biopax = biopaxLevel3Example, pwid = pwid, splitComplexMolecules = FALSE, useIDasNodenames = TRUE, verbose = FALSE, withDisconnectedParts = TRUE) pathwayAsGraph # should have 23 nodes, 24 edges plotRegulatoryGraph(pathwayAsGraph) # build pathway discarding the disconnected parts of the graph pathwayAsGraph <- pathway2Graph(biopax = biopaxLevel3Example, pwid = pwid, splitComplexMolecules = FALSE, useIDasNodenames = TRUE, verbose = FALSE, withDisconnectedParts = FALSE) pathwayAsGraph # should have 10 nodes, 11 edges plotRegulatoryGraph(pathwayAsGraph)
This function generates the regulatory graph from the activations/inhibitions of a pathway in a biopax model.
This functions builds a graph from the pathway components of the supplied pathway. Only instances of class 'control' are considered, this leads a functinal graph with all edges either representing activations or inhibitions. No transports, no translocation, etc. If desired complexes can be split up into several nodes, this can sometimes lead to a more complex and cluttered graph. There can not be multiple edges between 2 nodes. Whenever duplicated edges are generated (especially by splitting up complexes) a warning is thrown.
pathway2RegulatoryGraph( biopax, pwid, expandSubpathways = TRUE, splitComplexMolecules = TRUE, useIDasNodenames = FALSE, verbose = TRUE )
pathway2RegulatoryGraph( biopax, pwid, expandSubpathways = TRUE, splitComplexMolecules = TRUE, useIDasNodenames = FALSE, verbose = TRUE )
biopax |
A biopax model |
pwid |
string |
expandSubpathways |
logical. If TRUE subpathways are expanded into this graph, otherwise only this very pathway is used. |
splitComplexMolecules |
logical. If TRUE every complex is split up into its components. This leads to splitting a single node with name of the complex into several nodes with names of the components, these components all have identical edges. |
useIDasNodenames |
logical. If TRUE nodes of the graph are named by their molecule IDs instead of using the NAME property. This can help with badly annotated/formatted databases. |
verbose |
logical |
Returns the representing the regulatory graph of the supplied pathway in a node-edge-list graph.
Frank Kramer
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph = pathway2RegulatoryGraph(biopax, pwid1) plotRegulatoryGraph(mygraph)
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph = pathway2RegulatoryGraph(biopax, pwid1) plotRegulatoryGraph(mygraph)
This function takes a regulatory graph as generated by pathway2regulatoryGraph and plots it using standard layout options of layoutRegulatoryGraph. This function is a wrapper for layoutRegulatoryGraph with standard parameters. Subgraphs can be painted with different colors. This can be done by passing parameter subgraph a list of character vectors with node names.
plotRegulatoryGraph(mygraph, subgraphs = list(), layoutGraph = TRUE)
plotRegulatoryGraph(mygraph, subgraphs = list(), layoutGraph = TRUE)
mygraph |
graphNEL, regulatory graph |
subgraphs |
list of character vectors with node names |
layoutGraph |
logical. If FALSE the graph is not laid out again but send directly to Rgraphviz::renderGraph. |
none
Frank Kramer
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph = pathway2RegulatoryGraph(biopax, pwid1) plotRegulatoryGraph(mygraph)
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph = pathway2RegulatoryGraph(biopax, pwid1) plotRegulatoryGraph(mygraph)
Print a biopax object.
## S3 method for class 'biopax' print(x, ...)
## S3 method for class 'biopax' print(x, ...)
x |
A |
... |
Other arguments to be passed to |
data(biopaxexample) print(biopax)
data(biopaxexample) print(biopax)
This function reads in a Biopax .owl file and generates the internal data.frame format used in this package. This function can take a while with really big Biopax files like NCIs Pathway Interaction Database or Reactome. In almost every case this is your starting point. Returns a biopax model, which is a list with named elements:
The data.frame representing the biopax in R
RDF Namespace
OWL Namespace
Biopax Namespace
File name
readBiopax(file, verbose = TRUE)
readBiopax(file, verbose = TRUE)
file |
string. File name |
verbose |
logical. Output messages about how parsing is going and so on. |
A biopax model
Frank Kramer
## Not run: biopax = readBiopax(file="biopaxmodel.owl") ## Not run: biopax #' # load data and retrieve wnt pathway data(biopaxexample)
## Not run: biopax = readBiopax(file="biopaxmodel.owl") ## Not run: biopax #' # load data and retrieve wnt pathway data(biopaxexample)
This function is used internally by pathway2Graph to remove the smaller disconnected parts of the pathway graph.
removeDisconnectedParts(mygraph)
removeDisconnectedParts(mygraph)
mygraph |
a graph object |
Nirupama Benis
This function removes an instance from an existing biopax model.
removeInstance(biopax, id)
removeInstance(biopax, id)
biopax |
A biopax model |
id |
string. ID of the instance |
Returns the supplied biopax model with the instance removed from it.
Frank Kramer
# load data data(biopaxexample) biopax2 = removeInstance(biopax, 1)
# load data data(biopaxexample) biopax2 = removeInstance(biopax, 1)
This function gracefully removes nodes from a regulatory graph. If the node to be removed has both parent and child nodes, these are connected directly. The weight of the new direct edge is the product of multiplying the incomming and outgoing edge weights of the original node.
removeNodes(graph, nodes)
removeNodes(graph, nodes)
graph |
graphNEL |
nodes |
vector of node names specifiying which nodes to remove. |
Returns a graph with specified nodes removed.
Frank Kramer
# load data and retrieve wnt pathway data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" mygraph1 = pathway2RegulatoryGraph(biopax, pwid1) mygraph1 = layoutRegulatoryGraph(mygraph1) # retrieve all nodes nodes = nodes(mygraph1) # random expression data for your nodes values = rnorm(length(nodes), mean=6, sd=2) # color nodes of the graph mygraph1 = colorGraphNodes(mygraph1, nodes, values, colors="greenred") # plot the now colored graph plotRegulatoryGraph(mygraph1, layoutGraph=FALSE)
# load data and retrieve wnt pathway data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" mygraph1 = pathway2RegulatoryGraph(biopax, pwid1) mygraph1 = layoutRegulatoryGraph(mygraph1) # retrieve all nodes nodes = nodes(mygraph1) # random expression data for your nodes values = rnorm(length(nodes), mean=6, sd=2) # color nodes of the graph mygraph1 = colorGraphNodes(mygraph1, nodes, values, colors="greenred") # plot the now colored graph plotRegulatoryGraph(mygraph1, layoutGraph=FALSE)
This function removes a property fram an existing biopax instance.
removeProperties(biopax, id, properties)
removeProperties(biopax, id, properties)
biopax |
A biopax model |
id |
string. ID of the instance |
properties |
character vector. listing the properties to remove. |
Returns the supplied biopax model with properties removed from this instance.
Frank Kramer
# load data data(biopaxexample) biopax2 = removeProperties(biopax, 1, "name")
# load data data(biopaxexample) biopax2 = removeProperties(biopax, 1, "name")
Returns all instances that conform to the selection criteria. This function returns a subset of the internal data.table of the biopax object. Selection criteria are wether instances belong to a certain class or have the specified id, property or name. Setting a criteria to NULL ignores this criteria. If returnValues is set to FALSE only the selector (a logical vector with length of the internal data.table) is returned, otherwise the selected data is returned. If includeSubClasses is set to TRUE the class criteria is broadened to include all classes that inherit from the given class, e.g. if class="control" and includeSubClasses=TRUE the function will select catalyses and modulations too, since they are a subclass of class control. If includeReferencedInstances is set to TRUE all instances that are being referenced by the selected instances are being selected too. The parameter works recursively, this means for example that a selected pathway and all it's interactions, complexes, molecules and annotations are returned if this parameter is set to true. This parameter is especially helpful if you want to migrate or merge knowledge from different data bases.
selectInstances( biopax, id = NULL, class = NULL, property = NULL, name = NULL, returnValues = TRUE, includeSubClasses = FALSE, includeReferencedInstances = FALSE, returnCopy = TRUE, biopaxlevel = 3 )
selectInstances( biopax, id = NULL, class = NULL, property = NULL, name = NULL, returnValues = TRUE, includeSubClasses = FALSE, includeReferencedInstances = FALSE, returnCopy = TRUE, biopaxlevel = 3 )
biopax |
A biopax model or a compatible internal data.table |
id |
string. ID of the instances to select |
class |
string. Class of the instances to select |
property |
string. Return only this property of the instances |
name |
string. Name of the instances to select |
returnValues |
logical. If returnValues is set to FALSE only the selector (a logical vector with length of the internal data.table) is returned, otherwise the selected data is returned |
includeSubClasses |
logical. If includeSubClasses is set to TRUE the class criteria is broadened to include all classes that inherit from the given class |
includeReferencedInstances |
logical. If includeReferencedInstances is set to TRUE all instances that are being referenced by the selected instances are being selected too |
returnCopy |
logical. Defaults to TRUE. If TRUE a copy of the internal data.table is returned. If FALSE data is returned by reference. Set to FALSE to increase speed when only ever reading data. Make sure you understand the implications of using this! See vignette of data.table package. |
biopaxlevel |
integer. Set the biopax level here if you supply a data.table directly. |
Returns a data.table containing all instances conforming to the given selection criteria if returnValues=TRUE, only the selector for the internal data.table otherwise.
Frank Kramer
# load data data(biopaxexample) # select the subset of the internal data.table that belongs to class "protein" selectInstances(biopax, class="protein") # select the subset of the internal data.table that belongs to class "interaction" selectInstances(biopax, class="interaction") # select the subset of the internal data.table that belongs to class "interaction" or any of its sub classes, like control, catalysis etc. selectInstances(biopax, class="interaction", includeSubClasses=TRUE) # select the subset of the internal data.table that belongs to class "pathway" AND is a "NAME" property selectInstances(biopax, class="pathway", property="NAME")
# load data data(biopaxexample) # select the subset of the internal data.table that belongs to class "protein" selectInstances(biopax, class="protein") # select the subset of the internal data.table that belongs to class "interaction" selectInstances(biopax, class="interaction") # select the subset of the internal data.table that belongs to class "interaction" or any of its sub classes, like control, catalysis etc. selectInstances(biopax, class="interaction", includeSubClasses=TRUE) # select the subset of the internal data.table that belongs to class "pathway" AND is a "NAME" property selectInstances(biopax, class="pathway", property="NAME")
This function looks up the supplied Complex ID and returns the names of all its components.
splitComplex( biopax, complexid, recursive = TRUE, returnIDonly = FALSE, biopaxlevel = 3 )
splitComplex( biopax, complexid, recursive = TRUE, returnIDonly = FALSE, biopaxlevel = 3 )
biopax |
A biopax model |
complexid |
string ID of an complex |
recursive |
logical |
returnIDonly |
logical. If TRUE only IDs of the components are returned. This saves tiem for looking up names for every single ID. |
biopaxlevel |
integer. Set the biopax level here if you supply a data.table directly. |
Returns a character vector with the names of all subcomponents.
Frank Kramer
# load data data(biopaxexample) selectInstances(biopax, id="ex_m_100650") listInstances(biopax, id="ex_m_100650") listComplexComponents(biopax, id="ex_m_100650") splitComplex(biopax, complexid="ex_m_100650")
# load data data(biopaxexample) selectInstances(biopax, id="ex_m_100650") listInstances(biopax, id="ex_m_100650") listComplexComponents(biopax, id="ex_m_100650") splitComplex(biopax, complexid="ex_m_100650")
Strips a hash in front of a string
striphash(x)
striphash(x)
x |
A string to be stripped off a preceeeding hash |
The supplied string with a hash "#" stripped off front.
Frank Kramer
Strips a namespace tag off a supplied classname string
stripns(classname)
stripns(classname)
classname |
A string containing a classname preceeded by a namespace tag |
The classname with the namespace tag stripped off it.
Frank Kramer
This function generates the transitive closure of the supplied graph. In short: if A->B->C then an edge A->C is added. Edge weights are conserved if possible (in a hopefully smart way). This is a simple convenience wrapper for the RBGL function transitive.closure.
transitiveClosure(mygraph)
transitiveClosure(mygraph)
mygraph |
graphNEL |
Returns the transitive closure of the supplied graph.
Frank Kramer
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph = pathway2RegulatoryGraph(biopax, pwid1) tc = transitiveClosure(mygraph)
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph = pathway2RegulatoryGraph(biopax, pwid1) tc = transitiveClosure(mygraph)
This function is deprecated due to nem dropping out of Bioconductor in BioC 4.0. This function generates the transitive reduction of the supplied graph. In short: if A->B->C AND A->C then edge A->C is removed. This is a simple convenience wrapper for the NEM function transitive.reduction. Be aware of implications on the edge weights!
transitiveReduction(mygraph)
transitiveReduction(mygraph)
mygraph |
graphNEL |
Returns the transitive reduction of the supplied graph.
Frank Kramer
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph = pathway2RegulatoryGraph(biopax, pwid1) tr = transitiveReduction(mygraph)
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph = pathway2RegulatoryGraph(biopax, pwid1) tr = transitiveReduction(mygraph)
This function takes a data.frame as argument and returns it with strings instead of factors.
unfactorize(df)
unfactorize(df)
df |
any data.frame with factor levels in at least one column |
The data.frame is returned using strings instead of factors.
Frank Kramer
This function unites the two supplied graphs. Layout parameters from graph1 are used. If colorNodes==TRUE the returned graph has different colors for overlapping nodes and nodes individual for each graph.
uniteGraphs( graph1, graph2, colorNodes = TRUE, colors = c("#B3E2CD", "#FDCDAC", "#F4CAE4") )
uniteGraphs( graph1, graph2, colorNodes = TRUE, colors = c("#B3E2CD", "#FDCDAC", "#F4CAE4") )
graph1 |
graphNEL |
graph2 |
graphNEL |
colorNodes |
logical |
colors |
colors character vector of colors. If colorNodes==TRUE these colors are used for graph1 and graph2 respectivley. |
Return a graph generated by uniting the two supplied graphs
Frank Kramer
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph1 = pathway2RegulatoryGraph(biopax, pwid1) mygraph2 = pathway2RegulatoryGraph(biopax, pwid2) plotRegulatoryGraph(uniteGraphs(mygraph1,mygraph2))
# load data data(biopaxexample) pwid1 = "pid_p_100002_wntpathway" pwid2 = "pid_p_100146_hespathway" mygraph1 = pathway2RegulatoryGraph(biopax, pwid1) mygraph2 = pathway2RegulatoryGraph(biopax, pwid2) plotRegulatoryGraph(uniteGraphs(mygraph1,mygraph2))
This function writes out a biopax model, as generated by readBiopax, to either a file or returns the xmlTree if file is omitted.
writeBiopax( biopax, file = "", verbose = TRUE, overwrite = FALSE, namespaces = list(rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#", bp = "http://www.biopax.org/release/biopax-level2.owl#", rdfs = "http://www.w3.org/2000/01/rdf-schema#", owl = "http://www.w3.org/2002/07/owl#", xsd = "http://www.w3.org/2001/XMLSchema#") )
writeBiopax( biopax, file = "", verbose = TRUE, overwrite = FALSE, namespaces = list(rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#", bp = "http://www.biopax.org/release/biopax-level2.owl#", rdfs = "http://www.w3.org/2000/01/rdf-schema#", owl = "http://www.w3.org/2002/07/owl#", xsd = "http://www.w3.org/2001/XMLSchema#") )
biopax |
A biopax model as generated by readBiopax |
file |
A string giving a file name. |
verbose |
logical |
overwrite |
logical, if TRUE an already existing file will be overwritten, otherwise an error is thrown |
namespaces |
A list of namespaces to use for the generated XML/RDF file |
Returns the xmlTree object generated from the biopax model. If a filename is supplied the XML is written to this file.
Frank Kramer
# load data data(biopax2example) ## Not run: writeBiopax(biopax, file="mybiopax.owl")
# load data data(biopax2example) ## Not run: writeBiopax(biopax, file="mybiopax.owl")