1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! DIALOGUE over in-memory metacells.
//!
//! A shim, not a second implementation. Everything DIALOGUE asks of the
//! expression matrix is per-gene, so the streaming core in
//! [crate::single_cell::sc_analysis::dialogue] runs unchanged once the metacell
//! matrix is wrapped in an [InMemorySparseReader].
//!
//! The only thing to keep in mind is what a "cell" means here. Metacells are
//! already aggregates, so the sample a metacell belongs to has to be
//! unambiguous: build them within samples, not across them. The random
//! intercept in stage two is over samples, and a metacell straddling two of
//! them has no well-defined level.
use MatRef;
use crate*;
use crateas_csc;
use crate;
use crateInMemorySparseReader;
/// Runs DIALOGUE on metacells held in memory.
///
/// ### Params
///
/// * `matrix` - Metacell counts, shape (metacells, genes). Raw counts in
/// `data`, normalised counts in `data_2`. Either orientation is accepted.
/// * `cell_type_indices` - Metacell indices per cell type
/// * `features` - Dense metacell-level features per cell type,
/// `n_metacells_in_type x k_i`, rows aligned to `cell_type_indices`
/// * `sample_ids` - Sample level code per metacell
/// * `cell_quality` - Quality covariate per metacell
/// * `genes` - Genes to consider when building signatures
/// * `params` - See [DialogueParams]
/// * `verbose` - `0` silent, non-zero prints progress
///
/// ### Returns
///
/// The [DialogueResult], or the first error encountered.