Question: heatmap.2 ..help..how to cluster column ..but not Rows..
0
gravatar for SAURIN
8.2 years ago by
SAURIN1.1k
SAURIN1.1k wrote:
Hi BioC, This must be simple but somehow I can not be able to do it... How can I cluster samples only.. below code is giving me dendrogram on both rows and clumns...! if I do Rowv = FALSE..then I don't see any colors and KEY. Please see this: FeatureX is Matrix with proper rows and colmns. row.dist <- as.dist(1 - cor(t(FeatureX))); col.dist <- as.dist(1 - cor(FeatureX)); heatmap.2(FeatureX,col=bluered,Colv = as.dendrogram(hclust(col.dist, method = "centroid")), scale = "none",key = TRUE,density.info = "none",tracecol="black"); Thank you in advance, Saurin
• 6.4k views
ADD COMMENTlink modified 8.2 years ago • written 8.2 years ago by SAURIN1.1k
Answer: heatmap.2 ..help..how to cluster column ..but not Rows..
0
gravatar for SAURIN
8.2 years ago by
SAURIN1.1k
SAURIN1.1k wrote:
Hi Jason, I tried Rowv = "none" heatmap.2(FeatureX,col=bluered,Colv = as.dendrogram(hclust(col.dist, method = "centroid")), scale = "none",key = TRUE, Rowv = "none", density.info = "none",tracecol="black"); Warning message: In heatmap.2(FeatureX, col = bluered, Colv = as.dendrogram(hclust(col.dist, : Discrepancy: Rowv is FALSE, while dendrogram is `both'. Omitting row dendogram. Error in plot(ddr, horiz = TRUE, axes = FALSE, yaxs = "i", leaflab = "none") : error in evaluating the argument 'x' in selecting a method for function 'plot' Still I don't get columns clustered and key is not there. Any thoughts? Thanks, Saurin --- On Thu, 4/14/11, Jason Shoemaker <jshoe at="" ims.u-tokyo.ac.jp=""> wrote: From: Jason Shoemaker <jshoe@ims.u-tokyo.ac.jp> Subject: Re: [BioC] heatmap.2 ..help..how to cluster column ..but not Rows.. To: "saurin_jani" <saurin_jani at="" yahoo.com=""> Cc: "Bioconductor Bioconductor" <bioconductor at="" stat.math.ethz.ch=""> Date: Thursday, April 14, 2011, 10:12 PM Set Rowv="none" You will get a warning because of the dendrogram parameters. You can adjust those accordingly Cheers Jason On Fri, Apr 15, 2011 at 10:49 AM, Saurin D. Jani <saurin_jani at="" yahoo.com=""> wrote: Hi BioC, This must be simple but somehow I can not be able to do it... How can I cluster samples only.. below code is giving me dendrogram on both rows and clumns...! if I do Rowv = FALSE..then I don't see any colors and KEY. Please see this: FeatureX is Matrix with proper rows and colmns. row.dist <- as.dist(1 - cor(t(FeatureX))); col.dist <- as.dist(1 - cor(FeatureX)); heatmap.2(FeatureX,col=bluered,Colv = as.dendrogram(hclust(col.dist, method = "centroid")), scale = "none",key = TRUE,density.info = "none",tracecol="black"); Thank you in advance, Saurin _______________________________________________ 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 -- Jason Shoemaker, Ph D Japanese Science and Technology Agency Infection Induced Host Response Laboratory The Institute of Medical Science, University of Tokyo
ADD COMMENTlink written 8.2 years ago by SAURIN1.1k
I suspect the problem is the Colv call. If I understand this correctly, Colv only accepts only T or F arguments. When that is erased it seems to work just fine. Try using the hclustfun option instead of calling Colv = as.dendrogram(hclust(col.dist, method = "centroid")). I am not sure how to change the parameters of hclust though. Cheers Jason On Fri, Apr 15, 2011 at 11:31 AM, Saurin D. Jani <saurin_jani at="" yahoo.com=""> wrote: > > Hi Jason, > > I tried Rowv = "none" > > heatmap.2(FeatureX,col=bluered,Colv = as.dendrogram(hclust(col.dist, method = "centroid")), scale = "none",key = TRUE, Rowv = "none", density.info = "none",tracecol="black"); > > Warning message: > In heatmap.2(FeatureX, col = bluered, Colv = as.dendrogram(hclust(col.dist, ?: > ?Discrepancy: Rowv is FALSE, while dendrogram is `both'. Omitting row dendogram. > Error in plot(ddr, horiz = TRUE, axes = FALSE, yaxs = "i", leaflab = "none") : > ?error in evaluating the argument 'x' in selecting a method for function 'plot' > > > Still I don't get columns clustered and key is not there. > > Any thoughts? > > Thanks, > Saurin > > > --- On Thu, 4/14/11, Jason Shoemaker <jshoe at="" ims.u-tokyo.ac.jp=""> wrote: > > From: Jason Shoemaker <jshoe at="" ims.u-tokyo.ac.jp=""> > Subject: Re: [BioC] heatmap.2 ..help..how to cluster column ..but not Rows.. > To: "saurin_jani" <saurin_jani at="" yahoo.com=""> > Cc: "Bioconductor Bioconductor" <bioconductor at="" stat.math.ethz.ch=""> > Date: Thursday, April 14, 2011, 10:12 PM > > Set Rowv="none" > > You will get a warning because of the dendrogram parameters. You can adjust those accordingly > Cheers > Jason > > On Fri, Apr 15, 2011 at 10:49 AM, Saurin D. Jani <saurin_jani at="" yahoo.com=""> wrote: > > Hi BioC, > > > > This must be simple but somehow I can not be able to do it... > > How can I cluster samples only.. below code is giving me dendrogram on both rows and clumns...! if I do Rowv = FALSE..then I don't see any colors and KEY. > > > > Please see this: > > > > FeatureX is Matrix with proper rows and colmns. > > > > > > row.dist <- as.dist(1 - cor(t(FeatureX))); > > col.dist <- as.dist(1 - cor(FeatureX)); > > heatmap.2(FeatureX,col=bluered,Colv = as.dendrogram(hclust(col.dist, method = "centroid")), scale = "none",key = TRUE,density.info = "none",tracecol="black"); > > > > > Thank you in advance, > > Saurin > > > > _______________________________________________ > > 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 > > > > > -- > Jason Shoemaker, Ph D > Japanese Science and Technology Agency > Infection Induced Host Response Laboratory > The Institute of Medical Science, > University of Tokyo > > > > > -- Jason Shoemaker, Ph D Japanese Science and Technology Agency Infection Induced Host Response Laboratory The Institute of Medical Science, University of Tokyo
ADD REPLYlink written 8.2 years ago by Jason Shoemaker80
Answer: heatmap.2 ..help..how to cluster column ..but not Rows..
0
gravatar for Sean Davis
8.2 years ago by
Sean Davis21k
United States
Sean Davis21k wrote:
On Thu, Apr 14, 2011 at 9:49 PM, Saurin D. Jani <saurin_jani at="" yahoo.com=""> wrote: > Hi BioC, > > This must be simple but somehow I can not be able to do it... > How can I cluster samples only.. below code is giving me dendrogram on both rows and clumns...! if I do Rowv = FALSE..then I don't see any colors and KEY. > Hi, Saurin. See the "dendrogram" argument in heatmap.2 help. In particular, dendrogram="column" will turn off the row dendrogram. Sean > Please see this: > > FeatureX is Matrix with proper rows and colmns. > > > row.dist <- as.dist(1 - cor(t(FeatureX))); > col.dist <- as.dist(1 - cor(FeatureX)); > heatmap.2(FeatureX,col=bluered,Colv = as.dendrogram(hclust(col.dist, method = "centroid")), scale = "none",key = TRUE,density.info = "none",tracecol="black"); > > Thank you in advance, > Saurin > > _______________________________________________ > 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 COMMENTlink written 8.2 years ago by Sean Davis21k
Hi Sean, heatmap.2(FeatureX,col=bluered,Colv = as.dendrogram(hclust(col.dist, method = "centroid")), scale = "none",key = TRUE, dendrogram = "column", density.info = "none",tracecol="black"); This one gives dendrogram on column and key is there as well..the only problem is Rows are being clustered as well...how do I prevent rows to get clustered? Thanks, Saurin --- On Thu, 4/14/11, Sean Davis <sdavis2 at="" mail.nih.gov=""> wrote: > From: Sean Davis <sdavis2 at="" mail.nih.gov=""> > Subject: Re: [BioC] heatmap.2 ..help..how to cluster column ..but not Rows.. > To: saurin_jani at yahoo.com > Cc: "Bioconductor Bioconductor" <bioconductor at="" stat.math.ethz.ch=""> > Date: Thursday, April 14, 2011, 10:24 PM > On Thu, Apr 14, 2011 at 9:49 PM, > Saurin D. Jani <saurin_jani at="" yahoo.com=""> > wrote: > > Hi BioC, > > > > This must be simple but somehow I can not be able to > do it... > > How can I cluster samples only.. below code is giving > me dendrogram on both rows and clumns...! if I do Rowv = > FALSE..then I don't see any colors and KEY. > > > > Hi, Saurin. > > See the "dendrogram" argument in heatmap.2 help.? In > particular, > dendrogram="column" will turn off the row dendrogram. > > Sean > > > Please see this: > > > > FeatureX is Matrix with proper rows and colmns. > > > > > > row.dist <- as.dist(1 - cor(t(FeatureX))); > > col.dist <- as.dist(1 - cor(FeatureX)); > > heatmap.2(FeatureX,col=bluered,Colv = > as.dendrogram(hclust(col.dist, method = "centroid")), scale > = "none",key = TRUE,density.info = > "none",tracecol="black"); > > > > Thank you in advance, > > Saurin > > > > _______________________________________________ > > 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 8.2 years ago by SAURIN1.1k
On Thu, Apr 14, 2011 at 10:34 PM, Saurin D. Jani <saurin_jani at="" yahoo.com=""> wrote: > Hi Sean, > > heatmap.2(FeatureX,col=bluered,Colv = as.dendrogram(hclust(col.dist, method = "centroid")), scale = "none",key = TRUE, dendrogram = "column", density.info = "none",tracecol="black"); > > > This one gives dendrogram on column and key is there as well..the only problem is Rows are being clustered as well...how do I prevent rows to get clustered? > Take a look at the Rowv argument; Rowv=FALSE is probably what you want. Sean > Thanks, > Saurin > > > > --- On Thu, 4/14/11, Sean Davis <sdavis2 at="" mail.nih.gov=""> wrote: > >> From: Sean Davis <sdavis2 at="" mail.nih.gov=""> >> Subject: Re: [BioC] heatmap.2 ..help..how to cluster column ..but not Rows.. >> To: saurin_jani at yahoo.com >> Cc: "Bioconductor Bioconductor" <bioconductor at="" stat.math.ethz.ch=""> >> Date: Thursday, April 14, 2011, 10:24 PM >> On Thu, Apr 14, 2011 at 9:49 PM, >> Saurin D. Jani <saurin_jani at="" yahoo.com=""> >> wrote: >> > Hi BioC, >> > >> > This must be simple but somehow I can not be able to >> do it... >> > How can I cluster samples only.. below code is giving >> me dendrogram on both rows and clumns...! if I do Rowv = >> FALSE..then I don't see any colors and KEY. >> > >> >> Hi, Saurin. >> >> See the "dendrogram" argument in heatmap.2 help.? In >> particular, >> dendrogram="column" will turn off the row dendrogram. >> >> Sean >> >> > Please see this: >> > >> > FeatureX is Matrix with proper rows and colmns. >> > >> > >> > row.dist <- as.dist(1 - cor(t(FeatureX))); >> > col.dist <- as.dist(1 - cor(FeatureX)); >> > heatmap.2(FeatureX,col=bluered,Colv = >> as.dendrogram(hclust(col.dist, method = "centroid")), scale >> = "none",key = TRUE,density.info = >> "none",tracecol="black"); >> > >> > Thank you in advance, >> > Saurin >> > >> > _______________________________________________ >> > 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 >> > >> > > _______________________________________________ > 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 8.2 years ago by Sean Davis21k
Hi Sean, Thanks for your reply. I tried all those..options in arguments. When I do Rowv = FALSE.. column clustering is not there. thats the reason I got confused..!! heatmap.2(FeatureX,col=bluered,Colv = as.dendrogram(hclust(col.dist, method = "centroid")), dendrogram = "column", scale = "none",key = TRUE, Rowv = FALSE, density.info = "none",tracecol="black"); Thanks, Saurin --- On Thu, 4/14/11, Sean Davis <sdavis2 at="" mail.nih.gov=""> wrote: > From: Sean Davis <sdavis2 at="" mail.nih.gov=""> > Subject: Re: [BioC] heatmap.2 ..help..how to cluster column ..but not Rows.. > To: saurin_jani at yahoo.com > Cc: "Bioconductor Bioconductor" <bioconductor at="" stat.math.ethz.ch=""> > Date: Thursday, April 14, 2011, 10:45 PM > On Thu, Apr 14, 2011 at 10:34 PM, > Saurin D. Jani <saurin_jani at="" yahoo.com=""> > wrote: > > Hi Sean, > > > > heatmap.2(FeatureX,col=bluered,Colv = > as.dendrogram(hclust(col.dist, method = "centroid")), scale > = "none",key = TRUE, dendrogram = "column", density.info = > "none",tracecol="black"); > > > > > > This one gives dendrogram on column and key is there > as well..the only problem is Rows are being clustered as > well...how do I prevent rows to get clustered? > > > > Take a look at the Rowv argument; Rowv=FALSE is probably > what you want. > > Sean > > > > Thanks, > > Saurin > > > > > > > > --- On Thu, 4/14/11, Sean Davis <sdavis2 at="" mail.nih.gov=""> > wrote: > > > >> From: Sean Davis <sdavis2 at="" mail.nih.gov=""> > >> Subject: Re: [BioC] heatmap.2 ..help..how to > cluster column ..but not Rows.. > >> To: saurin_jani at yahoo.com > >> Cc: "Bioconductor Bioconductor" <bioconductor at="" stat.math.ethz.ch=""> > >> Date: Thursday, April 14, 2011, 10:24 PM > >> On Thu, Apr 14, 2011 at 9:49 PM, > >> Saurin D. Jani <saurin_jani at="" yahoo.com=""> > >> wrote: > >> > Hi BioC, > >> > > >> > This must be simple but somehow I can not be > able to > >> do it... > >> > How can I cluster samples only.. below code > is giving > >> me dendrogram on both rows and clumns...! if I do > Rowv = > >> FALSE..then I don't see any colors and KEY. > >> > > >> > >> Hi, Saurin. > >> > >> See the "dendrogram" argument in heatmap.2 help.? > In > >> particular, > >> dendrogram="column" will turn off the row > dendrogram. > >> > >> Sean > >> > >> > Please see this: > >> > > >> > FeatureX is Matrix with proper rows and > colmns. > >> > > >> > > >> > row.dist <- as.dist(1 - > cor(t(FeatureX))); > >> > col.dist <- as.dist(1 - cor(FeatureX)); > >> > heatmap.2(FeatureX,col=bluered,Colv = > >> as.dendrogram(hclust(col.dist, method = > "centroid")), scale > >> = "none",key = TRUE,density.info = > >> "none",tracecol="black"); > >> > > >> > Thank you in advance, > >> > Saurin > >> > > >> > > _______________________________________________ > >> > 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 > >> > > >> > > > > _______________________________________________ > > 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 8.2 years ago by SAURIN1.1k
This previous discussion seems to answer the probleb: https://stat.ethz.ch/pipermail/bioconductor/2009-July/028898.html Jason On Fri, Apr 15, 2011 at 11:48 AM, Saurin D. Jani <saurin_jani at="" yahoo.com=""> wrote: > Hi Sean, > > Thanks for your reply. I tried all those..options in arguments. When I do Rowv = FALSE.. column clustering is not there. > > thats the reason I got confused..!! > > heatmap.2(FeatureX,col=bluered,Colv = as.dendrogram(hclust(col.dist, method = "centroid")), dendrogram = "column", scale = "none",key = TRUE, Rowv = FALSE, density.info = "none",tracecol="black"); > > > Thanks, > Saurin > > > --- On Thu, 4/14/11, Sean Davis <sdavis2 at="" mail.nih.gov=""> wrote: > >> From: Sean Davis <sdavis2 at="" mail.nih.gov=""> >> Subject: Re: [BioC] heatmap.2 ..help..how to cluster column ..but not Rows.. >> To: saurin_jani at yahoo.com >> Cc: "Bioconductor Bioconductor" <bioconductor at="" stat.math.ethz.ch=""> >> Date: Thursday, April 14, 2011, 10:45 PM >> On Thu, Apr 14, 2011 at 10:34 PM, >> Saurin D. Jani <saurin_jani at="" yahoo.com=""> >> wrote: >> > Hi Sean, >> > >> > heatmap.2(FeatureX,col=bluered,Colv = >> as.dendrogram(hclust(col.dist, method = "centroid")), scale >> = "none",key = TRUE, dendrogram = "column", density.info = >> "none",tracecol="black"); >> > >> > >> > This one gives dendrogram on column and key is there >> as well..the only problem is Rows are being clustered as >> well...how do I prevent rows to get clustered? >> > >> >> Take a look at the Rowv argument; Rowv=FALSE is probably >> what you want. >> >> Sean >> >> >> > Thanks, >> > Saurin >> > >> > >> > >> > --- On Thu, 4/14/11, Sean Davis <sdavis2 at="" mail.nih.gov=""> >> wrote: >> > >> >> From: Sean Davis <sdavis2 at="" mail.nih.gov=""> >> >> Subject: Re: [BioC] heatmap.2 ..help..how to >> cluster column ..but not Rows.. >> >> To: saurin_jani at yahoo.com >> >> Cc: "Bioconductor Bioconductor" <bioconductor at="" stat.math.ethz.ch=""> >> >> Date: Thursday, April 14, 2011, 10:24 PM >> >> On Thu, Apr 14, 2011 at 9:49 PM, >> >> Saurin D. Jani <saurin_jani at="" yahoo.com=""> >> >> wrote: >> >> > Hi BioC, >> >> > >> >> > This must be simple but somehow I can not be >> able to >> >> do it... >> >> > How can I cluster samples only.. below code >> is giving >> >> me dendrogram on both rows and clumns...! if I do >> Rowv = >> >> FALSE..then I don't see any colors and KEY. >> >> > >> >> >> >> Hi, Saurin. >> >> >> >> See the "dendrogram" argument in heatmap.2 help. >> In >> >> particular, >> >> dendrogram="column" will turn off the row >> dendrogram. >> >> >> >> Sean >> >> >> >> > Please see this: >> >> > >> >> > FeatureX is Matrix with proper rows and >> colmns. >> >> > >> >> > >> >> > row.dist <- as.dist(1 - >> cor(t(FeatureX))); >> >> > col.dist <- as.dist(1 - cor(FeatureX)); >> >> > heatmap.2(FeatureX,col=bluered,Colv = >> >> as.dendrogram(hclust(col.dist, method = >> "centroid")), scale >> >> = "none",key = TRUE,density.info = >> >> "none",tracecol="black"); >> >> > >> >> > Thank you in advance, >> >> > Saurin >> >> > >> >> > >> _______________________________________________ >> >> > 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 >> >> > >> >> >> > >> > _______________________________________________ >> > 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 >> > >> > > _______________________________________________ > 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 > -- Jason Shoemaker, Ph D Japanese Science and Technology Agency Infection Induced Host Response Laboratory The Institute of Medical Science, University of Tokyo
ADD REPLYlink written 8.2 years ago by Jason Shoemaker80
Hi Jason, Thanks. but, somehow that does not work..! hclust2 <- function(x, method="average") dist2 <- function(x) as.dist(1-cor(t(x), method="pearson")) heatmap.2(FeatureX, distfun=dist2, hclustfun=hclust2); Error in UseMethod("as.dendrogram") : no applicable method for 'as.dendrogram' applied to an object of class "function" ## one small experiment: heatmap.2(FeatureX,col=bluered,Colv = as.dendrogram(hclust(col.dist, method = "centroid")), dendrogram = "column", scale = "none",key = TRUE, Rowv = FALSE, density.info = "none",tracecol="black"); I suspect that...my column names are bit different in length...when I tried with "AA_0001" and so on..above heatmap.2 call works exactly what I want...!! Did any one experienced similar ? this is just me..! Thanks, Saurin --- On Thu, 4/14/11, Jason Shoemaker <jshoe at="" ims.u-tokyo.ac.jp=""> wrote: > From: Jason Shoemaker <jshoe at="" ims.u-tokyo.ac.jp=""> > Subject: Re: [BioC] heatmap.2 ..help..how to cluster column ..but not Rows.. > To: "saurin_jani" <saurin_jani at="" yahoo.com=""> > Cc: "Sean Davis" <sdavis2 at="" mail.nih.gov="">, "Bioconductor Bioconductor" <bioconductor at="" stat.math.ethz.ch=""> > Date: Thursday, April 14, 2011, 11:01 PM > This previous discussion seems to > answer the probleb: > https://stat.ethz.ch/pipermail/bioconductor/2009-July/028898.html > Jason > > On Fri, Apr 15, 2011 at 11:48 AM, Saurin D. Jani <saurin_jani at="" yahoo.com=""> > wrote: > > Hi Sean, > > > > Thanks for your reply. I tried all those..options in > arguments. When I do Rowv = FALSE.. column clustering is not > there. > > > > thats the reason I got confused..!! > > > > heatmap.2(FeatureX,col=bluered,Colv = > as.dendrogram(hclust(col.dist, method = "centroid")), > dendrogram = "column", scale = "none",key = TRUE, Rowv = > FALSE, density.info = "none",tracecol="black"); > > > > > > Thanks, > > Saurin > > > > > > --- On Thu, 4/14/11, Sean Davis <sdavis2 at="" mail.nih.gov=""> > wrote: > > > >> From: Sean Davis <sdavis2 at="" mail.nih.gov=""> > >> Subject: Re: [BioC] heatmap.2 ..help..how to > cluster column ..but not Rows.. > >> To: saurin_jani at yahoo.com > >> Cc: "Bioconductor Bioconductor" <bioconductor at="" stat.math.ethz.ch=""> > >> Date: Thursday, April 14, 2011, 10:45 PM > >> On Thu, Apr 14, 2011 at 10:34 PM, > >> Saurin D. Jani <saurin_jani at="" yahoo.com=""> > >> wrote: > >> > Hi Sean, > >> > > >> > heatmap.2(FeatureX,col=bluered,Colv = > >> as.dendrogram(hclust(col.dist, method = > "centroid")), scale > >> = "none",key = TRUE, dendrogram = "column", > density.info = > >> "none",tracecol="black"); > >> > > >> > > >> > This one gives dendrogram on column and key > is there > >> as well..the only problem is Rows are being > clustered as > >> well...how do I prevent rows to get clustered? > >> > > >> > >> Take a look at the Rowv argument; Rowv=FALSE is > probably > >> what you want. > >> > >> Sean > >> > >> > >> > Thanks, > >> > Saurin > >> > > >> > > >> > > >> > --- On Thu, 4/14/11, Sean Davis <sdavis2 at="" mail.nih.gov=""> > >> wrote: > >> > > >> >> From: Sean Davis <sdavis2 at="" mail.nih.gov=""> > >> >> Subject: Re: [BioC] heatmap.2 ..help..how > to > >> cluster column ..but not Rows.. > >> >> To: saurin_jani at yahoo.com > >> >> Cc: "Bioconductor Bioconductor" <bioconductor at="" stat.math.ethz.ch=""> > >> >> Date: Thursday, April 14, 2011, 10:24 PM > >> >> On Thu, Apr 14, 2011 at 9:49 PM, > >> >> Saurin D. Jani <saurin_jani at="" yahoo.com=""> > >> >> wrote: > >> >> > Hi BioC, > >> >> > > >> >> > This must be simple but somehow I > can not be > >> able to > >> >> do it... > >> >> > How can I cluster samples only.. > below code > >> is giving > >> >> me dendrogram on both rows and clumns...! > if I do > >> Rowv = > >> >> FALSE..then I don't see any colors and > KEY. > >> >> > > >> >> > >> >> Hi, Saurin. > >> >> > >> >> See the "dendrogram" argument in > heatmap.2 help. > >> In > >> >> particular, > >> >> dendrogram="column" will turn off the > row > >> dendrogram. > >> >> > >> >> Sean > >> >> > >> >> > Please see this: > >> >> > > >> >> > FeatureX is Matrix with proper rows > and > >> colmns. > >> >> > > >> >> > > >> >> > row.dist <- as.dist(1 - > >> cor(t(FeatureX))); > >> >> > col.dist <- as.dist(1 - > cor(FeatureX)); > >> >> > heatmap.2(FeatureX,col=bluered,Colv > = > >> >> as.dendrogram(hclust(col.dist, method = > >> "centroid")), scale > >> >> = "none",key = TRUE,density.info = > >> >> "none",tracecol="black"); > >> >> > > >> >> > Thank you in advance, > >> >> > Saurin > >> >> > > >> >> > > >> _______________________________________________ > >> >> > 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 > >> >> > > >> >> > >> > > >> > > _______________________________________________ > >> > 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 > >> > > >> > > > > _______________________________________________ > > 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 > > > > > > -- > Jason Shoemaker, Ph D > Japanese Science and Technology Agency > Infection Induced Host Response Laboratory > The Institute of Medical Science, > University of Tokyo >
ADD REPLYlink written 8.2 years ago by SAURIN1.1k
hmm. I am not sure what else to try then. I followed that example, ran this code: > hclust2 <- function(x, method="average", ...) + hclust(x, method=method, ...) > dist2 <- function(x, ...) + as.dist(1-cor(t(x), method="pearson")) heatmap.2(Rowv=F,as.matrix(mtcars), distfun=dist2, hclustfun=hclust2) it seems to run fine...I attached the figure here. Hopefully someone else knows the solution. Goodluck! Jason On Fri, Apr 15, 2011 at 12:12 PM, Saurin D. Jani <saurin_jani at="" yahoo.com=""> wrote: > Hi Jason, > > Thanks. but, somehow that does not work..! > > hclust2 <- function(x, method="average") > dist2 <- function(x) > ?as.dist(1-cor(t(x), method="pearson")) > > heatmap.2(FeatureX, distfun=dist2, hclustfun=hclust2); > > Error in UseMethod("as.dendrogram") : > ?no applicable method for 'as.dendrogram' applied to an object of class "function" > > > ## one small experiment: > > heatmap.2(FeatureX,col=bluered,Colv = as.dendrogram(hclust(col.dist, method = "centroid")), dendrogram = "column", scale = "none",key = TRUE, Rowv = FALSE, density.info = "none",tracecol="black"); > > > I suspect that...my column names are bit different in length...when I tried with "AA_0001" and so on..above heatmap.2 call works exactly what I want...!! > > Did any one experienced similar ? this is just me..! > > Thanks, > Saurin > > --- On Thu, 4/14/11, Jason Shoemaker <jshoe at="" ims.u-tokyo.ac.jp=""> wrote: > >> From: Jason Shoemaker <jshoe at="" ims.u-tokyo.ac.jp=""> >> Subject: Re: [BioC] heatmap.2 ..help..how to cluster column ..but not Rows.. >> To: "saurin_jani" <saurin_jani at="" yahoo.com=""> >> Cc: "Sean Davis" <sdavis2 at="" mail.nih.gov="">, "Bioconductor Bioconductor" <bioconductor at="" stat.math.ethz.ch=""> >> Date: Thursday, April 14, 2011, 11:01 PM >> This previous discussion seems to >> answer the probleb: >> https://stat.ethz.ch/pipermail/bioconductor/2009-July/028898.html >> Jason >> >> On Fri, Apr 15, 2011 at 11:48 AM, Saurin D. Jani <saurin_jani at="" yahoo.com=""> >> wrote: >> > Hi Sean, >> > >> > Thanks for your reply. I tried all those..options in >> arguments. When I do Rowv = FALSE.. column clustering is not >> there. >> > >> > thats the reason I got confused..!! >> > >> > heatmap.2(FeatureX,col=bluered,Colv = >> as.dendrogram(hclust(col.dist, method = "centroid")), >> dendrogram = "column", scale = "none",key = TRUE, Rowv = >> FALSE, density.info = "none",tracecol="black"); >> > >> > >> > Thanks, >> > Saurin >> > >> > >> > --- On Thu, 4/14/11, Sean Davis <sdavis2 at="" mail.nih.gov=""> >> wrote: >> > >> >> From: Sean Davis <sdavis2 at="" mail.nih.gov=""> >> >> Subject: Re: [BioC] heatmap.2 ..help..how to >> cluster column ..but not Rows.. >> >> To: saurin_jani at yahoo.com >> >> Cc: "Bioconductor Bioconductor" <bioconductor at="" stat.math.ethz.ch=""> >> >> Date: Thursday, April 14, 2011, 10:45 PM >> >> On Thu, Apr 14, 2011 at 10:34 PM, >> >> Saurin D. Jani <saurin_jani at="" yahoo.com=""> >> >> wrote: >> >> > Hi Sean, >> >> > >> >> > heatmap.2(FeatureX,col=bluered,Colv = >> >> as.dendrogram(hclust(col.dist, method = >> "centroid")), scale >> >> = "none",key = TRUE, dendrogram = "column", >> density.info = >> >> "none",tracecol="black"); >> >> > >> >> > >> >> > This one gives dendrogram on column and key >> is there >> >> as well..the only problem is Rows are being >> clustered as >> >> well...how do I prevent rows to get clustered? >> >> > >> >> >> >> Take a look at the Rowv argument; Rowv=FALSE is >> probably >> >> what you want. >> >> >> >> Sean >> >> >> >> >> >> > Thanks, >> >> > Saurin >> >> > >> >> > >> >> > >> >> > --- On Thu, 4/14/11, Sean Davis <sdavis2 at="" mail.nih.gov=""> >> >> wrote: >> >> > >> >> >> From: Sean Davis <sdavis2 at="" mail.nih.gov=""> >> >> >> Subject: Re: [BioC] heatmap.2 ..help..how >> to >> >> cluster column ..but not Rows.. >> >> >> To: saurin_jani at yahoo.com >> >> >> Cc: "Bioconductor Bioconductor" <bioconductor at="" stat.math.ethz.ch=""> >> >> >> Date: Thursday, April 14, 2011, 10:24 PM >> >> >> On Thu, Apr 14, 2011 at 9:49 PM, >> >> >> Saurin D. Jani <saurin_jani at="" yahoo.com=""> >> >> >> wrote: >> >> >> > Hi BioC, >> >> >> > >> >> >> > This must be simple but somehow I >> can not be >> >> able to >> >> >> do it... >> >> >> > How can I cluster samples only.. >> below code >> >> is giving >> >> >> me dendrogram on both rows and clumns...! >> if I do >> >> Rowv = >> >> >> FALSE..then I don't see any colors and >> KEY. >> >> >> > >> >> >> >> >> >> Hi, Saurin. >> >> >> >> >> >> See the "dendrogram" argument in >> heatmap.2 help. >> >> In >> >> >> particular, >> >> >> dendrogram="column" will turn off the >> row >> >> dendrogram. >> >> >> >> >> >> Sean >> >> >> >> >> >> > Please see this: >> >> >> > >> >> >> > FeatureX is Matrix with proper rows >> and >> >> colmns. >> >> >> > >> >> >> > >> >> >> > row.dist <- as.dist(1 - >> >> cor(t(FeatureX))); >> >> >> > col.dist <- as.dist(1 - >> cor(FeatureX)); >> >> >> > heatmap.2(FeatureX,col=bluered,Colv >> = >> >> >> as.dendrogram(hclust(col.dist, method = >> >> "centroid")), scale >> >> >> = "none",key = TRUE,density.info = >> >> >> "none",tracecol="black"); >> >> >> > >> >> >> > Thank you in advance, >> >> >> > Saurin >> >> >> > >> >> >> > >> >> _______________________________________________ >> >> >> > 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 >> >> >> > >> >> >> >> >> > >> >> > >> _______________________________________________ >> >> > 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 >> >> > >> >> >> > >> > _______________________________________________ >> > 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 >> > >> >> >> >> -- >> Jason Shoemaker, Ph D >> Japanese Science and Technology Agency >> Infection Induced Host Response Laboratory >> The Institute of Medical Science, >> University of Tokyo >> > -- Jason Shoemaker, Ph D Japanese Science and Technology Agency Infection Induced Host Response Laboratory The Institute of Medical Science, University of Tokyo -------------- next part -------------- A non-text attachment was scrubbed... Name: CarsExample.png Type: image/png Size: 10339 bytes Desc: not available URL: <https: stat.ethz.ch="" pipermail="" bioconductor="" attachments="" 20110415="" 20e74337="" attachment.png="">
ADD REPLYlink written 8.2 years ago by Jason Shoemaker80
Hi Jason, Sean, Thank you so much for your time and reply. I really appreciate that. Now, it does work. The only explanation I have it...when I fixed my strings for input sample names..I got it working..as Jason showed. have a fantastic weekend, Thanks, Saurin --- On Fri, 4/15/11, Jason Shoemaker <jshoe at="" ims.u-tokyo.ac.jp=""> wrote: > From: Jason Shoemaker <jshoe at="" ims.u-tokyo.ac.jp=""> > Subject: Re: [BioC] heatmap.2 ..help..how to cluster column ..but not Rows.. > To: "saurin_jani" <saurin_jani at="" yahoo.com=""> > Cc: "Sean Davis" <sdavis2 at="" mail.nih.gov="">, "Bioconductor Bioconductor" <bioconductor at="" stat.math.ethz.ch=""> > Date: Friday, April 15, 2011, 12:42 AM > hmm. I am not sure what else to try > then. I followed that example, ran > this code: > > hclust2 <- function(x, method="average", ...) > +???hclust(x, method=method, ...) > > dist2 <- function(x, ...) > +???as.dist(1-cor(t(x), method="pearson")) > heatmap.2(Rowv=F,as.matrix(mtcars), distfun=dist2, > hclustfun=hclust2) > > it seems to run fine...I attached the figure here. > Hopefully someone > else knows the solution. > Goodluck! > Jason > > > > > On Fri, Apr 15, 2011 at 12:12 PM, Saurin D. Jani <saurin_jani at="" yahoo.com=""> > wrote: > > Hi Jason, > > > > Thanks. but, somehow that does not work..! > > > > hclust2 <- function(x, method="average") > > dist2 <- function(x) > > ?as.dist(1-cor(t(x), method="pearson")) > > > > heatmap.2(FeatureX, distfun=dist2, > hclustfun=hclust2); > > > > Error in UseMethod("as.dendrogram") : > > ?no applicable method for 'as.dendrogram' applied to > an object of class "function" > > > > > > ## one small experiment: > > > > heatmap.2(FeatureX,col=bluered,Colv = > as.dendrogram(hclust(col.dist, method = "centroid")), > dendrogram = "column", scale = "none",key = TRUE, Rowv = > FALSE, density.info = "none",tracecol="black"); > > > > > > I suspect that...my column names are bit different in > length...when I tried with "AA_0001" and so on..above > heatmap.2 call works exactly what I want...!! > > > > Did any one experienced similar ? this is just me..! > > > > Thanks, > > Saurin > > > > --- On Thu, 4/14/11, Jason Shoemaker <jshoe at="" ims.u-tokyo.ac.jp=""> > wrote: > > > >> From: Jason Shoemaker <jshoe at="" ims.u-tokyo.ac.jp=""> > >> Subject: Re: [BioC] heatmap.2 ..help..how to > cluster column ..but not Rows.. > >> To: "saurin_jani" <saurin_jani at="" yahoo.com=""> > >> Cc: "Sean Davis" <sdavis2 at="" mail.nih.gov="">, > "Bioconductor Bioconductor" <bioconductor at="" stat.math.ethz.ch=""> > >> Date: Thursday, April 14, 2011, 11:01 PM > >> This previous discussion seems to > >> answer the probleb: > >> https://stat.ethz.ch/pipermail/bioconductor/2009-July/028898.html > >> Jason > >> > >> On Fri, Apr 15, 2011 at 11:48 AM, Saurin D. Jani > <saurin_jani at="" yahoo.com=""> > >> wrote: > >> > Hi Sean, > >> > > >> > Thanks for your reply. I tried all > those..options in > >> arguments. When I do Rowv = FALSE.. column > clustering is not > >> there. > >> > > >> > thats the reason I got confused..!! > >> > > >> > heatmap.2(FeatureX,col=bluered,Colv = > >> as.dendrogram(hclust(col.dist, method = > "centroid")), > >> dendrogram = "column", scale = "none",key = TRUE, > Rowv = > >> FALSE, density.info = "none",tracecol="black"); > >> > > >> > > >> > Thanks, > >> > Saurin > >> > > >> > > >> > --- On Thu, 4/14/11, Sean Davis <sdavis2 at="" mail.nih.gov=""> > >> wrote: > >> > > >> >> From: Sean Davis <sdavis2 at="" mail.nih.gov=""> > >> >> Subject: Re: [BioC] heatmap.2 ..help..how > to > >> cluster column ..but not Rows.. > >> >> To: saurin_jani at yahoo.com > >> >> Cc: "Bioconductor Bioconductor" <bioconductor at="" stat.math.ethz.ch=""> > >> >> Date: Thursday, April 14, 2011, 10:45 PM > >> >> On Thu, Apr 14, 2011 at 10:34 PM, > >> >> Saurin D. Jani <saurin_jani at="" yahoo.com=""> > >> >> wrote: > >> >> > Hi Sean, > >> >> > > >> >> > heatmap.2(FeatureX,col=bluered,Colv > = > >> >> as.dendrogram(hclust(col.dist, method = > >> "centroid")), scale > >> >> = "none",key = TRUE, dendrogram = > "column", > >> density.info = > >> >> "none",tracecol="black"); > >> >> > > >> >> > > >> >> > This one gives dendrogram on column > and key > >> is there > >> >> as well..the only problem is Rows are > being > >> clustered as > >> >> well...how do I prevent rows to get > clustered? > >> >> > > >> >> > >> >> Take a look at the Rowv argument; > Rowv=FALSE is > >> probably > >> >> what you want. > >> >> > >> >> Sean > >> >> > >> >> > >> >> > Thanks, > >> >> > Saurin > >> >> > > >> >> > > >> >> > > >> >> > --- On Thu, 4/14/11, Sean Davis > <sdavis2 at="" mail.nih.gov=""> > >> >> wrote: > >> >> > > >> >> >> From: Sean Davis <sdavis2 at="" mail.nih.gov=""> > >> >> >> Subject: Re: [BioC] heatmap.2 > ..help..how > >> to > >> >> cluster column ..but not Rows.. > >> >> >> To: saurin_jani at yahoo.com > >> >> >> Cc: "Bioconductor Bioconductor" > <bioconductor at="" stat.math.ethz.ch=""> > >> >> >> Date: Thursday, April 14, 2011, > 10:24 PM > >> >> >> On Thu, Apr 14, 2011 at 9:49 > PM, > >> >> >> Saurin D. Jani <saurin_jani at="" yahoo.com=""> > >> >> >> wrote: > >> >> >> > Hi BioC, > >> >> >> > > >> >> >> > This must be simple but > somehow I > >> can not be > >> >> able to > >> >> >> do it... > >> >> >> > How can I cluster samples > only.. > >> below code > >> >> is giving > >> >> >> me dendrogram on both rows and > clumns...! > >> if I do > >> >> Rowv = > >> >> >> FALSE..then I don't see any > colors and > >> KEY. > >> >> >> > > >> >> >> > >> >> >> Hi, Saurin. > >> >> >> > >> >> >> See the "dendrogram" argument > in > >> heatmap.2 help. > >> >> In > >> >> >> particular, > >> >> >> dendrogram="column" will turn > off the > >> row > >> >> dendrogram. > >> >> >> > >> >> >> Sean > >> >> >> > >> >> >> > Please see this: > >> >> >> > > >> >> >> > FeatureX is Matrix with > proper rows > >> and > >> >> colmns. > >> >> >> > > >> >> >> > > >> >> >> > row.dist <- as.dist(1 - > >> >> cor(t(FeatureX))); > >> >> >> > col.dist <- as.dist(1 - > >> cor(FeatureX)); > >> >> >> > > heatmap.2(FeatureX,col=bluered,Colv > >> = > >> >> >> as.dendrogram(hclust(col.dist, > method = > >> >> "centroid")), scale > >> >> >> = "none",key = TRUE,density.info > = > >> >> >> "none",tracecol="black"); > >> >> >> > > >> >> >> > Thank you in advance, > >> >> >> > Saurin > >> >> >> > > >> >> >> > > >> >> > _______________________________________________ > >> >> >> > 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 > >> >> >> > > >> >> >> > >> >> > > >> >> > > >> _______________________________________________ > >> >> > 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 > >> >> > > >> >> > >> > > >> > > _______________________________________________ > >> > 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 > >> > > >> > >> > >> > >> -- > >> Jason Shoemaker, Ph D > >> Japanese Science and Technology Agency > >> Infection Induced Host Response Laboratory > >> The Institute of Medical Science, > >> University of Tokyo > >> > > > > > > -- > Jason Shoemaker, Ph D > Japanese Science and Technology Agency > Infection Induced Host Response Laboratory > The Institute of Medical Science, > University of Tokyo >
ADD REPLYlink written 8.2 years ago by SAURIN1.1k
Answer: heatmap.2 ..help..how to cluster column ..but not Rows..
0
gravatar for Jason Shoemaker
8.2 years ago by
Jason Shoemaker80 wrote:
Set Rowv="none" You will get a warning because of the dendrogram parameters. You can adjust those accordingly Cheers Jason On Fri, Apr 15, 2011 at 10:49 AM, Saurin D. Jani <saurin_jani@yahoo.com>wrote: > Hi BioC, > > This must be simple but somehow I can not be able to do it... > How can I cluster samples only.. below code is giving me dendrogram on both > rows and clumns...! if I do Rowv = FALSE..then I don't see any colors and > KEY. > > Please see this: > > FeatureX is Matrix with proper rows and colmns. > > > row.dist <- as.dist(1 - cor(t(FeatureX))); > col.dist <- as.dist(1 - cor(FeatureX)); > heatmap.2(FeatureX,col=bluered,Colv = as.dendrogram(hclust(col.dist, method > = "centroid")), scale = "none",key = TRUE,density.info = > "none",tracecol="black"); > > Thank you in advance, > Saurin > > _______________________________________________ > Bioconductor mailing list > Bioconductor@r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Jason Shoemaker, Ph D Japanese Science and Technology Agency Infection Induced Host Response Laboratory The Institute of Medical Science, University of Tokyo [[alternative HTML version deleted]]
ADD COMMENTlink written 8.2 years ago by Jason Shoemaker80
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 16.09
Traffic: 247 users visited in the last hour