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>
65template<
typename Label_ = DefaultLabel,
typename Float_ = DefaultFloat>
132template<
typename Value_,
typename Index_,
typename Float_,
typename Label_>
134 const tatami::Matrix<Value_, Index_>& test,
139 if (trained.
test_nrow() != test.nrow()) {
140 throw std::runtime_error(
"number of rows in 'test' is not the same as that used to build 'trained'");
142 annotate_cells_single(
160template<
typename Label_ = DefaultLabel,
typename Float_ = DefaultFloat>
166 best(sanisizer::cast<I<
decltype(
best.size())> >(num_cells)),
167 delta(sanisizer::cast<I<
decltype(
delta.size())> >(num_cells))
169 scores.reserve(num_labels);
170 for (I<
decltype(num_labels)> l = 0; l < num_labels; ++l) {
171 scores.emplace_back(num_cells);
189 std::vector<std::vector<Float_> >
scores;
213template<
typename Label_ = DefaultLabel,
typename Value_,
typename Index_,
typename Float_>
215 const tatami::Matrix<Value_, Index_>& test,
225 for (
auto& s : output.
scores) {
226 buffers.
scores.emplace_back(s.data());
Classifier trained from a single reference.
Definition train_single.hpp:85
Index_ test_nrow() const
Definition train_single.hpp:115
std::size_t num_labels() const
Definition train_single.hpp:141
Common definitions for singlepp.
Cell type classification using the SingleR algorithm in C++.
Definition classify_single.hpp:20
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:133
Output buffers for classify_single().
Definition classify_single.hpp:66
Float_ * delta
Definition classify_single.hpp:86
Label_ * best
Definition classify_single.hpp:71
std::vector< Float_ * > scores
Definition classify_single.hpp:79
Options for classify_single() and friends.
Definition classify_single.hpp:27
bool fine_tune
Definition classify_single.hpp:51
Float_ fine_tune_threshold
Definition classify_single.hpp:45
int num_threads
Definition classify_single.hpp:57
Float_ quantile
Definition classify_single.hpp:36
Results of classify_single() and classify_single().
Definition classify_single.hpp:161
std::vector< Float_ > delta
Definition classify_single.hpp:195
std::vector< Label_ > best
Definition classify_single.hpp:182
std::vector< std::vector< Float_ > > scores
Definition classify_single.hpp:189
Train a classifier from a single reference.