inst/scripts/make-data_tritrypdb_odds.R

#!/usr/bin/env Rscript
source("config.R")
webservice <- "tritrypdb"
meta <- download_eupathdb_metadata(
  bioc_version=bioc_version, overwrite=TRUE, webservice=webservice,
  eupathdb_version=eupathdb_version, write_csv=TRUE)
all_metadata <- meta[["valid"]]
end <- nrow(all_metadata)

odds <- c()
for (i in 1:nrow(all_metadata)) {
  if (i %% 2 == 1) {
    odds <- c(odds, i)
  }
}

for (it in odds) {
  entry <- all_metadata[it, ]
  species <- entry[["Species"]]
  message("Starting generation of ", species, ", which is ", it, " of ", end, " species.")
  pkgnames <- get_eupathdb_pkgnames(entry)
  if (isTRUE(bsgenome)) {
    bsgenome_result <- make_eupathdb_bsgenome(entry, eupathdb_version=eupathdb_version, copy_s3=TRUE, install=install)
    results[["bsgenome"]][[species]] <- bsgenome_result
  }
  if (isTRUE(orgdb)) {
    orgdb_result <- make_eupathdb_orgdb(entry, eupathdb_version=eupathdb_version, copy_s3=TRUE, install=install)
    if (is.null(orgdb_result)) {
      message("There is insufficient data for ", species, " to make the other packages.")
    }
    results[["orgdb"]][[species]] <- orgdb_result
  }
  if (isTRUE(txdb)) {
    txdb_result <- make_eupathdb_txdb(entry, eupathdb_version=eupathdb_version, copy_s3=TRUE, install=install)
    if (is.null(txdb_result)) {
      next
    }
    results[["txdb"]][[species]] <- txdb_result[["txdb_name"]]
  }
  if (isTRUE(organismdb)) {
    organ_result <- make_eupathdb_organismdbi(entry, eupathdb_version=eupathdb_version, copy_s3=TRUE, install=install)
    results[["organismdbi"]] <- organ_result
  }
} ## End iterating over every entry in the eupathdb metadata.
khughitt/EuPathDB documentation built on Nov. 4, 2023, 4:19 a.m.