Last data update: 2014.03.03

R: plot_pathway
plot_pathwayR Documentation

plot_pathway

Description

A wrapper for function download_KEGGfile, parse_XMLfile and plot_profile

Usage

plot_pathway(gene_expr, line_col, groups, pathway_id = "00010",
  species = "hsa", pathway_min = 5, database_dir = getwd(),
  speciesRefMap = TRUE, ...)

Arguments

gene_expr

the matrix for gene expression, row.names should be NCBI gene ID, such as 67040, 93683

line_col

line color for expression in different samples in the pathway map, valid when type='lines'

groups

a character used to indicate expression values from different types of samples

pathway_id

the KEGG pathway id, such as '00010'

species

the species id in KEGG database, 'hsa' means human, 'mmu' means mouse, 'rno' means rat, etc

pathway_min

The pathways with number of annotated genes less than pathway_min would be ignored

database_dir

the directory where the XML files and png files are located

speciesRefMap

Logical, use the species specific figure as reference map. if set as FALSE, the reference pathway figure without species information will be used

...

any other Arguments for function plot_profile

Details

This wrapper function is developed to make the visualization process more easier. Firstly the existence of XML file and png file would be checked, if not, the download_KEGGfile function would be used to download the files. Then the parse_XMLfile function would be used to parse the XML file. At last the plot_profile function would be used to generate the pathway map.

See Also

download_KEGGfile, parse_XMLfile, plot_profile

Examples

data(pro_pho_expr)
data(pho_sites_count)
#type='lines'
col<-col_by_value(pho_sites_count,col=colorRampPalette(c('white','khaki2'))(4),breaks=c(0,1,4,10,Inf))
temp<-plot_pathway(pro_pho_expr,bg_col=col,line_col=c("brown1","seagreen3"),groups=c(rep("Proteome ",6),rep("Phosphoproteome ",6)),magnify=1.2,species='hsa',database_dir=system.file("extdata",package="KEGGprofile"),pathway_id="04110",max_dist=5)
#type='bg'
pho_expr<-pro_pho_expr[,7:12]
temp<-apply(pho_expr,1,function(x) length(which(is.na(x))))
pho_expr<-pho_expr[which(temp==0),]
col<-col_by_value(pho_expr,col=colorRampPalette(c('green','black','red'))(1024),range=c(-6,6))
temp<-plot_pathway(pho_expr,type="bg",bg_col=col,text_col="white",magnify=1.2,species='hsa',database_dir=system.file("extdata",package="KEGGprofile"),pathway_id="04110")
#Compound and gene data
set.seed(124)
testData1<-rbind(rnorm(6),rnorm(6),rnorm(6),rnorm(6),rnorm(6),rnorm(6),rnorm(6),rnorm(6))
row.names(testData1)<-c("4967","55753","1743","8802","47","50","cpd:C15972","cpd:C16255")
colnames(testData1)<-c("Control0","Control2","Control5","Sample0","Sample2","Sample5")
temp<-plot_pathway(testData1,type="lines",line_col=c("brown1","seagreen3"),groups=c(rep("Control",3),rep("Sample",3)),magnify=1.2,species='hsa',database_dir=system.file("extdata",package="KEGGprofile"),pathway_id="00020",max_dist=2)
testData2<-testData1[,4:6]-testData1[,1:3]
col<-col_by_value(testData2,col=colorRampPalette(c('green','black','red'))(1024),range=c(-2,2))
temp<-plot_pathway(testData2,type="bg",bg_col=col,text_col="white",magnify=1.2,species='hsa',database_dir=system.file("extdata",package="KEGGprofile"),pathway_id="00020")

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(KEGGprofile)

