Bioconductor / Biostrings

Efficient manipulation of biological strings
https://bioconductor.org/packages/Biostrings
54 stars 16 forks source link

bug (?) in DNAStringSetList element reassignment #75

Closed jayoung closed 2 years ago

jayoung commented 2 years ago

Hi there,

I think I found a bug in Biostrings version 2.64.0? Not sure.

I'm trying to reassign an element in a DNAStringSetList, but I don't think I can. I'll stick with a plain list as a workaround. Hopefully the code below shows what I mean.

Is it a bug, or am I just not using [[ right?

Apologies I have not tested the devel version: I should remind myself how to have >1 version installed at once - it's been a while....

thanks!

Janet


library(Biostrings)

seqs1a <- DNAStringSet( c("AAAAAA","GGGGGG") )
seqs1b <- DNAStringSet( c("TTTTTT","CCCCCC") )

### I can reassign when it's a plain list
seqListPlain <- list(seqs1a, seqs1b) 
seqListPlain[[1]] <- seqs1b

### but not when it's a DNAStringSetList
seqList <- DNAStringSetList(seqs1a, seqs1b) 
seqList[[1]] <- seqs1b
# Error in .wrap_in_length_one_list_like_object(value, names(x)[[i]], x) : 
#   failed to coerce 'list(value)' to a DNAStringSetList object of length 1

sessionInfo()

R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.5

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] Biostrings_2.64.0   GenomeInfoDb_1.32.3 XVector_0.36.0      IRanges_2.30.0      S4Vectors_0.34.0   
[6] BiocGenerics_0.42.0

loaded via a namespace (and not attached):
[1] zlibbioc_1.42.0        compiler_4.2.1         tools_4.2.1            GenomeInfoDbData_1.2.8
[5] RCurl_1.98-1.8         crayon_1.5.1           bitops_1.0-7              
hpages commented 2 years ago

Hi @jayoung,

[[<- was actually never implemented for XStringSetList derivatives. Clearly there was no strong demand for it... until now! :wink:

Should work with Biostrings 2.64.1 (release) and Biostrings 2.65.2 (devel). Both versions should become available via BiocManager::install() in the next 24-48 hours for users of BioC 3.14 (current release) and BioC 3.15 (current devel).

Best, H.

jayoung commented 2 years ago

Thanks, Herve! appreciate it. I can now more fully embrace the joys of XStringSetLists.