Search
Question: how to make line graph
0
gravatar for Dana.Stanley@csiro.au
5.7 years ago by
Dana.Stanley@csiro.au110 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. Thanks Dana [[alternative HTML version deleted]]
ADD COMMENTlink modified 5.7 years ago • written 5.7 years ago by Dana.Stanley@csiro.au110
0
gravatar for James W. MacDonald
5.7 years ago by
United States
James W. MacDonald45k wrote:
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
ADD COMMENTlink written 5.7 years ago by James W. MacDonald45k
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@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
ADD REPLYlink written 5.7 years ago by Dana.Stanley@csiro.au110
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
ADD REPLYlink written 5.7 years ago by James W. MacDonald45k
Thank you both James and Benilton!!! I finally have a graph in front of me... Thanks!!! -----Original Message----- From: James W. MacDonald [mailto:jmacdon@uw.edu] Sent: Tuesday, March 06, 2012 12:40 AM To: Stanley, Dana (LI, Geelong AAHL) Cc: bioconductor at r-project.org Subject: Re: [BioC] how to make line graph 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
ADD REPLYlink written 5.7 years ago by Dana.Stanley@csiro.au110
On 05.03.2012 14:13, 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 Hi Dana Does this example code represent something like what you're after? m = matrix(rnorm(1000),ncol=10) plot(1:10,m[1,],type="l",ylim=c(-2,2),xlab="Samples",ylab="Expression" ) for(i in 2:100){ lines(1:10,m[i,]) } I know the mfuzz package produces similar plots, but I don't think it's a general solution.Also, in my experience you will often want to scale the expression values first in some way, depending on the patterns you are seeing. Alex Gutteridge > > -----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 > > _______________________________________________ > 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 -- Alex Gutteridge
ADD REPLYlink written 5.7 years ago by Alex Gutteridge650
Those plots can be generated with something like the below: x <- 1:50 ## these would be your genes set.seed(1) y <- matrix(rnorm(1e4), nc=200) ## this would be your gene expr matrix col <- rgb(190, 190, 190, alpha=60, maxColorValue=255) matplot(x, y, type='l', col=col) or even: library(MASS) parcoord(t(y), col=col) b On 5 March 2012 14:13, <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 > > _______________________________________________ > 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
ADD REPLYlink written 5.7 years ago by Benilton Carvalho4.2k
0
gravatar for Dana.Stanley@csiro.au
5.7 years ago by
Dana.Stanley@csiro.au110 wrote:
Thanks Alex G! Yes, that works as well. WGCNA package offers a number of good plots but not this one. Thanks to all for help!!! Dana [[alternative HTML version deleted]]
ADD COMMENTlink written 5.7 years ago by Dana.Stanley@csiro.au110
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 157 users visited in the last hour