Skip to content

Instantly share code, notes, and snippets.

Created October 2, 2017 22:47
Show Gist options
  • Save anonymous/a8c6374b381dc9c27f55487756cb4e1b to your computer and use it in GitHub Desktop.
Save anonymous/a8c6374b381dc9c27f55487756cb4e1b to your computer and use it in GitHub Desktop.
library('knitcitations')
check_bib <- function() {
xx <- sapply(bib, function(x) {
tryCatch(citep(x), error = function(e) {
message(paste('found an error attempting to cite', names(x)))
print(e)
})
})
}
## derfinderHelper
bib <- c(knitcitations = citation('knitcitations'),
derfinderHelper = citation('derfinderHelper')[1],
BiocStyle = citation('BiocStyle'),
knitr = citation('knitr')[3],
rmarkdown = citation('rmarkdown'),
BiocParallel = citation('BiocParallel'),
R = citation(),
IRanges = citation('IRanges'),
Matrix = citation('Matrix'),
S4Vectors = citation('S4Vectors'),
devtools = citation('devtools'),
testthat = citation('testthat'))
check_bib()
## derfinderPlot
bib <- c(knitcitations = citation('knitcitations'),
derfinderPlot = citation('derfinderPlot')[1],
BiocStyle = citation('BiocStyle'),
knitr = citation('knitr')[3],
rmarkdown = citation('rmarkdown'),
derfinder = citation('derfinder')[1],
ggbio = citation('ggbio'),
brainspan = RefManageR::BibEntry(bibtype = 'Unpublished',
key = 'brainspan',
title = 'Atlas of the Developing Human Brain [Internet]. Funded by ARRA Awards 1RC2MH089921-01, 1RC2MH090047-01, and 1RC2MH089929-01.',
author = 'BrainSpan', year = 2011, url = 'http://www.brainspan.org/'),
R = citation(),
IRanges = citation('IRanges'),
devtools = citation('devtools'),
testthat = citation('testthat'),
GenomeInfoDb = citation('GenomeInfoDb'),
GenomicRanges = citation('GenomicRanges'),
ggplot2 = citation('ggplot2'),
plyr = citation('plyr'),
RColorBrewer = citation('RColorBrewer'),
reshape2 = citation('reshape2'),
scales = citation('scales'),
biovizBase = citation('biovizBase'),
bumphunter = citation('bumphunter')[1],
TxDb.Hsapiens.UCSC.hg19.knownGene = citation('TxDb.Hsapiens.UCSC.hg19.knownGene'),
bumphunterPaper = RefManageR::BibEntry(bibtype = 'article',
key = 'bumphunterPaper',
title = 'Bump hunting to identify differentially methylated regions in epigenetic epidemiology studies',
author = 'Jaffe, Andrew E and Murakami, Peter and Lee, Hwajin and Leek, Jeffrey T and Fallin, M Daniele and Feinberg, Andrew P and Irizarry, Rafael A',
year = 2012, journal = 'International Journal of Epidemiology'),
derfinderData = citation('derfinderData')
)
check_bib()
## derfinder quickstart
bib <- c(knitcitations = citation('knitcitations'),
derfinder = citation('derfinder')[1],
BiocStyle = citation('BiocStyle'),
knitrBootstrap = citation('knitrBootstrap'),
knitr = citation('knitr')[3],
rmarkdown = citation('rmarkdown'),
brainspan = RefManageR::BibEntry(bibtype = 'Unpublished',
key = 'brainspan',
title = 'Atlas of the Developing Human Brain [Internet]. Funded by ARRA Awards 1RC2MH089921-01, 1RC2MH090047-01, and 1RC2MH089929-01.',
author = 'BrainSpan', year = 2011, url = 'http://www.brainspan.org/'),
originalder = citation('derfinder')[2],
R = citation(),
IRanges = citation('IRanges'),
devtools = citation('devtools'),
testthat = citation('testthat'),
GenomeInfoDb = citation('GenomeInfoDb'),
GenomicRanges = citation('GenomicRanges'),
ggplot2 = citation('ggplot2'),
biovizBase = citation('biovizBase'),
bumphunter = citation('bumphunter')[1],
TxDb.Hsapiens.UCSC.hg19.knownGene = citation('TxDb.Hsapiens.UCSC.hg19.knownGene'),
AnnotationDbi = citation('AnnotationDbi'),
BiocParallel = citation('BiocParallel'),
derfinderHelper = citation('derfinderHelper'),
GenomicAlignments = citation('GenomicAlignments'),
GenomicFeatures = citation('GenomicFeatures'),
GenomicFiles = citation('GenomicFiles'),
Hmisc = citation('Hmisc'),
qvalue = citation('qvalue'),
Rsamtools = citation('Rsamtools'),
rtracklayer = citation('rtracklayer'),
S4Vectors = citation('S4Vectors'),
bumphunterPaper = RefManageR::BibEntry(bibtype = 'article',
key = 'bumphunterPaper',
title = 'Bump hunting to identify differentially methylated regions in epigenetic epidemiology studies',
author = 'Jaffe, Andrew E and Murakami, Peter and Lee, Hwajin and Leek, Jeffrey T and Fallin, M Daniele and Feinberg, Andrew P and Irizarry, Rafael A',
year = 2012, journal = 'International Journal of Epidemiology'),
derfinderData = citation('derfinderData')
)
check_bib()
## derfinder users guide
bib <- c(knitcitations = citation('knitcitations'),
derfinder = citation('derfinder')[1],
BiocStyle = citation('BiocStyle'),
knitrBootstrap = citation('knitrBootstrap'),
knitr = citation('knitr')[3],
rmarkdown = citation('rmarkdown'),
brainspan = RefManageR::BibEntry(bibtype = 'Unpublished',
key = 'brainspan',
title = 'Atlas of the Developing Human Brain [Internet]. Funded by ARRA Awards 1RC2MH089921-01, 1RC2MH090047-01, and 1RC2MH089929-01.',
author = 'BrainSpan', year = 2011, url = 'http://www.brainspan.org/'),
originalder = citation('derfinder')[2],
R = citation(),
IRanges = citation('IRanges'),
devtools = citation('devtools'),
testthat = citation('testthat'),
GenomeInfoDb = citation('GenomeInfoDb'),
GenomicRanges = citation('GenomicRanges'),
ggplot2 = citation('ggplot2'),
biovizBase = citation('biovizBase'),
bumphunter = citation('bumphunter')[1],
TxDb.Hsapiens.UCSC.hg19.knownGene = citation('TxDb.Hsapiens.UCSC.hg19.knownGene'),
AnnotationDbi = citation('AnnotationDbi'),
BiocParallel = citation('BiocParallel'),
derfinderHelper = citation('derfinderHelper'),
GenomicAlignments = citation('GenomicAlignments'),
GenomicFeatures = citation('GenomicFeatures'),
GenomicFiles = citation('GenomicFiles'),
Hmisc = citation('Hmisc'),
qvalue = citation('qvalue'),
Rsamtools = citation('Rsamtools'),
rtracklayer = citation('rtracklayer'),
S4Vectors = citation('S4Vectors'),
bumphunterPaper = RefManageR::BibEntry(bibtype = 'article',
key = 'bumphunterPaper',
title = 'Bump hunting to identify differentially methylated regions in epigenetic epidemiology studies',
author = 'Jaffe, Andrew E and Murakami, Peter and Lee, Hwajin and Leek, Jeffrey T and Fallin, M Daniele and Feinberg, Andrew P and Irizarry, Rafael A',
year = 2012, journal = 'International Journal of Epidemiology'),
derfinderData = citation('derfinderData')
)
check_bib()
## regionReport
bib <- c(knitcitations = citation('knitcitations'),
derfinder = citation('derfinder')[1],
regionReport = citation('regionReport')[1],
knitrBootstrap = citation('knitrBootstrap'),
BiocStyle = citation('BiocStyle'),
ggbio = citation('ggbio'),
ggplot2 = citation('ggplot2'),
knitr = citation('knitr')[3],
rmarkdown = citation('rmarkdown'),
DT = citation('DT'),
R = citation(),
IRanges = citation('IRanges'),
devtools = citation('devtools'),
GenomeInfoDb = citation('GenomeInfoDb'),
GenomicRanges = citation('GenomicRanges'),
biovizBase = citation('biovizBase'),
TxDb.Hsapiens.UCSC.hg19.knownGene = citation('TxDb.Hsapiens.UCSC.hg19.knownGene'),
derfinderPlot = citation('derfinderPlot')[1],
grid = citation('grid'),
gridExtra = citation('gridExtra'),
mgcv = citation('mgcv'),
RColorBrewer = citation('RColorBrewer'),
whikser = citation('whisker'),
bumphunter = citation('bumphunter')[1],
pheatmap = citation('pheatmap'),
DESeq2 = citation('DESeq2'),
edgeR1 = citation('edgeR')[1],
edgeR2 = citation('edgeR')[2],
edgeR5 = citation('edgeR')[5],
edgeR6 = RefManageR::BibEntry('inbook', key = 'edgeR6',
author = 'Chen, Yunshun and Lun, Aaron T. L. and Smyth, Gordon K.',
title = 'Differential expression analysis of complex RNA-seq experiments using edgeR',
booktitle = 'Statistical Analysis of Next Generation Sequencing Data',
year = 2014,
editor = 'Datta, Somnath and Nettleton, Dan', publisher = 'Springer',
location = 'New York', pages = '51-74'),
DEFormats = citation('DEFormats')
)
check_bib()
## recount
bib <- c(
AnnotationDbi = citation('AnnotationDbi'),
BiocParallel = citation('BiocParallel'),
BiocStyle = citation('BiocStyle'),
derfinder = citation('derfinder')[1],
DESeq2 = citation('DESeq2'),
devtools = citation('devtools'),
downloader = citation('downloader'),
EnsDb.Hsapiens.v79 = citation('EnsDb.Hsapiens.v79'),
GEOquery = citation('GEOquery'),
GenomeInfoDb = citation('GenomeInfoDb'),
GenomicFeatures = citation('GenomicFeatures'),
GenomicRanges = citation('GenomicRanges'),
IRanges = citation('IRanges'),
knitcitations = citation('knitcitations'),
knitr = citation('knitr')[3],
org.Hs.eg.db = citation('org.Hs.eg.db'),
R = citation(),
RCurl = citation('RCurl'),
recount = citation('recount'),
regionReport = citation('regionReport'),
rentrez = citation('rentrez'),
rmarkdown = citation('rmarkdown'),
rtracklayer = citation('rtracklayer'),
S4Vectors = citation('S4Vectors'),
SummarizedExperiment = citation('SummarizedExperiment'),
testthat = citation('testthat')
)
check_bib()
## Reproduce all issues
citep(bib[['GenomeInfoDb']])
citep(bib[['AnnotationDbi']])
citep(bib[['S4Vectors']])
citep(bib[['SummarizedExperiment']])
traceback()
# > citep(bib[['GenomeInfoDb']])
# Error in nchar(aut) : invalid multibyte string, element 1
# > citep(bib[['AnnotationDbi']])
# Error in nchar(aut) : invalid multibyte string, element 1
# > citep(bib[['S4Vectors']])
# Error in nchar(aut) : invalid multibyte string, element 1
# > citep(bib[['SummarizedExperiment']])
# Error in nchar(aut) : invalid multibyte string, element 1
# > traceback()
# 12: nchar(aut)
# 11: withCallingHandlers(expr, warning = function(w) invokeRestart("muffleWarning"))
# 10: suppressWarnings({
# ind <- nchar(aut) == 0L & !x$bibtype %in% c("XData", "Set")
# aut[ind] <- x$title[ind]
# x$.duplicated <- duplicated(aut)
# })
# 9: sort.BibEntry(bib, sorting = "none", .bibstyle = bibstyle, return.labs = TRUE)
# 8: sort(bib, sorting = "none", .bibstyle = bibstyle, return.labs = TRUE)
# 7: eval(substitute(expr), data, enclos = parent.frame())
# 6: eval(substitute(expr), data, enclos = parent.frame())
# 5: with.default(BibOptions(), {
# style <- .BibEntry_match_format_style(style)
# papers <- suppressMessages(do.call(`[.BibEntry`, list(x = bib,
# ...)))
# keys <- unlist(papers$key)
# if (!length(papers))
# return("")
# if (cite.style == "pandoc") {
# MakePandocCitation(papers, keys, textual, bibpunct, before,
# after)
# }
# else {
# numeric <- "numeric" %in% cite.style
# alphabetic <- "alphabetic" %in% cite.style
# if (cite.style != .cites$sty)
# ClearLabs(cite.style)
# n <- length(papers)
# cited <- names(.cites$indices)
# first <- !(keys %in% cited)
# if (cite.style != "numeric") {
# if (any(!names(bib) %in% names(.cites$labs))) {
# bibstyle <- switch(cite.style, authortitle = "authoryear",
# cite.style)
# bib <- sort(bib, sorting = "none", .bibstyle = bibstyle,
# return.labs = TRUE)
# newinds <- bib$.index
# .labs <- newinds[keys]
# .cites$labs <- c(.cites$labs, newinds)
# }
# else {
# .labs <- .cites$labs[keys]
# }
# }
# else {
# first.ind <- if (!length(.cites$labs))
# seq_along(papers)
# else which(first | !keys %in% names(.cites$labs))
# if (length(first.ind)) {
# shorthands <- unlist(papers$shorthand)
# max.ind <- suppressWarnings(sum(!is.na(as.numeric(.cites$labs))))
# newinds <- seq.int(max.ind + 1L, length.out = length(first.ind))
# names(newinds) <- keys[first.ind]
# if (length(shorthands))
# newinds[names(shorthands)] <- shorthands
# .cites$labs <- c(.cites$labs, newinds)
# }
# .labs <- .cites$labs[keys]
# }
# AddCite(keys, !identical(hyperlink, FALSE))
# year <- match(keys, names(.cites$indices))
# if (alphabetic || numeric) {
# year <- structure(.labs, names = NULL)
# }
# else {
# year <- structure(unlist(lapply(papers$dateobj, MakeAuthorYear()$DateFormatter)),
# names = NULL)
# if (any(.labs %in% letters))
# year <- paste0(year, .labs)
# }
# if (textual || (!numeric && !alphabetic)) {
# auth <- character(n)
# authorLists <- lapply(papers, authorList)
# lastAuthors <- NULL
# for (i in seq_len(n)) {
# authors <- authorLists[[i]]
# if (length(authors) > max.names && !(first[i] &&
# longnamesfirst)) {
# authors <- authors[seq_len(max.names)]
# authors[length(authors)] <- paste0(authors[length(authors)],
# ", et al.")
# }
# else {
# if (length(authors) > 1L)
# authors[length(authors)] <- paste("and",
# authors[length(authors)])
# }
# if (length(authors) > 2L)
# auth[i] <- paste(authors, collapse = ", ")
# else auth[i] <- paste(authors, collapse = " ")
# }
# }
# make.hyper <- !identical(hyperlink, FALSE)
# if (textual) {
# if (numeric || alphabetic) {
# result <- paste0(bibpunct[3L], before, year,
# after, bibpunct[4L])
# }
# else {
# result <- paste0(bibpunct[1L], before, year,
# after, bibpunct[2L])
# }
# if (super && numeric && (!style %in% c("markdown",
# "html") || !make.hyper))
# result <- paste0(auth, "^{", result, "}")
# else if (!super || !numeric)
# result <- paste0(auth, " ", result)
# }
# else if (numeric || alphabetic) {
# result <- year
# }
# else {
# result <- paste0(auth, bibpunct[6L], " ", year)
# }
# result <- if (make.hyper)
# MakeCiteHyperlink(result, papers, hyperlink, keys,
# auth, style, first, numeric, alphabetic, super,
# textual, bibpunct, before, after)
# else AddCitationPunct(result, bibpunct, before, after,
# textual, numeric, alphabetic, super)
# result
# }
# })
# 4: with(BibOptions(), {
# style <- .BibEntry_match_format_style(style)
# papers <- suppressMessages(do.call(`[.BibEntry`, list(x = bib,
# ...)))
# keys <- unlist(papers$key)
# if (!length(papers))
# return("")
# if (cite.style == "pandoc") {
# MakePandocCitation(papers, keys, textual, bibpunct, before,
# after)
# }
# else {
# numeric <- "numeric" %in% cite.style
# alphabetic <- "alphabetic" %in% cite.style
# if (cite.style != .cites$sty)
# ClearLabs(cite.style)
# n <- length(papers)
# cited <- names(.cites$indices)
# first <- !(keys %in% cited)
# if (cite.style != "numeric") {
# if (any(!names(bib) %in% names(.cites$labs))) {
# bibstyle <- switch(cite.style, authortitle = "authoryear",
# cite.style)
# bib <- sort(bib, sorting = "none", .bibstyle = bibstyle,
# return.labs = TRUE)
# newinds <- bib$.index
# .labs <- newinds[keys]
# .cites$labs <- c(.cites$labs, newinds)
# }
# else {
# .labs <- .cites$labs[keys]
# }
# }
# else {
# first.ind <- if (!length(.cites$labs))
# seq_along(papers)
# else which(first | !keys %in% names(.cites$labs))
# if (length(first.ind)) {
# shorthands <- unlist(papers$shorthand)
# max.ind <- suppressWarnings(sum(!is.na(as.numeric(.cites$labs))))
# newinds <- seq.int(max.ind + 1L, length.out = length(first.ind))
# names(newinds) <- keys[first.ind]
# if (length(shorthands))
# newinds[names(shorthands)] <- shorthands
# .cites$labs <- c(.cites$labs, newinds)
# }
# .labs <- .cites$labs[keys]
# }
# AddCite(keys, !identical(hyperlink, FALSE))
# year <- match(keys, names(.cites$indices))
# if (alphabetic || numeric) {
# year <- structure(.labs, names = NULL)
# }
# else {
# year <- structure(unlist(lapply(papers$dateobj, MakeAuthorYear()$DateFormatter)),
# names = NULL)
# if (any(.labs %in% letters))
# year <- paste0(year, .labs)
# }
# if (textual || (!numeric && !alphabetic)) {
# auth <- character(n)
# authorLists <- lapply(papers, authorList)
# lastAuthors <- NULL
# for (i in seq_len(n)) {
# authors <- authorLists[[i]]
# if (length(authors) > max.names && !(first[i] &&
# longnamesfirst)) {
# authors <- authors[seq_len(max.names)]
# authors[length(authors)] <- paste0(authors[length(authors)],
# ", et al.")
# }
# else {
# if (length(authors) > 1L)
# authors[length(authors)] <- paste("and",
# authors[length(authors)])
# }
# if (length(authors) > 2L)
# auth[i] <- paste(authors, collapse = ", ")
# else auth[i] <- paste(authors, collapse = " ")
# }
# }
# make.hyper <- !identical(hyperlink, FALSE)
# if (textual) {
# if (numeric || alphabetic) {
# result <- paste0(bibpunct[3L], before, year,
# after, bibpunct[4L])
# }
# else {
# result <- paste0(bibpunct[1L], before, year,
# after, bibpunct[2L])
# }
# if (super && numeric && (!style %in% c("markdown",
# "html") || !make.hyper))
# result <- paste0(auth, "^{", result, "}")
# else if (!super || !numeric)
# result <- paste0(auth, " ", result)
# }
# else if (numeric || alphabetic) {
# result <- year
# }
# else {
# result <- paste0(auth, bibpunct[6L], " ", year)
# }
# result <- if (make.hyper)
# MakeCiteHyperlink(result, papers, hyperlink, keys,
# auth, style, first, numeric, alphabetic, super,
# textual, bibpunct, before, after)
# else AddCitationPunct(result, bibpunct, before, after,
# textual, numeric, alphabetic, super)
# result
# }
# })
# 3: Cite(bib, ..., textual = FALSE, before = before, after = after,
# .opts = .opts)
# 2: Citep(bib, ...)
# 1: citep(bib[["SummarizedExperiment"]])
## Reproducibility information
sessionInfo()
# R version 3.4.2 (2017-09-28)
# Platform: x86_64-w64-mingw32/x64 (64-bit)
# Running under: Windows 10 x64 (build 15063)
# Matrix products: default
# locale:
# [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
# [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
# [5] LC_TIME=English_United States.1252
# attached base packages:
# [1] stats graphics grDevices utils datasets methods base
# other attached packages:
# [1] knitcitations_1.0.8
# loaded via a namespace (and not attached):
# [1] httr_1.3.1 compiler_3.4.2 plyr_1.8.4 R6_2.2.2 magrittr_1.5
# [6] tools_3.4.2 Rcpp_0.12.13 lubridate_1.6.0 xml2_1.1.1 RefManageR_0.14.20
# [11] stringi_1.1.5 digest_0.6.12 jsonlite_1.5 stringr_1.2.0 bibtex_0.4.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment