topicks
Pick top genes for downstream analyses
Loading...
Searching...
No Matches
topicks.hpp File Reference

Choose top genes for downstream analyses. More...

#include <vector>
#include <algorithm>
#include <numeric>
#include <cstddef>
#include "sanisizer/sanisizer.hpp"
Include dependency graph for topicks.hpp:

Go to the source code of this file.

Classes

struct  topicks::PickTopGenesOptions< Stat_ >
 Options for pick_top_genes(). More...
 

Functions

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)
 

Detailed Description

Choose top genes for downstream analyses.

Function Documentation

◆ 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
nNumber of genes.
[in]statisticPointer to an array of length n, containing the statistics with which to rank genes.
topNumber 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.
largerWhether the top genes are defined as those with larger statistics.
[out]outputPointer to an array of length n. On output, this is filled with true if the gene is to be retained and false otherwise.
optionsFurther 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
nNumber of genes.
[in]statisticPointer to an array of length n, containing the statistics with which to rank genes.
topNumber of top genes to choose, see the pick_top_genes() overload for comments.
largerWhether the top genes are defined as those with larger statistics.
optionsFurther 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
nNumber of genes.
[in]statisticPointer to an array of length n containing the statistics with which to rank genes.
topNumber of top genes to choose, see the pick_top_genes() overload for comments.
largerWhether the top genes are defined as those with larger statistics.
optionsFurther options.
Returns
Vector of sorted and unique indices for the chosen genes. All indices are guaranteed to be non-negative and less than n.