Skip to content

Instantly share code, notes, and snippets.

@vjcitn
Created March 2, 2025 11:13
Show Gist options
  • Save vjcitn/4e6af8b67103e78d599b104b091c0abe to your computer and use it in GitHub Desktop.
Save vjcitn/4e6af8b67103e78d599b104b091c0abe to your computer and use it in GitHub Desktop.
AnnotationPipeline step -- from preliminary sqlite to sanctionedSqlite for a single organism
# This function can be run in a 'newPkgs' folder after sufficient
# results have been obtained in annosrc/db, to produce a sanctionedSqlite database
# for a single organism
# the following constants are crucial
whattype <- tolower("OrgDb")
wheretoput <- 20250301
theversion <- "3.21.0"
dbBaseDir <- "/home/rstudio/BSAnnoPipe/CODE/BioconductorAnnotationPipeline/annosrc/db/"
outDir <- "sanctionedSqlite"
if (!file.exists(outDir))
dir.create(outDir)
# verify 'wheretoput' is numeric -- not a great validation
if(isTRUE(is.nan(as.numeric(wheretoput))))
stop(paste("The second argument was", wheretoput, "but should instead be something like 20200910"),
call. = FALSE)
# verify 'theversion' syntax
if(length(grep("^[0-9]+\\.[0-9]+\\.[0-9]+$", theversion)) != 1L)
stop(paste("The third argument was",theversion,"but should instead be something like 3.11.0"),
call. = FALSE)
# these must succeed, the R-libraries is otiose and should be eliminated
.libPaths(c("~/R-libraries", .libPaths()))
library(AnnotationForge)
library(AnnotationDbi)
metaDataSrc <- paste0(dbBaseDir, "metadatasrc.sqlite")
# supply values below
whatiamdoing = # something like "FLY_DB" -- is there validation?
chipsrc_name = # something like "chipsrc_fly.sqlite" -- check existence?
prefix = # something like org.Dm.eg and the mapping to 2-letter token should be formalized
cat(sprintf("building %s\n", whatiamdoing))
# how do we check the result of this call to verify or explain adverse events?
populateDB( whatiamdoing, prefix = prefix,
chipSrc = paste0(dbBaseDir, chipsrc_name),
metaDataSrc = metaDataSrc,
outputDir = outDir)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment