GTF export fails with `could not find function "score"`, including `rtracklayer::export()` once Bioc.gff is loaded
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 76/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- r
- Lĩnh vực
- bioinformatics
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- R
- Star
- 0
- Fork
- 0
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue tương tự
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 66/100
nmfs-ost/stockplotr#518 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
nf-core/ampliseq#1146 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
HelenaLC/spatialdataR#295 ·
-
R cheat sheetĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
KUBDatalab/R-PUFF-SEMS#170 ·
-
size-time-budget
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
kapelner/EDI#66 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày