[BioC] how to make line graph
James W. MacDonald
jmacdon at uw.edu
Mon Mar 5 15:39:51 CET 2012
Hi Dana,
What you want to do isn't that difficult. A cursory glance at the
available BioC packages didn't come up with any existing package (how
did you do the original WGCNA? Does that package not have plotting
facilities?).
Anyway, the plots you point to are simply line plots of z-scores vs
factor levels. So assuming you have replication, you need to first
compute z-scores for each of your factor levels. I usually use tapply()
for that sort of task, although you could also use by(). Something like
zscores <- do.call("cbind", tapply(1:ncol(exprs(eset)), factors,
function(x) rowMeans(exprs(eset)[,x])/apply(exprs(eset)[,x], 1, sd)))
Where eset is your subsetted ExpressionSet, and factors is the factor
levels of interest (e.g., in figure 1, this would be the panicle or seed
types). This will give you a matrix where the columns are the z-scores
for each factor level, and the rows will be the genes in your modules.
You can then use matplot() to plot them all (note here that matplot()
wants to plot by column, so we have to transpose).
matplot(t(zscores), factors, type = "l", col = "grey", lty = 1)
That should give you enough to get started.
Best,
Jim
On 3/5/2012 9:13 AM, Dana.Stanley at csiro.au wrote:
> Thanks Jim!!!
>
> I have a list of genes that follow specific pattern coming from co-expressed network module I did in WGCNA. I subsetted the original eset to contain only genes from my modules of interest and now I want to see the pattern of expression of the genes from each subset across all of my samples (1040 arrays) as a line graph. I want to show how they always "move together" across over a 1000 samples and make distinct pattern of expression. I expect all genes to overlap in expression so I should see a stream of genes moving across the samples and I should see two streams of genes; positively coexpressed and negatively coexpressed should move in the opposite direction like a mirror image of one another. I have done other plots like heatmap but the line graph is the best for this kind of module pattern comparisons... I tried to use plot(x, y) but I do not know how to specify that my x is all of the samples from Eset and y is all expression values of the all genes. If I could find an example in literature or just the name of the package to use I could work it out. The good example of what I want is in http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3142134/?tool=pubmed figures 1 and 2.
> Thanks
> Dana
>
>
> -----Original Message-----
> From: James W. MacDonald [mailto:jmacdon at uw.edu]
> Sent: Monday, March 05, 2012 11:53 PM
> To: Stanley, Dana (LI, Geelong AAHL)
> Cc: bioconductor at r-project.org
> Subject: Re: [BioC] how to make line graph
>
> Hi Dana,
>
> On 3/1/2012 6:21 PM, Dana.Stanley at csiro.au wrote:
>> Dear All
>>
>> I am trying to make a nice line chart using subset of my eset. I have been trying all night but I did not get very far, it does not seem to be as popular as other charts in Bioconductor literature. I just could not find any examples. Can anyone help me with this? Which package to use and sample code would be great.
> You need to give us more to go on. What exactly are you trying to do?
> What have you tried? What sort of errors or unexpected results did you get? Try to think about your question from the point of view of someone who has no idea what you are trying to accomplish, and go from there.
>
> Best,
>
> Jim
>
>
>> Thanks
>> Dana
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives:
>> http://news.gmane.org/gmane.science.biology.informatics.conductor
> --
> James W. MacDonald, M.S.
> Biostatistician
> University of Washington
> Environmental and Occupational Health Sciences
> 4225 Roosevelt Way NE, # 100
> Seattle WA 98105-6099
>
--
James W. MacDonald, M.S.
Biostatistician
University of Washington
Environmental and Occupational Health Sciences
4225 Roosevelt Way NE, # 100
Seattle WA 98105-6099
More information about the Bioconductor
mailing list