Undesirable behavior of limma MArrayLM?
1
0
Entering edit mode
@gordon-smyth
Last seen 1 hour ago
WEHI, Melbourne, Australia
Hi Paul, MArrayLM objects subset in the same way as other objects in R (data.frames, matrices, named vectors etc), and that was a deliberate design decision. All of them can be subsetted using logical, character or numerical indices. Despite your code example, I'm not actually clear in what way you found the behaviour unexpected, or what behaviour you're suggesting would be more desirable. It all seems to be working to me! Regards Gordon ----- original message ------ [BioC] Undesirable behavior of limma MArrayLM? Paul Leo p.leo at uq.edu.au Thu Jun 26 09:33:59 CEST 2008 Personally I don't like this kind of behavior see "#*** and comments... It will surely catch someone out, will it use a rowname or a number , the joy of variable interpolation! Do I complain too much or is this worth a fix? > n<-8963 > fit2[8963,]$genes["ID"] ID 8963 106220736 ## ok that's what I wanted > fit2$genes[8961,"ID"] #** [1] "5050440" ## oops! > test<-fit2$genes > test[8963,] [1] "106220736" ## life is sane again, but now I need more caffeine! > > n<-8963 > fit2[n,]$genes["ID"] ID 8963 106220736 > fit2$genes[n,"ID"] ### Works as I would expect AGAIN [1] "106220736" > test<-fit2$genes > test[n,] [1] "106220736" > > fit2[8963,]$genes["ID"] ID 8963 106220736 > fit2$genes[8961,"ID"] [1] "5050440" > fit2$genes["8961","ID"] # Oh yes... now I get it! [1] "5050440" > fit2$genes[n,"ID"] [1] "106220736" > class(fit2) [1] "MArrayLM" attr(,"package") [1] "limma" > sessionInfo() R version 2.7.1 RC (2008-06-16 r45949) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] limma_2.14.5 Cheers Paul
limma limma • 1.1k views
ADD COMMENT
0
Entering edit mode
Paul Leo ▴ 970
@paul-leo-2092
Last seen 10.2 years ago
I guess this is my point: fit2$genes below is a data.frame when I access it with a numerical valve , this appears to be interpolated to a character. I don't think of this as being typical behaviour for a data.frame see the next line of code for data.frame "results". I access it the same way, the index is treated as numeric : I get back nothing because the numerical index exceeds the dimension of the data.frame. > fit2$genes[8961,"ID"] [1] "5050440" > class(fit2$genes) [1] "data.frame" > results[8961,] # same on any data.frame... ID logFC AveExpr t P.Value adj.P.Val B NA <na> NA NA NA NA NA NA > dim(results) [1] 2927 7 > class(results) [1] "data.frame" Bottom line I think this is undesirable behaviour as these two snips line of code should return the SAME result... least to me: ################# CODE 1###### > fit2$genes[8963,"ID"] ## index is treated as character [1] "5050440" ############################ BUT ################# CODE 1###### > test<-fit2$genes > test[8963,"ID"] ## index is treated as numeric [1] "106220736" ############################ > class(fit2$genes) [1] "data.frame" > class(test) [1] "data.frame" Not putting it forward as a bug, but I found this to be unexpected behavior. Cheers Paul > dim(fit2) [1] 14260 6 -----Original Message----- From: bioconductor-bounces@stat.math.ethz.ch [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of Gordon K Smyth Sent: Saturday, June 28, 2008 2:45 PM To: Bioconductor mailing list Subject: [BioC] Undesirable behavior of limma MArrayLM? Hi Paul, MArrayLM objects subset in the same way as other objects in R (data.frames, matrices, named vectors etc), and that was a deliberate design decision. All of them can be subsetted using logical, character or numerical indices. Despite your code example, I'm not actually clear in what way you found the behaviour unexpected, or what behaviour you're suggesting would be more desirable. It all seems to be working to me! Regards Gordon ----- original message ------ [BioC] Undesirable behavior of limma MArrayLM? Paul Leo p.leo at uq.edu.au Thu Jun 26 09:33:59 CEST 2008 Personally I don't like this kind of behavior see "#*** and comments... It will surely catch someone out, will it use a rowname or a number , the joy of variable interpolation! Do I complain too much or is this worth a fix? > n<-8963 > fit2[8963,]$genes["ID"] ID 8963 106220736 ## ok that's what I wanted > fit2$genes[8961,"ID"] #** [1] "5050440" ## oops! > test<-fit2$genes > test[8963,] [1] "106220736" ## life is sane again, but now I need more caffeine! > > n<-8963 > fit2[n,]$genes["ID"] ID 8963 106220736 > fit2$genes[n,"ID"] ### Works as I would expect AGAIN [1] "106220736" > test<-fit2$genes > test[n,] [1] "106220736" > > fit2[8963,]$genes["ID"] ID 8963 106220736 > fit2$genes[8961,"ID"] [1] "5050440" > fit2$genes["8961","ID"] # Oh yes... now I get it! [1] "5050440" > fit2$genes[n,"ID"] [1] "106220736" > class(fit2) [1] "MArrayLM" attr(,"package") [1] "limma" > sessionInfo() R version 2.7.1 RC (2008-06-16 r45949) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] limma_2.14.5 Cheers Paul _______________________________________________ Bioconductor mailing list Bioconductor at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/bioconductor Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD COMMENT
0
Entering edit mode
Oops my error ... after restarting R I can't reproduce the problem. Near the memory limit of this windows box I sometimes get some strange stuff happening... My apologies Paul -----Original Message----- From: bioconductor-bounces@stat.math.ethz.ch [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of Paul Leo Sent: Monday, June 30, 2008 9:57 AM To: Gordon K Smyth; Bioconductor mailing list Subject: Re: [BioC] Undesirable behavior of limma MArrayLM? I guess this is my point: fit2$genes below is a data.frame when I access it with a numerical valve , this appears to be interpolated to a character. I don't think of this as being typical behaviour for a data.frame see the next line of code for data.frame "results". I access it the same way, the index is treated as numeric : I get back nothing because the numerical index exceeds the dimension of the data.frame. > fit2$genes[8961,"ID"] [1] "5050440" > class(fit2$genes) [1] "data.frame" > results[8961,] # same on any data.frame... ID logFC AveExpr t P.Value adj.P.Val B NA <na> NA NA NA NA NA NA > dim(results) [1] 2927 7 > class(results) [1] "data.frame" Bottom line I think this is undesirable behaviour as these two snips line of code should return the SAME result... least to me: ################# CODE 1###### > fit2$genes[8963,"ID"] ## index is treated as character [1] "5050440" ############################ BUT ################# CODE 1###### > test<-fit2$genes > test[8963,"ID"] ## index is treated as numeric [1] "106220736" ############################ > class(fit2$genes) [1] "data.frame" > class(test) [1] "data.frame" Not putting it forward as a bug, but I found this to be unexpected behavior. Cheers Paul > dim(fit2) [1] 14260 6 -----Original Message----- From: bioconductor-bounces@stat.math.ethz.ch [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of Gordon K Smyth Sent: Saturday, June 28, 2008 2:45 PM To: Bioconductor mailing list Subject: [BioC] Undesirable behavior of limma MArrayLM? Hi Paul, MArrayLM objects subset in the same way as other objects in R (data.frames, matrices, named vectors etc), and that was a deliberate design decision. All of them can be subsetted using logical, character or numerical indices. Despite your code example, I'm not actually clear in what way you found the behaviour unexpected, or what behaviour you're suggesting would be more desirable. It all seems to be working to me! Regards Gordon ----- original message ------ [BioC] Undesirable behavior of limma MArrayLM? Paul Leo p.leo at uq.edu.au Thu Jun 26 09:33:59 CEST 2008 Personally I don't like this kind of behavior see "#*** and comments... It will surely catch someone out, will it use a rowname or a number , the joy of variable interpolation! Do I complain too much or is this worth a fix? > n<-8963 > fit2[8963,]$genes["ID"] ID 8963 106220736 ## ok that's what I wanted > fit2$genes[8961,"ID"] #** [1] "5050440" ## oops! > test<-fit2$genes > test[8963,] [1] "106220736" ## life is sane again, but now I need more caffeine! > > n<-8963 > fit2[n,]$genes["ID"] ID 8963 106220736 > fit2$genes[n,"ID"] ### Works as I would expect AGAIN [1] "106220736" > test<-fit2$genes > test[n,] [1] "106220736" > > fit2[8963,]$genes["ID"] ID 8963 106220736 > fit2$genes[8961,"ID"] [1] "5050440" > fit2$genes["8961","ID"] # Oh yes... now I get it! [1] "5050440" > fit2$genes[n,"ID"] [1] "106220736" > class(fit2) [1] "MArrayLM" attr(,"package") [1] "limma" > sessionInfo() R version 2.7.1 RC (2008-06-16 r45949) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] limma_2.14.5 Cheers Paul _______________________________________________ Bioconductor mailing list Bioconductor at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/bioconductor Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor _______________________________________________ Bioconductor mailing list Bioconductor at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/bioconductor Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD REPLY
0
Entering edit mode
Hi Paul, Thanks for the clarification. Let me just add that in your examples below, you are alway subsetting data.frames, not objects defined in limma. So you are invoking subsetting commands defined in the R base package, rather than those defined in the limma package. E.g. fit2$genes[i,j] invokes two functions: '$' and '[]' both defined in the base package. So whatever the problem is, it must be affecting your R installation, not just Bioconductor. Hope this helps All the best Gordon On Mon, 30 Jun 2008, Paul Leo wrote: > Oops my error ... after restarting R I can't reproduce the problem. > > Near the memory limit of this windows box I sometimes get some strange > stuff happening... > > My apologies > Paul > > > > -----Original Message----- > From: bioconductor-bounces at stat.math.ethz.ch > [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of Paul Leo > Sent: Monday, June 30, 2008 9:57 AM > To: Gordon K Smyth; Bioconductor mailing list > Subject: Re: [BioC] Undesirable behavior of limma MArrayLM? > > I guess this is my point: fit2$genes below is a data.frame when I access > it with a numerical valve , this appears to be interpolated to a > character. > > I don't think of this as being typical behaviour for a data.frame see > the next line of code for data.frame "results". I access it the same > way, the index is treated as numeric : I get back nothing because the > numerical index exceeds the dimension of the data.frame. > >> fit2$genes[8961,"ID"] > [1] "5050440" > >> class(fit2$genes) > [1] "data.frame" > >> results[8961,] # same on any data.frame... > ID logFC AveExpr t P.Value adj.P.Val B > NA <na> NA NA NA NA NA NA > >> dim(results) > [1] 2927 7 >> class(results) > [1] "data.frame" > > > Bottom line I think this is undesirable behaviour as these two snips > line of code should return the SAME result... least to me: > > ################# CODE 1###### >> fit2$genes[8963,"ID"] ## index is treated as character > [1] "5050440" > ############################ > > BUT > > ################# CODE 1###### >> test<-fit2$genes >> test[8963,"ID"] ## index is treated as numeric > [1] "106220736" > ############################ > > >> class(fit2$genes) > [1] "data.frame" >> class(test) > [1] "data.frame" > > Not putting it forward as a bug, but I found this to be unexpected > behavior. > > > Cheers > Paul > > >> dim(fit2) > [1] 14260 6
ADD REPLY

Login before adding your answer.

Traffic: 460 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