Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large aggregation #192

Merged
merged 67 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
a7ffd46
Squashed commit of the following:
kclem Jan 11, 2022
ddbd39f
Merge branch 'pinellolab:master' into master
kclem Jan 13, 2022
a7cde12
Add parameter `--suppress_batch_summary_plots`
kclem Jan 23, 2022
c150468
Pep formatting cleanup
kclem Jan 23, 2022
55c2e9b
Add summary nucleotide plots to aggregate
kclem Jan 23, 2022
1316d30
Aggregate plots are paginated
kclem Jan 23, 2022
2e9b50b
Update CRISPRessoAggregateCORE.py
kclem Jan 23, 2022
6d5bc83
Add --max_samples_per_summary_plot to CRISPRessoAggregate
kclem Jan 24, 2022
ef67027
Add plotly function to plot an interactive heatmap
Colelyman Jan 26, 2022
2ffdff7
Fix deprecated numpy type to suppress warning
Colelyman Jan 26, 2022
06e05db
Add plotting of heatmaps to CRISPRessoAggregateCORE to summarize modi…
Colelyman Jan 26, 2022
bab6e51
Add the heatmap summaries to the CRISPRessoAggregate report
Colelyman Jan 26, 2022
7829387
Update Bootstrap to 5.1.3
Colelyman Jan 28, 2022
9da1403
Move the plotly heatmaps to a Bootstrap modal
Colelyman Jan 29, 2022
bbb7d6f
Merge branch 'master' of https://github.com/edilytics/CRISPResso2
kclem Mar 15, 2022
769f58d
Fix bug where plots were not filling up entire modal.
Colelyman Mar 15, 2022
802bb1f
Update the axis labels and add autosize to plotly heatmaps
Colelyman Mar 16, 2022
91fa0ad
Abandon attempts to make plots fullscreen
Colelyman Mar 16, 2022
ec6e570
Rename and refactor how plot data is passed around
Colelyman Mar 18, 2022
e8370ec
Implement the line plot version of the modification percentages
Colelyman Mar 22, 2022
82f5d55
Change default `max_samples_per_summary_plot` to be 150 instead of 250
Colelyman Mar 22, 2022
e076330
Remove extra assignments of `this_number_samples` and suppress plot
Colelyman Mar 22, 2022
05c5bbd
Implement parallel plotting in CRISPRessoAggregate
Colelyman Mar 22, 2022
cbe560f
Fix sample indexing error and heatmap scaling for large number of sam…
Colelyman Mar 23, 2022
af4ab6e
Merge branch 'pinellolab:master' into master
Colelyman Mar 25, 2022
b7245da
Add parameter `--suppress_batch_summary_plots`
kclem Jan 23, 2022
c5ff5b4
Pep formatting cleanup
kclem Jan 23, 2022
70c22c4
Add summary nucleotide plots to aggregate
kclem Jan 23, 2022
87839e7
Aggregate plots are paginated
kclem Jan 23, 2022
e41d639
Update CRISPRessoAggregateCORE.py
kclem Jan 23, 2022
f86b10f
Add --max_samples_per_summary_plot to CRISPRessoAggregate
kclem Jan 24, 2022
ed6a038
Add plotly function to plot an interactive heatmap
Colelyman Jan 26, 2022
47a6bc0
Fix deprecated numpy type to suppress warning
Colelyman Jan 26, 2022
b1951a6
Add plotting of heatmaps to CRISPRessoAggregateCORE to summarize modi…
Colelyman Jan 26, 2022
164299d
Add the heatmap summaries to the CRISPRessoAggregate report
Colelyman Jan 26, 2022
13c03f8
Update Bootstrap to 5.1.3
Colelyman Jan 28, 2022
45e4ccf
Move the plotly heatmaps to a Bootstrap modal
Colelyman Jan 29, 2022
b5897f9
Fix bug where plots were not filling up entire modal.
Colelyman Mar 15, 2022
62f4e38
Update the axis labels and add autosize to plotly heatmaps
Colelyman Mar 16, 2022
ff1305a
Abandon attempts to make plots fullscreen
Colelyman Mar 16, 2022
f0d424d
Rename and refactor how plot data is passed around
Colelyman Mar 18, 2022
7653f67
Implement the line plot version of the modification percentages
Colelyman Mar 22, 2022
077a60c
Change default `max_samples_per_summary_plot` to be 150 instead of 250
Colelyman Mar 22, 2022
e32b202
Remove extra assignments of `this_number_samples` and suppress plot
Colelyman Mar 22, 2022
b8c1a8c
Implement parallel plotting in CRISPRessoAggregate
Colelyman Mar 22, 2022
e514ccf
Fix sample indexing error and heatmap scaling for large number of sam…
Colelyman Mar 23, 2022
862e803
Merge branch 'largeAggregation' of https://github.com/edilytics/CRISP…
kclem Mar 27, 2022
dcadcff
Add plotly requrement to setup.py
kclem Mar 27, 2022
0220ea4
Remove space around vertical barcharts
kclem Mar 27, 2022
4380407
Add scrollbar to long images in multiReport
kclem Mar 27, 2022
13c56ee
Fill in default (empty) values to allele modification plots
Colelyman Mar 28, 2022
4b2bdcd
Include CRISPRessoBatch in the refactor of how summary_plot dicts are…
Colelyman Mar 29, 2022
f69250f
Update dockerfile for new docker
kclem Apr 8, 2022
0f1beda
minor bug fixes for plotCustomAllelePlot.py to work with Python3 (#212)
dharjanto Apr 12, 2022
e96e3df
Allow for flexible parsing of quant window coordinates
kclem Apr 15, 2022
095ce13
CRISPRessoPooled debug flash command, fix pep formatting
kclem Apr 15, 2022
b5f9ec0
Set flexiguide homology parameter type to int
kclem Apr 15, 2022
0002ebb
Coerce ints in batch file checking (#200)
Snicker7 Apr 15, 2022
1a2d9c1
Handle multiple qwcs in batch mode
kclem Apr 15, 2022
ded680c
Fix bug from old pandas for int cols
kclem Apr 15, 2022
4e812ed
Merge branch 'pinellolab:master' into master
Colelyman May 2, 2022
3b21f39
Merge branch 'master' into largeAggregation
Colelyman May 3, 2022
894a266
Create allele modification heatmaps and line plots in CRISPRessoBatch
Colelyman May 3, 2022
dffcd21
Add allele modification heatmaps and line plots to CRISPRessoBatch
Colelyman May 3, 2022
114562c
Make all plots in CRISPRessoBatch run in parallel
Colelyman May 3, 2022
1379c07
Make `--suppress_batch_summary_plots` store true
Colelyman May 3, 2022
4558350
Add blank values for allele_modification entries when not present
Colelyman May 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
391 changes: 320 additions & 71 deletions CRISPResso2/CRISPRessoAggregateCORE.py

Large diffs are not rendered by default.

400 changes: 306 additions & 94 deletions CRISPResso2/CRISPRessoBatchCORE.py

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions CRISPResso2/CRISPRessoPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import matplotlib.patches as patches
import matplotlib.cm as cm
import matplotlib.gridspec as gridspec
import plotly.express as px
from collections import defaultdict
from copy import deepcopy
import re
Expand Down Expand Up @@ -3261,6 +3262,7 @@ def plot_unmod_mod_pcts(fig_filename_root,df_summary_quantification,save_png,cut

#if there are rows..
if df.shape[0] > 0:
ax.set_ylim(-0.5, df.shape[0]-0.5)
max_val = max(df['Reads_total'])
space_val = max_val*0.02
pct_labels = []
Expand Down Expand Up @@ -3300,6 +3302,8 @@ def plot_reads_total(fig_filename_root,df_summary_quantification,save_png,cutoff
names = [((name[:20] + "..") if len(name) > 18 else name) for name in df['Name'].values]
ax.set_yticks(xs)
ax.set_yticklabels(names)
if df.shape[0] > 0:
ax.set_ylim(-0.5, df.shape[0]-0.5)
if df['Reads_total'].max() > 100000:
ax.ticklabel_format(style='sci', axis='x', scilimits=(0, 0))
if cutoff is not None:
Expand Down Expand Up @@ -3710,3 +3714,85 @@ def plot_quantification_positions(
)

plt.close(fig)


def plot_allele_modification_heatmap(
sample_values, sample_sgRNA_intervals, plot_path, title,
):
fig = px.imshow(
sample_values,
labels={
'x': 'Amplicon Nucleotide (Position)',
'y': 'Sample (Index)',
'color': '{0} (%)'.format(title),
},
aspect='auto',
)
for sample_id, sgRNA_intervals in zip(
range(sample_values.shape[0]), sample_sgRNA_intervals,
):
for sgRNA_interval in sgRNA_intervals:
fig.add_shape(
type='rect',
x0=sgRNA_interval[0],
y0=sample_id - 0.5,
x1=sgRNA_interval[1],
y1=sample_id + 0.5,
line={'color': 'Black'},
)

fig.update_layout(
autosize=True,
)
fig['layout']['yaxis']['scaleanchor'] = 'x'
fig['layout']['yaxis']['gridcolor'] = 'rgba(0, 0, 0, 0)'
fig['layout']['xaxis']['gridcolor'] = 'rgba(0, 0, 0, 0)'
return fig.write_html(
plot_path,
config={
'responsive': True,
'displaylogo': False,
},
include_plotlyjs='cdn',
full_html=False,
div_id='allele-modification-heatmap-{0}'.format(title.lower()),
)


def plot_allele_modification_line(
sample_values, sample_sgRNA_intervals, plot_path, title,
):
fig = px.line(sample_values.transpose())
sgRNA_intervals = set(
tuple(sgRNA_interval)
for sample_sgRNA_interval in sample_sgRNA_intervals
for sgRNA_interval in sample_sgRNA_interval
)
for sgRNA_interval in sgRNA_intervals:
fig.add_shape(
type='rect',
x0=sgRNA_interval[0],
y0=0,
x1=sgRNA_interval[1],
y1=0.5,
fillcolor='Gray',
opacity=0.2,
line={'color': 'gray'},
)

fig.update_layout(
autosize=True,
xaxis_title='Amplicon Nucleotide (Position)',
yaxis_title='{0} (%)'.format(title),
legend_title='Samples',
)
return fig.write_html(
plot_path,
config={
'responsive': True,
'displaylogo': False,
},
include_plotlyjs='cdn',
full_html=False,
div_id='allele-modification-line-{0}'.format(title.lower()),
)