## ----include = FALSE----------------------------------------------------------
# Every code chunk in this vignette is eval = FALSE on purpose, and none of
# them can be turned on: they either download a multi-GB genome assembly from
# UCSC (gdb.create, gdb.create_genome, gdb.build_genome, gdb.install_intervals)
# or fetch/point at an external binary (gtfToGenePred, gff3ToGenePred). None of
# that is possible during a package build or on CRAN. Everything here is
# verified by the test suite instead - see tests/testthat/test-genome-build-*.R.
knitr::opts_chunk$set(
    collapse = TRUE,
    comment = "#>"
)

## ----setup--------------------------------------------------------------------
library(misha)

## ----eval = FALSE-------------------------------------------------------------
# gdb.create_genome("hg19") # creates a database for the hg19 genome
# gdb.create_genome("hg38") # creates a database for the hg38 genome
# gdb.create_genome("mm10") # creates a database for the mm10 genome
# gdb.create_genome("mm9") # creates a database for the mm9 genome
# gdb.create_genome("mm39") # creates a database for the mm39 genome

## ----eval = FALSE-------------------------------------------------------------
# ftp <- "ftp://hgdownload.soe.ucsc.edu/goldenPath/hg19"
# gdb.create(
#     "hg19",
#     paste(ftp, "chromosomes", paste0("chr", c(1:22, "X", "Y", "M"), ".fa.gz"), sep = "/"),
#     paste(ftp, "database/knownGene.txt.gz", sep = "/"),
#     paste(ftp, "database/kgXref.txt.gz", sep = "/"),
#     c(
#         "kgID", "mRNA", "spID", "spDisplayID", "geneSymbol",
#         "refseq", "protAcc", "description", "rfamAcc",
#         "tRnaName"
#     )
# )
# gdb.init("hg19")

## ----eval = FALSE-------------------------------------------------------------
# ftp <- "ftp://hgdownload.soe.ucsc.edu/goldenPath/hg38"
# gdb.create(
#     "hg38",
#     paste(ftp, "chromosomes", paste0("chr", c(1:22, "X", "Y", "M"), ".fa.gz"), sep = "/"),
#     paste(ftp, "database/knownGene.txt.gz", sep = "/"),
#     paste(ftp, "database/kgXref.txt.gz", sep = "/"),
#     c(
#         "kgID", "mRNA", "spID", "spDisplayID", "geneSymbol",
#         "refseq", "protAcc", "description", "rfamAcc",
#         "tRnaName"
#     )
# )
# gdb.init("hg38")

## ----eval = FALSE-------------------------------------------------------------
# ftp <- "ftp://hgdownload.soe.ucsc.edu/goldenPath/mm9"
# gdb.create(
#     "mm9",
#     paste(ftp, "chromosomes", paste0("chr", c(1:19, "X", "Y", "M"), ".fa.gz"), sep = "/"),
#     paste(ftp, "database/knownGene.txt.gz", sep = "/"),
#     paste(ftp, "database/kgXref.txt.gz", sep = "/"),
#     c(
#         "kgID", "mRNA", "spID", "spDisplayID", "geneSymbol",
#         "refseq", "protAcc", "description"
#     )
# )
# gdb.init("mm9")

## ----eval = FALSE-------------------------------------------------------------
# ftp <- "ftp://hgdownload.soe.ucsc.edu/goldenPath/mm10"
# gdb.create(
#     "mm10",
#     paste(ftp, "chromosomes", paste0("chr", c(1:19, "X", "Y", "M"), ".fa.gz"), sep = "/"),
#     paste(ftp, "database/knownGene.txt.gz", sep = "/"),
#     paste(ftp, "database/kgXref.txt.gz", sep = "/"),
#     c(
#         "kgID", "mRNA", "spID", "spDisplayID", "geneSymbol",
#         "refseq", "protAcc", "description", "rfamAcc",
#         "tRnaName"
#     )
# )
# gdb.init("mm10")

## ----eval = FALSE-------------------------------------------------------------
# ftp <- "ftp://hgdownload.soe.ucsc.edu/goldenPath/mm39"
# gdb.create(
#     "mm39",
#     paste(ftp, "chromosomes", paste0("chr", c(1:19, "X", "Y", "M"), ".fa.gz"), sep = "/"),
#     paste(ftp, "database/knownGene.txt.gz", sep = "/"),
#     paste(ftp, "database/kgXref.txt.gz", sep = "/"),
#     c(
#         "kgID", "mRNA", "spID", "spDisplayID", "geneSymbol",
#         "refseq", "protAcc", "description", "rfamAcc",
#         "tRnaName"
#     )
# )
# gdb.init("mm39")

## ----eval = FALSE-------------------------------------------------------------
# # One-shot. Default sets = c("genes", "rmsk", "cgi", "cytoband"); cytoband and
# # (often) cgi are skipped with a warning since hubs don't ship them.
# gdb.build_genome("GCA_004023825.1",
#     path   = "/genomes/arctic_fox",
#     prefix = "intervs.global."
# )

## ----eval = FALSE-------------------------------------------------------------
# gdb.install_intervals(
#     groot  = "/genomes/my_private_assembly",
#     source = list(source = "ucsc-hub", accession = "GCA_004023825.1"),
#     sets   = c("genes", "rmsk"),
#     prefix = "intervs.global."
# )

## ----eval = FALSE-------------------------------------------------------------
# gdb.install_gff3_converter()
# gdb.install_gtf_converter()

## ----eval = FALSE-------------------------------------------------------------
# Sys.setenv(MISHA_GFF3_TO_GENEPRED = "/path/to/env/bin/gff3ToGenePred")
# Sys.setenv(MISHA_GTF_TO_GENEPRED = "/path/to/env/bin/gtfToGenePred")

