string to function argument
4
0
Entering edit mode
@jeremiah-h-savage-4102
Last seen 10.2 years ago
Hello, I would like to get the Table information out of multiple GPLList objects. How can I use a string/char variable as a function argument? In this case the function is GEOquery::Table() geodata <- parseGEO("GSExxxx.soft") gpldata <- GPLList(geodata)[1] gplname <- names(gpldata) # eg. "GPL96" gplaccess <- paste(gpldata,gplname,sep="$") ENTREZ_GENE_ID <- Table(gplaccess)$ENTREZ_GENE_ID ###^^^ the above line does NOT work ,but ENTREZ_GENE_ID <-Table(gpldata$GPL96)$ENTREZ_GENE_ID ###^^^ the above line DOES work
• 1.4k views
ADD COMMENT
0
Entering edit mode
@jeremiah-h-savage-4102
Last seen 10.2 years ago
One minor correction to the question: gplaccess <- paste("gpldata",gplname,sep="$") Thanks, Jeremiah On Tue, Jun 29, 2010 at 4:44 PM, Jeremiah H. Savage <jeremiahsavage at="" gmail.com=""> wrote: > Hello, > > I would like to get the Table information out of multiple GPLList objects. > > How can I use a string/char variable as a function argument? > > In this case the function is GEOquery::Table() > > geodata <- parseGEO("GSExxxx.soft") > gpldata <- GPLList(geodata)[1] > gplname <- names(gpldata) ?# eg. "GPL96" > gplaccess <- paste(gpldata,gplname,sep="$") > > ENTREZ_GENE_ID <- Table(gplaccess)$ENTREZ_GENE_ID > ###^^^ the above line does NOT work ,but > > ENTREZ_GENE_ID <-Table(gpldata$GPL96)$ENTREZ_GENE_ID > ###^^^ the above line DOES work >
ADD COMMENT
0
Entering edit mode
@jeremiah-h-savage-4102
Last seen 10.2 years ago
I just found out that I can access the gpldata list object through [[1]] instead of $GPL96, so the problem is solved. On Tue, Jun 29, 2010 at 4:44 PM, Jeremiah H. Savage <jeremiahsavage at="" gmail.com=""> wrote: > Hello, > > I would like to get the Table information out of multiple GPLList objects. > > How can I use a string/char variable as a function argument? > > In this case the function is GEOquery::Table() > > geodata <- parseGEO("GSExxxx.soft") > gpldata <- GPLList(geodata)[1] > gplname <- names(gpldata) ?# eg. "GPL96" > gplaccess <- paste(gpldata,gplname,sep="$") > > ENTREZ_GENE_ID <- Table(gplaccess)$ENTREZ_GENE_ID > ###^^^ the above line does NOT work ,but > > ENTREZ_GENE_ID <-Table(gpldata$GPL96)$ENTREZ_GENE_ID > ###^^^ the above line DOES work >
ADD COMMENT
0
Entering edit mode
@sean-davis-490
Last seen 3 months ago
United States
Hi, Jeremiah. The gpldata object is a list and the line that you are using that you say does work is the correct way to access the data. I'm not sure what else you are trying to do. Could you clarify? Sean On Jun 29, 2010 7:44 PM, "Jeremiah H. Savage" <jeremiahsavage@gmail.com> wrote: Hello, I would like to get the Table information out of multiple GPLList objects. How can I use a string/char variable as a function argument? In this case the function is GEOquery::Table() geodata <- parseGEO("GSExxxx.soft") gpldata <- GPLList(geodata)[1] gplname <- names(gpldata) # eg. "GPL96" gplaccess <- paste(gpldata,gplname,sep="$") ENTREZ_GENE_ID <- Table(gplaccess)$ENTREZ_GENE_ID ###^^^ the above line does NOT work ,but ENTREZ_GENE_ID <-Table(gpldata$GPL96)$ENTREZ_GENE_ID ###^^^ the above line DOES work _______________________________________________ Bioconductor mailing list Bioconductor@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/bioconductor Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor [[alternative HTML version deleted]]
ADD COMMENT
0
Entering edit mode
Hi Sean, I just saw your message after sending the last one a minute ago. My question was that I wanted to use a character object 'gplaccess' that contained the string "gpldata$GPL96" I wanted to use this string to access a data.frame in a GEOData object, but the Table() function expects a GEOData-Class, not a string. So Table(gpldata$GPL96) will access the data.frame but Table(gplaccess) would not access that data.frame, as I get the following error: > Table(gplaccess) Error in function (classes, fdef, mtable) : unable to find an inherited method for function "Table", for signature "character" So, is there a function I can apply to 'gplaccess' to have it be an accepted argument to Table()? I tried Table(cat(gplaccess)) Tableas.name(gplaccess)) and others without success. Thanks again, Jeremiah On Tue, Jun 29, 2010 at 6:47 PM, Sean Davis <sdavis2 at="" mail.nih.gov=""> wrote: > Hi, Jeremiah. > > The gpldata object is a list and the line that you are using that you say > does work is the correct way to access the data.? I'm not sure what else you > are trying to do.? Could you clarify? > > Sean > > On Jun 29, 2010 7:44 PM, "Jeremiah H. Savage" <jeremiahsavage at="" gmail.com=""> > wrote: > > Hello, > > I would like to get the Table information out of multiple GPLList objects. > > How can I use a string/char variable as a function argument? > > In this case the function is GEOquery::Table() > > geodata <- parseGEO("GSExxxx.soft") > gpldata <- GPLList(geodata)[1] > gplname <- names(gpldata) ?# eg. "GPL96" > gplaccess <- paste(gpldata,gplname,sep="$") > > ENTREZ_GENE_ID <- Table(gplaccess)$ENTREZ_GENE_ID > ###^^^ the above line does NOT work ,but > > ENTREZ_GENE_ID <-Table(gpldata$GPL96)$ENTREZ_GENE_ID > ###^^^ the above line DOES work > > _______________________________________________ > 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
@sean-davis-490
Last seen 3 months ago
United States
You can also do gpldata[["GPL96"]]. Is that what you want to do? Sean On Jun 29, 2010 10:06 PM, "Jeremiah H. Savage" <jeremiahsavage@gmail.com> wrote: I just found out that I can access the gpldata list object through [[1]] instead of $GPL96, so the problem is solved. On Tue, Jun 29, 2010 at 4:44 PM, Jeremiah H. Savage <jeremiahsavage@gmail.com> wrote: > Hello, > > ... [[alternative HTML version deleted]]
ADD COMMENT
0
Entering edit mode
That does work. Thanks. I also was pointed to a way to do the function call using a string to represent the entire argument: gplaccess <- "gpldata$GPL97" Table(eval(parse(text=gplaccess))) Jeremiah On Wed, Jun 30, 2010 at 3:36 AM, Sean Davis <sdavis2 at="" mail.nih.gov=""> wrote: > You can also do gpldata[["GPL96"]].? Is that what you want to do? > > Sean > > On Jun 29, 2010 10:06 PM, "Jeremiah H. Savage" <jeremiahsavage at="" gmail.com=""> > wrote: > > I just found out that I can access the gpldata list object through > [[1]] instead of $GPL96, so the problem is solved. > > On Tue, Jun 29, 2010 at 4:44 PM, Jeremiah H. Savage > <jeremiahsavage at="" gmail.com=""> wrote: >> Hello, >> >> ...
ADD REPLY
0
Entering edit mode
On Wed, Jun 30, 2010 at 2:04 PM, Jeremiah H. Savage < jeremiahsavage@gmail.com> wrote: > That does work. Thanks. > > Glad it worked for you. > I also was pointed to a way to do the function call using a string to > represent the entire argument: > > gplaccess <- "gpldata$GPL97" > Table(eval(parse(text=gplaccess))) While this will work, for the record, I would not recommend this as a way to access list elements. Sean > > Jeremiah > > On Wed, Jun 30, 2010 at 3:36 AM, Sean Davis <sdavis2@mail.nih.gov> wrote: > > You can also do gpldata[["GPL96"]]. Is that what you want to do? > > > > Sean > > > > On Jun 29, 2010 10:06 PM, "Jeremiah H. Savage" <jeremiahsavage@gmail.com> > > > wrote: > > > > I just found out that I can access the gpldata list object through > > [[1]] instead of $GPL96, so the problem is solved. > > > > On Tue, Jun 29, 2010 at 4:44 PM, Jeremiah H. Savage > > <jeremiahsavage@gmail.com> wrote: > >> Hello, > >> > >> ... > [[alternative HTML version deleted]]
ADD REPLY

Login before adding your answer.

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