How to remove IEA genes from list of GO terms?
1
0
Entering edit mode
Guido Hooiveld ★ 4.1k
@guido-hooiveld-2020
Last seen 2 days ago
Wageningen University, Wageningen, the …

Dear list,

I do have a list of (all) human GO categories and associated genes, and I would like to remove the genes that are annotated as "IEA" (inferred from electronic annotation). http://geneontology.org/page/guide-go-evidence-codes

Sounds like an easy exercise, however, I cannot get this to work.... Any pointer on how to achieve this would be very appreciated!

Guido

 

> library(org.Hs.eg.db)

> xx <- as.list (org.Hs.egGO2ALLEGS)

> xx[1]
$`GO:0000002`
     TAS      IDA      TAS      IEA      ISS      IMP      IEA      IEA      IEA      NAS      IMP      IEA      IMP
   "291"   "1763"   "1890"   "3980"   "4205"   "4358"   "5428"   "9093"   "9361"   "9361"  "10000"  "10891"  "30968"
     IEA      IMP      IMP      NAS      IEA      IEA      IMP      TAS      IMP      IEA
 "50484"  "55022"  "56652"  "56652"  "80119"  "83667"  "92667"  "92667" "201973" "246243"

>

> # check evidence codes genes belonging to 1st category

> xx[[1]]

     TAS      IDA      TAS      IEA      ISS      IMP      IEA      IEA      IEA      NAS      IMP      IEA      IMP

   "291"   "1763"   "1890"   "3980"   "4205"   "4358"   "5428"   "9093"   "9361"   "9361"  "10000"  "10891"  "30968"

     IEA      IMP      IMP      NAS      IEA      IEA      IMP      TAS      IMP      IEA

 "50484"  "55022"  "56652"  "56652"  "80119"  "83667"  "92667"  "92667" "201973" "246243"

 

#get rid of genes that are IEA

> i= 1

> xx[[i]][names(xx[[i]])!="IEA"]

     TAS      IDA      TAS      ISS      IMP      NAS      IMP      IMP      IMP      IMP      NAS      IMP      TAS

   "291"   "1763"   "1890"   "4205"   "4358"   "9361"  "10000"  "30968"  "55022"  "56652"  "56652"  "92667"  "92667"

     IMP

"201973"

 

How to loop this? So i will end up with a list in which for each GO categorie all IEA genes are removed

 

for (i in 1:length(xx)) { .... ???

 

        

 

 

go annotation organismdb • 1.4k views
ADD COMMENT
2
Entering edit mode
@james-w-macdonald-5106
Last seen 2 days ago
United States

The beauty of the list structure in R is that you very seldom have to do explicit for loops (it's not Perl, after all...).

xx <- lapply(xx, function(x) x[names(x) != "IEA"])
ADD COMMENT
0
Entering edit mode

Thanks James, very useful, as always. Works like a charm!

Guido

ADD REPLY

Login before adding your answer.

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