Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_expressed_genes - fix for Seurat v5 and add method for matrices #247

Closed
wants to merge 8 commits into from

Conversation

csangara
Copy link
Member

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:

  • Use 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
  • Allow additional parameters to be passed to GetAssayData as ... (to handle difference in 'slot' and 'layer' terminology between versions)
  • If no value for assay_oi is given, the DefaultAssay will be used instead of the most 'advanced' assay as previously done
  • Turned the function into a generic and implemented a method for matrices (get_expressed_genes.default)
    • The order of arguments has changed from function(ident, seurat_obj, pct = 0.1, assay_oi = NULL) to function(seurat_obj, ident, assay_oi = NULL, pct = 0.1, ...) because the main object has to be the first argument

@csangara csangara linked an issue Jan 17, 2024 that may be closed by this pull request
@codecov-commenter
Copy link

Codecov Report

Attention: 100 lines in your changes are missing coverage. Please review.

Comparison is base (0e14cbe) 70.08% compared to head (7d13d91) 69.59%.
Report is 14 commits behind head on master.

Files Patch % Lines
R/supporting_functions.R 26.19% 62 Missing ⚠️
R/application_prediction.R 42.42% 38 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #247      +/-   ##
==========================================
- Coverage   70.08%   69.59%   -0.50%     
==========================================
  Files          16       16              
  Lines        5419     5472      +53     
==========================================
+ Hits         3798     3808      +10     
- Misses       1621     1664      +43     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@csangara
Copy link
Member Author

Replaced by #250 - the function is rewritten to keep the argument ordering consistent.

@csangara csangara closed this Jan 29, 2024
@csangara csangara deleted the get-expressed-genes branch January 29, 2024 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get_expressed_genes function for sparse matrix
2 participants