Comments (11)
Thanks @kpagacz for posting this!
@ maintainers: please let us know if you need more information or if we can help. thanks!
from summarizedexperiment.
Hi @kpagacz
We're not sure what the use case would be for this but when there is no method specified,
it defaults to subset.default
.
For example:
> subset(MultiAssayExperiment())
Error in subset.default(MultiAssayExperiment()) :
argument "subset" is missing, with no default
We can make a change to SummarizedExperiment
to print the same.
SummarizedExperiment
is a Vector
derivative and
does not have a contract to behave like a data.frame()
.
showClass("SummarizedExperiment")
The change would likely occur in:
getMethod("subset", "Vector")
Hervé @hpages will provide his expert opinion.
Best regards,
Marcel
from summarizedexperiment.
Thanks a lot Marcel @LiNk-NY for coming back to us so quickly!
We're not sure what the use case would be for this
Just to clarify maybe: This is not only occurring when calling subset()
without any other arguments.
E.g. consider the above example with
subset(no_samples[["gistict"]], subset = Gene.Symbol == "DIRAS3")
then this fails with the same error message.
The use case is an interactive (Shiny) application where the user can filter the MAE but also the experiments (SEs). Basically we would like to make this robust such that the user could unintentionally have a subset of the MAE resulting in 0 samples, but then not breaking the app when also subsetting the experiment.
Does that make sense?
from summarizedexperiment.
subset
should actually work on the columns so the syntax for the call does not seem intuitive.
From the ?subset
examples, temp
here is a column in the airquality
data.frame:
> head(subset(airquality, Temp > 80))
Ozone Solar.R Wind Temp Month Day
29 45 252 14.9 81 5 29
35 NA 186 9.2 84 6 4
36 NA 220 8.6 85 6 5
38 29 127 9.7 82 6 7
39 NA 273 6.9 87 6 8
40 71 291 13.8 90 6 9
Perhaps what you mean to do is:
> aa <- no_samples[["gistict"]]
> aa[mcols(aa)$Gene.Symbol == "DIRAS3", ]
class: SummarizedExperiment
dim: 1 0
metadata(0):
assays(1): ''
rownames(1): DIRAS3
rowData names(3): Gene.Symbol Locus.ID Cytoband
colnames(0):
colData names(0):
which uses the standard SummarizedExperiment
interface, i.e., bracket subsetting.
But we agree that at least the error message should be more informative.
Best,
Marcel
from summarizedexperiment.
subset
should actually work on the columns so the syntax for the call does not seem intuitive.
Thanks Marcel. That is strange, and I am pretty sure that the syntax is correct, because on a non-empty MAE it works:
library(MultiAssayExperiment)
no_samples <- MultiAssayExperiment::subsetByColData(miniACC, y = miniACC$gender %in% c("male"))
subset(no_samples[["gistict"]], subset = Gene.Symbol == "DIRAS3")
# correctly selects the rows / genes that fulfill the subset condition.
from summarizedexperiment.
According to this doc subsetting via subset is supported and the provided examples don't suggest a no columns exception.
from summarizedexperiment.
This actually stems from a bug in S4Vectors:::evalqForSubset()
which is used in various subset()
methods, including the subset()
method for SummarizedExperiment objects. I just reported the issue here.
Best,
H.
from summarizedexperiment.
Great, thanks @hpages !
from summarizedexperiment.
Yeah, thanks a lot for digging into this!
from summarizedexperiment.
subset
should actually work on the columns so the syntax for the call does not seem intuitive.Thanks Marcel. That is strange, and I am pretty sure that the syntax is correct, because on a non-empty MAE it works:
library(MultiAssayExperiment) no_samples <- MultiAssayExperiment::subsetByColData(miniACC, y = miniACC$gender %in% c("male")) subset(no_samples[["gistict"]], subset = Gene.Symbol == "DIRAS3") # correctly selects the rows / genes that fulfill the subset condition.
I mean to point out that subset.data.frame
and getMethod("subset", "Vector")
do not behave the same.
So I would not expect to get the same result as subset(data.frame())
.
the provided examples don't suggest a no columns exception.
It's actually using the rowData
/ mcols
for that look up.
You can follow the issue in S4Vectors and close the one here. Thanks for reporting!
And thanks for looking into it Hervé!
from summarizedexperiment.
Closing and hoping S4Vectors' team addresses this promptly.
from summarizedexperiment.
Related Issues (20)
- Should the show() method for SummarizedExperiment objects suggest saveHDF5SummarizedExperiment()? HOT 1
- Enforce unique assay names HOT 2
- `combineCols()` and `combineRows()` not listed in 'Usage' section HOT 4
- Consider assayData DataFrame for assays HOT 6
- Constructor could check that assay is in matric format HOT 2
- `all.equal(x, y)` vs `all(x == y)` HOT 3
- Remove all dimnames in `combine_assays_by` to avoid constructor check failures HOT 3
- `combineCols` should keep names in metadata with `use.names=TRUE`
- Erroneous behaviour when colData is data.frame
- package(s) not installed when version(s) same as or greater than current; use `force = TRUE` to re-install: 'SummarizedExperiment' HOT 1
- Add an `assaybind()` method
- Curious about how Rd manuals are generated HOT 3
- Feature request: keep rownames(se) and rownames() of DataFrame nested in rowData(se) in sync HOT 4
- metadata function is not exported as others HOT 1
- colData Default in Constructor Inconsistency HOT 1
- Warning about dim, nrow and ncol deprecated methods.
- Warning and error message when using '$' operator on summarizedExperiment object HOT 5
- Depreciated function calls in DelayedArray HOT 4
- Rows being removed from ASV table when building SummarizedExperiment
- Clarify withDimnames=FALSE in the documentation HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from summarizedexperiment.