I have found that renaming of seqlevels (TxDb) doesn't persist after a save-load cycle via saveDb and loadDb. I'm not sure whether this is intended behavior or not. If it's intended, perhaps a note to this effect could be added to the relevant documentation for the seqlevels() setter function?
Here is code to reproduce the behavior:
library (GenomicFeatures) refSeqDb = suppressWarnings (makeTranscriptDbFromUCSC ("hg19", tablename = "refGene")) seqlevels (refSeqDb) = gsub ("^chr", "", seqlevels (refSeqDb)) head (seqlevels (refSeqDb))
This code returns:
[1] "1" "2" "3" "4" "5" "6"
We then invoke a save-load cycle:
file = tempfile() saveDb (refSeqDb, file = file) refSeqDb = loadDb (file) head (seqlevels (refSeqDb))
which returns:
[1] "chr1" "chr2" "chr3" "chr4" "chr5" "chr6"
My version information is:
> sessionInfo() R version 3.2.2 (2015-08-14) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.10.5 (Yosemite) locale: [1] C attached base packages: [1] stats4 parallel grDevices utils datasets stats graphics methods base other attached packages: [1] GenomicFeatures_1.20.3 AnnotationDbi_1.30.1 Biobase_2.28.0 GenomicRanges_1.20.5 GenomeInfoDb_1.4.2 IRanges_2.2.7 S4Vectors_0.6.3 [8] BiocGenerics_0.14.0 loaded via a namespace (and not attached): [1] XVector_0.8.0 zlibbioc_1.14.0 GenomicAlignments_1.4.1 BiocParallel_1.2.20 tools_3.2.2 DBI_0.3.1 lambda.r_1.1.7 [8] futile.logger_1.4.1 rtracklayer_1.28.9 futile.options_1.0.0 bitops_1.0-6 RCurl_1.95-4.7 biomaRt_2.24.0 RSQLite_1.0.0 [15] compiler_3.2.2 Biostrings_2.36.3 Rsamtools_1.20.4 XML_3.98-1.3