Catrin:
Catalogue
of
Transcriptional
Regulatory
Interactions
Use this API for getting Search Results directly into your R code.
### ##########################################################
### # Usage
### ##########################################################
###
### 1. Copy the complete code below into your project
###
### 2. INPUT:
### - Find section 'Sample of Search'.
### - Adjust 'Query Genes' and filters. Follow to provided instructions at each sub-section.
###
### 3. RESULTS
### - Use unlist(list_map["results_size"]) for getting result size
### - Use unlist(list_map["results"]) for getiing ressults formatted as tab delimited spreadsheet
###
### end-of-doc
# please install package httr
library(httr)
# const values
url <- "http://ophid.utoronto.ca/Catrin/Http_API"
list_searchFor <- list("0", "1", "2", "3")
names(list_searchFor) <- c(
"Transcription Factors of Query Genes",
"Targets Regulated by Query Genes",
"All Interactions of Query Genes",
"Interactions among the Query Genes")
list_integrationScore <- list("0", "1", "2", "3")
names(list_integrationScore) <- c(
"< 0.01",
">= 0.01 and < 0.05",
">= 0.05 and < 0.10",
">= 0.10")
list_validated <- list("0", "1")
names(list_validated) <- c(
"FALSE",
"TRUE")
searchCatrin <- function(queryGenes, searchFor_, integrativeScore, evidenceType, minimumNumberOfConfirmations, resources) {
if (integrativeScore != "n.s.") {
is = unlist(list_integrationScore[integrativeScore])
} else {
is = ""
}
if (validated != "n.s.") {
val = unlist(list_validated[validated])
} else {
val = ""
}
if (minimumNumberOfConfirmations != "n.s.") {
mnoc = minimumNumberOfConfirmations
} else {
mnoc = ""
}
parameters <- list(
genesymbol = queryGenes,
searchFor = unlist(list_searchFor[searchFor_]),
score_V = is,
validated_V = val,
numOfConfirm_V = mnoc,
sources = resources
)
# ... 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
}
##########################################################
# Sample of Search
##########################################################
# Query Genes:
# - Comma delimited.
# - User HUGO notation, case sensitive.
queryGenes <- " AGO1, AR, BCL6, CBP, ZNF595 "
# Search for:
# - Uncomment the only one of those four below:
# - do not change spelling
searchFor <- "Transcription Factors of Query Genes"
# searchFor <- "Targets Regulated by Query Genes"
# searchFor <- "All Interactions of Query Genes"
# searchFor <- "Interactions among the Query Genes"
# Integrative score:
# - Replace "n.s." with one of those below or keep "n.s." to deactivate this filter:
# - do not change spelling
integrativeScore = "n.s."
# integrativeScore = "< 0.01"
# integrativeScore = ">= 0.01 and < 0.05"
# integrativeScore = ">= 0.05 and < 0.10"
# integrativeScore = ">= 0.10"
# Minimum number of confirmations:
# - Replace "n.s." with value set as 1 to 10, or keep "n.s." to deactivate this filter:
minimumNumberOfConfirmations = "n.s."
# minimumNumberOfConfirmations = "4"
# Experimentally validated:
# - Replace "n.s." with one of those below or keep "n.s." to deactivate this filter:
# - do not change spelling
validated = "n.s."
# validated = "FALSE"
# validated = "TRUE"
# Resources
# - Use some or all of those:
# AURA, cistrome.org, ChEA, CTCFBSDB, ENCODE, GTRD, HmChiP, ITFP, JASPAR, MSigDB, Nepth_et_al, PReMod, ReMap2018, TF2DNA.experimental, TRED
# - Comma delimited.
# - Mind exact spelling.
resources <- toString(paste(
"AURA, cistrome.org, ChEA, CTCFBSDB, ENCODE, GTRD, HmChiP, ITFP, JASPAR, ",
"MSigDB, Nepth_et_al, PReMod, ReMap2018, TF2DNA.experimental, TRED",
collapse = ""))
res <- searchCatrin(queryGenes, searchFor, integrativeScore, validated, minimumNumberOfConfirmations, resources)
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 Catrin:", "\r\n")
cat("Generated at: ", unlist(list_map["generated_at"]), "\r\n")
cat("Query Genes : ", unlist(list_map["gene_symbols"]), "\r\n")
cat("Search for: ", unlist(list_map["search_for"]), "\r\n")
cat("integrative Score: ", unlist(list_map["integrative_score"]), "\r\n")
cat("Minimum Number of Confirmations: ", unlist(list_map["minimum_number_of_confirmations"]), "\r\n")
cat("Experimentally validated: ", unlist(list_map["validated"]), "\r\n")
cat("Resources: ", unlist(list_map["resources"]), "\r\n")
cat("\r\n", "Results size: ", unlist(list_map["results_size"]), "\r\n")
cat("Results: \r\n", unlist(list_map["results"]), "\r\n") # formatted as tab - delimited spreadsheet
}
All contents copyright: Jurisica Lab, Krembil Research Institute - the University Health Network, Toronto, Canada.
Last modified October 3, 2022. (Version 1.0.6.2.b; Database version 1.0.0.1)
All downloads and use of this database are subject to the following terms.
Permission to use, copy, and modify this database hereby granted to all academic and not-for-profit institutions without fee, provided that name of organization and author appear in all copies of the database. Under these conditions, the permission to modify and distribute or to make extended versions of the database is explicitly granted to non-profit organizations. All commercial entities willing to download or use the database must contact the authors.
This database is provided "AS-IS" and with out any warranty of any kind. In no event shall Krembil Research Institute - the University Health Network or the authors be liable for any consequential damage of any kind, or any damages resulting from the use of this database.
|