Skip to content

Commit 515eeda

Browse files
authored
Merge pull request #182 from JuliaS92/split_analysis_plots
create aggregate_cluster_scatter
2 parents 9cddcb7 + cd52f00 commit 515eeda

1 file changed

Lines changed: 31 additions & 10 deletions

File tree

domaps/domaps.py

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3057,17 +3057,16 @@ def plot_intramap_scatter_cluster(
30573057

30583058
return distance_boxplot_figure
30593059

3060-
def plot_intramap_scatter(
3060+
def aggregate_cluster_scatter(
30613061
self,
30623062
normalization=np.median,
30633063
aggregate_proteins=True,
30643064
aggregate_maps=False,
3065-
plot_type="strip",
30663065
min_size=5,
30673066
multi_choice=None,
30683067
clusters_for_ranking=None,
3069-
highlight=None,
30703068
):
3069+
"""Aggregate the cluster distances for ranking"""
30713070
if multi_choice is None:
30723071
multi_choice = self.exp_names
30733072
if clusters_for_ranking is None:
@@ -3128,22 +3127,44 @@ def plot_intramap_scatter(
31283127
columns=["distance"],
31293128
)
31303129

3131-
plotargs = dict(
3132-
x=DataFrameStrings.EXPERIMENT,
3133-
y="distance",
3134-
hover_data=df.index.names,
3135-
template="simple_white",
3136-
)
3137-
31383130
df = df.sort_values("distance", ascending=False).sort_index(
31393131
level=DataFrameStrings.EXPERIMENT,
31403132
key=lambda x: pd.Index(
31413133
[multi_choice.index(el) for el in x], name=DataFrameStrings.EXPERIMENT
31423134
),
31433135
)
31443136

3137+
return df
3138+
3139+
def plot_intramap_scatter(
3140+
self,
3141+
normalization=np.median,
3142+
aggregate_proteins=True,
3143+
aggregate_maps=False,
3144+
plot_type="strip",
3145+
min_size=5,
3146+
multi_choice=None,
3147+
clusters_for_ranking=None,
3148+
highlight=None,
3149+
):
3150+
df = self.aggregate_cluster_scatter(
3151+
normalization=normalization,
3152+
aggregate_proteins=aggregate_proteins,
3153+
aggregate_maps=aggregate_maps,
3154+
min_size=min_size,
3155+
multi_choice=multi_choice,
3156+
clusters_for_ranking=clusters_for_ranking,
3157+
)
3158+
31453159
medians = df.groupby(DataFrameStrings.EXPERIMENT).median()
31463160

3161+
plotargs = dict(
3162+
x=DataFrameStrings.EXPERIMENT,
3163+
y="distance",
3164+
hover_data=df.index.names,
3165+
template="simple_white",
3166+
)
3167+
31473168
df_plot = df.reset_index()
31483169

31493170
if plot_type == "strip":

0 commit comments

Comments
 (0)