subset a list based on table
1
0
Entering edit mode
najib • 0
@59ce8241
Last seen 20 months ago
South Korea

hello, I am trying to extract the fold change of several genes from a list resFilt and I tried the use the code below, but I got an error. is the code for extracting the genes is wrong?

myterms <-read.table("GO-0004553.txt", header= FALSE)
head(myterms)
typeof(resFilt)
head(resFilt[[1]])
de<- resFilt[resFilt$table %in% myterms$V1]

# 
>myterms <-read.table("GO-0004553.txt", header= FALSE)
> head(myterms)
                   V1
1 ATCC64974_100070-T1
2  ATCC64974_10330-T1
3 ATCC64974_103600-T1
4 ATCC64974_104830-T1
5 ATCC64974_104980-T1
6 ATCC64974_105530-T1
> typeof(resFilt)
[1] "list"
> head(resFilt[[1]])
                        logFC   logCPM        PValue           FDR
ATCC64974_37230-T1   7.884895 8.768304 6.165094e-129 6.172492e-125
ATCC64974_22790-T1   8.445245 8.551614 6.821145e-123 3.414665e-119
ATCC64974_1640-T1    7.064251 8.514810 4.084580e-122 1.363161e-118
ATCC64974_83150-T1  11.827867 9.097794 2.269826e-108 5.681375e-105
ATCC64974_17880-T1 -10.040251 5.026719  5.238859e-98  1.049029e-94
ATCC64974_17840-T1  -7.017230 5.483155  4.549345e-97  7.591341e-94
> de<- resFilt[resFilt$table %in% myterms$V1]
Error: Two subscripts required

sessionInfo( )
edgeR RNASeq resfilt • 1.0k views
ADD COMMENT
1
Entering edit mode
ATpoint ★ 4.6k
@atpoint-13662
Last seen 1 hour ago
Germany

Probably:

resFilt[rownames(resFilt$table) %in% myterms$V1,]

You have to tell the function what it should compare with myterms. In your case that is the rownames, not the entire table itself, that makes no sense.

Alternatively:

resFilt$table[myterms$V1,] 

should work as well. Please be sure to read about basic filtering/data manipulation in R.

ADD COMMENT
0
Entering edit mode

thank you a lot and thank you for your advice.

ADD REPLY
0
Entering edit mode

If there are further questions for general bioinformatics things I recommend to post from now on at biostars.org. This forum here is for specific technical help with Bioconductor packages. Please also try to not open multiple questions on the exact same topic. You can always comment on your existing ones and ask for clarification if answers are not sufficient.

ADD REPLY

Login before adding your answer.

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