Search
Question: multiple annotations with get()?
0
gravatar for Ed Siefker
4.1 years ago by
Ed Siefker210
United States
Ed Siefker210 wrote:
I have a list of gene symbols I want to convert into entrez ids. For example, I have a txt file with these symbols: SFRP2 MGP COL10A1 MSRB3 I've loaded Biobase, annotate, and org.Hs.eg.db and done the following: symb<- read.table("example.txt",stringsAsFactors=FALSE) > get(symb, org.Hs.egSYMBOL2EG) Error in .checkKeysAreWellFormed(keys) : keys must be supplied in a character vector with no NAs > class(symb[[1]]) [1] "character" > length(symb[[1]]) [1] 4 > get(symb[[1]], org.Hs.egSYMBOL2EG) [1] "6423" Why is get() only giving me one entrez ID? Shouldn't it give me a vector of 4 entrez IDs when I pass it a vector of 4 gene symbols?
ADD COMMENTlink modified 4.1 years ago by Sean Davis21k • written 4.1 years ago by Ed Siefker210
0
gravatar for Sean Davis
4.1 years ago by
Sean Davis21k
United States
Sean Davis21k wrote:
On Fri, Oct 11, 2013 at 3:31 PM, Ed Siefker <ebs15242 at="" gmail.com=""> wrote: > I have a list of gene symbols I want to convert into entrez ids. > For example, I have a txt file with these symbols: > > SFRP2 > MGP > COL10A1 > MSRB3 > > I've loaded Biobase, annotate, and org.Hs.eg.db and done the following: > > symb<- read.table("example.txt",stringsAsFactors=FALSE) >> get(symb, org.Hs.egSYMBOL2EG) Hi, Ed. You may want to use mget (multiple get) instead. Sean > Error in .checkKeysAreWellFormed(keys) : > keys must be supplied in a character vector with no NAs >> class(symb[[1]]) > [1] "character" >> length(symb[[1]]) > [1] 4 >> get(symb[[1]], org.Hs.egSYMBOL2EG) > [1] "6423" > > Why is get() only giving me one entrez ID? Shouldn't it give me a vector > of 4 entrez IDs when I pass it a vector of 4 gene symbols? > > _______________________________________________ > 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 4.1 years ago by Sean Davis21k
Thanks, I figured the answer would be something trivial but nonobvious like that. Out of curiosity, is there a reason get() isn't designed to "do the right thing" if passed a character vector of length >1? On Fri, Oct 11, 2013 at 2:34 PM, Sean Davis <sdavis2 at="" mail.nih.gov=""> wrote: > On Fri, Oct 11, 2013 at 3:31 PM, Ed Siefker <ebs15242 at="" gmail.com=""> wrote: >> I have a list of gene symbols I want to convert into entrez ids. >> For example, I have a txt file with these symbols: >> >> SFRP2 >> MGP >> COL10A1 >> MSRB3 >> >> I've loaded Biobase, annotate, and org.Hs.eg.db and done the following: >> >> symb<- read.table("example.txt",stringsAsFactors=FALSE) >>> get(symb, org.Hs.egSYMBOL2EG) > > Hi, Ed. > > You may want to use mget (multiple get) instead. > > Sean > >> Error in .checkKeysAreWellFormed(keys) : >> keys must be supplied in a character vector with no NAs >>> class(symb[[1]]) >> [1] "character" >>> length(symb[[1]]) >> [1] 4 >>> get(symb[[1]], org.Hs.egSYMBOL2EG) >> [1] "6423" >> >> Why is get() only giving me one entrez ID? Shouldn't it give me a vector >> of 4 entrez IDs when I pass it a vector of 4 gene symbols? >> >> _______________________________________________ >> 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 4.1 years ago by Ed Siefker210
Hi Ed, I am not sure how this is non-obvious. You tried something and then didn't get the result you expected. In my mind, the next obvious step is to read the help page for get() to see what the API for that function is. And if you had done so, you would have seen: Description: Search by name for an object (?get?) or zero or more objects (?mget?). Usage: get(x, pos = -1, envir = as.environment(pos), mode = "any", inherits = TRUE) mget(x, envir = as.environment(-1), mode = "any", ifnotfound, inherits = FALSE) Arguments: x: For ?get?, an object name (given as a character string). For ?mget?, a character vector of object names. Best, Jim On Friday, October 11, 2013 4:08:13 PM, Ed Siefker wrote: > Thanks, I figured the answer would be something trivial but nonobvious > like that. Out of > curiosity, is there a reason get() isn't designed to "do the right > thing" if passed a character > vector of length >1? > > On Fri, Oct 11, 2013 at 2:34 PM, Sean Davis <sdavis2 at="" mail.nih.gov=""> wrote: >> On Fri, Oct 11, 2013 at 3:31 PM, Ed Siefker <ebs15242 at="" gmail.com=""> wrote: >>> I have a list of gene symbols I want to convert into entrez ids. >>> For example, I have a txt file with these symbols: >>> >>> SFRP2 >>> MGP >>> COL10A1 >>> MSRB3 >>> >>> I've loaded Biobase, annotate, and org.Hs.eg.db and done the following: >>> >>> symb<- read.table("example.txt",stringsAsFactors=FALSE) >>>> get(symb, org.Hs.egSYMBOL2EG) >> >> Hi, Ed. >> >> You may want to use mget (multiple get) instead. >> >> Sean >> >>> Error in .checkKeysAreWellFormed(keys) : >>> keys must be supplied in a character vector with no NAs >>>> class(symb[[1]]) >>> [1] "character" >>>> length(symb[[1]]) >>> [1] 4 >>>> get(symb[[1]], org.Hs.egSYMBOL2EG) >>> [1] "6423" >>> >>> Why is get() only giving me one entrez ID? Shouldn't it give me a vector >>> of 4 entrez IDs when I pass it a vector of 4 gene symbols? >>> >>> _______________________________________________ >>> 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 -- 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 4.1 years ago by James W. MacDonald45k
You might also consider using select(), which is the newfangled way to do things: > z <- c("SFRP2","MGP","COL10A1","MSRB3") > select(org.Hs.eg.db, z, "ENTREZID","SYMBOL") SYMBOL ENTREZID 1 SFRP2 6423 2 MGP 4256 3 COL10A1 1300 4 MSRB3 253827 Best, Jim On Friday, October 11, 2013 3:34:45 PM, Sean Davis wrote: > On Fri, Oct 11, 2013 at 3:31 PM, Ed Siefker <ebs15242 at="" gmail.com=""> wrote: >> I have a list of gene symbols I want to convert into entrez ids. >> For example, I have a txt file with these symbols: >> >> SFRP2 >> MGP >> COL10A1 >> MSRB3 >> >> I've loaded Biobase, annotate, and org.Hs.eg.db and done the following: >> >> symb<- read.table("example.txt",stringsAsFactors=FALSE) >>> get(symb, org.Hs.egSYMBOL2EG) > > Hi, Ed. > > You may want to use mget (multiple get) instead. > > Sean > >> Error in .checkKeysAreWellFormed(keys) : >> keys must be supplied in a character vector with no NAs >>> class(symb[[1]]) >> [1] "character" >>> length(symb[[1]]) >> [1] 4 >>> get(symb[[1]], org.Hs.egSYMBOL2EG) >> [1] "6423" >> >> Why is get() only giving me one entrez ID? Shouldn't it give me a vector >> of 4 entrez IDs when I pass it a vector of 4 gene symbols? >> >> _______________________________________________ >> 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 -- 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 4.1 years ago by James W. MacDonald45k
On Fri, Oct 11, 2013 at 3:53 PM, James W. MacDonald <jmacdon at="" uw.edu=""> wrote: > You might also consider using select(), which is the newfangled way to do > things: > >> z <- c("SFRP2","MGP","COL10A1","MSRB3") >> select(org.Hs.eg.db, z, "ENTREZID","SYMBOL") > > SYMBOL ENTREZID > 1 SFRP2 6423 > 2 MGP 4256 > 3 COL10A1 1300 > 4 MSRB3 253827 Definitely the better way to go. Sean > On Friday, October 11, 2013 3:34:45 PM, Sean Davis wrote: >> >> On Fri, Oct 11, 2013 at 3:31 PM, Ed Siefker <ebs15242 at="" gmail.com=""> wrote: >>> >>> I have a list of gene symbols I want to convert into entrez ids. >>> For example, I have a txt file with these symbols: >>> >>> SFRP2 >>> MGP >>> COL10A1 >>> MSRB3 >>> >>> I've loaded Biobase, annotate, and org.Hs.eg.db and done the following: >>> >>> symb<- read.table("example.txt",stringsAsFactors=FALSE) >>>> >>>> get(symb, org.Hs.egSYMBOL2EG) >> >> >> Hi, Ed. >> >> You may want to use mget (multiple get) instead. >> >> Sean >> >>> Error in .checkKeysAreWellFormed(keys) : >>> keys must be supplied in a character vector with no NAs >>>> >>>> class(symb[[1]]) >>> >>> [1] "character" >>>> >>>> length(symb[[1]]) >>> >>> [1] 4 >>>> >>>> get(symb[[1]], org.Hs.egSYMBOL2EG) >>> >>> [1] "6423" >>> >>> Why is get() only giving me one entrez ID? Shouldn't it give me a vector >>> of 4 entrez IDs when I pass it a vector of 4 gene symbols? >>> >>> _______________________________________________ >>> 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 > > > -- > 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 4.1 years ago by Sean Davis21k
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: 132 users visited in the last hour