diff --git a/docs/classify__single_8hpp_source.html b/docs/classify__single_8hpp_source.html index dd3b80b..2d0023f 100644 --- a/docs/classify__single_8hpp_source.html +++ b/docs/classify__single_8hpp_source.html @@ -140,114 +140,112 @@
136{
137 internal::annotate_cells_single(
138 test,
-
139 trained.get_subset().size(),
-
140 trained.get_subset().data(),
-
141 trained.get_references(),
-
142 trained.get_markers(),
-
143 options.quantile,
-
144 options.fine_tune,
-
145 options.fine_tune_threshold,
-
146 buffers.best,
-
147 buffers.scores,
-
148 buffers.delta,
-
149 options.num_threads
-
150 );
-
151}
+
139 trained.get_subset(),
+
140 trained.get_references(),
+
141 trained.get_markers(),
+
142 options.quantile,
+
143 options.fine_tune,
+
144 options.fine_tune_threshold,
+
145 buffers.best,
+
146 buffers.scores,
+
147 buffers.delta,
+
148 options.num_threads
+
149 );
+
150}
-
152
-
169template<typename Value_, typename Index_, typename Float_, typename Label_>
-
-
170void classify_single_intersect(
-
171 const tatami::Matrix<Value_, Index_>& test,
-
172 const TrainedSingleIntersect<Index_, Float_>& trained,
-
173 const ClassifySingleBuffers<Label_, Float_>& buffers,
-
174 const ClassifySingleOptions<Float_>& options)
-
175{
-
176 internal::annotate_cells_single(
-
177 test,
-
178 trained.get_test_subset().size(),
-
179 trained.get_test_subset().data(),
-
180 trained.get_references(),
-
181 trained.get_markers(),
-
182 options.quantile,
-
183 options.fine_tune,
-
184 options.fine_tune_threshold,
-
185 buffers.best,
-
186 buffers.scores,
-
187 buffers.delta,
-
188 options.num_threads
-
189 );
-
190}
+
151
+
168template<typename Value_, typename Index_, typename Float_, typename Label_>
+
+ +
170 const tatami::Matrix<Value_, Index_>& test,
+ + + +
174{
+
175 internal::annotate_cells_single(
+
176 test,
+
177 trained.get_test_subset(),
+
178 trained.get_references(),
+
179 trained.get_markers(),
+
180 options.quantile,
+
181 options.fine_tune,
+
182 options.fine_tune_threshold,
+
183 buffers.best,
+
184 buffers.scores,
+
185 buffers.delta,
+
186 options.num_threads
+
187 );
+
188}
-
191
-
197template<typename Label_ = DefaultLabel, typename Float_ = DefaultFloat>
-
- -
202 ClassifySingleResults(size_t num_cells, size_t num_labels) : best(num_cells), delta(num_cells) {
-
203 scores.reserve(num_labels);
-
204 for (size_t l = 0; l < num_labels; ++l) {
-
205 scores.emplace_back(num_cells);
-
206 }
-
207 }
-
216 std::vector<Label_> best;
-
217
-
223 std::vector<std::vector<Float_> > scores;
-
224
-
229 std::vector<Float_> delta;
-
230};
+
189
+
195template<typename Label_ = DefaultLabel, typename Float_ = DefaultFloat>
+
+ +
200 ClassifySingleResults(size_t num_cells, size_t num_labels) : best(num_cells), delta(num_cells) {
+
201 scores.reserve(num_labels);
+
202 for (size_t l = 0; l < num_labels; ++l) {
+
203 scores.emplace_back(num_cells);
+
204 }
+
205 }
+
214 std::vector<Label_> best;
+
215
+
221 std::vector<std::vector<Float_> > scores;
+
222
+
227 std::vector<Float_> delta;
+
228};
-
231
-
235namespace internal {
-
236
-
237template<typename Label_, typename Float_>
- - -
240 output.best = results.best.data();
-
241 output.delta = results.delta.data();
-
242 output.scores.reserve(results.scores.size());
-
243 for (auto& s : results.scores) {
-
244 output.scores.emplace_back(s.data());
-
245 }
-
246 return output;
+
229
+
233namespace internal {
+
234
+
235template<typename Label_, typename Float_>
+ + +
238 output.best = results.best.data();
+
239 output.delta = results.delta.data();
+
240 output.scores.reserve(results.scores.size());
+
241 for (auto& s : results.scores) {
+
242 output.scores.emplace_back(s.data());
+
243 }
+
244 return output;
+
245}
+
246
247}
-
248
-
249}
-
269template<typename Label_ = DefaultLabel, typename Value_, typename Index_, typename Float_>
-
- -
271 const tatami::Matrix<Value_, Index_>& test,
- - -
274{
-
275 ClassifySingleResults<Label_, Float_> output(test.ncol(), trained.get_references().size());
-
276 auto buffers = internal::results_to_buffers(output);
- -
278 return output;
-
279}
+
267template<typename Label_ = DefaultLabel, typename Value_, typename Index_, typename Float_>
+
+ +
269 const tatami::Matrix<Value_, Index_>& test,
+ + +
272{
+
273 ClassifySingleResults<Label_, Float_> output(test.ncol(), trained.get_references().size());
+
274 auto buffers = internal::results_to_buffers(output);
+ +
276 return output;
+
277}
-
280
-
296template<typename Label_ = DefaultLabel, typename Value_, typename Index_, typename Float_>
-
- -
298 const tatami::Matrix<Value_, Index_>& test,
- - -
301{
-
302 ClassifySingleResults<Label_, Float_> output(test.ncol(), trained.get_references().size());
-
303 auto buffers = internal::results_to_buffers(output);
- -
305 return output;
+
278
+
294template<typename Label_ = DefaultLabel, typename Value_, typename Index_, typename Float_>
+
+ +
296 const tatami::Matrix<Value_, Index_>& test,
+ + +
299{
+
300 ClassifySingleResults<Label_, Float_> output(test.ncol(), trained.get_references().size());
+
301 auto buffers = internal::results_to_buffers(output);
+ +
303 return output;
+
304}
+
+
305
306}
307
-
308}
-
-
309
-
310#endif
+
308#endif
Common definitions for singlepp.
Cell type classification using the SingleR algorithm in C++.
Definition classify_single.hpp:19
std::vector< std::vector< std::vector< Index_ > > > Markers
Definition Markers.hpp:40
-
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:170
+
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:169
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:131
Output buffers for classify_single().
Definition classify_single.hpp:64
Float_ * delta
Definition classify_single.hpp:84
@@ -258,10 +256,10 @@
Float_ fine_tune_threshold
Definition classify_single.hpp:43
int num_threads
Definition classify_single.hpp:55
Float_ quantile
Definition classify_single.hpp:34
-
Results of classify_single() and classify_single_intersect().
Definition classify_single.hpp:198
-
std::vector< Float_ > delta
Definition classify_single.hpp:229
-
std::vector< Label_ > best
Definition classify_single.hpp:216
-
std::vector< std::vector< Float_ > > scores
Definition classify_single.hpp:223
+
Results of classify_single() and classify_single_intersect().
Definition classify_single.hpp:196
+
std::vector< Float_ > delta
Definition classify_single.hpp:227
+
std::vector< Label_ > best
Definition classify_single.hpp:214
+
std::vector< std::vector< Float_ > > scores
Definition classify_single.hpp:221
Train a classifier from a single reference.
diff --git a/docs/index.html b/docs/index.html index 71435af..8ee153d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -157,7 +157,7 @@

Intersecting feature sets

trained_intersect,
class_opt
);
-
singlepp::classify_single_intersect
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:170
+
singlepp::classify_single_intersect
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:169

The gene identifiers can be anything that can be hashed and compared. These are most commonly std::strings but can also be integers (e.g., for Entrez IDs).

Integrating results across references

To combine results from multiple references, we first need to perform classification within each reference. Let's say we have two references A and B: