Skip to content

Commit

Permalink
Update the url of TRRUST database
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanghao-njmu committed Oct 30, 2023
1 parent e743249 commit 141972d
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions R/SCP-analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -2846,12 +2846,19 @@ PrepareDB <- function(species = c("Homo_sapiens", "Mus_musculus"),
}
message("Preparing database: TRRUST")
url <- switch(db_species["TRRUST"],
"Homo_sapiens" = "https://www.grnpedia.org/trrust/data/trrust_rawdata.human.tsv",
"Mus_musculus" = "https://www.grnpedia.org/trrust/data/trrust_rawdata.mouse.tsv"
"Homo_sapiens" = "https://raw.githubusercontent.com/bioinfonerd/Transcription-Factor-Databases/master/Ttrust_v2/trrust_rawdata.human.tsv",
"Mus_musculus" = "https://raw.githubusercontent.com/bioinfonerd/Transcription-Factor-Databases/master/Ttrust_v2/trrust_rawdata.mouse.tsv.gz"
)
temp <- tempfile()
download(url = url, destfile = temp)
TERM2GENE <- read.table(temp, header = FALSE, fill = T, sep = "\t")[, 1:2]
if (endsWith(url, "gz")) {
temp <- tempfile(fileext = ".gz")
download(url = url, destfile = temp)
R.utils::gunzip(temp)
TERM2GENE <- read.table(gsub(".gz$", "", temp), header = FALSE, fill = T, sep = "\t")[, 1:2]
} else {
temp <- tempfile()
download(url = url, destfile = temp)
TERM2GENE <- read.table(temp, header = FALSE, fill = T, sep = "\t")[, 1:2]
}
version <- "v2.0"
TERM2NAME <- TERM2GENE[, c(1, 1)]
colnames(TERM2GENE) <- c("Term", default_IDtypes[["TRRUST"]])
Expand Down Expand Up @@ -3275,7 +3282,7 @@ PrepareDB <- function(species = c("Homo_sapiens", "Mus_musculus"),
}
}

### Convert ID
### Convert ID types
for (term in names(db_list[[sps]])) {
IDtypes <- db_IDtypes[!db_IDtypes %in% colnames(db_list[[sps]][[term]][["TERM2GENE"]])]
if (length(IDtypes) > 0) {
Expand Down

0 comments on commit 141972d

Please sign in to comment.