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,
138 if (trained.
test_nrow() != test.nrow()) {
139 throw std::runtime_error(
"number of rows in 'test' is not the same as that used to build 'trained'");
141 annotate_cells_single(
159template<
typename Label_ = DefaultLabel,
typename Float_ = DefaultFloat>
165 scores.reserve(num_labels);
166 for (
decltype(num_labels) l = 0; l < num_labels; ++l) {
167 scores.emplace_back(num_cells);
185 std::vector<std::vector<Float_> >
scores;
209template<
typename Label_ = DefaultLabel,
typename Value_,
typename Index_,
typename Float_>
211 const tatami::Matrix<Value_, Index_>& test,
221 for (
auto& s : output.
scores) {
222 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: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().
Definition classify_single.hpp:160
std::vector< Float_ > delta
Definition classify_single.hpp:191
std::vector< Label_ > best
Definition classify_single.hpp:178
std::vector< std::vector< Float_ > > scores
Definition classify_single.hpp:185
Train a classifier from a single reference.