Skip to content

Commit

Permalink
fix: Move signed_pi_value columns to the end (again) (#117)
Browse files Browse the repository at this point in the history
- Undo my overwriting of the position of the signed_pi_cols
- Small bug fixes

---------

Co-authored-by: Addimator <adpri100hhu.de>
  • Loading branch information
Addimator authored Sep 20, 2024
1 parent 1ccc3fa commit ac4a73b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 21 deletions.
24 changes: 14 additions & 10 deletions workflow/resources/datavzrd/diffexp-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ views:
display-mode: hidden
regex('qval_.+'):
display-mode: hidden
regex('signed_pi_value_.+'):
?f"regex('signed_pi_value_{params.primary_variable}.+')":
display-mode: normal
plot:
heatmap:
Expand All @@ -147,8 +147,9 @@ views:
- -1
- 0
- 1
regex('^b_(?!.*_se$)'):
display-mode: normal
?f"regex('signed_pi_value_(?!{params.primary_variable})')":
display-mode: hidden # Hide all signed pi cols that are not associated to the primary variable
?f"regex('^b_(?!.*_se$)')":
plot:
heatmap:
scale: linear
Expand All @@ -157,9 +158,9 @@ views:
- "white"
- "#6baed6"
domain:
- -1
- -10
- 0
- 1
- 10
regex('^b_.*_se$'):
display-mode: hidden
?for sample in params.samples:
Expand Down Expand Up @@ -242,7 +243,7 @@ views:
display-mode: hidden
regex('qval_.+'):
display-mode: hidden
regex('signed_pi_value_.+'):
?f"regex('signed_pi_value_{params.primary_variable}.+')":
display-mode: normal
plot:
heatmap:
Expand All @@ -255,8 +256,9 @@ views:
- -1
- 0
- 1
regex('b_.*(?<!_se(?!part2))'):
display-mode: normal
?f"regex('signed_pi_value_(?!{params.primary_variable})')":
display-mode: hidden # Hide all signed pi cols that are not associated to the primary variable
?f"regex('^b_(?!.*_se$)')":
plot:
heatmap:
scale: linear
Expand All @@ -265,9 +267,11 @@ views:
- "white"
- "#6baed6"
domain:
- -1
- -10
- 0
- 1
- 10
regex('^b_.*_se$'):
display-mode: hidden
?for sample in params.samples:
?sample:
display-mode: hidden
Expand Down
2 changes: 1 addition & 1 deletion workflow/resources/datavzrd/go-enrichment-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ views:
}
}
spec-path: ?input.vega_bars
vega-controls: true
vega-controls: false
p_uncorrected:
label: p-value
plot:
Expand Down
7 changes: 5 additions & 2 deletions workflow/resources/datavzrd/spia-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ views:
}
}
spec-path: ?input.vega_circle
vega-controls: true
vega-controls: false
p-value for at least NDE genes:
display-mode: detail
total perturbation accumulation:
Expand All @@ -70,7 +70,10 @@ views:
- "#B2182B"
- "#F7F7F7"
- "#2166AC"
domain-mid: 0
domain:
- -100
- 0
- 100
p-value to observe a total accumulation:
display-mode: detail
Combined p-value:
Expand Down
2 changes: 1 addition & 1 deletion workflow/scripts/compare_enrichment.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def plot(df, effect_x, effect_y, title, xlabel, ylabel):
)
)

point_selector = alt.selection_single(fields=["term"], empty="all")
point_selector = alt.selection_single(fields=["term"], empty=False)
text_background = (
alt.Chart(df)
.mark_text(
Expand Down
10 changes: 5 additions & 5 deletions workflow/scripts/compare_pathways.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def prepare(df):

alt.data_transformers.disable_max_rows()
points = (
alt.Chart(df)
alt.Chart(combined_pd)
.mark_circle(size=15, tooltip={"content": "data"})
.encode(
alt.X(
Expand All @@ -102,8 +102,8 @@ def prepare(df):
)
)

min_value = min(df[effect_x].min(), df[effect_y].min())
max_value = max(df[effect_x].max(), df[effect_y].max())
min_value = min(combined_pd[effect_x].min(), combined_pd[effect_y].min())
max_value = max(combined_pd[effect_x].max(), combined_pd[effect_y].max())

line = (
alt.Chart(
Expand Down Expand Up @@ -140,7 +140,7 @@ def prepare(df):
)

text_background = (
alt.Chart(df)
alt.Chart(combined_pd)
.mark_text(
align="left",
baseline="middle",
Expand All @@ -158,7 +158,7 @@ def prepare(df):
)

text = (
alt.Chart(df)
alt.Chart(combined_pd)
.mark_text(
align="left",
baseline="middle",
Expand Down
9 changes: 7 additions & 2 deletions workflow/scripts/postprocess_diffexp.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ def sort_columns(df, matching_columns):
for prefix in matching_columns
for suffix in ["_lower", "", "_upper", "_se"]
]
other_columns = [col for col in df.columns if not col.startswith("b_")]
return df[other_columns + b_column_order]
signed_pi_columns = [col for col in df.columns if col.startswith("signed_pi_value")]
other_columns = [
col
for col in df.columns
if not col.startswith("b_") and not col.startswith("signed_pi_value")
]
return df[other_columns + b_column_order + signed_pi_columns]


def sort_rows(df):
Expand Down

0 comments on commit ac4a73b

Please sign in to comment.