KEGG.db contains mappings based on older data because the original
  resource was removed from the the public domain before the most
  recent update was produced. This package should now be considered
  deprecated and future versions of Bioconductor may not have it
  available.  Users who want more current data are encouraged to look
  at the KEGGREST or reactome.db packages

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/KEGGprofile/plot_pathway.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plot_pathway
> ### Title: plot_pathway
> ### Aliases: plot_pathway
> 
> ### ** Examples
> 
> data(pro_pho_expr)
> data(pho_sites_count)
> #type='lines'
> col<-col_by_value(pho_sites_count,col=colorRampPalette(c('white','khaki2'))(4),breaks=c(0,1,4,10,Inf))
> temp<-plot_pathway(pro_pho_expr,bg_col=col,line_col=c("brown1","seagreen3"),groups=c(rep("Proteome ",6),rep("Phosphoproteome ",6)),magnify=1.2,species='hsa',database_dir=system.file("extdata",package="KEGGprofile"),pathway_id="04110",max_dist=5)
[1] "Downloading files: 1/1"
trying URL 'http://www.genome.jp/kegg-bin/download?entry=hsa04110&format=kgml'
Content type 'text/xml' length unknown
.......... .......... .......... .......... ....
downloaded 44 KB

trying URL 'http://www.genome.jp/kegg/pathway/hsa/hsa04110.png'
Content type 'image/png' length 32599 bytes (31 KB)
==================================================
downloaded 31 KB

trying URL 'http://www.genome.jp/kegg/pathway/map/map04110.png'
Content type 'image/png' length 30938 bytes (30 KB)
==================================================
downloaded 30 KB

[1] "The figure was generated in hsa04110_profile_lines.png"
> #type='bg'
> pho_expr<-pro_pho_expr[,7:12]
> temp<-apply(pho_expr,1,function(x) length(which(is.na(x))))
> pho_expr<-pho_expr[which(temp==0),]
> col<-col_by_value(pho_expr,col=colorRampPalette(c('green','black','red'))(1024),range=c(-6,6))
> temp<-plot_pathway(pho_expr,type="bg",bg_col=col,text_col="white",magnify=1.2,species='hsa',database_dir=system.file("extdata",package="KEGGprofile"),pathway_id="04110")
[1] "The figure was generated in hsa04110_profile_bg.png"
> #Compound and gene data
> set.seed(124)
> testData1<-rbind(rnorm(6),rnorm(6),rnorm(6),rnorm(6),rnorm(6),rnorm(6),rnorm(6),rnorm(6))
> row.names(testData1)<-c("4967","55753","1743","8802","47","50","cpd:C15972","cpd:C16255")
> colnames(testData1)<-c("Control0","Control2","Control5","Sample0","Sample2","Sample5")
> temp<-plot_pathway(testData1,type="lines",line_col=c("brown1","seagreen3"),groups=c(rep("Control",3),rep("Sample",3)),magnify=1.2,species='hsa',database_dir=system.file("extdata",package="KEGGprofile"),pathway_id="00020",max_dist=2)
[1] "Downloading files: 1/1"
trying URL 'http://www.genome.jp/kegg-bin/download?entry=hsa00020&format=kgml'
Content type 'text/xml' length unknown
.......... .......... .......... ....
downloaded 34 KB

trying URL 'http://www.genome.jp/kegg/pathway/hsa/hsa00020.png'
Content type 'image/png' length 25459 bytes (24 KB)
==================================================
downloaded 24 KB

trying URL 'http://www.genome.jp/kegg/pathway/map/map00020.png'
Content type 'image/png' length 24592 bytes (24 KB)
==================================================
downloaded 24 KB

[1] "The figure was generated in hsa00020_profile_lines.png"
> testData2<-testData1[,4:6]-testData1[,1:3]
> col<-col_by_value(testData2,col=colorRampPalette(c('green','black','red'))(1024),range=c(-2,2))
> temp<-plot_pathway(testData2,type="bg",bg_col=col,text_col="white",magnify=1.2,species='hsa',database_dir=system.file("extdata",package="KEGGprofile"),pathway_id="00020")
[1] "The figure was generated in hsa00020_profile_bg.png"
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>