GTF export fails with `could not find function "score"`, including `rtracklayer::export()` once Bioc.gff is loaded
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 76/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- r
- Ambito
- bioinformatics
Direzione di ricerca
Start by running the fresh-session reproducer, then inspect NAMESPACE for imported generics and the registration/dispatch of GTF export methods in the package source. Check whether score is unavailable and whether Bioc.gff overrides an rtracklayer method for GTFFile. Done means both BiocIO::export() and rtracklayer::export() succeed without attaching BiocGenerics, with regression tests covering exports before and after loading Bioc.gff.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hi there! I was super happy to see this package as I use import/export a lot. I was trying to port over a function that uses rtracklayer and ran into some weird errors. With the help of Claude Code, I tracked it down:
Summary
Two related problems with Bioc.gff 1.2.0:
- In a fresh session,
BiocIO::export(gr, Bioc.gff::GTFFile(path))fails with
Error in score(object) : could not find function "score".scoreis not
visible from the Bioc.gff namespace (exists("score", envir = asNamespace("Bioc.gff"))isFALSE). BiocGenerics is listed under Imports
in DESCRIPTION, so it looks likescoreis just missing from the
importFrom(BiocGenerics, ...)directives in NAMESPACE. - Once Bioc.gff is loaded,
rtracklayer::export(gr, path, format = "gtf")
fails with the same error, though it works before Bioc.gff is loaded. Both
packages define classes such asGTFFileandexport()methods for them, and
with both loaded the rtracklayer call appears to dispatch to Bioc.gff's
method.
Problem 2 is easy to hit without loading Bioc.gff on purpose: RStudio loads a
package's namespace when its pkg:: functions are referenced in an open editor
tab (for autocompletion). An rtracklayer script that had worked for years
started failing after a Bioc.gff version of it was opened in another tab. The
error appears only after the slow import and processing are done (about 4
minutes for the mouse RefSeq GFF), and the output file is left with just its
header lines.
Reproducible example
# Run in a fresh session: R --vanilla
gr <- GenomicRanges::GRanges("chr1", IRanges::IRanges(c(1, 20, 40), width = 10),
type = "exon", gene_id = "g1", transcript_id = "t1")
out <- tempfile(fileext = ".gtf")
# 1. rtracklayer alone works
rtracklayer::export(gr, out, format = "gtf")
# no error
# 2. Load Bioc.gff; the same rtracklayer call now fails
loadNamespace("Bioc.gff")
rtracklayer::export(gr, out, format = "gtf")
# Error in score(object) : could not find function "score"
# Which package's export method is selected now?
environmentName(environment(selectMethod(BiocIO::export,
list("GRanges", class(rtracklayer::GTFFile(out))))))
# "Bioc.gff"
# 3. Bioc.gff's own export fails the same way
BiocIO::export(gr, Bioc.gff::GTFFile(out))
# Error in score(object) : could not find function "score"
exists("score", envir = asNamespace("Bioc.gff"))
# [1] FALSE
# 4. Workaround: attach BiocGenerics so score() is on the search path
library(BiocGenerics)
BiocIO::export(gr, Bioc.gff::GTFFile(out))
rtracklayer::export(gr, out, format = "gtf")
# both run without error
Expected behavior
BiocIO::export(gr, Bioc.gff::GTFFile(path))writes the GTF without needing
BiocGenerics attached.- Loading Bioc.gff does not change which method
rtracklayer::export()uses, or
at least the method it ends up using works.
Session info
sessionInfo()
R version 4.6.1 (2026-06-24 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26200)
Matrix products: default
LAPACK version 3.12.1
locale:
[1] LC_COLLATE=English_United States.utf8
[2] LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
time zone: America/Chicago
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] BiocGenerics_0.58.1 generics_0.1.4
loaded via a namespace (and not attached):
[1] Matrix_1.7-6 compiler_4.6.1
[3] rjson_0.2.23 crayon_1.5.3
[5] BiocBaseUtils_1.14.2 SummarizedExperiment_1.42.0
[7] Biobase_2.72.0 Rsamtools_2.28.0
[9] GenomicRanges_1.64.0 bitops_1.1-0
[11] Biostrings_2.80.2 GenomicAlignments_1.48.0
[13] parallel_4.6.1 IRanges_2.46.0
[15] Seqinfo_1.2.0 BiocParallel_1.46.0
[17] yaml_2.3.12 lattice_0.23-1
[19] R6_2.6.1 XVector_0.52.0
[21] S4Arrays_1.12.1 curl_8.1.0
[23] XML_3.99-0.25 DelayedArray_0.38.2
[25] MatrixGenerics_1.24.0 Bioc.gff_1.2.0
[27] SparseArray_1.12.3 grid_4.6.1
[29] rtracklayer_1.72.0 S4Vectors_0.50.3
[31] codetools_0.2-20 cigarillo_1.2.1
[33] abind_1.4-8 stats4_4.6.1
[35] RCurl_1.98-1.20 restfulr_0.0.17
[37] httr_1.4.9 matrixStats_1.5.0
[39] tools_4.6.1 BiocIO_1.22.0
- Lingua principale
- R
- Stelle
- 0
- Fork
- 0
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Issue simili
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 66/100
nmfs-ost/stockplotr#518 ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
nf-core/ampliseq#1146 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
HelenaLC/spatialdataR#295 ·
-
size-time-budget
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
kapelner/EDI#66 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Openscapes/blogscapes#61 ·
I maintainer di solito rispondono entro 1 giorno