diff --git a/docs/annotated.html b/docs/annotated.html index 2fe4b09..2bbe049 100644 --- a/docs/annotated.html +++ b/docs/annotated.html @@ -87,21 +87,28 @@  Nchoose_filter_thresholdsDefine QC filter thresholds using a MAD-based approach  COptionsOptions for compute()  CResultsResults of compute() - Nfind_median_madCalculate the median and MAD from an array of values - COptionsOptions for find_median_mad::compute() - CResultsContainer for the median and MAD - CWorkspaceTemporary data structures for compute_blocked() - Nper_cell_qc_metricsCompute per-cell quality control metrics - CBuffersBuffers for direct storage of the calculated statistics - COptionsOptions for compute() - CResultsResult store for QC metric calculations - Nrna_quality_controlSimple per-cell QC metrics from an RNA count matrix - CBlockedFiltersFilter for high-quality cells using RNA-based metrics with blocking - CFiltersFilter for high-quality cells using RNA-based metrics - CFiltersOptionsOptions for Filters() - CMetricsBuffersBuffers for direct storage of the calculated statistics - CMetricsOptionsOptions for compute_metrics() - CMetricsResultsResults of the QC metric calculations + Ncrispr_quality_controlSimple per-cell QC metrics from a CRISPR count matrix + CBlockedFiltersFilter for high-quality cells using CRISPR-based metrics with blocking + CFiltersFilter for high-quality cells using CRISPR-based metrics + CFiltersOptionsOptions for Filters() + CMetricsBuffersBuffers for direct storage of the calculated statistics + CMetricsOptionsOptions for compute_metrics() + CMetricsResultsResults of the QC metric calculations + Nfind_median_madCalculate the median and MAD from an array of values + COptionsOptions for find_median_mad::compute() + CResultsContainer for the median and MAD + CWorkspaceTemporary data structures for compute_blocked() + Nper_cell_qc_metricsCompute per-cell quality control metrics + CBuffersBuffers for direct storage of the calculated statistics + COptionsOptions for compute() + CResultsResult store for QC metric calculations + Nrna_quality_controlSimple per-cell QC metrics from an RNA count matrix + CBlockedFiltersFilter for high-quality cells using RNA-based metrics with blocking + CFiltersFilter for high-quality cells using RNA-based metrics + CFiltersOptionsOptions for Filters() + CMetricsBuffersBuffers for direct storage of the calculated statistics + CMetricsOptionsOptions for compute_metrics() + CMetricsResultsResults of the QC metric calculations diff --git a/docs/choose__filter__thresholds_8hpp.html b/docs/choose__filter__thresholds_8hpp.html index 035fcf1..8a651d9 100644 --- a/docs/choose__filter__thresholds_8hpp.html +++ b/docs/choose__filter__thresholds_8hpp.html @@ -119,11 +119,13 @@
- - - - - + + + + + + +
diff --git a/docs/choose__filter__thresholds_8hpp__dep__incl.map b/docs/choose__filter__thresholds_8hpp__dep__incl.map index c932d87..eb407f0 100644 --- a/docs/choose__filter__thresholds_8hpp__dep__incl.map +++ b/docs/choose__filter__thresholds_8hpp__dep__incl.map @@ -1,7 +1,9 @@ - - - - - + + + + + + + diff --git a/docs/choose__filter__thresholds_8hpp__dep__incl.md5 b/docs/choose__filter__thresholds_8hpp__dep__incl.md5 index 2f92b5a..475285c 100644 --- a/docs/choose__filter__thresholds_8hpp__dep__incl.md5 +++ b/docs/choose__filter__thresholds_8hpp__dep__incl.md5 @@ -1 +1 @@ -7810543eaff2a1a437a5e9f131f93b50 \ No newline at end of file +bcc69480c3a3ce723cdbfa72ff482a45 \ No newline at end of file diff --git a/docs/choose__filter__thresholds_8hpp__dep__incl.png b/docs/choose__filter__thresholds_8hpp__dep__incl.png index 2d3269c..e251591 100644 Binary files a/docs/choose__filter__thresholds_8hpp__dep__incl.png and b/docs/choose__filter__thresholds_8hpp__dep__incl.png differ diff --git a/docs/classes.html b/docs/classes.html index 1da7927..431b851 100644 --- a/docs/classes.html +++ b/docs/classes.html @@ -78,13 +78,13 @@
B
-
BlockedFilters (scran::adt_quality_control)
BlockedFilters (scran::rna_quality_control)
Buffers (scran::per_cell_qc_metrics)
+
BlockedFilters (scran::adt_quality_control)
BlockedFilters (scran::crispr_quality_control)
BlockedFilters (scran::rna_quality_control)
Buffers (scran::per_cell_qc_metrics)
F
-
Filters (scran::adt_quality_control)
Filters (scran::rna_quality_control)
FiltersOptions (scran::adt_quality_control)
FiltersOptions (scran::rna_quality_control)
+
Filters (scran::adt_quality_control)
Filters (scran::crispr_quality_control)
Filters (scran::rna_quality_control)
FiltersOptions (scran::adt_quality_control)
FiltersOptions (scran::crispr_quality_control)
FiltersOptions (scran::rna_quality_control)
M
-
MetricsBuffers (scran::adt_quality_control)
MetricsBuffers (scran::rna_quality_control)
MetricsOptions (scran::adt_quality_control)
MetricsOptions (scran::rna_quality_control)
MetricsResults (scran::adt_quality_control)
MetricsResults (scran::rna_quality_control)
+
MetricsBuffers (scran::adt_quality_control)
MetricsBuffers (scran::crispr_quality_control)
MetricsBuffers (scran::rna_quality_control)
MetricsOptions (scran::adt_quality_control)
MetricsOptions (scran::crispr_quality_control)
MetricsOptions (scran::rna_quality_control)
MetricsResults (scran::adt_quality_control)
MetricsResults (scran::crispr_quality_control)
MetricsResults (scran::rna_quality_control)
O
Options (scran::choose_filter_thresholds)
Options (scran::find_median_mad)
Options (scran::per_cell_qc_metrics)
diff --git a/docs/classscran_1_1crispr__quality__control_1_1BlockedFilters-members.html b/docs/classscran_1_1crispr__quality__control_1_1BlockedFilters-members.html new file mode 100644 index 0000000..fb08c91 --- /dev/null +++ b/docs/classscran_1_1crispr__quality__control_1_1BlockedFilters-members.html @@ -0,0 +1,96 @@ + + + + + + + +scran_quality_control: Member List + + + + + + + + + + +
+
+ + + + + + +
+
scran_quality_control +
+
Compute simple per-cell quality control metrics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
scran::crispr_quality_control::BlockedFilters< Float_ > Member List
+
+
+ +

