Closed cvanderaa closed 4 years ago
Hi @cvanderaa
We don't have explicit methods for ExperimentList
so any [
subsetting will use the List
methods and those probably are not meant to handle the input.
I can look into adding an explicit [
method for ExperimentList
. There are a couple of alternatives in the meantime:
## Use MAE-level subsetting
mae[list(sce = "a"), ]
## Use subsetByRow method for ExperimentList
subsetByRow(experiments(mae), list(sce = "a"))
@cvanderaa what do you want experiments(mae)[list(sce = "a")]
to do? Is it this?
> subsetByRow(experiments(mae), "a") %>% subsetByAssay(., "sce")
ExperimentList class object of length 1:
[1] sce: SingleCellExperiment with 1 rows and 10 columns
Thank you for your answers @LiNk-NY and @lwaldron. My goal is to include and use SingleCellExperiment
objects in a Features
object that is based on your MultiAssayExperiment
class. Features
(developed by @lgatto) integrates various levels of linked proteomic expression data (e.g. proteins expression levels computed from peptide expression levels). I want to adapt Features
for single-cell proteomics usage.
One very interesting functionality of Features
is to subset, let's say, a protein over all levels of expression, typically PSM, peptide and protein. Of course in my reproducible example, it is strange to have a list with only 1 entry, but a real case scenario would look like this:
experiments(mae)[list(PSM = c("psm1", "psm2" , "psm3", "psm4"),
peptide = c("peptide1", "peptide2"),
protein = c("protein1"))]
See this line in Features
where the error occurs. featurename_list
is a list as given in the code chunk above.
Since this works perfectly for SummarizedExperiments
, I was hoping it would be possible to make it also work for SingleCellExperiments
without too much effort.
Sorry, don't mind my last comment, I was able to adapt Features
to solve the issue with the solution of @LiNk-NY
experiments(x[list(sce = "a"), ])
Thanks again for your help!
I do think row subsetting should be supported for ExperimentList, and it is when using subsetByRow()
. @LiNk-NY I would propose that the following should be equivalent (and should be documented in ?ExperimentList-class
and the cheatsheet).
subsetByRow(experiments(mae), "a")
ExperimentList class object of length 2:
[1] se: SummarizedExperiment with 1 rows and 10 columns
[2] sce: SingleCellExperiment with 1 rows and 10 columns
> experiments(mae)["a", ]
Error: subscript contains invalid names
>
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
You can test in this branch: https://github.com/waldronlab/MultiAssayExperiment/tree/expsubset
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi,
FWIW the root of the problem reported by the OP was a bug in the SingleCellExperiment class that got fixed 9 days ago: https://github.com/drisso/SingleCellExperiment/commit/bc220cab41b7112347dda5e094ebb2a9c987fb23 This was a bug in the extractROWS()
method for SingleCellExperiment objects. The bug was breaking things based on extractROWS()
like head(sce, n=2)
or experiments(mae)[list(sce="a")]
.
Note that changing the behavior of subsetting on ExperimentList objects was not needed in order to address the problem.
H.
Hello, I encounter an error when I subset features from a
SingleCellExperiment
object that is contained in aMultiAssayExperiment
object. I want to perform this by subsetting the output ofexperiments(x)
which (from thetraceback()
) calls tosubset_List_by_List
. Note it works perfectly fine for aSummarizedExperiment
object.Here is some reproducible example: