1#ifndef SINGLEPP_CLASSIFY_SINGLE_HPP
2#define SINGLEPP_CLASSIFY_SINGLE_HPP
6#include "tatami/tatami.hpp"
8#include "annotate_cells_single.hpp"
26template<
typename Float_ = DefaultFloat>
64template<
typename Label_ = DefaultLabel,
typename Float_ = DefaultFloat>
131template<
typename Value_,
typename Index_,
typename Float_,
typename Label_>
133 const tatami::Matrix<Value_, Index_>& test,
139 throw std::runtime_error(
"number of rows in 'test' is not the same as that used to build 'trained'");
141 internal::annotate_cells_single(
144 trained.get_references(),
172template<
typename Value_,
typename Index_,
typename Float_,
typename Label_>
174 const tatami::Matrix<Value_, Index_>& test,
180 throw std::runtime_error(
"number of rows in 'test' is not the same as that used to build 'trained'");
182 internal::annotate_cells_single(
185 trained.get_references(),
202template<
typename Label_ = DefaultLabel,
typename Float_ = DefaultFloat>
208 scores.reserve(num_labels);
209 for (
decltype(num_labels) l = 0; l < num_labels; ++l) {
210 scores.emplace_back(num_cells);
228 std::vector<std::vector<Float_> >
scores;
242template<
typename Label_,
typename Float_>
248 for (
auto& s : results.
scores) {
249 output.
scores.emplace_back(s.data());
274template<
typename Label_ = DefaultLabel,
typename Value_,
typename Index_,
typename Float_>
276 const tatami::Matrix<Value_, Index_>& test,
281 auto buffers = internal::results_to_buffers(output);
301template<
typename Label_ = DefaultLabel,
typename Value_,
typename Index_,
typename Float_>
303 const tatami::Matrix<Value_, Index_>& test,
308 auto buffers = internal::results_to_buffers(output);
Classifier built from an intersection of genes.
Definition train_single.hpp:218
Index_ get_test_nrow() const
Definition train_single.hpp:250
const Markers< Index_ > & get_markers() const
Definition train_single.hpp:260
const std::vector< Index_ > & get_test_subset() const
Definition train_single.hpp:269
Classifier trained from a single reference.
Definition train_single.hpp:89
const std::vector< Index_ > & get_subset() const
Definition train_single.hpp:136
Index_ get_test_nrow() const
Definition train_single.hpp:118
const Markers< Index_ > & get_markers() const
Definition train_single.hpp:128
Common definitions for singlepp.
Cell type classification using the SingleR algorithm in C++.
Definition classify_single.hpp:20
void classify_single_intersect(const tatami::Matrix< Value_, Index_ > &test, const TrainedSingleIntersect< Index_, Float_ > &trained, const ClassifySingleBuffers< Label_, Float_ > &buffers, const ClassifySingleOptions< Float_ > &options)
Definition classify_single.hpp:173
void classify_single(const tatami::Matrix< Value_, Index_ > &test, const TrainedSingle< Index_, Float_ > &trained, const ClassifySingleBuffers< Label_, Float_ > &buffers, const ClassifySingleOptions< Float_ > &options)
Implements the SingleR algorithm for automated annotation of single-cell RNA-seq data.
Definition classify_single.hpp:132
Output buffers for classify_single().
Definition classify_single.hpp:65
Float_ * delta
Definition classify_single.hpp:85
Label_ * best
Definition classify_single.hpp:70
std::vector< Float_ * > scores
Definition classify_single.hpp:78
Options for classify_single() and friends.
Definition classify_single.hpp:27
bool fine_tune
Definition classify_single.hpp:50
Float_ fine_tune_threshold
Definition classify_single.hpp:44
int num_threads
Definition classify_single.hpp:56
Float_ quantile
Definition classify_single.hpp:35
Results of classify_single() and classify_single_intersect().
Definition classify_single.hpp:203
std::vector< Float_ > delta
Definition classify_single.hpp:234
std::vector< Label_ > best
Definition classify_single.hpp:221
std::vector< std::vector< Float_ > > scores
Definition classify_single.hpp:228
Train a classifier from a single reference.