GENOME <- "hetGla2"
ORGANISM <- "Heterocephalus glaber"
ASSEMBLED_MOLECULES <- CIRC_SEQS <- "chrM"

.order_seqlevels <- function(seqlevels)
{
    idx1 <- which(seqlevels == "chrM")
    stopifnot(length(idx1) == length(ASSEMBLED_MOLECULES))
    oo1 <- match(ASSEMBLED_MOLECULES, seqlevels[idx1])
    stopifnot(!anyNA(oo1))
    idx1 <- idx1[oo1]

    idx2 <- which(seqlevels != "chrM")
    oo2 <- order(seqlevels[idx2])
    idx2 <- idx2[oo2]

    c(idx1, idx2)
}

FETCH_ORDERED_CHROM_SIZES <-
    function(goldenPath.url=getOption("UCSC.goldenPath.url"))
{
    chrom_sizes <- GenomeInfoDb:::fetch_chrom_sizes_from_UCSC(GENOME,
                                              goldenPath.url=goldenPath.url)
    oo <- .order_seqlevels(chrom_sizes[ , "chrom"])
    S4Vectors:::extract_data_frame_rows(chrom_sizes, oo)
}

NCBI_LINKER <- list(
    assembly_accession="GCF_000247695.1",
    special_mappings=c(chrM="MT")
)

ENSEMBL_LINKER <- "chromAlias"