This is the complete list of members for scran::crispr_quality_control::BlockedFilters< Float_ >, including all inherited members.

+ + + + + + + +
BlockedFilters()=defaultscran::crispr_quality_control::BlockedFilters< Float_ >
filter(size_t num, const MetricsBuffers< Sum_, Detected_, Value_, Index_ > &metrics, const Block_ *block, Output_ *output) constscran::crispr_quality_control::BlockedFilters< Float_ >inline
filter(const MetricsResults< Sum_, Detected_, Value_, Index_ > &metrics, const Block_ *block, Output_ *output) constscran::crispr_quality_control::BlockedFilters< Float_ >inline
filter(const MetricsResults< Sum_, Detected_, Value_, Index_ > &metrics, const Block_ *block) constscran::crispr_quality_control::BlockedFilters< Float_ >inline
get_max_value() constscran::crispr_quality_control::BlockedFilters< Float_ >inline
get_max_value()scran::crispr_quality_control::BlockedFilters< Float_ >inline
+ + + + diff --git a/docs/classscran_1_1crispr__quality__control_1_1BlockedFilters.html b/docs/classscran_1_1crispr__quality__control_1_1BlockedFilters.html new file mode 100644 index 0000000..c4ae159 --- /dev/null +++ b/docs/classscran_1_1crispr__quality__control_1_1BlockedFilters.html @@ -0,0 +1,408 @@ + + + + + + + +scran_quality_control: scran::crispr_quality_control::BlockedFilters< Float_ > Class Template Reference + + + + + + + + + + +
+
+ + + + + + +
+
scran_quality_control +
+
Compute simple per-cell quality control metrics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+ +
scran::crispr_quality_control::BlockedFilters< Float_ > Class Template Reference
+
+
+ +

Filter for high-quality cells using CRISPR-based metrics with blocking. + More...

+ +

#include <crispr_quality_control.hpp>

+ + + + + + + + + + + + + + + + + +

+Public Member Functions

 BlockedFilters ()=default
 
const std::vector< Float_ > & get_max_value () const
 
std::vector< Float_ > & get_max_value ()
 
template<typename Sum_ , typename Detected_ , typename Value_ , typename Index_ , typename Block_ , typename Output_ >
void filter (size_t num, const MetricsBuffers< Sum_, Detected_, Value_, Index_ > &metrics, const Block_ *block, Output_ *output) const
 
template<typename Sum_ , typename Detected_ , typename Value_ , typename Index_ , typename Block_ , typename Output_ >
void filter (const MetricsResults< Sum_, Detected_, Value_, Index_ > &metrics, const Block_ *block, Output_ *output) const
 
template<typename Output_ = uint8_t, typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int, typename Block_ = int>
std::vector< Output_ > filter (const MetricsResults< Sum_, Detected_, Value_, Index_ > &metrics, const Block_ *block) const
 
+

Detailed Description

+
template<typename Float_ = double>
+class scran::crispr_quality_control::BlockedFilters< Float_ >

Filter for high-quality cells using CRISPR-based metrics with blocking.

+
Template Parameters
+ + +
Float_Floating-point type for filter thresholds.
+
+
+

Constructor & Destructor Documentation

+ +

◆ BlockedFilters()

+ +
+
+
+template<typename Float_ = double>
+ + + + + +
+ + + + + + + +
scran::crispr_quality_control::BlockedFilters< Float_ >::BlockedFilters ()
+
+default
+
+

Default constructor.

+ +
+
+

Member Function Documentation

+ +

◆ get_max_value() [1/2]

+ +
+
+
+template<typename Float_ = double>
+ + + + + +
+ + + + + + + +
const std::vector< Float_ > & scran::crispr_quality_control::BlockedFilters< Float_ >::get_max_value () const
+
+inline
+
+
Returns
Vector of length equal to the number of blocks, containing the lower threshold on the maximum count in each block.
+ +
+
+ +

◆ get_max_value() [2/2]

+ +
+
+
+template<typename Float_ = double>
+ + + + + +
+ + + + + + + +
std::vector< Float_ > & scran::crispr_quality_control::BlockedFilters< Float_ >::get_max_value ()
+
+inline
+
+
Returns
Vector of length equal to the number of blocks, containing the lower threshold on the maximum count in each block.
+ +
+
+ +

◆ filter() [1/3]

+ +
+
+
+template<typename Float_ = double>
+
+template<typename Sum_ , typename Detected_ , typename Value_ , typename Index_ , typename Block_ , typename Output_ >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void scran::crispr_quality_control::BlockedFilters< Float_ >::filter (size_t num,
const MetricsBuffers< Sum_, Detected_, Value_, Index_ > & metrics,
const Block_ * block,
Output_ * output 
) const
+
+inline
+
+
Template Parameters
+ + + + + + + +
Sum_Numeric type to store the summed expression.
Detected_Integer type to store the number of cells.
Value_Type of matrix value.
Index_Type of the matrix indices.
Block_Integer type for the block assignment.
Output_Boolean type to store the high quality flags.
+
+
+
Parameters
+ + + + + +
numNumber of cells.
metricsA collection of arrays containing CRISPR-based QC metrics, filled by compute_metrics().
[in]blockPointer to an array of length num containing block identifiers. Each identifier should correspond to the same blocks used in the constructor.
[out]outputPointer to an array of length num. On output, this is truthy for cells considered to be of high quality, and false otherwise.
+
+
+ +
+
+ +

◆ filter() [2/3]

+ +
+
+
+template<typename Float_ = double>
+
+template<typename Sum_ , typename Detected_ , typename Value_ , typename Index_ , typename Block_ , typename Output_ >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
void scran::crispr_quality_control::BlockedFilters< Float_ >::filter (const MetricsResults< Sum_, Detected_, Value_, Index_ > & metrics,
const Block_ * block,
Output_ * output 
) const
+
+inline
+
+
Template Parameters
+ + + + + + + +
Sum_Numeric type to store the summed expression.
Detected_Integer type to store the number of cells.
Value_Type of matrix value.
Index_Type of the matrix indices.
Block_Integer type for the block assignment.
Output_Boolean type to store the high quality flags.
+
+
+
Parameters
+ + + + +
metricsCRISPR-based QC metrics computed by compute_metrics().
[in]blockPointer to an array of length num containing block identifiers. Each identifier should correspond to the same blocks used in the constructor.
[out]outputPointer to an array of length num. On output, this is truthy for cells considered to be of high quality, and false otherwise.
+
+
+ +
+
+ +

◆ filter() [3/3]

+ +
+
+
+template<typename Float_ = double>
+
+template<typename Output_ = uint8_t, typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int, typename Block_ = int>
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
std::vector< Output_ > scran::crispr_quality_control::BlockedFilters< Float_ >::filter (const MetricsResults< Sum_, Detected_, Value_, Index_ > & metrics,
const Block_ * block 
) const
+
+inline
+
+
Template Parameters
+ + + + + + + +
Output_Boolean type to store the high quality flags.
Sum_Numeric type to store the summed expression.
Detected_Integer type to store the number of cells.
Value_Type of matrix value.
Index_Type of the matrix indices.
Block_Integer type for the block assignment.
+
+
+
Parameters
+ + + +
metricsCRISPR-based QC metrics computed by compute_metrics().
[in]blockPointer to an array of length num containing block identifiers. Each identifier should correspond to the same blocks used in the constructor.
+
+
+
Returns
Vector of length num, containing the high-quality calls.
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/docs/classscran_1_1crispr__quality__control_1_1Filters-members.html b/docs/classscran_1_1crispr__quality__control_1_1Filters-members.html new file mode 100644 index 0000000..5be6a0b --- /dev/null +++ b/docs/classscran_1_1crispr__quality__control_1_1Filters-members.html @@ -0,0 +1,96 @@ + + + + + + + +scran_quality_control: Member List + + + + + + + + + + +
+
+ + + + + + +
+
scran_quality_control +
+
Compute simple per-cell quality control metrics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
scran::crispr_quality_control::Filters< Float_ > Member List
+
+
+ +

This is the complete list of members for scran::crispr_quality_control::Filters< Float_ >, including all inherited members.

+ + + + + + + +
filter(size_t num, const MetricsBuffers< Sum_, Detected_, Value_, Index_ > &metrics, Output_ *output) constscran::crispr_quality_control::Filters< Float_ >inline
filter(const MetricsResults< Sum_, Detected_, Value_, Index_ > &metrics, Output_ *output) constscran::crispr_quality_control::Filters< Float_ >inline
filter(const MetricsResults< Sum_, Detected_, Value_, Index_ > &metrics) constscran::crispr_quality_control::Filters< Float_ >inline
Filters()=defaultscran::crispr_quality_control::Filters< Float_ >
get_max_value() constscran::crispr_quality_control::Filters< Float_ >inline
get_max_value()scran::crispr_quality_control::Filters< Float_ >inline
+ + + + diff --git a/docs/classscran_1_1crispr__quality__control_1_1Filters.html b/docs/classscran_1_1crispr__quality__control_1_1Filters.html new file mode 100644 index 0000000..c64af60 --- /dev/null +++ b/docs/classscran_1_1crispr__quality__control_1_1Filters.html @@ -0,0 +1,380 @@ + + + + + + + +scran_quality_control: scran::crispr_quality_control::Filters< Float_ > Class Template Reference + + + + + + + + + + +
+
+ + + + + + +
+
scran_quality_control +
+
Compute simple per-cell quality control metrics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+ +
scran::crispr_quality_control::Filters< Float_ > Class Template Reference
+
+
+ +

Filter for high-quality cells using CRISPR-based metrics. + More...

+ +

#include <crispr_quality_control.hpp>

+ + + + + + + + + + + + + + + + + +

+Public Member Functions

 Filters ()=default
 
Float_ get_max_value () const
 
Float_ & get_max_value ()
 
template<typename Sum_ , typename Detected_ , typename Value_ , typename Index_ , typename Output_ >
void filter (size_t num, const MetricsBuffers< Sum_, Detected_, Value_, Index_ > &metrics, Output_ *output) const
 
template<typename Sum_ , typename Detected_ , typename Value_ , typename Index_ , typename Output_ >
void filter (const MetricsResults< Sum_, Detected_, Value_, Index_ > &metrics, Output_ *output) const
 
template<typename Output_ = uint8_t, typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int>
std::vector< Output_ > filter (const MetricsResults< Sum_, Detected_, Value_, Index_ > &metrics) const
 
+

Detailed Description

+
template<typename Float_ = double>
+class scran::crispr_quality_control::Filters< Float_ >

Filter for high-quality cells using CRISPR-based metrics.

+
Template Parameters
+ + +
Float_Floating-point type for filter thresholds.
+
+
+

Constructor & Destructor Documentation

+ +

◆ Filters()

+ +
+
+
+template<typename Float_ = double>
+ + + + + +
+ + + + + + + +
scran::crispr_quality_control::Filters< Float_ >::Filters ()
+
+default
+
+

Default constructor.

+ +
+
+

Member Function Documentation

+ +

◆ get_max_value() [1/2]

+ +
+
+
+template<typename Float_ = double>
+ + + + + +
+ + + + + + + +
Float_ scran::crispr_quality_control::Filters< Float_ >::get_max_value () const
+
+inline
+
+
Returns
Lower threshold to apply to the maximum count.
+ +
+
+ +

◆ get_max_value() [2/2]

+ +
+
+
+template<typename Float_ = double>
+ + + + + +
+ + + + + + + +
Float_ & scran::crispr_quality_control::Filters< Float_ >::get_max_value ()
+
+inline
+
+
Returns
Lower threshold to apply to the maximum count.
+ +
+
+ +

◆ filter() [1/3]

+ +
+
+
+template<typename Float_ = double>
+
+template<typename Sum_ , typename Detected_ , typename Value_ , typename Index_ , typename Output_ >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
void scran::crispr_quality_control::Filters< Float_ >::filter (size_t num,
const MetricsBuffers< Sum_, Detected_, Value_, Index_ > & metrics,
Output_ * output 
) const
+
+inline
+
+
Template Parameters
+ + + + + + +
Sum_Numeric type to store the summed expression.
Detected_Integer type to store the number of cells.
Value_Type of matrix value.
Index_Type of the matrix indices.
Output_Boolean type to store the high quality flags.
+
+
+
Parameters
+ + + + +
numNumber of cells.
metricsA collection of arrays containing CRISPR-based QC metrics, filled by compute_metrics().
[out]outputPointer to an array of length num. On output, this is truthy for cells considered to be of high quality, and false otherwise.
+
+
+ +
+
+ +

◆ filter() [2/3]

+ +
+
+
+template<typename Float_ = double>
+
+template<typename Sum_ , typename Detected_ , typename Value_ , typename Index_ , typename Output_ >
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
void scran::crispr_quality_control::Filters< Float_ >::filter (const MetricsResults< Sum_, Detected_, Value_, Index_ > & metrics,
Output_ * output 
) const
+
+inline
+
+
Template Parameters
+ + + + + + +
Sum_Numeric type to store the summed expression.
Detected_Integer type to store the number of cells.
Value_Type of matrix value.
Index_Type of the matrix indices.
Output_Boolean type to store the high quality flags.
+
+
+
Parameters
+ + + +
metricsCRISPR-based QC metrics returned by compute_metrics().
[out]outputPointer to an array of length num. On output, this is truthy for cells considered to be of high quality, and false otherwise.
+
+
+ +
+
+ +

◆ filter() [3/3]

+ +
+
+
+template<typename Float_ = double>
+
+template<typename Output_ = uint8_t, typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int>
+ + + + + +
+ + + + + + + + +
std::vector< Output_ > scran::crispr_quality_control::Filters< Float_ >::filter (const MetricsResults< Sum_, Detected_, Value_, Index_ > & metrics) const
+
+inline
+
+
Template Parameters
+ + + + + + +
Output_Boolean type to store the high quality flags.
Sum_Numeric type to store the summed expression.
Detected_Integer type to store the number of cells.
Value_Type of matrix value.
Index_Type of the matrix indices.
+
+
+
Parameters
+ + +
metricsCRISPR-based QC metrics returned by compute_metrics().
+
+
+
Returns
Vector of length num, containing the high-quality calls.
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/docs/crispr__quality__control_8hpp.html b/docs/crispr__quality__control_8hpp.html new file mode 100644 index 0000000..d0379b4 --- /dev/null +++ b/docs/crispr__quality__control_8hpp.html @@ -0,0 +1,201 @@ + + + + + + + +scran_quality_control: scran/crispr_quality_control.hpp File Reference + + + + + + + + + + +
+
+ + + + + + +
+
scran_quality_control +
+
Compute simple per-cell quality control metrics
+
+
+ + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+ +
crispr_quality_control.hpp File Reference
+
+
+ +

Simple per-cell QC metrics from a CRISPR count matrix. +More...

+
#include <vector>
+#include <limits>
+#include <algorithm>
+#include <type_traits>
+#include "tatami/tatami.hpp"
+#include "find_median_mad.hpp"
+#include "per_cell_qc_metrics.hpp"
+#include "choose_filter_thresholds.hpp"
+
+Include dependency graph for crispr_quality_control.hpp:
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + + + +

+Classes

struct  scran::crispr_quality_control::MetricsOptions
 Options for compute_metrics(). More...
 
struct  scran::crispr_quality_control::MetricsBuffers< Sum_, Detected_, Value_, Index_ >
 Buffers for direct storage of the calculated statistics. More...
 
struct  scran::crispr_quality_control::MetricsResults< Sum_, Detected_, Value_, Index_ >
 Results of the QC metric calculations. More...
 
struct  scran::crispr_quality_control::FiltersOptions
 Options for Filters(). More...
 
class  scran::crispr_quality_control::Filters< Float_ >
 Filter for high-quality cells using CRISPR-based metrics. More...
 
class  scran::crispr_quality_control::BlockedFilters< Float_ >
 Filter for high-quality cells using CRISPR-based metrics with blocking. More...
 
+ + + + + + + +

+Namespaces

namespace  scran
 Methods for single-cell analysis.
 
namespace  scran::crispr_quality_control
 Simple per-cell QC metrics from a CRISPR count matrix.
 
+ + + + + + + + + + + + + + + + + + + +

+Functions

template<typename Value_ , typename Index_ , typename Sum_ , typename Detected_ >
void scran::crispr_quality_control::compute_metrics (const tatami::Matrix< Value_, Index_ > *mat, MetricsBuffers< Sum_, Detected_, Value_, Index_ > &output, const MetricsOptions &options)
 
template<typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int>
MetricsResults< Sum_, Detected_, Value_, Index_ > scran::crispr_quality_control::compute_metrics (const tatami::Matrix< Value_, Index_ > *mat, const MetricsOptions &options)
 
template<typename Float_ = double, typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int>
Filters< Float_ > scran::crispr_quality_control::compute_filters (size_t num, const MetricsBuffers< Sum_, Detected_, Value_, Index_ > &metrics, const FiltersOptions &options)
 
template<typename Float_ = double, typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int>
Filters< Float_ > scran::crispr_quality_control::compute_filters (const MetricsResults< Sum_, Detected_, Value_, Index_ > &metrics, const FiltersOptions &options)
 
template<typename Float_ = double, typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int, typename Block_ = int>
BlockedFilters< Float_ > scran::crispr_quality_control::compute_filters_blocked (size_t num, const MetricsBuffers< Sum_, Detected_, Value_, Index_ > &metrics, const Block_ *block, const FiltersOptions &options)
 
template<typename Float_ = double, typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int, typename Block_ = int>
BlockedFilters< Float_ > scran::crispr_quality_control::compute_filters_blocked (const MetricsResults< Sum_, Detected_, Value_, Index_ > &metrics, const Block_ *block, const FiltersOptions &options)
 
+

Detailed Description

+

Simple per-cell QC metrics from a CRISPR count matrix.

+
+ + + + diff --git a/docs/crispr__quality__control_8hpp__incl.map b/docs/crispr__quality__control_8hpp__incl.map new file mode 100644 index 0000000..4ea6468 --- /dev/null +++ b/docs/crispr__quality__control_8hpp__incl.map @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/crispr__quality__control_8hpp__incl.md5 b/docs/crispr__quality__control_8hpp__incl.md5 new file mode 100644 index 0000000..fa1d606 --- /dev/null +++ b/docs/crispr__quality__control_8hpp__incl.md5 @@ -0,0 +1 @@ +eddc95a16d3c46fc2ef1e65a4ea4949f \ No newline at end of file diff --git a/docs/crispr__quality__control_8hpp__incl.png b/docs/crispr__quality__control_8hpp__incl.png new file mode 100644 index 0000000..4e977f5 Binary files /dev/null and b/docs/crispr__quality__control_8hpp__incl.png differ diff --git a/docs/crispr__quality__control_8hpp_source.html b/docs/crispr__quality__control_8hpp_source.html new file mode 100644 index 0000000..60f5821 --- /dev/null +++ b/docs/crispr__quality__control_8hpp_source.html @@ -0,0 +1,464 @@ + + + + + + + +scran_quality_control: scran/crispr_quality_control.hpp Source File + + + + + + + + + + +
+
+ + + + + + +
+
scran_quality_control +
+
Compute simple per-cell quality control metrics
+
+
+ + + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
crispr_quality_control.hpp
+
+
+Go to the documentation of this file.
1#ifndef SCRAN_CRISPR_QUALITY_CONTROL_HPP
+
2#define SCRAN_CRISPR_QUALITY_CONTROL_HPP
+
3
+
4#include <vector>
+
5#include <limits>
+
6#include <algorithm>
+
7#include <type_traits>
+
8
+
9#include "tatami/tatami.hpp"
+
10
+
11#include "find_median_mad.hpp"
+ + +
14
+
21namespace scran {
+
22
+
61namespace crispr_quality_control {
+
62
+
+ +
70 int num_threads = 1;
+
71};
+
+
72
+
80template<typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int>
+
+ +
86 Sum_* sum = NULL;
+
87
+
92 Detected_* detected = NULL;
+
93
+
98 Value_* max_value = NULL;
+
99
+
104 Index_* max_index = NULL;
+
105};
+
+
106
+
120template<typename Value_, typename Index_, typename Sum_, typename Detected_>
+
+ + +
123 tmp.sum = output.sum;
+
124 tmp.detected = output.detected;
+
125 tmp.max_value = output.max_value;
+
126 tmp.max_index = output.max_index;
+
127
+ +
129 opt.num_threads = options.num_threads;
+
130 per_cell_qc_metrics::compute(mat, std::vector<uint8_t*>{}, tmp, opt);
+
131}
+
+
132
+
142template<typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int>
+
+ +
147 MetricsResults() = default;
+
155 std::vector<Sum_> sum;
+
156
+
160 std::vector<Detected_> detected;
+
161
+
165 std::vector<Value_> max_value;
+
166
+
170 std::vector<Index_> max_index;
+
171};
+
+
172
+
189template<typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int>
+
+ +
191 auto NC = mat->ncol();
+ + +
194
+
195 output.sum.resize(NC);
+
196 x.sum = output.sum.data();
+
197
+
198 output.detected.resize(NC);
+
199 x.detected = output.detected.data();
+
200
+
201 output.max_value.resize(NC);
+
202 x.max_value = output.max_value.data();
+
203
+
204 output.max_index.resize(NC);
+
205 x.max_index = output.max_index.data();
+
206
+
207 compute_metrics(mat, x, options);
+
208 return output;
+
209}
+
+
210
+
+ + +
220};
+
+
221
+
225namespace internal {
+
226
+
227template<typename Float_, class Host_, typename Sum_, typename Detected_, typename Value_, typename Index_, typename BlockSource_>
+
228void populate(Host_& host, size_t n, const MetricsBuffers<Sum_, Detected_, Value_, Index_>& res, BlockSource_ block, const FiltersOptions& options) {
+
229 constexpr bool unblocked = std::is_same<BlockSource_, bool>::value;
+
230 auto buffer = [&]() {
+
231 if constexpr(unblocked) {
+
232 return std::vector<Float_>(n);
+
233 } else {
+ +
235 }
+
236 }();
+
237
+
238 // Subsetting to the observations in the top 50% of proportions.
+
239 static_assert(std::is_floating_point<Float_>::value);
+
240 std::vector<Float_> maxprop;
+
241 maxprop.reserve(n);
+
242 for (size_t i = 0; i < n; ++i) {
+
243 maxprop.push_back(static_cast<Float_>(res.max_value[i]) / static_cast<Float_>(res.sum[i]));
+
244 }
+
245
+ +
247 fopt.median_only = true;
+
248 auto prop_res = [&]() {
+
249 if constexpr(unblocked) {
+
250 return find_median_mad::compute(n, maxprop.data(), buffer.data(), fopt);
+
251 } else {
+
252 return find_median_mad::compute_blocked(n, maxprop.data(), block, &buffer, fopt);
+
253 }
+
254 }();
+
255
+
256 for (size_t i = 0; i < n; ++i) {
+
257 auto limit = [&]() {
+
258 if constexpr(unblocked){
+
259 return prop_res.median;
+
260 } else {
+
261 return prop_res[block[i]].median;
+
262 }
+
263 }();
+
264 if (maxprop[i] >= limit) {
+
265 maxprop[i] = res.max_value[i];
+
266 } else {
+
267 maxprop[i] = std::numeric_limits<Float_>::quiet_NaN(); // ignored during threshold calculation.
+
268 }
+
269 }
+
270
+
271 // Filtering on the max counts.
+ +
273 copt.num_mads = options.max_value_num_mads;
+
274 copt.log = true;
+
275 copt.upper = false;
+
276 host.get_max_value() = [&]() {
+
277 if constexpr(unblocked) {
+
278 return choose_filter_thresholds::compute(n, maxprop.data(), buffer.data(), copt).lower;
+
279 } else {
+
280 return choose_filter_thresholds::internal::strip<true>(choose_filter_thresholds::compute_blocked(n, maxprop.data(), block, &buffer, copt));
+
281 }
+
282 }();
+
283}
+
284
+
285template<class Host_, typename Sum_, typename Detected_, typename Value_, typename Index_, typename BlockSource_, typename Output_>
+
286void filter(const Host_& host, size_t n, const MetricsBuffers<Sum_, Detected_, Value_, Index_>& metrics, BlockSource_ block, Output_* output) {
+
287 constexpr bool unblocked = std::is_same<BlockSource_, bool>::value;
+
288 std::fill_n(output, n, 1);
+
289
+
290 for (size_t i = 0; i < n; ++i) {
+
291 auto thresh = [&]() {
+
292 if constexpr(unblocked) {
+
293 return host.get_max_value();
+
294 } else {
+
295 return host.get_max_value()[block[i]];
+
296 }
+
297 }();
+
298 output[i] = output[i] && (metrics.max_value[i] >= thresh);
+
299 }
+
300}
+
301
+
302template<typename Sum_, typename Detected_, typename Value_, typename Index_>
+
303MetricsBuffers<const Sum_, const Detected_, const Value_, const Index_> to_buffer(const MetricsResults<Sum_, Detected_, Value_, Index_>& metrics) {
+
304 MetricsBuffers<const Sum_, const Detected_, const Value_, const Index_> buffer;
+
305 buffer.sum = metrics.sum.data();
+
306 buffer.detected = metrics.detected.data();
+
307 buffer.max_value = metrics.max_value.data();
+
308 buffer.max_index = metrics.max_index.data();
+
309 return buffer;
+
310}
+
311
+
312}
+
321template<typename Float_ = double>
+
+
322class Filters {
+
323public:
+
327 Filters() = default;
+
328
+
329public:
+
+
333 Float_ get_max_value() const {
+
334 return my_max_value;
+
335 }
+
+
336
+
+
340 Float_& get_max_value() {
+
341 return my_max_value;
+
342 }
+
+
343
+
344private:
+
345 Float_ my_max_value = 0;
+
346
+
347public:
+
360 template<typename Sum_, typename Detected_, typename Value_, typename Index_, typename Output_>
+
+
361 void filter(size_t num, const MetricsBuffers<Sum_, Detected_, Value_, Index_>& metrics, Output_* output) const {
+
362 internal::filter(*this, num, metrics, false, output);
+
363 }
+
+
364
+
376 template<typename Sum_, typename Detected_, typename Value_, typename Index_, typename Output_>
+
+
377 void filter(const MetricsResults<Sum_, Detected_, Value_, Index_>& metrics, Output_* output) const {
+
378 return filter(metrics.max_value.size(), internal::to_buffer(metrics), output);
+
379 }
+
+
380
+
391 template<typename Output_ = uint8_t, typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int>
+
+
392 std::vector<Output_> filter(const MetricsResults<Sum_, Detected_, Value_, Index_>& metrics) const {
+
393 std::vector<Output_> output(metrics.max_value.size());
+
394 filter(metrics, output.data());
+
395 return output;
+
396 }
+
+
397};
+
+
398
+
413template<typename Float_ = double, typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int>
+
+ +
415 Filters<Float_> output;
+
416 internal::populate<Float_>(output, num, metrics, false, options);
+
417 return output;
+
418}
+
+
419
+
433template<typename Float_ = double, typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int>
+
+ +
435 return compute_filters(metrics.max_value.size(), internal::to_buffer(metrics), options);
+
436}
+
+
437
+
442template<typename Float_ = double>
+
+ +
444public:
+
448 BlockedFilters() = default;
+
449
+
450public:
+
+
455 const std::vector<Float_>& get_max_value() const {
+
456 return my_max_value;
+
457 }
+
+
458
+
+
463 std::vector<Float_>& get_max_value() {
+
464 return my_max_value;
+
465 }
+
+
466
+
467private:
+
468 std::vector<Float_> my_sum;
+
469 std::vector<Float_> my_max_value;
+
470 std::vector<std::vector<Float_> > my_subset_sum;
+
471
+
472public:
+
488 template<typename Sum_, typename Detected_, typename Value_, typename Index_, typename Block_, typename Output_>
+
+
489 void filter(size_t num, const MetricsBuffers<Sum_, Detected_, Value_, Index_>& metrics, const Block_* block, Output_* output) const {
+
490 internal::filter(*this, num, metrics, block, output);
+
491 }
+
+
492
+
507 template<typename Sum_, typename Detected_, typename Value_, typename Index_, typename Block_, typename Output_>
+
+
508 void filter(const MetricsResults<Sum_, Detected_, Value_, Index_>& metrics, const Block_* block, Output_* output) const {
+
509 filter(metrics.max_value.size(), internal::to_buffer(metrics), block, output);
+
510 }
+
+
511
+
526 template<typename Output_ = uint8_t, typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int, typename Block_ = int>
+
+
527 std::vector<Output_> filter(const MetricsResults<Sum_, Detected_, Value_, Index_>& metrics, const Block_* block) const {
+
528 std::vector<Output_> output(metrics.max_value.size());
+
529 filter(metrics, block, output.data());
+
530 return output;
+
531 }
+
+
532};
+
+
533
+
549template<typename Float_ = double, typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int, typename Block_ = int>
+
+ + +
552 internal::populate<Float_>(output, num, metrics, block, options);
+
553 return output;
+
554}
+
+
555
+
570template<typename Float_ = double, typename Sum_ = double, typename Detected_ = int, typename Value_ = double, typename Index_ = int, typename Block_ = int>
+
+ +
572 return compute_filters_blocked(metrics.max_value.size(), internal::to_buffer(metrics), block, options);
+
573}
+
+
574
+
575}
+
576
+
577}
+
578
+
579#endif
+
Define QC filter thresholds using a MAD-based approach.
+
Filter for high-quality cells using CRISPR-based metrics with blocking.
Definition crispr_quality_control.hpp:443
+
std::vector< Float_ > & get_max_value()
Definition crispr_quality_control.hpp:463
+ +
const std::vector< Float_ > & get_max_value() const
Definition crispr_quality_control.hpp:455
+
std::vector< Output_ > filter(const MetricsResults< Sum_, Detected_, Value_, Index_ > &metrics, const Block_ *block) const
Definition crispr_quality_control.hpp:527
+
void filter(const MetricsResults< Sum_, Detected_, Value_, Index_ > &metrics, const Block_ *block, Output_ *output) const
Definition crispr_quality_control.hpp:508
+
void filter(size_t num, const MetricsBuffers< Sum_, Detected_, Value_, Index_ > &metrics, const Block_ *block, Output_ *output) const
Definition crispr_quality_control.hpp:489
+
Filter for high-quality cells using CRISPR-based metrics.
Definition crispr_quality_control.hpp:322
+
Float_ get_max_value() const
Definition crispr_quality_control.hpp:333
+
void filter(const MetricsResults< Sum_, Detected_, Value_, Index_ > &metrics, Output_ *output) const
Definition crispr_quality_control.hpp:377
+
Float_ & get_max_value()
Definition crispr_quality_control.hpp:340
+ +
std::vector< Output_ > filter(const MetricsResults< Sum_, Detected_, Value_, Index_ > &metrics) const
Definition crispr_quality_control.hpp:392
+
void filter(size_t num, const MetricsBuffers< Sum_, Detected_, Value_, Index_ > &metrics, Output_ *output) const
Definition crispr_quality_control.hpp:361
+
Temporary data structures for compute_blocked().
Definition find_median_mad.hpp:177
+ +
virtual Index_ ncol() const=0
+
Compute the median and MAD from an array of values.
+
Filters< Float_ > compute_filters(size_t num, const MetricsBuffers< Sum_, Detected_, Value_, Index_ > &metrics, const FiltersOptions &options)
Definition crispr_quality_control.hpp:414
+
BlockedFilters< Float_ > compute_filters_blocked(size_t num, const MetricsBuffers< Sum_, Detected_, Value_, Index_ > &metrics, const Block_ *block, const FiltersOptions &options)
Definition crispr_quality_control.hpp:550
+
void compute_metrics(const tatami::Matrix< Value_, Index_ > *mat, MetricsBuffers< Sum_, Detected_, Value_, Index_ > &output, const MetricsOptions &options)
Definition crispr_quality_control.hpp:121
+
void compute(const tatami::Matrix< Value_, Index_ > *mat, const std::vector< Subset_ > &subsets, Buffers< Sum_, Detected_, Value_, Index_ > &output, const Options &options)
Definition per_cell_qc_metrics.hpp:794
+
Methods for single-cell analysis.
Definition adt_quality_control.hpp:21
+
Compute per-cell quality control metrics.
+
Options for compute().
Definition choose_filter_thresholds.hpp:37
+
bool log
Definition choose_filter_thresholds.hpp:68
+
bool upper
Definition choose_filter_thresholds.hpp:48
+
double num_mads
Definition choose_filter_thresholds.hpp:55
+
Options for Filters().
Definition crispr_quality_control.hpp:214
+
double max_value_num_mads
Definition crispr_quality_control.hpp:219
+
Buffers for direct storage of the calculated statistics.
Definition crispr_quality_control.hpp:81
+
Index_ * max_index
Definition crispr_quality_control.hpp:104
+
Sum_ * sum
Definition crispr_quality_control.hpp:86
+
Value_ * max_value
Definition crispr_quality_control.hpp:98
+
Detected_ * detected
Definition crispr_quality_control.hpp:92
+
Options for compute_metrics().
Definition crispr_quality_control.hpp:66
+
int num_threads
Definition crispr_quality_control.hpp:70
+
Results of the QC metric calculations.
Definition crispr_quality_control.hpp:143
+
std::vector< Index_ > max_index
Definition crispr_quality_control.hpp:170
+
std::vector< Detected_ > detected
Definition crispr_quality_control.hpp:160
+
std::vector< Value_ > max_value
Definition crispr_quality_control.hpp:165
+
std::vector< Sum_ > sum
Definition crispr_quality_control.hpp:155
+
Options for find_median_mad::compute().
Definition find_median_mad.hpp:32
+
bool median_only
Definition find_median_mad.hpp:44
+
Buffers for direct storage of the calculated statistics.
Definition per_cell_qc_metrics.hpp:98
+
Detected_ * detected
Definition per_cell_qc_metrics.hpp:119
+
Index_ * max_index
Definition per_cell_qc_metrics.hpp:125
+
Sum_ * sum
Definition per_cell_qc_metrics.hpp:113
+
Value_ * max_value
Definition per_cell_qc_metrics.hpp:131
+
Options for compute().
Definition per_cell_qc_metrics.hpp:46
+
int num_threads
Definition per_cell_qc_metrics.hpp:86
+ +
+ + + + diff --git a/docs/dir_bdabb9492db2368b3caf0f4c1df6a160.html b/docs/dir_bdabb9492db2368b3caf0f4c1df6a160.html index 3e7d762..970bcbb 100644 --- a/docs/dir_bdabb9492db2368b3caf0f4c1df6a160.html +++ b/docs/dir_bdabb9492db2368b3caf0f4c1df6a160.html @@ -87,6 +87,9 @@  choose_filter_thresholds.hpp  Define QC filter thresholds using a MAD-based approach.
  + crispr_quality_control.hpp + Simple per-cell QC metrics from a CRISPR count matrix.
 find_median_mad.hpp  Compute the median and MAD from an array of values.
  diff --git a/docs/files.html b/docs/files.html index 1a5dc59..a496803 100644 --- a/docs/files.html +++ b/docs/files.html @@ -79,10 +79,11 @@   scran  adt_quality_control.hppSimple per-cell QC metrics from an ADT count matrix  choose_filter_thresholds.hppDefine QC filter thresholds using a MAD-based approach - find_median_mad.hppCompute the median and MAD from an array of values - per_cell_qc_metrics.hppCompute per-cell quality control metrics - rna_quality_control.hppSimple per-cell QC metrics from an RNA count matrix - scran.hppMethods for single-cell analysis + crispr_quality_control.hppSimple per-cell QC metrics from a CRISPR count matrix + find_median_mad.hppCompute the median and MAD from an array of values + per_cell_qc_metrics.hppCompute per-cell quality control metrics + rna_quality_control.hppSimple per-cell QC metrics from an RNA count matrix + scran.hppMethods for single-cell analysis
