I'm making a package that builds some TxDb objects from Gencode for human called GenomicState available at http://research.libd.org/GenomicState/. With that TxDb object I then run bumphunter::annotateTranscripts(by = 'gene') which triggers https://github.com/rafalab/bumphunter/blob/master/R/matchGenes.R#L129 and calls the genes() function. That function is not imported currently in the bumphunter NAMESPACE file at https://github.com/rafalab/bumphunter/blob/master/NAMESPACE#L26, which leads to the error I'm seeing. It goes away if you load GenomicFeatures which is guess most users that are making TxDb objects load anyway which is probably why this issue hasn't come up before.
I'll submit a PR that resolves this issue shortly.
Best,
Leo
Error
> library(GenomicState)
> txdb_v31_hg38_chr22 <- gencode_txdb(chrs = 'chr22')
2019-10-03 16:52:23 importing ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_31/gencode.v31.annotation.gtf.gz
trying URL 'ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_31/gencode.v31.annotation.gtf.gz'
Content type 'unknown' length 42824232 bytes (40.8 MB)
==================================================
2019-10-03 16:53:44 keeping relevant chromosomes
2019-10-03 16:53:45 preparing metadata
Prepare the 'metadata' data frame ... OK
2019-10-03 16:53:56 building the txdb object
> genes_v31_hg38_chr22 <- gencode_annotated_genes(txdb_v31_hg38_chr22)
2019-10-03 16:54:11 annotating the transcripts
No annotationPackage supplied. Trying org.Hs.eg.db.
Loading required package: org.Hs.eg.db
Loading required package: AnnotationDbi
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: ‘BiocGenerics’
The following objects are masked from ‘package:parallel’:
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport,
clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply,
parSapply, parSapplyLB
The following objects are masked from ‘package:stats’:
IQR, mad, sd, var, xtabs
The following objects are masked from ‘package:base’:
anyDuplicated, append, as.data.frame, basename, cbind, colnames, dirname,
do.call, duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect,
is.unsorted, lapply, Map, mapply, match, mget, order, paste, pmax, pmax.int,
pmin, pmin.int, Position, rank, rbind, Reduce, rownames, sapply, setdiff,
sort, table, tapply, union, unique, unsplit, which, which.max, which.min
Loading required package: Biobase
Welcome to Bioconductor
Vignettes contain introductory material; view with 'browseVignettes()'. To
cite Bioconductor, see 'citation("Biobase")', and for packages
'citation("pkgname")'.
Loading required package: IRanges
Loading required package: S4Vectors
Attaching package: ‘S4Vectors’
The following object is masked from ‘package:base’:
expand.grid
Getting TSS and TSE.
Error in genes(txdb) : could not find function "genes"
> traceback()
2: bumphunter::annotateTranscripts(txdb, by = "gene", mappingInfo = list(column = "ENTREZID",
keytype = "ENSEMBL", multiVals = "first"), simplifyGeneID = TRUE) at gencode_annotated_genes.R#41
1: gencode_annotated_genes(txdb_v31_hg38_chr22)
The actual call:
> txdb <- txdb_v31_hg38_chr22
> genes <- bumphunter::annotateTranscripts(txdb,
+ by = 'gene',
+ mappingInfo = list('column' = 'ENTREZID', 'keytype' = 'ENSEMBL',
+ 'multiVals' = 'first'),
+ simplifyGeneID = TRUE, annotationPackage="org.Hs.eg.db"
+ )
Getting TSS and TSE.
Error in genes(txdb) : could not find function "genes"
Manual solution
Solved with by manually defining genes() to match GenomicFeatures::genes.
> genes <- GenomicFeatures::genes
> genes_v31_hg38_chr22 <- gencode_annotated_genes(txdb_v31_hg38_chr22)
2019-10-03 17:12:54 annotating the transcripts
No annotationPackage supplied. Trying org.Hs.eg.db.
Getting TSS and TSE.
Getting CSS and CSE.
Getting exons.
Annotating genes.
'select()' returned 1:many mapping between keys and columns
Hi,
I'm making a package that builds some
TxDb
objects from Gencode for human calledGenomicState
available at http://research.libd.org/GenomicState/. With thatTxDb
object I then runbumphunter::annotateTranscripts(by = 'gene')
which triggers https://github.com/rafalab/bumphunter/blob/master/R/matchGenes.R#L129 and calls thegenes()
function. That function is not imported currently in thebumphunter
NAMESPACE file at https://github.com/rafalab/bumphunter/blob/master/NAMESPACE#L26, which leads to the error I'm seeing. It goes away if you loadGenomicFeatures
which is guess most users that are makingTxDb
objects load anyway which is probably why this issue hasn't come up before.I'll submit a PR that resolves this issue shortly.
Best, Leo
Error
The actual call:
Manual solution
Solved with by manually defining
genes()
to matchGenomicFeatures::genes
.R session information