if (!exists("meta") || is.null(meta)) {
    meta <- packageDescription("methylTFR")
}

pkg_year <- if (!is.null(meta$Date)) {
    substr(meta$Date, 1, 4)
} else if (!is.null(meta$`Date/Publication`)) {
    substr(meta$`Date/Publication`, 1, 4)
} else {
    format(Sys.Date(), "%Y")
}
pkg_note <- sprintf("R package version %s", meta$Version)
pkg_title <- "methylTFR: Quantification of DNA methylation signatures in TFBS"
pkg_url <- "https://github.com/EpigenomeInformatics/methylTFR"

bibentry(
    bibtype = "Manual",
    header = "To cite methylTFR in publications use:",
    title = pkg_title,
    author = c(
        person("Irem B.", "Gunduz"),
        person("Sarath Kumar", "Murugan"),
        person("Fabian", "Mueller")
    ),
    year = pkg_year,
    note = pkg_note,
    url = pkg_url,
    doi = "10.18129/B9.bioc.methylTFR",
    textVersion = paste0(
        "Gunduz IB, Murugan SK, Mueller F (", pkg_year, "). ",
        pkg_title, ". ", pkg_note, ". ", pkg_url
    )
)

bibentry(
    bibtype = "Article",
    header = "The method is described in:",
    title = paste(
        "methylTFR: Quantification of transcription factor activity",
        "from DNA methylation"
    ),
    author = c(
        person("Irem B.", "Gunduz"),
        person("Regina", "Nitsch"),
        person("Sarath Kumar", "Murugan"),
        person("Fabian", "Mueller")
    ),
    journal = "bioRxiv",
    year = "2026",
    doi = "10.64898/2026.09.29.755279",
    url = "https://www.biorxiv.org/content/10.64898/2026.09.29.755279v1",
    textVersion = paste(
        "Gunduz IB, Nitsch R, Murugan SK, Mueller F (2026).",
        "methylTFR: Quantification of transcription factor activity from",
        "DNA methylation. bioRxiv.",
        "https://www.biorxiv.org/content/10.64898/2026.09.29.755279v1"
    )
)
