Skip to content

Commit 609ed41

Browse files
committed
updating decoupler dependency
1 parent 653b35f commit 609ed41

5 files changed

Lines changed: 64 additions & 4 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ MigrationBackup/
397397
FodyWeavers.xsd
398398

399399
# VS Code files for those working on multiple tools
400+
.vscode
400401
.vscode/*
401402
!.vscode/settings.json
402403
!.vscode/tasks.json

src/intratalkerpy/tf/get_condition_significant.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,45 @@ def condition_comparison_significant(tf_activities, out_path, celltype, conditio
6161
g = g.cat.set_categories([vs1, vs2])
6262

6363
#finding markers for the condition comparison
64-
res_tmp = dc.rank_sources_groups(comparison_sub, groupby= condition, reference="rest", method="t-test")
64+
res_tmp_new_format = dc.tl.rankby_group(comparison_sub, groupby= condition, reference="rest", method="t-test")
65+
res_tmp = (
66+
res_tmp_new_format.rename(
67+
columns={
68+
"name": "names",
69+
"stat": "statistic",
70+
"pval": "pvals",
71+
"padj": "pvals_adj",
72+
}
73+
)
74+
.astype(
75+
{
76+
"group": str,
77+
"reference": str,
78+
"names": str,
79+
}
80+
)
81+
)
6582
res_tmp.rename(columns={"group": "condition", "statistic" : "scores"}, inplace=True)
6683

6784
#calculating wilcoxon scores to use for r value calculation (used in heatmaps)
68-
res_heatmap = dc.rank_sources_groups(comparison_sub, groupby= condition, reference="rest", method="wilcoxon")
85+
res_heatmap_new_format = dc.tl.rankby_group(comparison_sub, groupby= condition, reference="rest", method="wilcoxon")
86+
res_heatmap = (
87+
res_heatmap_new_format.rename(
88+
columns={
89+
"name": "names",
90+
"stat": "statistic",
91+
"pval": "pvals",
92+
"padj": "pvals_adj",
93+
}
94+
)
95+
.astype(
96+
{
97+
"group": str,
98+
"reference": str,
99+
"names": str,
100+
}
101+
)
102+
)
69103
res_heatmap.rename(columns={"group": "condition", "statistic" : "scores"}, inplace=True)
70104

71105
#subsetting into both conditions to calculate r value

src/intratalkerpy/tf/get_significant_TFs.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,24 @@ def get_significant_tfs(tf_activities_sub, condition, out_path, tf_condition_sig
5656
number_of_clusters = (len(tf_activities_sub.obs[celltype].unique()))
5757

5858
#get marker TFs for single condition
59-
anndataobject_markers = dc.rank_sources_groups(tf_activities_sub, groupby= celltype, reference="rest", method="t-test")
59+
anndataobject_markers_new_format = dc.tl.rankby_group(tf_activities_sub, groupby= celltype, reference="rest", method="t-test")
60+
anndataobject_markers = (
61+
anndataobject_markers_new_format.rename(
62+
columns={
63+
"name": "names",
64+
"stat": "statistic",
65+
"pval": "pvals",
66+
"padj": "pvals_adj",
67+
}
68+
)
69+
.astype(
70+
{
71+
"group": str,
72+
"reference": str,
73+
"names": str,
74+
}
75+
)
76+
)
6077
anndataobject_markers.rename(columns={"names" : "gene", "group": "cluster", "statistic" : "scores"}, inplace=True)
6178

6279
anndataobject_markers["tag"] = None

src/intratalkerpy/tf/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def map_t_value(tf_scores_df, anndataobject_markers):
7373
'''
7474
Description:
7575
-------------
76-
Merges the significant gene output from the dc.rank_sources_groups function with the t value/tf score from the filtered and summarized decoupler tf activity dataframe.
76+
Merges the significant gene output from the dc.tl.rankby_group function with the t value/tf score from the filtered and summarized decoupler tf activity dataframe.
7777
7878
Parameters:
7979
-----------

tests/test_package_smoke.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ def test_public_modules_import_and_expose_expected_api():
1414
assert hasattr(perturbation, "pl")
1515

1616

17+
def test_external_dependency_functions_are_callable():
18+
import decoupler as dc
19+
from coldelta import colDeltaCorpartial
20+
21+
assert callable(dc.tl.rankby_group)
22+
assert callable(colDeltaCorpartial)
23+
24+
1725
def test_transcription_factor_reference_data_is_packaged():
1826
data_files = [
1927
"rtf_db_human.csv",

0 commit comments

Comments
 (0)