Closed divy-kangeyan closed 7 years ago
Hi Divy,
The following works for me:
suppressPackageStartupMessages(library(DelayedArray))
set.seed(666)
a <- array(runif(1500000), dim=c(10000, 30, 5))
A <- DelayedArray(a)
A[which(A <= 1e-5)]
#> [1] 3.061723e-06 8.459203e-06 2.210494e-06 9.671785e-07 9.246171e-06
#> [6] 4.540198e-06 1.884997e-06 9.980286e-06 9.364448e-06 8.054543e-06
#> [11] 8.265488e-06 7.253839e-06 4.062895e-07
What is the output when you run the above code in a new session? And what is the output of sessionInfo()
or devtools::session_info()
?
DelayedArray objects do not currently support subassignment ([<-
or [[<-
); this is documented in the final sentence of the 'Subsetting' section of the help page?DelayedArray::DelayedArray
Cheers, Pete
Hi Divy,
I would strongly encourage you to use the Bioconductor support site for any question/discussion about a Bioconductor package: https://support.bioconductor.org Please include a self-contained example as well as the output of your sessionInfo()
.
Note that partial support for subassignment was added last week in the devel version of DelayedArray. See here https://support.bioconductor.org/p/100566/#100646 for the details.
Cheers, H.
Hi Pete, This is my sessionInfo()
Session info ---------------------------------------------------------------------------------
setting value
version R version 3.4.1 (2017-06-30)
system x86_64, darwin15.6.0
ui RStudio (1.0.153)
language (EN)
collate en_US.UTF-8
tz America/New_York
date 2017-09-26
Packages -------------------------------------------------------------------------------------
package * version date source
affy 1.55.0 2017-05-10 Bioconductor
affyio 1.47.0 2017-05-10 Bioconductor
annotate 1.55.0 2017-05-10 Bioconductor
AnnotationDbi * 1.39.2 2017-07-26 Bioconductor
AnnotationHub 2.9.12 2017-08-31 Bioconductor
annotatr * 1.2.1 2017-06-24 Bioconductor
aroma.affymetrix 3.1.0 2017-03-24 CRAN (R 3.4.0)
aroma.apd 0.6.0 2015-02-25 CRAN (R 3.4.0)
aroma.core 3.1.1 2017-09-13 CRAN (R 3.4.1)
aroma.light 3.7.0 2017-05-10 Bioconductor
assertthat 0.2.0 2017-04-11 CRAN (R 3.4.0)
backports 1.1.0 2017-05-22 CRAN (R 3.4.0)
base * 3.4.1 2017-07-07 local
base64enc 0.1-3 2015-07-28 CRAN (R 3.4.0)
bindr 0.1 2016-11-13 CRAN (R 3.4.0)
bindrcpp 0.2 2017-06-17 CRAN (R 3.4.0)
Biobase * 2.37.2 2017-05-10 Bioconductor
BiocGenerics * 0.23.0 2017-05-10 Bioconductor
BiocInstaller 1.26.1 2017-09-01 Bioconductor
BiocParallel 1.11.8 2017-08-31 Bioconductor
biomaRt 2.33.4 2017-08-02 Bioconductor
Biostrings * 2.45.4 2017-08-31 Bioconductor
bit 1.1-12 2014-04-09 CRAN (R 3.4.0)
bit64 0.9-7 2017-05-08 CRAN (R 3.4.0)
bitops 1.0-6 2013-08-17 CRAN (R 3.4.0)
blob 1.1.0 2017-06-17 CRAN (R 3.4.0)
BSgenome * 1.45.1 2017-05-10 Bioconductor
BSgenome.Hsapiens.NCBI.GRCh38 * 1.3.1000 2017-09-01 Bioconductor
bsseq 1.13.6 2017-07-22 Bioconductor
caTools 1.17.1 2014-09-10 CRAN (R 3.4.0)
cluster 2.0.6 2017-03-10 CRAN (R 3.4.1)
codetools 0.2-15 2016-10-05 CRAN (R 3.4.1)
colorspace 1.3-2 2016-12-14 CRAN (R 3.4.0)
compiler 3.4.1 2017-07-07 local
curl 2.8.1 2017-07-21 CRAN (R 3.4.1)
data.table 1.10.4 2017-02-01 CRAN (R 3.4.0)
datasets * 3.4.1 2017-07-07 local
DBI 0.7 2017-06-18 CRAN (R 3.4.0)
DelayedArray * 0.2.7 2017-06-03 Bioconductor
devtools 1.13.3 2017-08-02 CRAN (R 3.4.1)
digest 0.6.12 2017-01-27 CRAN (R 3.4.0)
DNAcopy 1.51.0 2017-05-10 Bioconductor
dplyr 0.7.3 2017-09-09 CRAN (R 3.4.1)
DT 0.2 2016-08-09 CRAN (R 3.4.0)
edgeR 3.19.3 2017-07-01 Bioconductor
evaluate 0.10.1 2017-06-24 CRAN (R 3.4.1)
future 1.6.1 2017-09-09 CRAN (R 3.4.1)
gdata 2.18.0 2017-06-06 CRAN (R 3.4.0)
genefilter 1.59.0 2017-05-10 Bioconductor
GenomeInfoDb * 1.13.4 2017-06-06 Bioconductor
GenomeInfoDbData 0.99.1 2017-08-31 Bioconductor
GenomicAlignments 1.13.5 2017-08-17 Bioconductor
GenomicFeatures * 1.29.8 2017-07-20 Bioconductor
GenomicRanges * 1.29.12 2017-07-28 Bioconductor
ggplot2 * 2.2.1 2016-12-30 CRAN (R 3.4.0)
globals 0.10.2 2017-08-08 CRAN (R 3.4.1)
glue 1.1.1 2017-06-21 CRAN (R 3.4.1)
gplots 3.0.1 2016-03-30 CRAN (R 3.4.0)
graphics * 3.4.1 2017-07-07 local
grDevices * 3.4.1 2017-07-07 local
grid 3.4.1 2017-07-07 local
gsmoothr 0.1.7 2014-06-10 CRAN (R 3.4.0)
gtable 0.2.0 2016-02-26 CRAN (R 3.4.0)
gtools 3.5.0 2015-05-29 CRAN (R 3.4.0)
HDF5Array * 1.4.8 2017-05-29 Bioconductor
hms 0.3 2016-11-22 CRAN (R 3.4.0)
htmltools 0.3.6 2017-04-28 CRAN (R 3.4.0)
htmlwidgets 0.9 2017-07-10 CRAN (R 3.4.1)
httpuv 1.3.5 2017-07-04 CRAN (R 3.4.1)
httr 1.3.1 2017-08-20 CRAN (R 3.4.1)
interactiveDisplayBase 1.15.0 2017-05-10 Bioconductor
IRanges * 2.11.12 2017-07-22 Bioconductor
jsonlite 1.5 2017-06-01 CRAN (R 3.4.0)
KernSmooth 2.23-15 2015-06-29 CRAN (R 3.4.1)
knitr 1.17 2017-08-10 CRAN (R 3.4.1)
labeling 0.3 2014-08-23 CRAN (R 3.4.0)
lattice 0.20-35 2017-03-25 CRAN (R 3.4.1)
lazyeval 0.2.0 2016-06-12 CRAN (R 3.4.0)
limma 3.33.7 2017-07-31 Bioconductor
listenv 0.6.0 2015-12-28 CRAN (R 3.4.0)
locfit 1.5-9.1 2013-04-20 CRAN (R 3.4.0)
magrittr 1.5 2014-11-22 CRAN (R 3.4.0)
MASS 7.3-47 2017-02-26 CRAN (R 3.4.1)
Matrix 1.2-11 2017-08-16 CRAN (R 3.4.1)
matrixStats * 0.52.2 2017-04-14 CRAN (R 3.4.0)
memoise 1.1.0 2017-04-21 CRAN (R 3.4.0)
methods * 3.4.1 2017-07-07 local
mime 0.5 2016-07-07 CRAN (R 3.4.0)
munsell 0.4.3 2016-02-13 CRAN (R 3.4.0)
org.Dm.eg.db 3.4.1 2017-08-24 Bioconductor
org.Hs.eg.db * 3.4.1 2017-08-24 Bioconductor
org.Mm.eg.db 3.4.1 2017-08-24 Bioconductor
org.Rn.eg.db 3.4.1 2017-08-24 Bioconductor
parallel * 3.4.1 2017-07-07 local
permute 0.9-4 2016-09-09 CRAN (R 3.4.0)
pkgconfig 2.0.1 2017-03-21 CRAN (R 3.4.0)
plyr 1.8.4 2016-06-08 CRAN (R 3.4.0)
preprocessCore 1.39.0 2017-05-10 Bioconductor
prettyunits 1.0.2 2015-07-13 CRAN (R 3.4.0)
progress 1.1.2 2016-12-14 CRAN (R 3.4.0)
PSCBS 0.63.0 2017-06-28 CRAN (R 3.4.1)
R.cache 0.12.0 2015-11-12 CRAN (R 3.4.0)
R.devices 2.15.1 2016-11-10 CRAN (R 3.4.0)
R.filesets 2.11.0 2017-02-28 CRAN (R 3.4.0)
R.huge 0.9.0 2015-02-22 CRAN (R 3.4.0)
R.methodsS3 1.7.1 2016-02-16 CRAN (R 3.4.0)
R.oo 1.21.0 2016-11-01 CRAN (R 3.4.0)
R.rsp 0.41.0 2017-04-16 CRAN (R 3.4.0)
R.utils 2.5.0 2016-11-07 CRAN (R 3.4.0)
R6 2.2.2 2017-06-17 CRAN (R 3.4.0)
Rcpp 0.12.12 2017-07-15 CRAN (R 3.4.1)
RCurl 1.95-4.8 2016-03-01 CRAN (R 3.4.0)
readr 1.1.1 2017-05-16 CRAN (R 3.4.0)
regioneR 1.9.1 2017-07-19 Bioconductor
Repitools 1.23.0 2017-05-10 Bioconductor
reshape2 1.4.2 2016-10-22 CRAN (R 3.4.0)
rhdf5 * 2.21.4 2017-08-31 Bioconductor
Ringo 1.41.0 2017-05-10 Bioconductor
rlang 0.1.2 2017-08-09 CRAN (R 3.4.1)
rmarkdown 1.6 2017-06-15 CRAN (R 3.4.0)
rprojroot 1.2 2017-01-16 CRAN (R 3.4.0)
Rsamtools 1.29.1 2017-08-19 Bioconductor
Rsolnp 1.16 2015-12-28 CRAN (R 3.4.0)
RSQLite 2.0 2017-06-19 CRAN (R 3.4.1)
rtracklayer * 1.37.3 2017-07-22 Bioconductor
S4Vectors * 0.15.6 2017-08-31 Bioconductor
scales 0.5.0 2017-08-24 CRAN (R 3.4.1)
scmeth * 0.99.2 2017-09-26 Bioconductor
shiny 1.0.5 2017-08-23 CRAN (R 3.4.1)
splines 3.4.1 2017-07-07 local
stats * 3.4.1 2017-07-07 local
stats4 * 3.4.1 2017-07-07 local
stringi 1.1.5 2017-04-07 CRAN (R 3.4.0)
stringr 1.2.0 2017-02-18 CRAN (R 3.4.0)
SummarizedExperiment 1.7.5 2017-06-22 Bioconductor
survival 2.41-3 2017-04-04 CRAN (R 3.4.1)
tibble 1.3.4 2017-08-22 CRAN (R 3.4.1)
tools 3.4.1 2017-07-07 local
truncnorm 1.0-7 2014-01-21 CRAN (R 3.4.0)
TxDb.Dmelanogaster.UCSC.dm3.ensGene 3.2.2 2017-08-24 Bioconductor
TxDb.Dmelanogaster.UCSC.dm6.ensGene 3.4.1 2017-08-24 Bioconductor
TxDb.Hsapiens.UCSC.hg19.knownGene 3.2.2 2017-08-24 Bioconductor
TxDb.Hsapiens.UCSC.hg38.knownGene * 3.4.0 2017-08-24 Bioconductor
TxDb.Mmusculus.UCSC.mm10.knownGene 3.4.0 2017-08-24 Bioconductor
TxDb.Mmusculus.UCSC.mm9.knownGene 3.2.2 2017-08-24 Bioconductor
TxDb.Rnorvegicus.UCSC.rn4.ensGene 3.2.2 2017-08-24 Bioconductor
TxDb.Rnorvegicus.UCSC.rn5.refGene 3.4.1 2017-08-24 Bioconductor
TxDb.Rnorvegicus.UCSC.rn6.refGene 3.4.1 2017-08-24 Bioconductor
utils * 3.4.1 2017-07-07 local
vsn 3.45.2 2017-08-14 Bioconductor
withr 2.0.0 2017-07-28 CRAN (R 3.4.1)
XML 3.98-1.9 2017-06-19 CRAN (R 3.4.1)
xtable 1.8-2 2016-02-05 CRAN (R 3.4.0)
XVector * 0.17.1 2017-08-19 Bioconductor
yaml 2.1.14 2016-11-12 CRAN (R 3.4.0)
zlibbioc 1.23.0 2017-05-10 Bioconductor
@hpages Subsetting using DelayedArray objects would be a great addition to the package!
Thank you, Divy
After I loaded the devel version (0.3.20) linear single bracket subsetting works but subassignment is still giving the same error.
Hi Divy,
As requested by @hpages, you really need to post a minimal reproducible example. The reprex package may be helpful. I suggest creating an example, copying it to the clipboard and running reprex::reprex(si = TRUE)
. Here is the output from my machine showing that both these work in v0.3.20
of DelayedArray
suppressPackageStartupMessages(library(DelayedArray))
set.seed(666)
a <- array(runif(1500000), dim=c(10000, 30, 5))
A <- DelayedArray(a)
A
#> DelayedArray object of 10000 x 30 x 5 doubles:
#> , , 1
#> [,1] [,2] [,3] ... [,29] [,30]
#> [1,] 0.7743685 0.1335279 0.6601787 . 0.3857886 0.5996245
#> [2,] 0.1972242 0.3542788 0.8436035 . 0.2411224 0.2071395
#> ... . . . . . .
#> [9999,] 0.2127723 0.1898557 0.9074174 . 0.5253920 0.1440427
#> [10000,] 0.8872269 0.8788905 0.5878090 . 0.2033673 0.8185943
#>
#> ...
#>
#> , , 5
#> [,1] [,2] [,3] ... [,29] [,30]
#> [1,] 0.07526986 0.41284998 0.44423969 . 0.8409677 0.6087548
#> [2,] 0.38461261 0.63997016 0.84820287 . 0.6244994 0.1408350
#> ... . . . . . .
#> [9999,] 0.9218325 0.8355206 0.5210054 . 0.1623455 0.6090565
#> [10000,] 0.4834550 0.8703160 0.8825387 . 0.9162283 0.6685152
# Subsetting works
A[which(A <= 1e-5)]
#> [1] 3.061723e-06 8.459203e-06 2.210494e-06 9.671785e-07 9.246171e-06
#> [6] 4.540198e-06 1.884997e-06 9.980286e-06 9.364448e-06 8.054543e-06
#> [11] 8.265488e-06 7.253839e-06 4.062895e-07
# Subassignment works
A[A < 0.2] <- NA
A
#> DelayedArray object of 10000 x 30 x 5 doubles:
#> , , 1
#> [,1] [,2] [,3] ... [,29] [,30]
#> [1,] 0.7743685 NA 0.6601787 . 0.3857886 0.5996245
#> [2,] NA 0.3542788 0.8436035 . 0.2411224 0.2071395
#> ... . . . . . .
#> [9999,] 0.2127723 NA 0.9074174 . 0.5253920 NA
#> [10000,] 0.8872269 0.8788905 0.5878090 . 0.2033673 0.8185943
#>
#> ...
#>
#> , , 5
#> [,1] [,2] [,3] ... [,29] [,30]
#> [1,] NA 0.4128500 0.4442397 . 0.8409677 0.6087548
#> [2,] 0.3846126 0.6399702 0.8482029 . 0.6244994 NA
#> ... . . . . . .
#> [9999,] 0.9218325 0.8355206 0.5210054 . NA 0.6090565
#> [10000,] 0.4834550 0.8703160 0.8825387 . 0.9162283 0.6685152
BiocInstaller::biocValid()
#> [1] TRUE
Finally, you cannot mix-and-match packages from the release and devel branches of Bioconductor. I think you may have done this. What is the output of BiocInstaller::biocValid()
? See in the above that the result on my machine is TRUE
Cheers, Pete
You beat me @PeteHaitch ;-) Thanks for the comprehensive answer!
@Divyagash: Again, please take a look at https://support.bioconductor.org/p/100566/#100646 The timing couldn't have been better for your request!
Just one more comment on this, don't know if that matters or not to you @Divyagash, but I think it's important to keep in mind that linear single bracket subsetting is NOT delayed whereas subassignment IS delayed. Forgot to mention this for subassignment in the man page. This is now done in DelayedArray 0.3.21.
Cheers, H.
Hi Peter, The example that I am using is the example from the manual as I mentioned in the first post
a <- array(runif(1500000), dim=c(10000, 30, 5))
A <- DelayedArray(a)
A[A < 0.2] <- NA
After updating the package and checking for BiocInstaller::biocValid()
I was able to do both of the operations without any error.
@hpages I was able to infer the structure of the output based on the output.
Thank you @PeteHaitch and @hpages for the help.
Divy
@Divyagash Glad it's working for you now!
Hi, I am using DelayedArray package to process some sequencing data. In the manual it says DelayedArray object can be subsetted by a logical DelayedArray object. So I tried some of the examples in the manual.
Linear single bracket subsetting:
A[which(A <= 1e-5)]
Subassignment:
A[A < 0.2] <- NA
where A is a delayedArray.Linear single bracket subsetting didn't work and I got this error
Error in which(A <= 1e-05) : argument to 'which' is not logical
, I am guessing which function is not recognizing logical delayedArray object as an acceptable logical object.For Subassignment, I am getting the following error
Error in A[A < 0.2] <- NA : object of type 'S4' is not subsettable
Any idea why this is happening? My main intent was to subset the DelayedArray, so is it possible in this case?
Thank you, Divy