pathDIP v.5
Search miRNAs Search Pathways API Download Statistics Documentation Publications Team Contact


You can use this API for calling pathDIP from your R code


Search   
      R     Windows   Linux   Mac
        

# please install package httr
library(httr)

# const values
url <- "http://ophid.utoronto.ca/pathDIP/Http_API"



searchOnUniprot_IDs <- function(IDs, component, sources, pathwayTypes, cutoffQ) {
    
    parameters <- list(
        typeChoice = "Uniprot ID",
        IDs = IDs,
        TableName = component,
        DataSet = sources,
        PathwayTypes = pathwayTypes,
        CutoffQ = cutoffQ
    )
    
    # ... send http POST
    res <- POST(url, body = parameters, encode = "form", verbose())
}


searchOnGenesymbols <- function(IDs, component, sources, pathwayTypes, cutoffQ) {
    
    parameters <- list(
        typeChoice = "Gene Symbol",
        IDs = IDs,
        TableName = component,
        DataSet = sources,
        PathwayTypes = pathwayTypes,
        CutoffQ = cutoffQ
    )
    
    # ... send http POST
    res <- POST(url, body = parameters, encode = "form", verbose())
}



searchOnEntrez_IDs <- function(IDs, component, sources, pathwayTypes, cutoffQ) {
    parameters <- list(
        typeChoice = "Egid",
        IDs = IDs,
        TableName = component,
        DataSet = sources,
        PathwayTypes = pathwayTypes,
        CutoffQ = cutoffQ
    )
    
    # ... send http POST
    res <- POST(url, body = parameters, encode = "form", verbose())
}


# make results-map as keyword - value
makeMap <- function(res) {

    ENTRY_DEL = "\001"
    KEY_DEL = "\002"

    response = content(res, "text")

    arr = unlist(strsplit(response, ENTRY_DEL, fixed = TRUE))

    list_map <- list("")
    vec_map_names <- c("");

    for (str in arr) {
        arrKeyValue = unlist(strsplit(str, KEY_DEL, fixed = TRUE));

        if (length(arrKeyValue) > 1) {
            list_map[length(list_map) + 1] <- arrKeyValue[2]
            vec_map_names[length(vec_map_names) + 1] <- arrKeyValue[1]
        }
    }

    names(list_map) <- vec_map_names

    list_map
}





# ... Pick-up right sample for your search
# Note: Adjust 'ophid.utoronto.ca' if you are using our development server.


if (TRUE) { # change to FALSE to comment this sample

    ####################################
    # Example of search on Uniprot IDs #
    ####################################

    # Uniprot IDs
    # - Comma delimited.
    # - Mind case.
    IDs <- "P01100,P05412,P15336,P27361,P28482,P45983,P45984,P53779,Q15759,Q16539"


    # Data component
    # - Uncomment the only one of those five:
    component <- "Literature curated (core) pathway memberships"
    # component <- "Extended pathway associations. Protein interaction set: Experimentally detected PPIsMinimum confidence level for predicted associations: 0.99"
    # component <- "Extended pathway associations. Protein interaction set: Experimentally detected and computationally predicted PPIs (full IID)Minimum confidence level for predicted associations: 0.99"


    # Data sources
    # - Use some or all of those:
    #       ACSN2,BioCarta,HumanCyc,KEGG,Panther_Pathway,PathBank,PharmGKB,REACTOME,MetabolicAtlas,SIGNOR 3.0,UniProt_Pathways,WikiPathways
    # - Comma delimited.
    # - Mind exact spelling.
    sources <- "ACSN2,BioCarta,HumanCyc,KEGG,Panther_Pathway,PathBank,PharmGKB,REACTOME,MetabolicAtlas,SIGNOR 3.0,UniProt_Pathways,WikiPathways";


    # Pathway types
    # - Use some or all of those:
    #       Cellular processes and organization,Diseases,Drugs and vitamins,Environmental information processing,Genetic information processing,Metabolism,Organismal systems
    # - Comma delimited.
    # - Mind exact spelling.
    pathwayTypes <- "Cellular processes and organization,Diseases,Drugs and vitamins,Environmental information processing,Genetic information processing,Metabolism,Organismal systems";


    # Deploy 'q-value (FDR: BH-method)' to cut off the insignificant results 
    # Use the only one of the follow settings   
    # significance  = "0.01";  
    significance    = "0.05";       # recommended
    # significance  = "0.1";  
    # significance  = "All";        # for getting a complete set of results  
    
    res <- searchOnUniprot_IDs(IDs, component, sources, pathwayTypes, significance)
    
    responseCode = status_code(res)
    if (responseCode != 200) {

        cat("Error: Response Code : ", responseCode, "\r\n")
    } else {

        list_map <- makeMap(res)

        # print results
        cat("\r\n", "Search on Uniprot IDs:", "\r\n")
        
        cat("Generated at: ", unlist(list_map["GeneratedAt"]), "\r\n")
        cat("IDs: ", unlist(list_map["IDs"]), "\r\n")
        cat("DataComponent: ", unlist(list_map["TableName"]), "\r\n")
        cat("Sources: ", unlist(list_map["DataSet"]), "\r\n")
        cat("PathwayTypes: ", unlist(list_map["PathwayTypes"]), "\r\n")
        cat("q-value (FDR: BH-method): ", unlist(list_map["CutoffQ"]), "\r\n")
        
        cat("\r\n", "Note: Pathways, where only one ID from the input list was found, were excluded from results.", "\r\n")
        
        cat("\r\n", "Summary size: ", unlist(list_map["SummarySize"]), "\r\n")
        cat("Summary: \r\n", unlist(list_map["Summary"]), "\r\n") # formatted as tab - delimited spreadsheet

        cat("\r\n", "Details size: ", unlist(list_map["DetailsSize"]), "\r\n")
        cat("Details: \r\n", unlist(list_map["Details"]), "\r\n") # formatted as tab - delimited spreadsheet
    }
}


