[BioC] parsing discrete colors in pathview KEGG
Luo Weijun
luo_weijun at yahoo.com
Sat Mar 1 03:00:10 CET 2014
Currently, Pathview does not provide a single function for your particular analysis. But you can make use of the individual module functions in Pathview package to get your job done. First, make sure you update your pathview to the latest version (1.2.3). Below is an example based on what you described: multiple columns, 1 color for each column. You may also specify colors for individual nodes directly this way. Note that we do not plot the color key for such data at this time. HTH.
library(pathview)
#simulate data first, gene hits are 1's, others are NA's
gnames <- sim.mol.data(nmol = 10000, discrete=T)
gdata=matrix(NA, ncol=4, nrow=10000)
rownames(gdata)=gnames
idx1=sample(1:10000, 4000)
idx2=sample(1:10000, 4000)
idx3=sample(1:10000, 4000)
idx4=sample(1:10000, 4000)
gdata[idx1,1]=1
gdata[idx2,2]=1
gdata[idx3,3]=1
gdata[idx4,4]=1
#donwload, parse and map your data
download.kegg(pathway.id="04110")
xml.file="hsa04110.xml"
node.data=node.info(xml.file)
names(node.data)
plot.data.gene=node.map(mol.data=gdata, node.data, node.types="gene")
head(plot.data.gene)
#generate and customize node colors
cols.ts.gene=node.color(plot.data.gene, limit=2, bins=4)
head(cols.ts.gene)
cols=rainbow(4)
bg.col="#FFFFFF"
for(i in 1:4){
cols.ts.gene[cols.ts.gene[,i]!=bg.col,i]=cols[i]
}
#KEGG view
pv.pars= keggview.native(plot.data.gene=plot.data.gene,
cols.ts.gene=cols.ts.gene, node.data=node.data, pathway.name="hsa04110",
same.layer=T, plot.col.key=F, out.suffix = "custom.4cols")
--------------------------------------------
On Tue, 2/25/14, Simran Azariah wrote:
Hi Luo,
I want to map some TF enrichment data for each gene in a KEGG pathway. I am able to compartmentalize the gene boxes by using the multi.state parameter. I have been trying to pass a discrete set of colors for each representation.
Is there a way we could parse a color in mol.col column for each corresponding mol.data column.
I want to show multiple TF for each gene in different colors on the KEGG pathway.
I’ll be extremely grateful if you could guide me on this
regards,
Solomon Azariah
Programmer/Analyst
Geschwind lab
Department of Neurology
David Geffen School of Medicine
UCLA
More information about the Bioconductor
mailing list