Extract M values from probes set to cluster
1
0
Entering edit mode
Marcelo Laia ▴ 450
@marcelo-laia-2007
Last seen 2.5 years ago
Brazil
HI, I would like to do a cluster in my topTable results. I am start here: selected <- p.adjust(fit.2$p.value) <0.05 MA.selected <- MA.2$M[selected, ] heatmap(MA.selected) Error in hclustfun(distfun(x)) : NA/NaN/Inf in foreign function call (arg 11) Then, I search in the archieves and found this function: na.dist <- function(x,...) { t.dist <- dist(x,...) t.dist <- as.matrix(t.dist) t.limit <- 1.1*max(t.dist,na.rm=T) t.dist[is.na(t.dist)] <- t.limit t.dist <- as.dist(t.dist) return(t.dist) } x <- na.dist(MA.selected) x <- as.matrix(x) heatmap(x) Work, but it cluster *all* probes on the data set!!! I would like to cluster only 165 genes (p.value < 0.05) How I need to do the heatmap with only toptable selected genes? Could you help me, please. Thank you -- Marcelo Luiz de Laia Ph.D Candidate S?o Paulo State University (http://www.unesp.br/eng/) School of Agricultural and Veterinary Sciences Department of Technology Via de Acesso Prof. Paulo Donato Castellane s/n 14884-900 Jaboticabal - SP - Brazil Phone: +55-016-3209-2675 Cell: +55-016-97098526
• 1.2k views
ADD COMMENT
0
Entering edit mode
@sean-davis-490
Last seen 4 months ago
United States
On Tuesday 13 February 2007 06:12, Marcelo Laia wrote: > HI, > > I would like to do a cluster in my topTable results. > > I am start here: > > selected <- p.adjust(fit.2$p.value) <0.05 > > MA.selected <- MA.2$M[selected, ] > > heatmap(MA.selected) > Error in hclustfun(distfun(x)) : NA/NaN/Inf in foreign function call (arg > 11) > > Then, I search in the archieves and found this function: > > na.dist <- function(x,...) { > t.dist <- dist(x,...) > t.dist <- as.matrix(t.dist) > t.limit <- 1.1*max(t.dist,na.rm=T) > t.dist[is.na(t.dist)] <- t.limit > t.dist <- as.dist(t.dist) > return(t.dist) > } > > x <- na.dist(MA.selected) > x <- as.matrix(x) > heatmap(x) > > Work, but it cluster *all* probes on the data set!!! I would like to > cluster only 165 genes (p.value < 0.05) What is the output of: length(selected) and dim(MA.selected)
ADD COMMENT
0
Entering edit mode
Dear Sean I thought that I did a mistake in selected. Then, I try... But no success. Here are the outputs: > selected <- p.adjust(fit.2$p.value) <0.05 > summary(selected) Mode FALSE TRUE NA's logical 2565 130 761 > length(selected) [1] 3456 > MA.selected <- MA.2$M[selected, ] > dim(MA.selected) [1] 1782 3 I thought that I did a mistake here: > selected <- p.adjust(fit.2$p.value) <0.05 ^^^^^^^^^^ > selected <- (fit.2$p.value) <0.05 > length(selected) [1] 3456 > MA.selected <- MA.2$M[selected, ] > dim(MA.selected) [1] 4154 3 > fit.2 <- eBayes(fit) Thank you very much Laia 2007/2/13, Sean Davis <sdavis2 at="" mail.nih.gov="">: > On Tuesday 13 February 2007 06:12, Marcelo Laia wrote: > > HI, > > > > I would like to do a cluster in my topTable results. > > > > I am start here: > > > > selected <- p.adjust(fit.2$p.value) <0.05 > > > > MA.selected <- MA.2$M[selected, ] > > > > heatmap(MA.selected) > > Error in hclustfun(distfun(x)) : NA/NaN/Inf in foreign function call (arg > > 11) > > > > Then, I search in the archieves and found this function: > > > > na.dist <- function(x,...) { > > t.dist <- dist(x,...) > > t.dist <- as.matrix(t.dist) > > t.limit <- 1.1*max(t.dist,na.rm=T) > > t.dist[is.na(t.dist)] <- t.limit > > t.dist <- as.dist(t.dist) > > return(t.dist) > > } > > > > x <- na.dist(MA.selected) > > x <- as.matrix(x) > > heatmap(x) > > > > Work, but it cluster *all* probes on the data set!!! I would like to > > cluster only 165 genes (p.value < 0.05) > > What is the output of: > > length(selected) > > and > > dim(MA.selected) >
ADD REPLY
0
Entering edit mode
On Tuesday 13 February 2007 06:51, Marcelo Laia wrote: > Dear Sean > > I thought that I did a mistake in selected. Then, I try... But no success. > > Here are the outputs: > > selected <- p.adjust(fit.2$p.value) <0.05 > > summary(selected) > > Mode FALSE TRUE NA's > logical 2565 130 761 > > > length(selected) > > [1] 3456 > > > MA.selected <- MA.2$M[selected, ] > > dim(MA.selected) > > [1] 1782 3 > > I thought that I did a mistake here: > > selected <- p.adjust(fit.2$p.value) <0.05 > > ^^^^^^^^^^ > > > selected <- (fit.2$p.value) <0.05 > > length(selected) > > [1] 3456 > > > MA.selected <- MA.2$M[selected, ] > > dim(MA.selected) > > [1] 4154 3 > > > fit.2 <- eBayes(fit) > > Thank you very much Looks like your fit.2$p.value is shorter than the MA.2 object, so you will need to go about things a different way. I typically use topTable like: tt <- topTable(fit2) heatmap(MA.2$M[as.numeric(rownames(tt)),]) Of course, you can make any call to topTable you like. Does this work for you? Sean
ADD REPLY
0
Entering edit mode
First of all, you will have to get rid of the missing values in your selection vector selected[is.na(selected)]<-FALSE Secondly, I think that you have duplicate spots on your array, with a total of 6912 spots. It depends on the layout on the chip how you can get to the M-values of both spots using the selected vector. unwrapdups() can help you here Something like this (untested) M.uw<-unwrapdups(MA.2$M,ndups=2,spacing=1) # ndups and spacing same as in lmFit() and duplicateCorrelation() M.ag<-apply(M.uw,1,function(x) (x[c(T,F)]+x[c(F,T)])/2) # doesn't handle NA MA.selected<-M.ag[selected,] Jan -----Original Message----- From: bioconductor-bounces@stat.math.ethz.ch [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of Marcelo Laia Sent: dinsdag 13 februari 2007 12:51 To: Bioconductor Subject: Re: [BioC] Extract M values from probes set to cluster Dear Sean I thought that I did a mistake in selected. Then, I try... But no success. Here are the outputs: > selected <- p.adjust(fit.2$p.value) <0.05 > summary(selected) Mode FALSE TRUE NA's logical 2565 130 761 > length(selected) [1] 3456 > MA.selected <- MA.2$M[selected, ] > dim(MA.selected) [1] 1782 3 I thought that I did a mistake here: > selected <- p.adjust(fit.2$p.value) <0.05 ^^^^^^^^^^ > selected <- (fit.2$p.value) <0.05 > length(selected) [1] 3456 > MA.selected <- MA.2$M[selected, ] > dim(MA.selected) [1] 4154 3 > fit.2 <- eBayes(fit) Thank you very much Laia
ADD REPLY
0
Entering edit mode
Ohh! I am so sorry!!! I have duplicate. 2 each 32. thank you Laia 2007/2/13, J.Oosting at lumc.nl <j.oosting at="" lumc.nl="">: > First of all, you will have to get rid of the missing values in your > selection vector > > selected[is.na(selected)]<-FALSE > > Secondly, I think that you have duplicate spots on your array, with a > total of 6912 spots. It depends on the layout on the chip how you can > get to the M-values of both spots using the selected vector. > unwrapdups() can help you here > Something like this (untested) > M.uw<-unwrapdups(MA.2$M,ndups=2,spacing=1) # ndups and spacing same as > in lmFit() and duplicateCorrelation() > M.ag<-apply(M.uw,1,function(x) (x[c(T,F)]+x[c(F,T)])/2) # doesn't > handle NA > MA.selected<-M.ag[selected,] > > Jan > > > > -----Original Message----- > From: bioconductor-bounces at stat.math.ethz.ch > [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of Marcelo > Laia > Sent: dinsdag 13 februari 2007 12:51 > To: Bioconductor > Subject: Re: [BioC] Extract M values from probes set to cluster > > Dear Sean > > I thought that I did a mistake in selected. Then, I try... But no > success. > > Here are the outputs: > > > selected <- p.adjust(fit.2$p.value) <0.05 > > summary(selected) > Mode FALSE TRUE NA's > logical 2565 130 761 > > length(selected) > [1] 3456 > > MA.selected <- MA.2$M[selected, ] > > dim(MA.selected) > [1] 1782 3 > > I thought that I did a mistake here: > > > selected <- p.adjust(fit.2$p.value) <0.05 > ^^^^^^^^^^ > > > selected <- (fit.2$p.value) <0.05 > > length(selected) > [1] 3456 > > MA.selected <- MA.2$M[selected, ] > > dim(MA.selected) > [1] 4154 3 > > fit.2 <- eBayes(fit) > > Thank you very much > > Laia > -- Marcelo Luiz de Laia Ph.D Candidate S?o Paulo State University (http://www.unesp.br/eng/) School of Agricultural and Veterinary Sciences Department of Technology Via de Acesso Prof. Paulo Donato Castellane s/n 14884-900 Jaboticabal - SP - Brazil Phone: +55-016-3209-2675 Cell: +55-016-97098526
ADD REPLY
0
Entering edit mode
Hi Jan, I try your suggestion and some errors appear. Could you (or someone) help me again? Thank you very much > fit.2 <- eBayes(fit) > selected <- (fit.2$p.value) <0.05 > > selected[is.na(selected)]<-FALSE > > MA.selected <- MA.2$M[selected, ] > > M.uw<-unwrapdups(MA.2$M,ndups=2,spacing=32) > > M.ag<-apply(M.uw,1,function(x) (x[c(T,F)]+x[c(F,T)])/2) > > MA.selected<-M.ag[selected,] Error: (subscript) logical subscript too long > length(selected) [1] 3456 > length(M.uw) [1] 20736 > lengthM.ag) [1] 10368 > dim(MA.selected) [1] 2632 3 > dim(M.uw) [1] 3456 6 > dimM.ag) [1] 3 3456 > Marcelo 2007/2/13, J.Oosting at lumc.nl <j.oosting at="" lumc.nl="">: > First of all, you will have to get rid of the missing values in your > selection vector > > selected[is.na(selected)]<-FALSE > > Secondly, I think that you have duplicate spots on your array, with a > total of 6912 spots. It depends on the layout on the chip how you can > get to the M-values of both spots using the selected vector. > unwrapdups() can help you here > Something like this (untested) > M.uw<-unwrapdups(MA.2$M,ndups=2,spacing=1) # ndups and spacing same as > in lmFit() and duplicateCorrelation() > M.ag<-apply(M.uw,1,function(x) (x[c(T,F)]+x[c(F,T)])/2) # doesn't > handle NA > MA.selected<-M.ag[selected,] > > Jan > > > > -----Original Message----- > From: bioconductor-bounces at stat.math.ethz.ch > [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of Marcelo > Laia > Sent: dinsdag 13 februari 2007 12:51 > To: Bioconductor > Subject: Re: [BioC] Extract M values from probes set to cluster > > Dear Sean > > I thought that I did a mistake in selected. Then, I try... But no > success. > > Here are the outputs: > > > selected <- p.adjust(fit.2$p.value) <0.05 > > summary(selected) > Mode FALSE TRUE NA's > logical 2565 130 761 > > length(selected) > [1] 3456 > > MA.selected <- MA.2$M[selected, ] > > dim(MA.selected) > [1] 1782 3 > > I thought that I did a mistake here: > > > selected <- p.adjust(fit.2$p.value) <0.05 > ^^^^^^^^^^ > > > selected <- (fit.2$p.value) <0.05 > > length(selected) > [1] 3456 > > MA.selected <- MA.2$M[selected, ] > > dim(MA.selected) > [1] 4154 3 > > fit.2 <- eBayes(fit) > > Thank you very much > > Laia > -- Marcelo Luiz de Laia Ph.D Candidate S?o Paulo State University (http://www.unesp.br/eng/) School of Agricultural and Veterinary Sciences Department of Technology Via de Acesso Prof. Paulo Donato Castellane s/n 14884-900 Jaboticabal - SP - Brazil Phone: +55-016-3209-2675 Cell: +55-016-97098526
ADD REPLY
0
Entering edit mode
As you can see from the dim() statements, the apply function has transposed the array, you can correct that by transposing again. Also you probably forgot the p.adjust() on the p-values from the linear model. M.ag<-t(apply(M.uw,1,function(x) (x[c(T,F)]+x[c(F,T)])/2)) MA.selected<-M.ag[selected,] > > I try your suggestion and some errors appear. > > Could you (or someone) help me again? > > Thank you very much > > > fit.2 <- eBayes(fit) > > selected <- (fit.2$p.value) <0.05 > > > > selected[is.na(selected)]<-FALSE > > > > MA.selected <- MA.2$M[selected, ] > > > > M.uw<-unwrapdups(MA.2$M,ndups=2,spacing=32) > > > > M.ag<-apply(M.uw,1,function(x) (x[c(T,F)]+x[c(F,T)])/2) > > > > MA.selected<-M.ag[selected,] > Error: (subscript) logical subscript too long > > length(selected) > [1] 3456 > > length(M.uw) > [1] 20736 > > lengthM.ag) > [1] 10368 > > dim(MA.selected) > [1] 2632 3 > > dim(M.uw) > [1] 3456 6 > > dimM.ag) > [1] 3 3456 > >
ADD REPLY

Login before adding your answer.

Traffic: 495 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6