|
ScoreMarkers & | set_threshold (double t=Defaults::threshold) |
|
ScoreMarkers & | set_num_threads (int n=Defaults::num_threads) |
|
ScoreMarkers & | set_cache_size (int c=Defaults::cache_size) |
|
ScoreMarkers & | set_block_weight_policy (WeightPolicy w=Defaults::block_weight_policy) |
|
ScoreMarkers & | set_variable_block_weight_parameters (VariableBlockWeightParameters v=Defaults::variable_block_weight_parameters) |
|
ScoreMarkers & | set_compute_cohen (ComputeSummaries s=Defaults::compute_all_summaries()) |
|
ScoreMarkers & | set_compute_cohen (bool c) |
|
ScoreMarkers & | set_compute_cohen (differential_analysis::summary s, bool c) |
|
ScoreMarkers & | set_compute_auc (ComputeSummaries s=Defaults::compute_all_summaries()) |
|
ScoreMarkers & | set_compute_auc (bool c) |
|
ScoreMarkers & | set_compute_auc (differential_analysis::summary s, bool c) |
|
ScoreMarkers & | set_compute_lfc (ComputeSummaries s=Defaults::compute_all_summaries()) |
|
ScoreMarkers & | set_compute_lfc (bool c) |
|
ScoreMarkers & | set_compute_lfc (differential_analysis::summary s, bool c) |
|
ScoreMarkers & | set_compute_delta_detected (ComputeSummaries s=Defaults::compute_all_summaries()) |
|
ScoreMarkers & | set_compute_delta_detected (bool c) |
|
ScoreMarkers & | set_compute_delta_detected (differential_analysis::summary s, bool c) |
|
ScoreMarkers & | set_summary_min (bool s) |
|
ScoreMarkers & | set_summary_mean (bool s) |
|
ScoreMarkers & | set_summary_median (bool s) |
|
ScoreMarkers & | set_summary_max (bool s) |
|
ScoreMarkers & | set_summary_min_rank (bool s) |
|
template<typename Value_ , typename Index_ , typename Group_ , typename Stat_ > |
void | run (const tatami::Matrix< Value_, Index_ > *p, const Group_ *group, std::vector< Stat_ * > means, std::vector< Stat_ * > detected, std::vector< std::vector< Stat_ * > > cohen, std::vector< std::vector< Stat_ * > > auc, std::vector< std::vector< Stat_ * > > lfc, std::vector< std::vector< Stat_ * > > delta_detected) const |
|
template<typename Value_ , typename Index_ , typename Group_ , typename Block_ , typename Stat_ > |
void | run_blocked (const tatami::Matrix< Value_, Index_ > *p, const Group_ *group, const Block_ *block, std::vector< Stat_ * > means, std::vector< Stat_ * > detected, std::vector< std::vector< Stat_ * > > cohen, std::vector< std::vector< Stat_ * > > auc, std::vector< std::vector< Stat_ * > > lfc, std::vector< std::vector< Stat_ * > > delta_detected) const |
|
template<typename Stat_ = double, typename Value_ , typename Index_ , typename Group_ > |
Results< Stat_ > | run (const tatami::Matrix< Value_, Index_ > *p, const Group_ *group) const |
|
template<typename Stat_ = double, typename Value_ , typename Index_ , typename Group_ , typename Block_ > |
Results< Stat_ > | run_blocked (const tatami::Matrix< Value_, Index_ > *p, const Group_ *group, const Block_ *block) const |
|
Score each gene as a candidate marker for each group of cells.
Markers are identified by differential expression analyses between pairs of groups of cells (e.g., clusters, cell types). Given n
groups, each group is involved in n - 1
pairwise comparisons and thus has n - 1
effect sizes. For each group, we compute summary statistics - e.g., median, mean - of the effect sizes across all of that group's comparisons. Users can then sort by any of these summaries to obtain a ranking of potential marker genes for each group.
The choice of effect size and summary statistic determines the characteristics of the resulting marker set. For the effect sizes: we compute Cohen's d, the area under the curve (AUC), the log-fold change and the delta-detected, which are described in more detail in the documentation for PairwiseEffects
, For the summary statistics: we compute the minimum, mean, median, maximum and min-rank of the effect sizes across each group's pairwise comparisons, which are described in SummarizeEffects
.
If the dataset contains blocking factors such as batch or sample, we compute the effect size within each level of the blocking factor. This avoids interference from batch effects or sample-to-sample variation. Users can also adjust the effect size to account for a minimum log-fold change threshold, in order to focus on markers with larger changes in expression. See PairwiseEffects
for more details.
As a courtesy, we also compute the mean expression a
template<typename Value_ , typename Index_ , typename Group_ , typename Stat_ >
void scran::ScoreMarkers::run |
( |
const tatami::Matrix< Value_, Index_ > * |
p, |
|
|
const Group_ * |
group, |
|
|
std::vector< Stat_ * > |
means, |
|
|
std::vector< Stat_ * > |
detected, |
|
|
std::vector< std::vector< Stat_ * > > |
cohen, |
|
|
std::vector< std::vector< Stat_ * > > |
auc, |
|
|
std::vector< std::vector< Stat_ * > > |
lfc, |
|
|
std::vector< std::vector< Stat_ * > > |
delta_detected |
|
) |
| const |
|
inline |
Score potential marker genes by computing summary statistics across pairwise comparisons between groups. On completion, means
, detected
, cohen
, auc
, lfc
and delta_detected
are filled with their corresponding statistics.
If cohen
is of length 0, Cohen's d is not computed. If any of the inner vectors are of length 0, the corresponding summary statistic is not computed. The same applies to auc
, lfc
and delta_detected
. (set_compute_cohen()
and related functions have no effect here.)
- Template Parameters
-
Data_ | Matrix data type. |
Index_ | Matrix index type. |
Group_ | Integer type for the group assignments. |
Stat_ | Floating-point type to store the statistics. |
- Parameters
-
| p | Pointer to a tatami matrix instance. |
[in] | group | Pointer to an array of length equal to the number of columns in p , containing the group assignments. These should be 0-based and consecutive. |
[out] | means | Pointers to arrays of length equal to the number of rows in p , used to store the mean expression of each group. |
[out] | detected | Pointers to arrays of length equal to the number of rows in p , used to store the proportion of detected expression in each group. |
[out] | cohen | Vector of vector of pointers to arrays of length equal to the number of rows in p . Each inner vector corresponds to a summary statistic for Cohen's d, ordered as in differential_analysis::summary . Each pointer corresponds to a group and is filled with the relevant summary statistic for that group. |
[out] | auc | Vector of vector of pointers as described for cohen , but instead storing summary statistics for the AUC. |
[out] | lfc | Vector of vector of pointers as described for cohen , but instead storing summary statistics for the log-fold change instead of Cohen's d. |
[out] | delta_detected | Vector of vector of pointers as described for cohen , but instead storing summary statistics for the delta in the detected proportions. |
template<typename Value_ , typename Index_ , typename Group_ , typename Block_ , typename Stat_ >
void scran::ScoreMarkers::run_blocked |
( |
const tatami::Matrix< Value_, Index_ > * |
p, |
|
|
const Group_ * |
group, |
|
|
const Block_ * |
block, |
|
|
std::vector< Stat_ * > |
means, |
|
|
std::vector< Stat_ * > |
detected, |
|
|
std::vector< std::vector< Stat_ * > > |
cohen, |
|
|
std::vector< std::vector< Stat_ * > > |
auc, |
|
|
std::vector< std::vector< Stat_ * > > |
lfc, |
|
|
std::vector< std::vector< Stat_ * > > |
delta_detected |
|
) |
| const |
|
inline |
Score potential marker genes by computing summary statistics across pairwise comparisons between groups in multiple blocks. On completion, means
, detected
, cohen
, auc
, lfc
and delta_detected
are filled with their corresponding statistics.
If cohen
is of length 0, Cohen's d is not computed. If any of the inner vectors are of length 0, the corresponding summary statistic is not computed. The same applies to auc
, lfc
and delta_detected
. (set_compute_cohen()
and related functions have no effect here.)
- Template Parameters
-
Data_ | Matrix data type. |
Index_ | Matrix index type. |
Group_ | Integer type for the group assignments. |
Block_ | Integer type for the block assignments. |
Stat_ | Floating-point type to store the statistics. |
- Parameters
-
| p | Pointer to a tatami matrix instance. |
[in] | group | Pointer to an array of length equal to the number of columns in p , containing the group assignments. These should be 0-based and consecutive. |
[in] | block | Pointer to an array of length equal to the number of columns in p , containing the blocking factor. Levels should be 0-based and consecutive. If NULL , this is ignored and the result is the same as calling run() . |
[out] | means | Vector of vectors of pointers to arrays of length equal to the number of rows in p . Each inner vector corresponds to a group and each pointer therein contains the mean expression in a blocking level. |
[out] | detected | Pointers to arrays of length equal to the number of rows in p . Each inner vector corresponds to a group and each pointer therein contains the proportion of detected expression in a blocking level. |
[out] | cohen | Vector of vector of pointers to arrays of length equal to the number of rows in p . Each inner vector corresponds to a summary statistic for Cohen's d, ordered as in differential_analysis::summary . Each pointer corresponds to a group and is filled with the relevant summary statistic for that group. |
[out] | auc | Vector of vector of pointers as described for cohen , but instead storing summary statistics for the AUC. |
[out] | lfc | Vector of vector of pointers as described for cohen , but instead storing summary statistics for the log-fold change instead of Cohen's d. |
[out] | delta_detected | Vector of vector of pointers as described for cohen , but instead storing summary statistics for the delta in the detected proportions. |