if (TRUE) { # change to FALSE to comment this sample

    #####################################
    # Example of search on Gene Symbols #
    #####################################

    # Gene Symbols
    # - Comma delimited.
    # - Mind case.
    IDs <- "ATF2,FOS,JUN,MAPK1,MAPK10,MAPK11,MAPK14,MAPK3,MAPK8,MAPK9"


    # Data component
    # - Uncomment the only one of those five:
    component <- "Literature curated (core) pathway memberships"
    # component <- "Extended pathway associations. Protein interaction set: Experimentally detected PPIsMinimum confidence level for predicted associations: 0.99"
    # component <- "Extended pathway associations. Protein interaction set: Experimentally detected and computationally predicted PPIs (full IID)Minimum confidence level for predicted associations: 0.99"


    # Data sources
    # - Use some or all of those:
    #       ACSN2,BioCarta,HumanCyc,KEGG,Panther_Pathway,PathBank,PharmGKB,REACTOME,MetabolicAtlas,SIGNOR 3.0,UniProt_Pathways,WikiPathways
    # - Comma delimited.
    # - Mind exact spelling.
    sources <- "ACSN2,BioCarta,HumanCyc,KEGG,Panther_Pathway,PathBank,PharmGKB,REACTOME,MetabolicAtlas,SIGNOR 3.0,UniProt_Pathways,WikiPathways";


    # Pathway types
    # - Use some or all of those:
    #       Cellular processes and organization,Diseases,Drugs and vitamins,Environmental information processing,Genetic information processing,Metabolism,Organismal systems
    # - Comma delimited.
    # - Mind exact spelling.
    pathwayTypes <- "Cellular processes and organization,Diseases,Drugs and vitamins,Environmental information processing,Genetic information processing,Metabolism,Organismal systems";

    
    # Deploy 'q-value (FDR: BH-method)' to cut off the insignificant results 
    # Use the only one of the follow settings   
    # significance  = "0.01";  
    significance    = "0.05";       # recommended
    # significance  = "0.1";  
    # significance  = "All";        # for getting a complete set of results  
    
    res <- searchOnGenesymbols(IDs, component, sources, pathwayTypes, significance)
    
    responseCode = status_code(res)
    if (responseCode != 200) {

        cat("Error: Response Code : ", responseCode, "\r\n")
    } else {

        list_map <- makeMap(res)

        # print results
        cat("\r\n", "Search on Uniprot IDs:", "\r\n")

        cat("Generated at: ", unlist(list_map["GeneratedAt"]), "\r\n")
        cat("IDs: ", unlist(list_map["IDs"]), "\r\n")
        cat("DataComponent: ", unlist(list_map["TableName"]), "\r\n")
        cat("Sources: ", unlist(list_map["DataSet"]), "\r\n")
        cat("PathwayTypes: ", unlist(list_map["PathwayTypes"]), "\r\n")
        cat("q-value (FDR: BH-method): ", unlist(list_map["CutoffQ"]), "\r\n")
       
        cat("\r\n", "Note: Pathways, where only one ID from the input list was found, were excluded from results.", "\r\n")

        cat("\r\n", "Summary size: ", unlist(list_map["SummarySize"]), "\r\n")
        cat("Summary: \r\n", unlist(list_map["Summary"]), "\r\n") # formatted as tab - delimited spreadsheet

        cat("\r\n", "Details size: ", unlist(list_map["DetailsSize"]), "\r\n")
        cat("Details: \r\n", unlist(list_map["Details"]), "\r\n") # formatted as tab - delimited spreadsheet
    }
}


if (TRUE) { # change to FALSE to comment this sample

    ########################################
    # Example of search on Entrez Gene IDs #
    ########################################

    # Entrez Gene IDs
    # - Comma delimited.
    # - Mind case.
    IDs <- "1386, 1432, 2353, 3725, 5594, 5595, 5599, 5600, 5601, 5602"


    # Data component
    # - Uncomment the only one of those five:
    component <- "Literature curated (core) pathway memberships"
    # component <- "Extended pathway associations. Protein interaction set: Experimentally detected PPIsMinimum confidence level for predicted associations: 0.99"
    # component <- "Extended pathway associations. Protein interaction set: Experimentally detected and computationally predicted PPIs (full IID)Minimum confidence level for predicted associations: 0.99"


    # Data sources
    # - Use some or all of those:
    #       ACSN2,BioCarta,HumanCyc,KEGG,Panther_Pathway,PathBank,PharmGKB,REACTOME,MetabolicAtlas,SIGNOR 3.0,UniProt_Pathways,WikiPathways
    # - Comma delimited.
    # - Mind exact spelling.
    sources <- "ACSN2,BioCarta,HumanCyc,KEGG,Panther_Pathway,PathBank,PharmGKB,REACTOME,MetabolicAtlas,SIGNOR 3.0,UniProt_Pathways,WikiPathways";


    # Pathway types
    # - Use some or all of those:
    #       Cellular processes and organization,Diseases,Drugs and vitamins,Environmental information processing,Genetic information processing,Metabolism,Organismal systems
    # - Comma delimited.
    # - Mind exact spelling.
    pathwayTypes <- "Cellular processes and organization,Diseases,Drugs and vitamins,Environmental information processing,Genetic information processing,Metabolism,Organismal systems";
    
    
    # Deploy 'q-value (FDR: BH-method)' to cut off the insignificant results 
    # Use the only one of the follow settings   
    # significance  = "0.01";  
    significance    = "0.05";       # recommended
    # significance  = "0.1";  
    # significance  = "All";        # for getting a complete set of results  
    
    res <- searchOnEntrez_IDs(IDs, component, sources, pathwayTypes, significance)
    
    responseCode = status_code(res)
    if (responseCode != 200) {

        cat("Error: Response Code : ", responseCode, "\r\n")
    } else {

        list_map <- makeMap(res)

        # print results
        cat("\r\n", "Search on Uniprot IDs:", "\r\n")

        cat("Generated at: ", unlist(list_map["GeneratedAt"]), "\r\n")
        cat("IDs: ", unlist(list_map["IDs"]), "\r\n")
        cat("DataComponent: ", unlist(list_map["TableName"]), "\r\n")
        cat("Sources: ", unlist(list_map["DataSet"]), "\r\n")
        cat("PathwayTypes: ", unlist(list_map["PathwayTypes"]), "\r\n")
        cat("q-value (FDR: BH-method): ", unlist(list_map["CutoffQ"]), "\r\n")
        
        cat("\r\n", "Note: Pathways, where only one ID from the input list was found, were excluded from results.", "\r\n")

        cat("\r\n", "Summary size: ", unlist(list_map["SummarySize"]), "\r\n")
        cat("Summary: \r\n", unlist(list_map["Summary"]), "\r\n") # formatted as tab - delimited spreadsheet

        cat("\r\n", "Details size: ", unlist(list_map["DetailsSize"]), "\r\n")
        cat("Details: \r\n", unlist(list_map["Details"]), "\r\n") # formatted as tab - delimited spreadsheet
    }
}

            




All contents copyright © Jurisica Lab, Schroeder Arthritis Institute, Krembil Research Institute - the University Health Network, Toronto, Canada.
Last modified January 28, 2024, version 5.0.32.4 (Database version 5.0.31.0)