Choose top genes for downstream analyses.
More...
#include <vector>
#include <algorithm>
#include <numeric>
#include <cstddef>
#include "sanisizer/sanisizer.hpp"
Go to the source code of this file.
|
template<typename Stat_ , typename Top_ , typename Bool_ > |
void | topicks::pick_top_genes (std::size_t n, const Stat_ *statistic, Top_ top, bool larger, Bool_ *output, const PickTopGenesOptions< Stat_ > &options) |
|
template<typename Bool_ , typename Stat_ , typename Top_ > |
std::vector< Bool_ > | topicks::pick_top_genes (std::size_t n, const Stat_ *statistic, Top_ top, bool larger, const PickTopGenesOptions< Stat_ > &options) |
|
template<typename Index_ , typename Stat_ , typename Top_ > |
std::vector< Index_ > | topicks::pick_top_genes_index (Index_ n, const Stat_ *statistic, Top_ top, bool larger, const PickTopGenesOptions< Stat_ > &options) |
|
Choose top genes for downstream analyses.
◆ pick_top_genes() [1/2]
template<typename Stat_ , typename Top_ , typename Bool_ >
void topicks::pick_top_genes |
( |
std::size_t | n, |
|
|
const Stat_ * | statistic, |
|
|
Top_ | top, |
|
|
bool | larger, |
|
|
Bool_ * | output, |
|
|
const PickTopGenesOptions< Stat_ > & | options ) |
- Template Parameters
-
Stat_ | Numeric type of the statistic for picking top genes. |
Top_ | Integer type of the number of top genes. |
Bool_ | Output boolean type. |
- Parameters
-
| n | Number of genes. |
[in] | statistic | Pointer to an array of length n , containing the statistics with which to rank genes. |
| top | Number of top genes to choose. Note that the actual number of chosen genes may be:
- smaller than
top , if the latter is greater than the total number of genes in the dataset.
- smaller than
top , if PickTopGenesOptions::bound is set and top is greater than X , where X is the number of genes in the dataset with statistics greater than PickTopGenesOptions::bound (or less than the bound, if PickTopGenesOptions::larger = false ).
- larger than
top , if PickTopGenesOptions::keep_ties = true and there are multiple ties at the top -th chosen gene.
|
| larger | Whether the top genes are defined as those with larger statistics. |
[out] | output | Pointer to an array of length n . On output, this is filled with true if the gene is to be retained and false otherwise. |
| options | Further options. |
◆ pick_top_genes() [2/2]
template<typename Bool_ , typename Stat_ , typename Top_ >
std::vector< Bool_ > topicks::pick_top_genes |
( |
std::size_t | n, |
|
|
const Stat_ * | statistic, |
|
|
Top_ | top, |
|
|
bool | larger, |
|
|
const PickTopGenesOptions< Stat_ > & | options ) |
- Template Parameters
-
Bool_ | Output boolean type. |
Stat_ | Numeric type of the statistic for picking top genes. |
Top_ | Integer type of the number of top genes. |
- Parameters
-
| n | Number of genes. |
[in] | statistic | Pointer to an array of length n , containing the statistics with which to rank genes. |
| top | Number of top genes to choose, see the pick_top_genes() overload for comments. |
| larger | Whether the top genes are defined as those with larger statistics. |
| options | Further options. |
- Returns
- A vector of booleans of length
n
, indicating whether each gene is to be retained.
◆ pick_top_genes_index()
template<typename Index_ , typename Stat_ , typename Top_ >
std::vector< Index_ > topicks::pick_top_genes_index |
( |
Index_ | n, |
|
|
const Stat_ * | statistic, |
|
|
Top_ | top, |
|
|
bool | larger, |
|
|
const PickTopGenesOptions< Stat_ > & | options ) |
- Template Parameters
-
Index_ | Integer type of the output indices. |
Stat_ | Numeric type of the statistic for picking top genes. |
Top_ | Integer type of the number of top genes. |
- Parameters
-
| n | Number of genes. |
[in] | statistic | Pointer to an array of length n containing the statistics with which to rank genes. |
| top | Number of top genes to choose, see the pick_top_genes() overload for comments. |
| larger | Whether the top genes are defined as those with larger statistics. |
| options | Further options. |
- Returns
- Vector of sorted and unique indices for the chosen genes. All indices are guaranteed to be non-negative and less than
n
.