MCPcopy Index your code
hub / github.com/SingleRust/SingleRust / test_mann_whitney_method

Function test_mann_whitney_method

src/memory/processing/diffexp/mod.rs:1236–1276  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1234
1235 #[test]
1236 fn test_mann_whitney_method() -> anyhow::Result<()> {
1237 let adata = create_test_anndata()?;
1238
1239 rank_gene_groups(
1240 &adata,
1241 "group",
1242 Some("rest"),
1243 Some(&["A"]),
1244 Some("mann_whitney_test"),
1245 Some(TestMethod::MannWhitney),
1246 Some(5),
1247 CorrectionMethod::Bonferroni,
1248 Some(true),
1249 Some(0.5),
1250 )?;
1251
1252 let uns = adata.uns();
1253 let scores = uns.get_data("rank_genes_groups_mann_whitney_test_scores")?;
1254 let _pvals = uns.get_data("rank_genes_groups_mann_whitney_test_pvals")?;
1255 let method_param = uns.get_data("rank_genes_groups_mann_whitney_test_params_method")?;
1256
1257 let method_data = method_param.get_data()?;
1258 match method_data {
1259 Data::Scalar(scalar) => match scalar {
1260 DynScalar::String(s) => {
1261 assert!(s.contains("MannWhitney"));
1262 }
1263 _ => panic!("Expected string scalar for method parameter"),
1264 },
1265 _ => panic!("Expected scalar data for method parameter"),
1266 }
1267
1268 match scores.get_data()? {
1269 Data::ArrayData(ArrayData::DataFrame(df)) => {
1270 assert_eq!(df.height(), 5, "Should return exactly 5 genes");
1271 }
1272 _ => panic!("Expected DataFrame for scores"),
1273 }
1274
1275 Ok(())
1276 }
1277
1278 #[test]
1279 fn test_multiple_groups() -> anyhow::Result<()> {

Callers

nothing calls this directly

Calls 2

create_test_anndataFunction · 0.85
rank_gene_groupsFunction · 0.85

Tested by

no test coverage detected