R - how to create an expression matrix from limma test DE data?
1
3
Entering edit mode
9.6 years ago
orzech_mag ▴ 230

Hallo,

I would like to create such an expression matrix:

GENE ID/SAMPLE     sample1     sample2     sample3     sample4     sample-n
gene1              logFC       ...         ...         ...         ...
gene2              ...         ...         ...         ...         ...
gene3              ...         ...         ...         ...         ...
gene4              ...         ...         ...         ...         ...
gene-n             ...         ...         ...         ...         ...

using data from GSE at GEO. I will be grateful for any suggestions or just codes.

Second thing:

How to get such an expression matrix after limma DE analysis? How to modify limma codes? I will appreciate any suggestions or codes.

Thanks in advance, one more time.

Regards!

R procedure GEO • 5.9k views
ADD COMMENT
6
Entering edit mode
9.6 years ago

Something like this should about do it.

library(GEOquery)
# assumes only one platform in the GSE
gse = getGEO('GSEXXXX')[[1]]

gse is an ExpressionSet, so all the usual ExpressionSet methods work as expected. In particular, we can use fData() to get the feature information (gene information) and the exprs() method to get the actual values.

write.table(data.frame(fData(gse),exprs(gse)),sep="\t",row.names=FALSE,file='abc.txt')

You may need to use a subset of the columns in fData to match your needs.

ADD COMMENT
0
Entering edit mode

Thank you for the answer. I have checked it already, and what I got:

Error in(function (classes, fdef, mtable)
  unable to find an inherited method for function 'fData' for signature '"list"'

The same thing appers when using only fData command.

ADD REPLY
1
Entering edit mode

Note that getGEO() returns a list. I'm guessing that you tried to use fData() on that list. To get the first element of the list (usually, that is what you want), you'll want to follow the code above and note the [[1]] after the getGEO() function call. In my code above, gse is an ExpressionSet. If you need to check, you can try class(gse).

ADD REPLY
0
Entering edit mode

Now, everything is working. You have solved my problem. Thank you very much!

Regards!

ADD REPLY

Login before adding your answer.

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