-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move modelGeneVar to internal function, switch scran to suggest
- Loading branch information
Showing
5 changed files
with
81 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#' selectFeatures | ||
#' | ||
#' For a given assay and set of features, perform variance ranking and select | ||
#' a subset of features | ||
#' | ||
#' @param assay An assay matrix rows are features, columns are cells | ||
#' @param features Character vector of the current features that are selected | ||
#' @param maxFeatures Integer of the number of maxFeatures to select | ||
#' | ||
#' @return A character vector of the selected features according to variance | ||
#' ranking. | ||
#' | ||
#' @keywords internal | ||
selectFeatures = function(assay, features, maxFeatures) { | ||
|
||
if (!requireNamespace("scran", quietly = TRUE)) { | ||
stop("Install 'scran' select features when maxFeatures is selected") | ||
} | ||
|
||
genevars <- scran::modelGeneVar( | ||
assay[features, ], | ||
min.mean = 0 | ||
) | ||
genevars_sorted <- genevars[ | ||
order(genevars$bio, decreasing = TRUE), | ||
] | ||
features_selected <- rownames( | ||
genevars_sorted | ||
)[seq_len(maxFeatures)] | ||
return(features_selected) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters