This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Get pathway and all other gene interactions involved in that pathway for an input gene

Hi,

I have an input gene. I want to get all the pathways that the input gene participates in. Once I get the pathway name/id, I want to get all other genes and gene interactions involved in that particular pathway. How can I obtain this information using the PaxtoolsR?

Thanks in advance.

r paxtoolsr pathway-commons biopax

I tried the following:

results <- topPathways(q="TP53", organism='9606') 

uri <- results$uri[1][1]

xml <- traverse(uri = uri, path = "Pathway/pathwayComponent:Interaction/participant*/displayName")

xml_list <- xmlToList(xml)

However, I am not sure about the path parameter in traverse(). What is the correct input for path to get the pathway components and the interactions. Also, how can I convert the xml to a dataframe in R?

Thanks

3 answers

This is probably easier than going through the XML. Download:

https://www.pathwaycommons.org/archives/PC2/v12/PathwayCommons12.All.hgnc.gmt.gz

then using this function: https://github.com/cannin/listutils/blob/master/R/searchListOfVectors.R

Run something like this:

library(paxtoolsr)
library(listutils)

gmt <- readGmt("~/Downloads/PathwayCommons12.All.hgnc.gmt")
tmp <- searchListOfVectors("NOS3", gmt, useNames=FALSE)
pathway_ids <- tmp$NOS3

gmt[pathway_ids]

Thank you for your response. This seems easier. However, How can I get all the pathway interactions between the genes as well?

Below is code with output that depends only on downloaded files:

> library(paxtoolsr)
> library(listutils)
> 
> cur_gene <- "NOS3"
> 
> # Downloaded from: https://www.pathwaycommons.org/archives/PC2/v12/ as gz files and uncompressed
> # NOTE: Download the "All" versions to search all of Pathway Commons 
> gmt <- readGmt("~/Downloads/PathwayCommons12.reactome.hgnc.gmt")
> sifnx <- readSifnx("~/Downloads/PathwayCommons12.reactome.hgnc.txt")
> pathways <- readPcPathwaysInfo("~/Downloads/pathways.txt")                                              
> 
> tmp <- searchListOfVectors(cur_gene, gmt, useNames=TRUE)
> pathway_ids <- tmp[[cur_gene]]
> 
> # Selected GMT results
> # gmt[pathway_ids]
> 
> # As demo grab, "http://identifiers.org/reactome/R-HSA-203615" named "eNOS activation"
> cur_pathway_id <- pathway_ids[3]
> cur_pathway_id
[1] "http://identifiers.org/reactome/R-HSA-203615"
> cur_pathway_name <- pathways$DISPLAY_NAME[pathways$PATHWAY_URI == cur_pathway_id]
> cur_pathway_name
[1] "eNOS activation"
>
> # NOTE: You may need something more complex than a simple "==" comparison here
> cur_sif <- sifnx$edges[which(sifnx$edges$PATHWAY_NAMES == cur_pathway_name),]
> cur_sif
# A tibble: 31 × 7
   PARTICIPANT_A INTERACTION_TYPE PARTICIPANT_B INTERACTION_DAT… INTERACTION_PUB… PATHWAY_NAMES MEDIATOR_IDS
   <chr>         <chr>            <chr>         <chr>            <chr>            <chr>         <chr>       
 1 AKT1          controls-produc… CHEBI:18421   Reactome         11879202         eNOS activat… http://path…
 2 CALM1         controls-produc… CHEBI:18421   Reactome         11879202         eNOS activat… http://path…
 3 CHEBI:15379   consumption-con… AKT1          Reactome         11879202         eNOS activat… http://path…
 4 CHEBI:15379   consumption-con… CALM1         Reactome         11879202         eNOS activat… http://path…
 5 CHEBI:15379   consumption-con… HSP90AA1      Reactome         11879202         eNOS activat… http://path…
 6 CHEBI:15379   consumption-con… NOS3          Reactome         11879202         eNOS activat… http://path…
 7 CHEBI:16474   consumption-con… AKT1          Reactome         11879202         eNOS activat… http://path…
 8 CHEBI:16474   consumption-con… CALM1         Reactome         11879202         eNOS activat… http://path…
 9 CHEBI:16474   consumption-con… HSP90AA1      Reactome         11879202         eNOS activat… http://path…
