Closed susheelbhanu closed 2 years ago
Hi Susheel, @susheelbhanu
Can you please provide a minimally reproducible example? Are you using one of our workflow packages?
Best, Marcel
Here's an MRE:
library(Biostrings)
dna <- DNAStringSet(c(chr1="AAA", chr2="TTTTT", chrM="GG"))
seqlevelsStyle(dna)
# [1] "UCSC"
seqlevelsStyle(dna) <- "Ensembl"
# Error: 'new2old' not supported in 'seqinfo<-,DNAStringSet-method'
Thanks Hervé for the MRE.
While we work on a long term solution, perhaps we can add a seqlevelsStyle
setter method to the class?
setReplaceMethod("seqlevelsStyle", "DNAStringSet",
function(x, value) {
seqs <- seqinfo(x)
seqlevelsStyle(seqs) <- value
names(x) <- names(seqs)
x
}
)
I think a better approach is to make the seqinfo()
setter a little bit smarter. There is no reason why it wouldn't accept a new2old
value that is set to seq_along()
of the supplied Seqinfo. I'm working on that.
I ended up doing a substantial refactoring of the seqinfo()
getter and setter for DNAStringSet objects. Only the circularity flags and genome info are now stored in the metadata()
of the object. The seqnames()
and seqlengths()
are just inferred from the names()
and width()
.
The new behavior of the setter now allows it to alter everything (i.e. names/seqnames and/or circularity flags and/or genome) except the widths/seqlengths of the sequences. Also now new2old
can be set to seq_along(x)
.
We still have the long-time problem that subsetting the DNAStringSet object breaks its seqinfo()
but that's for another day.
See https://github.com/Bioconductor/Biostrings/commit/76279b5b32c146425a73f593fa40b2b790b81565 for the details.
Hi,
I'm trying to use the package in workflow, with the following code:
And I get the following error:
Any help would be appreciated. Thank you, Susheel