| 187 | /// ``` |
| 188 | #[allow(clippy::too_many_arguments)] |
| 189 | pub fn rank_gene_groups( |
| 190 | adata: &IMAnnData, |
| 191 | groupby: &str, |
| 192 | reference: Option<&str>, |
| 193 | groups: Option<&[&str]>, |
| 194 | key_added: Option<&str>, |
| 195 | method: Option<TestMethod>, |
| 196 | n_genes: Option<usize>, |
| 197 | correction_method: CorrectionMethod, |
| 198 | compute_logfoldchanges: Option<bool>, |
| 199 | pseudocount: Option<f64>, |
| 200 | ) -> anyhow::Result<()> { |
| 201 | let method = method.unwrap_or(TestMethod::TTest(TTestType::Welch)); |
| 202 | let key = key_added.unwrap_or("").to_string(); |
| 203 | let compute_lfc = compute_logfoldchanges.unwrap_or(true); |
| 204 | let pseudocount = pseudocount.unwrap_or(1.0); |
| 205 | let n_genes = n_genes.unwrap_or(adata.n_vars()); |
| 206 | |
| 207 | let computation = compute_rank_gene_groups( |
| 208 | adata, |
| 209 | groupby, |
| 210 | reference, |
| 211 | groups, |
| 212 | method, |
| 213 | n_genes, |
| 214 | correction_method, |
| 215 | compute_lfc, |
| 216 | pseudocount, |
| 217 | )?; |
| 218 | |
| 219 | let RankGeneGroupsComputed { |
| 220 | groups: groups_to_test, |
| 221 | results, |
| 222 | reference, |
| 223 | } = computation; |
| 224 | |
| 225 | store_results( |
| 226 | adata, |
| 227 | &key, |
| 228 | &groups_to_test, |
| 229 | results.scores, |
| 230 | results.pvals, |
| 231 | results.pvals_adj, |
| 232 | results.logfoldchanges, |
| 233 | results.gene_names, |
| 234 | method, |
| 235 | groupby, |
| 236 | reference, |
| 237 | )?; |
| 238 | |
| 239 | Ok(()) |
| 240 | } |
| 241 | |
| 242 | #[allow(clippy::too_many_arguments)] |
| 243 | pub fn rank_gene_groups_dataframe( |