Biobase geneData, geneRecommender data object
1
0
Entering edit mode
R.T. Sweeney ▴ 10
@rt-sweeney-4754
Last seen 9.6 years ago
Hi, I am trying to use the package geneRecommender (along with Biobase) to find genes that co-vary with a query set of genes. I am struggling just to load my own data and the documentation is somewhat brief. The example uses the geneData prepackaged in Biobase. I have read Biobase documentation and geneRecommender documentation and searched extensively online for help. The code appears straightforward: > library(geneRecommender) > data(geneData) > my.query <- c("31613_at", "31712_at", "31497_at") > normalized.data <- gr.normalize(geneData) > gr.main(normalized.data, my.query, ngenes = 10 I do not understand how to get my data into a form that will load like data(geneData). When you load the Biobase library the object geneData cannot by found with typeof or attributes. > typeof(geneData) Error in typeof(geneData) : object 'geneData' not found > class(geneData) Error: object 'geneData' not found However, once you run the command data(geneData) then typeof(geneData) and class(geneData) are informative. > data(geneData) > typeof(geneData) [1] "double" > class(geneData) [1] "matrix" Same is true with trying to write.table geneData...object not found until data(geneData) performed. > write.table(geneData, file="geneData.txt", sep="\t", col.names = NA) Error in inherits(x, "data.frame") : object 'geneData' not found > data(geneData) > write.table(geneData, file="geneData.txt", sep="\t", col.names = NA) geneData looks like this: A B C D AFFX-MurIL2_at 192.742000 85.753300 176.757000 1.35575e+02 AFFX-MurIL10_at 97.137000 126.196000 77.921600 9.33713e+01 AFFX-MurIL4_at 45.819200 8.831350 33.063200 2.87072e+01 AFFX-MurFAS_at 22.544500 3.600930 14.688300 1.23397e+01 I have a test tab delimited file (my_data.txt) that looks like this(cDNA array data, not affy): S1 S2 S3 S4 S5 S6 S7 S8 1 NA NA NA NA -0.77 -1.02 -1.18 1.51 With the dimensions of 186 rows and 8 columns. I have built an expressionSet exprs from my_data.txt, coerced into a data.frame, tried it as a matrix, and cannot get data(exprs) to load like data(geneData). > dataDirectory <- system.file("extdata", package = "Biobase") > exprsFile <- "path/to/my_data.txt" > exprs <- as.matrix(read.table(exprsFile, header = TRUE, sep = "\t", row.names = 1, as.is = TRUE)) > class(exprs) [1] "matrix" > typeof(exprs) [1] "double" So, exprs appears to match geneData class and typeof (shown above) > data(exprs) Warning message: In data(exprs) : data set 'exprs' not found Then, when I check exprs, I find the appropriate data which seems to match geneData attributes: head(exprs[, 1:2]) S1 S2 1 0.58 -0.79 2 1.98 -0.67 3 NA NA 4 -1.37 -1.83 5 NA NA 6 1.60 0.55 > attributes(exprs) $dim [1] 186 8 $dimnames[[1]] [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" [10] "10" "11" "12" "13" "14" "15" "16" "17" "18" [19] "19" "20" "21" "22" "23" "24" "25" "26" "27" [28] "28" "29" "30" "31" "32" "33" "34" "35" "36" etc $dimnames[[2]] [1] "S1" [2] "S2" [3] "S3" etc Similar to what is found looking at attributes(geneData) (but only after data(geneData) ) > attributes(geneData) $dim [1] 500 26 $dimnames $dimnames[[1]] [1] "AFFX-MurIL2_at" "AFFX-MurIL10_at" [3] "AFFX-MurIL4_at" "AFFX-MurFAS_at" [5] "AFFX-BioB-5_at" "AFFX-BioB-M_at" $dimnames[[2]] [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" [20] "T" "U" "V" "W" "X" "Y" "Z" I am aware that this is likely a basic R issue but I have just struggled quite a few hours trying to troubleshoot and figure this out, but can't. I need help getting my matrix input file loaded like data(geneData) in the geneRecommender example. Any advice would be greatly appreciated. Thanks, Robert Sweeney > sessionInfo() R version 2.13.0 (2011-04-13) Platform: x86_64-redhat-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] geneRecommender_1.24.0 Biobase_2.12.2 loaded via a namespace (and not attached): [1] tools_2.13.0 >
Biobase geneRecommender Biobase geneRecommender • 1.1k views
ADD COMMENT
0
Entering edit mode
@steve-lianoglou-2771
Last seen 13 months ago
United States
Hi, On Wed, Jul 13, 2011 at 4:09 PM, R.T. Sweeney <rtswee2 at="" stanford.edu=""> wrote: > Hi, > I am trying to use the package geneRecommender (along with Biobase) to find genes that co-vary with a query set of genes. > I am struggling just to load my own data and the documentation is somewhat brief. > The example uses the geneData prepackaged in Biobase. I have read Biobase documentation and geneRecommender > documentation and searched extensively online for help. > > The code appears straightforward: >> library(geneRecommender) >> data(geneData) >> my.query <- c("31613_at", "31712_at", "31497_at") >> normalized.data <- gr.normalize(geneData) >> gr.main(normalized.data, my.query, ngenes = 10 > > I do not understand how to get my data into a form that will load like data(geneData). > When you load the Biobase library the object geneData cannot by found with typeof or attributes. > >> typeof(geneData) > Error in typeof(geneData) : object 'geneData' not found >> class(geneData) > Error: object 'geneData' not found > > However, once you run the command data(geneData) then typeof(geneData) and class(geneData) are informative. >> data(geneData) >> typeof(geneData) > [1] "double" >> class(geneData) > [1] "matrix" I'm going to cut here. Take a minute to read the help file in ?data Calling `data()` is a mechanism to load a data file that is typically distributed with a package, for the purposes of running/showing examples. You really don't have to worry about getting your data into a form that can be loaded by `data` -- you just need to get your data in a form that you can load into R, and it seems you have already done that. It looks like for geneRecommender to work (I've never used it, so I don't know), you need to get your dat into numeric matrix form. By what you say later in your email, it seems you can pull your data into R in such a form (with a mix of read.table and as.matrix). So ... that's it, you're ready to work with it now. If you need to follow the examples verbatim, maybe you can set your data to be named `geneData`, but it's probably best to figure out what the vignettes show that you need to do to the `geneData` matrix, and just do the same with your data matrix. HTH, -steve > Same is true with trying to write.table geneData...object not found until data(geneData) performed. >> write.table(geneData, file="geneData.txt", sep="\t", col.names = NA) > Error in inherits(x, "data.frame") : object 'geneData' not found >> data(geneData) >> write.table(geneData, file="geneData.txt", sep="\t", col.names = NA) > > geneData looks like this: > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? A ? ? ? ? ? B ? ? ? ? ? C ? ? ? ? ? ?D > AFFX-MurIL2_at ? ? ? ? ? ? ? 192.742000 ? 85.753300 ?176.757000 ?1.35575e+02 > AFFX-MurIL10_at ? ? ? ? ? ? ? 97.137000 ?126.196000 ? 77.921600 ?9.33713e+01 > AFFX-MurIL4_at ? ? ? ? ? ? ? ?45.819200 ? ?8.831350 ? 33.063200 ?2.87072e+01 > AFFX-MurFAS_at ? ? ? ? ? ? ? ?22.544500 ? ?3.600930 ? 14.688300 ?1.23397e+01 > > I have a test tab delimited file (my_data.txt) that looks like this(cDNA array data, not affy): > ? ? ? ? ? ? ? ?S1 ? ? ?S2 ? ? ?S3 ? ? ?S4 ? ? ? ?S5 ? ? ?S6 ? ? ?S7 ? ? S8 > 1 ? ? ? ? ? ? ? NA ? ? ?NA ? ? ?NA ? ? ?NA ? ? ?-0.77 ? -1.02 ? -1.18 ? 1.51 > > With the dimensions of 186 rows and 8 columns. > > I have built an expressionSet exprs from my_data.txt, coerced into a data.frame, tried it as a matrix, and > cannot get data(exprs) to load like data(geneData). > >> dataDirectory <- system.file("extdata", package = "Biobase") >> exprsFile <- "path/to/my_data.txt" >> exprs <- as.matrix(read.table(exprsFile, header = TRUE, sep = "\t", row.names = 1, as.is = TRUE)) >> class(exprs) > [1] "matrix" >> typeof(exprs) > [1] "double" > > So, exprs appears to match geneData class and typeof (shown above) > >> data(exprs) > Warning message: > In data(exprs) : data set 'exprs' not found > > Then, when I check exprs, I find the appropriate data which seems to match geneData attributes: > head(exprs[, 1:2]) > ? ? ? ? ? S1 ? ? ? ? ? ? ? ? ? ?S2 > 1 ? ? ? ?0.58 ? ? ? ? ? ? ? ? -0.79 > 2 ? ? ? ?1.98 ? ? ? ? ? ? ? ? -0.67 > 3 ? ? ? ? NA ? ? ? ? ? ? ? ? ? NA > 4 ? ? ? -1.37 ? ? ? ? ? ? ? ? -1.83 > 5 ? ? ? ? NA ? ? ? ? ? ? ? ? ? NA > 6 ? ? ? 1.60 ? ? ? ? ? ? ? ? ? 0.55 > >> attributes(exprs) > $dim > [1] 186 ? ?8 > > $dimnames[[1]] > ? ?[1] "1" ? ? "2" ? ? "3" ? ? "4" ? ? "5" ? ? "6" ? ? "7" ? ? "8" ? ? "9" > ? [10] "10" ? ?"11" ? ?"12" ? ?"13" ? ?"14" ? ?"15" ? ?"16" ? ?"17" ? ?"18" > ? [19] "19" ? ?"20" ? ?"21" ? ?"22" ? ?"23" ? ?"24" ? ?"25" ? ?"26" ? ?"27" > ? [28] "28" ? ?"29" ? ?"30" ? ?"31" ? ?"32" ? ?"33" ? ?"34" ? ?"35" ? ?"36" > etc > > $dimnames[[2]] > ?[1] "S1" > ?[2] "S2" > ?[3] "S3" > etc > > Similar to what is found looking at attributes(geneData) (but only after data(geneData) ) > >> attributes(geneData) > $dim > [1] 500 ?26 > $dimnames > $dimnames[[1]] > ?[1] "AFFX-MurIL2_at" ? ? ? ? ? ? ?"AFFX-MurIL10_at" > ?[3] "AFFX-MurIL4_at" ? ? ? ? ? ? ?"AFFX-MurFAS_at" > ?[5] "AFFX-BioB-5_at" ? ? ? ? ? ? ?"AFFX-BioB-M_at" > $dimnames[[2]] > ?[1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" > [20] "T" "U" "V" "W" "X" "Y" "Z" > > I am aware that this is likely a basic R issue but I have just struggled quite a few hours trying to troubleshoot > and figure this out, but can't. I need help getting my matrix input file loaded like data(geneData) in the geneRecommender example. > > Any advice would be greatly appreciated. > > Thanks, > Robert Sweeney > >> sessionInfo() > R version 2.13.0 (2011-04-13) > Platform: x86_64-redhat-linux-gnu (64-bit) > > locale: > ?[1] LC_CTYPE=en_US.UTF-8 ? ? ? LC_NUMERIC=C > ?[3] LC_TIME=en_US.UTF-8 ? ? ? ?LC_COLLATE=en_US.UTF-8 > ?[5] LC_MONETARY=C ? ? ? ? ? ? ?LC_MESSAGES=en_US.UTF-8 > ?[7] LC_PAPER=en_US.UTF-8 ? ? ? LC_NAME=C > ?[9] LC_ADDRESS=C ? ? ? ? ? ? ? LC_TELEPHONE=C > [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats ? ? graphics ?grDevices utils ? ? datasets ?methods ? base > > other attached packages: > [1] geneRecommender_1.24.0 Biobase_2.12.2 > > loaded via a namespace (and not attached): > [1] tools_2.13.0 >> > > _______________________________________________ > 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 > -- Steve Lianoglou Graduate Student: Computational Systems Biology ?| Memorial Sloan-Kettering Cancer Center ?| Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact
ADD COMMENT

Login before adding your answer.

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