diff --git a/docs/find__median__mad_8hpp.html b/docs/find__median__mad_8hpp.html index 1322da1..c541e46 100644 --- a/docs/find__median__mad_8hpp.html +++ b/docs/find__median__mad_8hpp.html @@ -116,15 +116,18 @@
- - - - - - - - - + + + + + + + + + + + +
diff --git a/docs/find__median__mad_8hpp__dep__incl.map b/docs/find__median__mad_8hpp__dep__incl.map index 0a9a59b..2ac2e1f 100644 --- a/docs/find__median__mad_8hpp__dep__incl.map +++ b/docs/find__median__mad_8hpp__dep__incl.map @@ -1,11 +1,14 @@ - - - - - - - - - + + + + + + + + + + + + diff --git a/docs/find__median__mad_8hpp__dep__incl.md5 b/docs/find__median__mad_8hpp__dep__incl.md5 index 4c9f854..22018da 100644 --- a/docs/find__median__mad_8hpp__dep__incl.md5 +++ b/docs/find__median__mad_8hpp__dep__incl.md5 @@ -1 +1 @@ -28faf82396f4dd4422027145be5de534 \ No newline at end of file +4ab3ff3d0d457fafbaba879df4e5b342 \ No newline at end of file diff --git a/docs/find__median__mad_8hpp__dep__incl.png b/docs/find__median__mad_8hpp__dep__incl.png index 4f8fa13..7b44128 100644 Binary files a/docs/find__median__mad_8hpp__dep__incl.png and b/docs/find__median__mad_8hpp__dep__incl.png differ diff --git a/docs/functions.html b/docs/functions.html index 8610375..b5763b4 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -74,7 +74,7 @@
Here is a list of all documented class members with links to the class documentation for each member:

- b -

@@ -89,21 +89,22 @@

- c -