MCPcopy Create free account
hub / github.com/SingleRust/SingleRust / process_omnipath_dataframe

Function process_omnipath_dataframe

src/connectors/omnipath.rs:30–64  ·  view source on GitHub ↗
(
    mut df: DataFrame,
    tax_id: Option<&str>,
)

Source from the content-addressed store, hash-verified

28}
29
30fn process_omnipath_dataframe(
31 mut df: DataFrame,
32 tax_id: Option<&str>,
33) -> anyhow::Result<DataFrame> {
34 let df = df.select(["genesymbol", "label", "value", "record_id"])?;
35
36 let mut pivoted = pivot(
37 &df,
38 ["value"],
39 Some(["genesymbol", "record_id"]),
40 Some(["label"]),
41 false,
42 None,
43 None,
44 )?;
45
46 if let Some(org) = tax_id {
47 let p: PlSmallStr = org.into();
48 if pivoted.get_column_names().contains(&&p) {
49 let mask = pivoted.column("ncbi_tax_id")?.str()?.equal(org);
50 pivoted = pivoted.filter(&mask)?;
51 }
52 }
53
54 let cols_to_remove = ["record_id", "entity_type", "_entity_type"];
55 let mut final_df = pivoted;
56
57 for col in cols_to_remove {
58 let c: PlSmallStr = col.into();
59 if final_df.get_column_names().contains(&&c) {
60 final_df = final_df.drop(col)?;
61 }
62 }
63 Ok(final_df)
64}
65
66pub fn construct_network_from_panglaodb(
67 license: &str,

Callers 1

load_resourceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected