(
adata: &IMAnnData,
groupby: &str,
reference: Option<&str>,
groups: Option<&[&str]>,
method: TestMethod,
n_genes: usize,
correction_method: CorrectionMethod,
compute_l
| 349 | |
| 350 | #[allow(clippy::too_many_arguments)] |
| 351 | fn compute_rank_gene_groups( |
| 352 | adata: &IMAnnData, |
| 353 | groupby: &str, |
| 354 | reference: Option<&str>, |
| 355 | groups: Option<&[&str]>, |
| 356 | method: TestMethod, |
| 357 | n_genes: usize, |
| 358 | correction_method: CorrectionMethod, |
| 359 | compute_lfc: bool, |
| 360 | pseudocount: f64, |
| 361 | ) -> anyhow::Result<RankGeneGroupsComputed> { |
| 362 | let all_groups = get_unique_groups(adata, groupby)?; |
| 363 | let groups_to_test = filter_groups_to_test(&all_groups, groups)?; |
| 364 | let reference_group = resolve_reference_group(&all_groups, reference)?; |
| 365 | |
| 366 | let var_names = adata.var_names(); |
| 367 | |
| 368 | let x = adata.x(); |
| 369 | let read_guard = x.0.read_inner(); |
| 370 | let data = read_guard.deref(); |
| 371 | |
| 372 | let correction_method_owned = correction_method; |
| 373 | |
| 374 | let results = match data { |
| 375 | ArrayData::CsrMatrix(matrix) => match matrix { |
| 376 | DynCsrMatrix::F32(csr_matrix) => run_differential_expression( |
| 377 | adata, |
| 378 | csr_matrix, |
| 379 | &groups_to_test, |
| 380 | &reference_group, |
| 381 | groupby, |
| 382 | method, |
| 383 | correction_method_owned.clone(), |
| 384 | compute_lfc, |
| 385 | pseudocount, |
| 386 | n_genes, |
| 387 | &var_names, |
| 388 | )?, |
| 389 | DynCsrMatrix::F64(csr_matrix) => run_differential_expression( |
| 390 | adata, |
| 391 | csr_matrix, |
| 392 | &groups_to_test, |
| 393 | &reference_group, |
| 394 | groupby, |
| 395 | method, |
| 396 | correction_method_owned, |
| 397 | compute_lfc, |
| 398 | pseudocount, |
| 399 | n_genes, |
| 400 | &var_names, |
| 401 | )?, |
| 402 | _ => { |
| 403 | return Err(anyhow::anyhow!( |
| 404 | "Unsupported matrix data type. Only F32 and F64 CSR matrices are supported." |
| 405 | )); |
| 406 | } |
| 407 | }, |
| 408 | other => unimplemented!( |
no test coverage detected