Last data update: 2014.03.03

R: Function to coerce an adjacency matrix to a Pathway
AdjacencyMatrix2PathwayR Documentation

Function to coerce an adjacency matrix to a Pathway

Description

The function coerces an adjacency matrix to a Pathway. Two types of matrices are allowed. The first one, where 1 denotes an edge between two nodes and 0 otherwise. This matrix is coerced into a simply pathway were type of all edges is set to "process". The second type of adjacency matrix contains: 1 for an activation, -1 for an inhibition and 0 otherwise (=no edge between two nodes). In this case, activations are set to "process(activation)" and inhibition to "process(inhibition)". The symetricity of the matrix is used to decide between directed and undirected graph. Symmetric matrix is expected for undirected graph and only the lower triangle of the matrix is used to extract the edges of the graph.

Usage

AdjacencyMatrix2Pathway(adjmat, name = "pathway", ident = "unknown", database = "unknown", species = "unknown", date = NULL)

Arguments

adjmat

An adjacency matrix describing the pathway topology

name

A character, name of the pathway. Defaults to "pathway"

ident

A character, type of the identificators, e.g "gene symbol"

database

A character, the name of the database the topology comes from

species

A character, the species to which the topology belong

date

A date, the date the topology was created

Value

An object of class Pathway, id is the same as title - name of the pathway

Author(s)

Ivana Ihnatova

Examples

genes<-paste("gene", 1:10, sep="")
adjmat<-matrix(sample(c(0,0,0,0,1), 100, TRUE),10,10, dimnames=list(genes,genes))
p<-AdjacencyMatrix2Pathway(adjmat)
head(edges(p))

adjmat<-matrix(sample(c(0,0,0,0,1,-1), 100, TRUE),10,10, dimnames=list(genes,genes))
p<-AdjacencyMatrix2Pathway(adjmat)
head(edges(p))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ToPASeq)
Loading required package: graphite
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: gRbase
Loading required package: graph
Loading required package: locfit
locfit 1.5-9.1 	 2013-03-22
Loading required package: Rgraphviz
Loading required package: grid
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/ToPASeq/AdjacencyMatrix2Pathway.Rd_%03d_medium.png", width=480, height=480)
> ### Name: AdjacencyMatrix2Pathway
> ### Title: Function to coerce an adjacency matrix to a Pathway
> ### Aliases: AdjacencyMatrix2Pathway
> ### Keywords: manip
> 
> ### ** Examples
> 
> genes<-paste("gene", 1:10, sep="")
> adjmat<-matrix(sample(c(0,0,0,0,1), 100, TRUE),10,10, dimnames=list(genes,genes))
> p<-AdjacencyMatrix2Pathway(adjmat)
> head(edges(p))
     src  dest  direction    type
1  gene4 gene1 undirected process
2  gene2 gene2 undirected process
3  gene9 gene2 undirected process
4 gene10 gene2 undirected process
5  gene5 gene3 undirected process
6  gene7 gene3 undirected process
> 
> adjmat<-matrix(sample(c(0,0,0,0,1,-1), 100, TRUE),10,10, dimnames=list(genes,genes))
> p<-AdjacencyMatrix2Pathway(adjmat)
> head(edges(p))
    src  dest direction                type
1 gene7 gene1  directed process(activation)
2 gene4 gene4  directed process(activation)
3 gene5 gene4  directed process(activation)
4 gene8 gene4  directed process(activation)
5 gene4 gene5  directed process(activation)
6 gene8 gene5  directed process(activation)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>