Skip to content

fix: add hs1/hs1_chrR TxDb support to R annotation scripts (ccbr_annotate_bed.R, ccbr_annotate_peaks.R) #123

Description

@kopardev

Summary

ccbr_annotate_bed.R and ccbr_annotate_peaks.R do not handle hs1 or hs1_chrR genomes. Any rule that calls these scripts crashes with object 'tdb' not found because neither genome is present in the genome→TxDb dispatch chain.

Discovered during the Biowulf test run for PR #120.


Error

Error in is(TxDb, "GRanges") : object 'tdb' not found

Affected rules: atac_genrich_peakcalling, atac_annotate_fixed_width_consensus_peaks, annotate_roi
Scripts: workflow/scripts/ccbr_annotate_bed.R, workflow/scripts/ccbr_annotate_peaks.R


Root cause

Both scripts dispatch on args$genome to assign tdb (TxDb annotation database) and adb (OrgDb). The current if-chain covers: hg19, hg38, mm9, mm10, mmul10, bosTau9 — but not hs1 or hs1_chrR. When neither matches, tdb is never assigned and downstream usage crashes.


Modern viable solutions (in order of preference)

1. Use a real T2T TxDb — a pre-built one now exists ✅ (preferred)

The BiocT2T package provides a TxDb built from the actual CHM13v2.0 annotation. Install via:

BiocT2T::install_early_t2t_txdb()
library(TxDb.Hsapiens.NCBI.CHM13v2)

This gives correct T2T coordinates rather than an hg38 stand-in.

2. Build the TxDb from the NCBI GFF (officially documented method)

makeTxDbFromUCSC() does not support hs1, so the recommended route is the GFF file provided by NCBI. Download GCF_009914755.1_T2T-CHM13v2.0_genomic.gff.gz from NCBI, then:

library(rtracklayer); library(txdbmaker)
gff <- import("GCF_009914755.1_T2T-CHM13v2.0_genomic.gff.gz")
seqinfo(gff) <- Seqinfo(genome="T2T-CHM13v2.0")
txdb <- makeTxDbFromGRanges(gff, taxonomyId=9606)

This produces a proper TxDb with ~188,205 transcripts on the T2T-CHM13v2.0 genome. The resulting .sqlite file could be shipped as a cached resource in ASPEN's resource bundle so it isn't rebuilt each run.

3. BSgenome / sequence side

BSgenome.Hsapiens.NCBI.T2T.CHM13v2.0 wraps the T2T-CHM13v2.0 assembly (GCA_009914755.4) and is installable via BiocManager. There's also BSgenome.Hsapiens.UCSC.hs1 if UCSC-style seqnames are needed.

OrgDb (adb): org.Hs.eg.db is correct as-is

An OrgDb holds no positional data — it maps gene identifiers and pathways only. Reusing org.Hs.eg.db for hs1/hs1_chrR is correct; only the TxDb needs a real T2T source.


⚠️ Seqname convention caveat

T2T RefSeq/Liftoff annotations use NCBI-style seqnames (1, 2, ..., X, Y, MT) while ASPEN's hs1 index uses UCSC-style names (chr1, chr2, ..., chrX, chrY). Any TxDb built from the NCBI GFF must be harmonized before use, or annotation will silently produce no overlaps:

seqlevelsStyle(tdb) <- "UCSC"

This must be applied to tdb before passing it to annotatePeak().


Recommended fix for the PR

Add the hs1 / hs1_chrR case to both scripts, assigning:

  • tdb = T2T TxDb (option 1 via BiocT2T, or option 2 pre-cached .sqlite), not hg38
  • adb = "org.Hs.eg.db" (already correct)
  • Apply seqlevelsStyle(tdb) <- "UCSC" after loading

Blocked by / Dependencies

Related

⚡ Generated using AI ⚡

Metadata

Metadata

Assignees

Labels

ASPENRepoNamebugSomething isn't workingenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions