Skip to content

Commit

Permalink
minor updates to interactive figures
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendan Larsen committed Mar 19, 2024
1 parent 8d8e72e commit c199a4a
Show file tree
Hide file tree
Showing 84 changed files with 2,655 additions and 6,605 deletions.
28 changes: 8 additions & 20 deletions custom_rules.smk
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ rule analyze_nipah_RBP_entry:
"combined_E2_E3_correlation_plots": output.combined_E2_E3_correlation_plots,
"nipah_config": input.nipah_config,
"altair_config": input.altair_config,
#"entropy_file": input.entropy_file,
"entry_region_boxplot_plot": output.entry_region_boxplot_plot,
"surface": input.surface,
"combined_region_barplot_output": output.combined_region_barplot_output,
Expand All @@ -57,19 +56,13 @@ rule analyze_nipah_RBP_entry:
rule analyze_nipah_RBP_binding:
"""Analyze EFNB2 and EFNB3 binding"""
input:
#func_scores_E2_file="results/func_effects/averages/CHO_EFNB2_low_func_effects.csv",
binding_E2_file="results/filtered_data/binding/E2_binding_filtered.csv",
#func_scores_E3_file="results/func_effects/averages/CHO_EFNB3_low_func_effects.csv",
binding_E3_file="results/filtered_data/binding/E3_binding_filtered.csv",
binding_E2_file="results/filtered_data/binding/e2_binding_filtered.csv",
binding_E3_file="results/filtered_data/binding/e3_binding_filtered.csv",
nb="notebooks/ephrin_binding.ipynb",
nipah_config="nipah_config.yaml",
altair_config="data/custom_analyses_data/theme.py",
output:
nb="results/notebooks/ephrin_binding.ipynb",
#filtered_E2_binding_data="results/filtered_data/E2_binding_filtered.csv",
#filtered_E3_binding_data="results/filtered_data/E3_binding_filtered.csv",
#filtered_E2_binding_low_effect="results/filtered_data/E2_binding_low_effect_filter.csv",
#filtered_E3_binding_low_effect="results/filtered_data/E3_binding_low_effect_filter.csv",
entry_binding_combined_corr_plot="results/images/entry_binding_combined_corr_plot.html",
entry_binding_combined_corr_plot_agg="results/images/entry_binding_combined_corr_plot_agg.html",
E2_E3_correlation="results/images/E2_E3_correlation.html",
Expand All @@ -82,21 +75,14 @@ rule analyze_nipah_RBP_binding:
binding_region_bubble_plot="results/images/binding_region_bubble_plot.html",
max_binding_in_contact="results/images/max_binding_in_contact.html",
max_binding_in_stalk="results/images/max_binding_in_stalk.html",
combined_contact_ranked_bar_output='results/images/combined_contact_ranked_bar_output.html',
params:
yaml=lambda _, input, output: yaml.round_trip_dump(
{
"nipah_config": input.nipah_config,
"altair_config": input.altair_config,
"entropy_file": input.entropy_file,
#"func_scores_E2_file": input.func_scores_E2_file,
"binding_E2_file": input.binding_E2_file,
#"func_scores_E3_file": input.func_scores_E3_file,
"binding_E3_file": input.binding_E3_file,

#"filtered_E2_binding_data": output.filtered_E2_binding_data,
#"filtered_E3_binding_data": output.filtered_E3_binding_data,
#"filtered_E2_binding_low_effect": output.filtered_E2_binding_low_effect,
#"filtered_E3_binding_low_effect": output.filtered_E3_binding_low_effect,
"entry_binding_combined_corr_plot": output.entry_binding_combined_corr_plot,
"entry_binding_combined_corr_plot_agg": output.entry_binding_combined_corr_plot_agg,
"E2_E3_correlation": output.E2_E3_correlation,
Expand All @@ -109,6 +95,7 @@ rule analyze_nipah_RBP_binding:
"binding_region_bubble_plot": output.binding_region_bubble_plot,
"max_binding_in_contact": output.max_binding_in_contact,
"max_binding_in_stalk": output.max_binding_in_stalk,
"combined_contact_ranked_bar_output": output.combined_contact_ranked_bar_output,
}
),
log:
Expand Down Expand Up @@ -521,7 +508,7 @@ rule filter_data:
m102_filtered_path="results/filtered_data/escape/m102_escape_filtered.csv",
HENV32_filtered_path="results/filtered_data/escape/HENV32_escape_filtered.csv",
nAH1_filtered_path="results/filtered_data/escape/nAH1_escape_filtered.csv",
#e2_low_mab_effect_filter = 'results/filtered_data/escape/e2_low_mab_effect_filter.csv',
mab_filter_concat_file = 'results/filtered_data/escape/mab_filter_concat.csv',
e3_low_mab_effect_filter = 'results/filtered_data/escape/e3_low_mab_effect_filter.csv'

params:
Expand Down Expand Up @@ -552,8 +539,8 @@ rule filter_data:
"HENV32_filtered_path": output.HENV32_filtered_path,
"m102_filtered_path": output.m102_filtered_path,
"nAH1_filtered_path": output.nAH1_filtered_path,
#"e2_low_mab_effect_filter": output.e2_low_mab_effect_filter,
"e3_low_mab_effect_filter": output.e3_low_mab_effect_filter,
"mab_filter_concat_file": output.mab_filter_concat_file,
}
),
log:
Expand Down Expand Up @@ -629,7 +616,7 @@ rule make_heatmaps:
input:
nb="notebooks/plot_heatmaps.ipynb",
nipah_config="nipah_config.yaml",
altair_config="data/custom_analyses_data/theme.py",
altair_config="data/custom_analyses_data/heatmap_theme.py",
entropy_file="results/entropy/entropy.csv",
func_scores_E2_file="results/filtered_data/entry/e2_entry_filtered.csv",
func_scores_E3_file="results/filtered_data/entry/e3_entry_filtered.csv",
Expand Down Expand Up @@ -817,6 +804,7 @@ docs["Additional files and charts"] = {
"Bubbleplot of binding scores by region": rules.analyze_nipah_RBP_binding.output.binding_region_bubble_plot,
"Max Binding Scores in Contact Site": rules.analyze_nipah_RBP_binding.output.max_binding_in_contact,
"Max Binding Scores in Stalk": rules.analyze_nipah_RBP_binding.output.max_binding_in_stalk,
"Contact ranked sites": rules.analyze_nipah_RBP_binding.output.combined_contact_ranked_bar_output,
"Ephrin neutralization notebook": rules.ephrin_neuts.output.nb,
"Ephrin neutralization curve plot": rules.ephrin_neuts.output.ephrin_curve_plot,
"Ephrin Binding Validation Neut Curves Plots": {
Expand Down
94 changes: 94 additions & 0 deletions data/custom_analyses_data/heatmap_theme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import altair as alt

def heatmap_theme():
# Typography
font = "Helvetica Light"
#labelFont = "Helvetica Light"

# Colors
main_palette = ["#1f4e79", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"]
sequential_palette = ["#c7e9b4", "#7fcdbb", "#41b6c4", "#1d91c0", "#225ea8", "#253494"]

# Axes
axisColor = "#000000"
gridColor = "#DEDDDD"

return {
#"width": 400,
#"height": 400,
"config": {
"background": "transparent",
"title": {
"fontSize": 20,
"fontWeight": 'bold',
"font": font,
"anchor": "start",
"color": "#000000",
"orient": 'top',
"offset": 5,
"subtitleColor": 'gray',
"subtitleFont": font,
"subtitleFontWeight": 'normal',
"subtitleFontSize": 18,
"subtitlePadding": 2,
},
"axis": {
#domain
"domain": True,
"domainColor": axisColor,
"domainWidth": 1,
#grid
"grid": False,
"gridColor": gridColor,
"gridWidth": 0.5,
#label
"labelFont": font,
"labelFontSize": 12,
"labelFlush": False,
"labelFontWeight": 'normal',
"labelPadding": 2,
#"labelAngle": 0,

#ticks
"tickColor": axisColor,
"tickSize": 4,
#"tickCount": 3,
"tickWidth": 1,
#title
"titleFont": font,
"titleAlign": 'center',
"titleFontWeight": 'bold',
"titleFontSize": 14,
"titlePadding": 5,
},
"legend": {
"labelFont": font,
"labelFontSize": 14,
"symbolSize": 100,
"titleFont": font,
"titleFontSize": 14,
"titleFontWeight": 'bold',
"padding": 5,
"titleLimit": 200,
"gradientLength": 100,
},
"range": {
"category": main_palette,
"diverging": sequential_palette,
},
"view": {
"stroke": "transparent", # Remove the border around the visualization
"strokeWidth": 0,
},
"text": {
"font": 'Helvetica Light',
"fontSize": 14,
}
}
}

# Register the custom theme under a chosen name
alt.themes.register('heatmap_theme', heatmap_theme)

# Enable the newly registered theme
alt.themes.enable('heatmap_theme')
79 changes: 36 additions & 43 deletions data/custom_analyses_data/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

def brendan_theme():
# Typography
font = "Helvetica"
labelFont = "Helvetica Light"
sourceFont = "Helvetica"
font = "Helvetica Light"
#labelFont = "Helvetica Light"

# Colors
main_palette = ["#1f4e79", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"]
Expand All @@ -21,55 +20,54 @@ def brendan_theme():
"background": "transparent",
"title": {
"fontSize": 20,
"fontWeight": 'bold',
"font": font,
"anchor": "start",
"color": "#000000",
"orient": 'top',
"offset": 10,
"offset": 5,
"subtitleColor": 'gray',
"subtitleFont": font,
"subtitleFontWeight": 'normal',
"subtitleFontSize": 18,
"subtitlePadding": 2,
},
"axisX": {
"axis": {
#domain
"domain": True,
"domainColor": axisColor,
"domainWidth": 1,
#grid
"grid": False,
"gridColor": gridColor,
"gridWidth": 0.5,
"labelFont": labelFont,
"labelFontSize": 12,
"labelAngle": 0,
#label
"labelFont": font,
"labelFontSize": 14,
"labelFlush": False,
"labelFontWeight": 'normal',
"labelPadding": 2,
#"labelAngle": 0,

#ticks
"tickColor": axisColor,
"tickSize": 4,
"titleFont": font,
"tickCount": 3,
"tickWidth": 1,
"titleFontSize": 14,
"titlePadding": 5,
},
"axisY": {
"domain": True,
"domainColor": axisColor,
"domainWidth": 1,
"grid": False,
"gridColor": gridColor,
"gridWidth": 0.5,
"labelFont": labelFont,
"labelFontSize": 12,
"labelAngle": 0,
"tickColor": axisColor,
"tickSize": 4,
"tickCount": 3,
#"tickCount": 3,
"tickWidth": 1,
#title
"titleFont": font,
"titleFontSize":14,
"titleAlign": 'center',
"titleFontWeight": 'bold',
"titleFontSize": 14,
"titlePadding": 5,
"titleAngle": 270,
},
"legend": {
"labelFont": labelFont,
"labelFontSize": 12,
"labelFont": font,
"labelFontSize": 14,
"symbolSize": 100,
"titleFont": font,
"titleFontSize": 14,
"titleFontWeight": 'bold',
"padding": 5,
"titleLimit": 200,
"gradientLength": 100,
Expand All @@ -80,22 +78,17 @@ def brendan_theme():
},
"view": {
"stroke": "transparent", # Remove the border around the visualization
"strokeWidth": 0,
},
#"point": {
#"filled": True,
#"size": 25,
#"opacity": 1,
#"color": "black"
#},
#"boxplot": {
#"extent": "min-max",
#
#}
"text": {
"font": 'Helvetica Light',
"fontSize": 14,
}
}
}

# Register the custom theme under a chosen name
alt.themes.register('black_marks', brendan_theme)
alt.themes.register('brendan_theme', brendan_theme)

# Enable the newly registered theme
alt.themes.enable('black_marks')
alt.themes.enable('brendan_theme')
2 changes: 1 addition & 1 deletion docs/htmls/CHO_EFNB2_all_corrs.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/htmls/CHO_EFNB3_all_corrs.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/htmls/CHO_corr_plot_save.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/htmls/E2_E3_correlation.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/htmls/E2_E3_correlation_site.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/htmls/E2_E3_entry_all_muts_plot.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/htmls/E2_E3_entry_corr_plot.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/htmls/E2_binding_heatmap.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/htmls/E2_entry_heatmap.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/htmls/E3_binding_heatmap.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/htmls/E3_entry_heatmap.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/htmls/EFNB2_neut_corr.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/htmls/EFNB3_neut_corr.html

Large diffs are not rendered by default.

Loading

0 comments on commit c199a4a

Please sign in to comment.