Skip to content

Find genes known to interact with a given gene

David Winter edited this page Jun 25, 2015 · 4 revisions

Some records in gene database contain a list of other genes known to interact with the described gene. For a given gene, how can we find this set of interactants?

##Get the gene id

In most cases, users will start with a list of gene symbols, which we'll need to convert to entrez gene ids. We can do that via entrez_search, specifying both the gene symbol and species of interest:

gene_search <- entrez_search(db="gene", term="(ZNF365[GENE]) AND (Homo sapiens[ORGN])")
gene_search
Entrez search result with 1 hits (object contains 1 IDs and no cookie)
 Search term (as translated):  ZNF365[GENE] AND "Homo sapiens"[Organism]

The summary records for the gene database don't contain the interaction list, so we have to fetch the complete record as an xml object. This is a big and pretty complex file, if you want to check the whole thing out you can...

xmlrec <- entrez_fetch(db="gene", id=gene_id, rettype="xml", parsed=TRUE) 

... or if you just want the interacting genes you can use this function, and it's huge Xpath query, to get at them:

interactions_from_gene <- function(gene_id){                                                                                                                                                                         
  xmlrec <- entrez_fetch(db="gene", id=gene_id, rettype="xml", parsed=TRUE)                                                                                                                                          
  XML::xpathSApply(xmlrec,                                                                                                                                                                                           
   "//Gene-commentary[Gene-commentary_heading[./text()='Interactions']]//Other-source[Other-source_src/Dbtag/Dbtag_db[./text()='GeneID']]//Other-source_anchor",
   XML::xmlValue)                                                                                                                                  
}
                                                                                                                                                                                                                                                                                                            
interactions_from_gene(gene_search$ids)
"APP"   "DISC1" "NDE1"