1#ifndef SINGLEPP_CLASSIFY_INTEGRATED_HPP
2#define SINGLEPP_CLASSIFY_INTEGRATED_HPP
6#include "tatami/tatami.hpp"
8#include "annotate_cells_integrated.hpp"
13#include <unordered_map>
14#include <unordered_set>
27template<
typename Float_ = DefaultFloat>
59template<
typename RefLabel_ = DefaultRefLabel,
typename Float_ = DefaultFloat>
126template<
typename Value_,
typename Index_,
typename Label_,
typename RefLabel_,
typename Float_>
128 const tatami::Matrix<Value_, Index_>& test,
129 const std::vector<const Label_*>& assigned,
134 if (trained.test_nrow !=
static_cast<Index_
>(-1) && trained.test_nrow != test.nrow()) {
135 throw std::runtime_error(
"number of rows in 'test' is not the same as that used to build 'trained'");
137 internal::annotate_cells_integrated(
156template<
typename RefLabel_ = DefaultRefLabel,
typename Float_ = DefaultFloat>
163 for (
decltype(nrefs) r = 0; r < nrefs; ++r) {
164 scores.emplace_back(ncells);
182 std::vector<std::vector<Float_> >
scores;
205template<
typename RefLabel_ = DefaultRefLabel,
typename Value_,
typename Index_,
typename Label_,
typename Float_>
207 const tatami::Matrix<Value_, Index_>& test,
208 const std::vector<const Label_*>& assigned,
217 for (
auto& s : results.
scores) {
218 buffers.
scores.emplace_back(s.data());
Classifier that integrates multiple reference datasets.
Definition train_integrated.hpp:240
std::size_t num_references() const
Definition train_integrated.hpp:245
Common definitions for singlepp.
Cell type classification using the SingleR algorithm in C++.
Definition classify_single.hpp:20
void classify_integrated(const tatami::Matrix< Value_, Index_ > &test, const std::vector< const Label_ * > &assigned, const TrainedIntegrated< Index_ > &trained, ClassifyIntegratedBuffers< RefLabel_, Float_ > &buffers, const ClassifyIntegratedOptions< Float_ > &options)
Integrate classifications from multiple references.
Definition classify_integrated.hpp:127
Output buffers for classify_single().
Definition classify_integrated.hpp:60
RefLabel_ * best
Definition classify_integrated.hpp:65
Float_ * delta
Definition classify_integrated.hpp:80
std::vector< Float_ * > scores
Definition classify_integrated.hpp:73
Options for classify_integrated().
Definition classify_integrated.hpp:28
bool fine_tune
Definition classify_integrated.hpp:45
int num_threads
Definition classify_integrated.hpp:51
Float_ quantile
Definition classify_integrated.hpp:33
Float_ fine_tune_threshold
Definition classify_integrated.hpp:39
Results of classify_integrated().
Definition classify_integrated.hpp:157
std::vector< std::vector< Float_ > > scores
Definition classify_integrated.hpp:182
std::vector< RefLabel_ > best
Definition classify_integrated.hpp:175
std::vector< Float_ > delta
Definition classify_integrated.hpp:188
Prepare for integrated classification across references.