get_expressed_genes
- fix for Seurat v5 and add method for matrices
#247
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In Seurat v4, the 'count' and 'data' slots are always present in the object - that is, a newly created Seurat object is initialized with both slots by default. This is not the case in Seurat v5, as objects are only initialized with the 'count' slot.
Since
get_expressed_genes
directly accesses the 'data' slot, this can cause errors in Seurat v5.The following changes to the function has been implemented:
GetAssayData
to access the expression matrix -> this means we can remove specific checks for each assay (SCT, integrated, Spatial, ...) because checks will be done by Seurat...
(to handle difference in 'slot' and 'layer' terminology between versions)assay_oi
is given, theDefaultAssay
will be used instead of the most 'advanced' assay as previously doneget_expressed_genes.default
)function(ident, seurat_obj, pct = 0.1, assay_oi = NULL)
tofunction(seurat_obj, ident, assay_oi = NULL, pct = 0.1, ...)
because the main object has to be the first argument