10 CHEBI:16474   consumption-con… NOS3          Reactome         11879202         eNOS activat… http://path…
# … with 21 more rows
> 
> filtered_sif <- filterSif(cur_sif, ids=cur_gene)
> filtered_sif
# A tibble: 7 × 7
  PARTICIPANT_A INTERACTION_TYPE  PARTICIPANT_B INTERACTION_DAT… INTERACTION_PUB… PATHWAY_NAMES MEDIATOR_IDS
  <chr>         <chr>             <chr>         <chr>            <chr>            <chr>         <chr>       
1 NOS3          controls-product… CHEBI:18421   Reactome         11879202         eNOS activat… http://path…
2 CHEBI:15379   consumption-cont… NOS3          Reactome         11879202         eNOS activat… http://path…
3 CHEBI:16474   consumption-cont… NOS3          Reactome         11879202         eNOS activat… http://path…
4 LYPLA1        controls-state-c… NOS3          Reactome         10551886         eNOS activat… http://iden…
5 LYPLA1        controls-transpo… NOS3          Reactome         10551886         eNOS activat… http://iden…
6 ZDHHC21       controls-state-c… NOS3          Reactome         16864653;862645… eNOS activat… http://path…
7 ZDHHC21       controls-transpo… NOS3          Reactome         16864653;862645… eNOS activat… http://path…

Hi cannin

Thank you very much. However, when I use the PathwayCommons12.All.hgnc.txt file. It is throwing the following error:

Error in checkInputFilePc(inputFile) : ERROR: A maximum file size limit of 1GB has been placed on files being read. Reading larger files with this function may be very slow. Please contact package author for workarounds.

Could you please let me know if there is any solution for this?

Expanded answer with interactions:

library(paxtoolsr)
library(listutils)

input_gene <- "NOS3"
gmt <- readGmt("~/Downloads/PathwayCommons12.All.hgnc.gmt")
tmp <- searchListOfVectors(input_gene, gmt, useNames=TRUE)
pathway_ids <- tmp[input_gene]

gmt[pathway_ids]

cur_pathway_id <- 8
uri <- pathway_ids[cur_pathway_id]
sif <- getPc(uri, format = "SIF")

interactions <- filterSif(sif, ids = input_gene)

Thank you very much for helping me. I tried to run the above commands. I am getting no result.

Here is the code with the output:

> library(paxtoolsr)
> library(listutils)
> 
> input_gene <- "NOS3"
> gmt <- readGmt("~/Downloads/PathwayCommons12.All.hgnc.gmt")
> tmp <- searchListOfVectors(input_gene, gmt, useNames=TRUE)
> pathway_ids <- tmp[[input_gene]]
> 
> gene_sets <- gmt[pathway_ids]
> head(gene_sets, 1)
$`http://identifiers.org/kegg.pathway/hsa00330`
 [1] "ACY1"     "AGMAT"    "ALDH18A1" "ALDH3A2"  "ALDH4A1"  "AMD1"     "AOC1"     "AOC2"     "AOC3"     "ARG1"    
[11] "ASL"      "ASS1"     "AZIN2"    "CARNS1"   "CKMT2"    "CPS1"     "DAO"      "GAMT"     "GATM"     "GLS"     
[21] "GLUD2"    "GLUL"     "GOT2"     "LAP3"     "MAOA"     "MAOB"     "NAGS"     "NOS3"     "OAT"      "ODC1"    
[31] "OTC"      "P4HA1"    "P4HA2"    "P4HA3"    "PRODH"    "PRODH2"   "PYCR3"    "SAT2"     "SMS"      "SRM"     

> 
> cur_pathway_id <- 8
> uri <- pathway_ids[cur_pathway_id] # The URI should look like a URL web link
> sif <- getPc(uri, format = "SIF")
>                                                                                                                                                           
> interactions <- filterSif(sif, ids = input_gene)
> head(interactions)
    PARTICIPANT_A          INTERACTION_TYPE PARTICIPANT_B
352          NOS3    controls-production-of   CHEBI:16349
353          NOS3    controls-production-of   CHEBI:16480
323   CHEBI:32682 consumption-controlled-by          NOS3

Hi,

I see that when I run this script for a large number of genes, it's taking a very long time to get the interactions using getPc(). I tried to use the 'PathwayCommons12.All.hgnc.txt' file to get the interactions. However, the delimiters in it doesn't seem to be correctly places because of which I am finding it difficult to load it as a table in R. Could you please let me know if there is any other way to get the interactions faster?

Thanks a lot!

Log in to answer this question.