Skip to content

Commit

Permalink
Showing sgRNA sequences on hover in CRISPRessoPro (pinellolab#432)
Browse files Browse the repository at this point in the history
* Passing sgRNA sequences to regular and Batch D3 plots (#73)

* Sam/try plots (#71)

* Fix batch mode pandas warning. (#70)

* refactor to call method on DataFrame, rather than Series.
Removes warning.

* Fix pandas future warning in CRISPRessoWGS

---------

Co-authored-by: Cole Lyman <cole@colelyman.com>

* Functional

* Cole/fix status file name (#69)

* Update config file logging messages

This removes printing the exception (which is essentially a duplicate),
and adds a condition if no config file was provided. Also changes `json`
to `config` so that it is more clear.

* Fix divide by zero when no amplicons are present in Batch mode

* Don't append file_prefix to status file name

* Place status files in output directories

* Update tests branch for file_prefix addition

* Load D3 and plotly figures with pro with multiple amplicons

* Update batch

* Fix bug in CRISPRessoCompare with pointing to report datas with file_prefix

Before this fix, when using a file_prefix the second run that was compared
would not be displayed as a data in the first figure of the report.

* Import CRISPRessoPro instead of importing the version

When installed via conda, the version is not available

* Remove `get_amplicon_output` unused function from CRISPRessoCompare

Also remove unused argparse import

* Implement `get_matching_allele_files` in CRISPRessoCompare and accompanying unit tests

* Allow for matching of multiple guides in the same amplicon

* Fix pandas FutureWarning

* Change test branch back to master

---------

Co-authored-by: Sam <snic9004@gmail.com>

* Try catch all futures

* Fix test fail plots

* Point test to try-plots

* Fix d3 not showing and plotly mixing with matplotlib

* Use logger for warnings and debug statements

* Point tests back at master

---------

Co-authored-by: mbowcut2 <55161542+mbowcut2@users.noreply.github.com>
Co-authored-by: Cole Lyman <cole@colelyman.com>

* Sam/fix plots (#72)

* Fix batch mode pandas warning. (#70)

* refactor to call method on DataFrame, rather than Series.
Removes warning.

* Fix pandas future warning in CRISPRessoWGS

---------

Co-authored-by: Cole Lyman <cole@colelyman.com>

* Functional

* Cole/fix status file name (#69)

* Update config file logging messages

This removes printing the exception (which is essentially a duplicate),
and adds a condition if no config file was provided. Also changes `json`
to `config` so that it is more clear.

* Fix divide by zero when no amplicons are present in Batch mode

* Don't append file_prefix to status file name

* Place status files in output directories

* Update tests branch for file_prefix addition

* Load D3 and plotly figures with pro with multiple amplicons

* Update batch

* Fix bug in CRISPRessoCompare with pointing to report datas with file_prefix

Before this fix, when using a file_prefix the second run that was compared
would not be displayed as a data in the first figure of the report.

* Import CRISPRessoPro instead of importing the version

When installed via conda, the version is not available

* Remove `get_amplicon_output` unused function from CRISPRessoCompare

Also remove unused argparse import

* Implement `get_matching_allele_files` in CRISPRessoCompare and accompanying unit tests

* Allow for matching of multiple guides in the same amplicon

* Fix pandas FutureWarning

* Change test branch back to master

---------

Co-authored-by: Sam <snic9004@gmail.com>

* Try catch all futures

* Fix test fail plots

* Fix d3 not showing and plotly mixing with matplotlib

---------

Co-authored-by: mbowcut2 <55161542+mbowcut2@users.noreply.github.com>
Co-authored-by: Cole Lyman <cole@colelyman.com>

* Remove token from integration tests file

* Provide sgRNA_sequences to plot_nucleotide_quilt plots

* Passing sgRNA_sequences to plot

* Refactor check for determining when to use CRISPREssoPro or matplotlib for Batch plots

* Add max-height to Batch report samples

* Change testing branch

* Fix wrong check for large Batch plots

* Update integration_tests.yml to point back at master

---------

Co-authored-by: Samuel Nichols <Snic9004@gmail.com>
Co-authored-by: mbowcut2 <55161542+mbowcut2@users.noreply.github.com>
Co-authored-by: Cole Lyman <cole@colelyman.com>

* Push new releases to ECR (#74)

* Create aws_ecr.yml (#1)

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* us-east-1

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Update aws_ecr.yml

* Fix d3 sgRNA sequences (#76)

* Pass correct sgRNA_sequences to d3 plot

* Pass correct sgRNA sequence to prime editor plot for d3

* Resize plotly (#75)

* Sam/try plots (#71)

* Fix batch mode pandas warning. (#70)

* refactor to call method on DataFrame, rather than Series.
Removes warning.

* Fix pandas future warning in CRISPRessoWGS

---------

Co-authored-by: Cole Lyman <cole@colelyman.com>

* Functional

* Cole/fix status file name (#69)

* Update config file logging messages

This removes printing the exception (which is essentially a duplicate),
and adds a condition if no config file was provided. Also changes `json`
to `config` so that it is more clear.

* Fix divide by zero when no amplicons are present in Batch mode

* Don't append file_prefix to status file name

* Place status files in output directories

* Update tests branch for file_prefix addition

* Load D3 and plotly figures with pro with multiple amplicons

* Update batch

* Fix bug in CRISPRessoCompare with pointing to report datas with file_prefix

Before this fix, when using a file_prefix the second run that was compared
would not be displayed as a data in the first figure of the report.

* Import CRISPRessoPro instead of importing the version

When installed via conda, the version is not available

* Remove `get_amplicon_output` unused function from CRISPRessoCompare

Also remove unused argparse import

* Implement `get_matching_allele_files` in CRISPRessoCompare and accompanying unit tests

* Allow for matching of multiple guides in the same amplicon

* Fix pandas FutureWarning

* Change test branch back to master

---------

Co-authored-by: Sam <snic9004@gmail.com>

* Try catch all futures

* Fix test fail plots

* Point test to try-plots

* Fix d3 not showing and plotly mixing with matplotlib

* Use logger for warnings and debug statements

* Point tests back at master

---------

Co-authored-by: mbowcut2 <55161542+mbowcut2@users.noreply.github.com>
Co-authored-by: Cole Lyman <cole@colelyman.com>

* Sam/fix plots (#72)

* Fix batch mode pandas warning. (#70)

* refactor to call method on DataFrame, rather than Series.
Removes warning.

* Fix pandas future warning in CRISPRessoWGS

---------

Co-authored-by: Cole Lyman <cole@colelyman.com>

* Functional

* Cole/fix status file name (#69)

* Update config file logging messages

This removes printing the exception (which is essentially a duplicate),
and adds a condition if no config file was provided. Also changes `json`
to `config` so that it is more clear.

* Fix divide by zero when no amplicons are present in Batch mode

* Don't append file_prefix to status file name

* Place status files in output directories

* Update tests branch for file_prefix addition

* Load D3 and plotly figures with pro with multiple amplicons

* Update batch

* Fix bug in CRISPRessoCompare with pointing to report datas with file_prefix

Before this fix, when using a file_prefix the second run that was compared
would not be displayed as a data in the first figure of the report.

* Import CRISPRessoPro instead of importing the version

When installed via conda, the version is not available

* Remove `get_amplicon_output` unused function from CRISPRessoCompare

Also remove unused argparse import

* Implement `get_matching_allele_files` in CRISPRessoCompare and accompanying unit tests

* Allow for matching of multiple guides in the same amplicon

* Fix pandas FutureWarning

* Change test branch back to master

---------

Co-authored-by: Sam <snic9004@gmail.com>

* Try catch all futures

* Fix test fail plots

* Fix d3 not showing and plotly mixing with matplotlib

---------

Co-authored-by: mbowcut2 <55161542+mbowcut2@users.noreply.github.com>
Co-authored-by: Cole Lyman <cole@colelyman.com>

* Remove token from integration tests file

* Pass div id for plotly

* Remove debug

---------

Co-authored-by: mbowcut2 <55161542+mbowcut2@users.noreply.github.com>
Co-authored-by: Cole Lyman <cole@colelyman.com>

---------

Co-authored-by: Trevor Martin <60452953+trevormartinj7@users.noreply.github.com>
Co-authored-by: Samuel Nichols <Snic9004@gmail.com>
Co-authored-by: mbowcut2 <55161542+mbowcut2@users.noreply.github.com>
  • Loading branch information
4 people committed Nov 8, 2024
1 parent 5eee80c commit 3891baf
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/aws_ecr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT_ID }}
ECR_REPOSITORY: 'crispresso2'
AWS_REGION: 'us-east-1'
IMAGE_TAG: v${{ steps.get_version.outputs.version }}
IMAGE_TAG: ${{ steps.get_version.outputs.version }}
run: |
# Build a docker container and push it to ECR
docker build -t $AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com/$ECR_REPOSITORY:$IMAGE_TAG .
Expand Down
20 changes: 9 additions & 11 deletions CRISPResso2/CRISPRessoBatchCORE.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,6 @@ def main():
crispresso2_info['results']['general_plots']['allele_modification_line_plot_datas'] = {}
crispresso2_info['results']['general_plots']['allele_modification_line_plot_divs'] = {}

large_plot_cutoff = 300

percent_complete_start, percent_complete_end = 90, 99
if all_amplicons:
percent_complete_step = (percent_complete_end - percent_complete_start) / len(all_amplicons)
Expand Down Expand Up @@ -609,7 +607,7 @@ def main():
sub_modification_percentage_summary_filename = _jp(amplicon_plot_name + 'Modification_percentage_summary_around_sgRNA_'+sgRNA+'.txt')
sub_modification_percentage_summary_df.to_csv(sub_modification_percentage_summary_filename, sep='\t', index=None)

if not args.suppress_plots and not args.suppress_batch_summary_plots and (nucleotide_percentage_summary_df.shape[0] / 6) < large_plot_cutoff:
if not args.suppress_plots and not args.suppress_batch_summary_plots and should_plot_large_plots(sub_nucleotide_percentage_summary_df.shape[0], C2PRO_INSTALLED, args.use_matplotlib):
# plot for each guide
# show all sgRNA's on the plot
sub_sgRNA_intervals = []
Expand Down Expand Up @@ -658,7 +656,7 @@ def main():
crispresso2_info['results']['general_plots']['summary_plot_labels'][plot_name] = 'Composition of each base around the guide ' + sgRNA + ' for the amplicon ' + amplicon_name
crispresso2_info['results']['general_plots']['summary_plot_datas'][plot_name] = [('Nucleotide frequencies', os.path.basename(nucleotide_frequency_summary_filename)), ('Modification frequencies', os.path.basename(modification_frequency_summary_filename))]

if args.base_editor_output and (sub_nucleotide_percentage_summary_df.shape[0] / 6) < large_plot_cutoff:
if args.base_editor_output and should_plot_large_plots(sub_nucleotide_percentage_summary_df.shape[0], False, args.use_matplotlib):
this_window_nuc_conv_plot_name = _jp(amplicon_plot_name + 'Nucleotide_conversion_map_around_sgRNA_'+sgRNA)
conversion_map_input = {
'nuc_pct_df': sub_nucleotide_percentage_summary_df,
Expand Down Expand Up @@ -686,7 +684,7 @@ def main():
]
# done with per-sgRNA plots

if not args.suppress_plots and not args.suppress_batch_summary_plots: # plot the whole region
if not args.suppress_plots and not args.suppress_batch_summary_plots and should_plot_large_plots(nucleotide_percentage_summary_df.shape[0], C2PRO_INSTALLED, args.use_matplotlib): # plot the whole region
this_nuc_pct_quilt_plot_name = _jp(amplicon_plot_name.replace('.', '') + 'Nucleotide_percentage_quilt')
nucleotide_quilt_input = {
'nuc_pct_df': nucleotide_percentage_summary_df,
Expand All @@ -710,7 +708,7 @@ def main():
crispresso2_info['results']['general_plots']['summary_plot_titles'][plot_name] = ''
crispresso2_info['results']['general_plots']['summary_plot_labels'][plot_name] = 'Composition of each base for the amplicon ' + amplicon_name
crispresso2_info['results']['general_plots']['summary_plot_datas'][plot_name] = [('Nucleotide frequencies', os.path.basename(nucleotide_frequency_summary_filename)), ('Modification frequencies', os.path.basename(modification_frequency_summary_filename))]
if args.base_editor_output and (sub_nucleotide_percentage_summary_df.shape[0] / 6) < large_plot_cutoff:
if args.base_editor_output and should_plot_large_plots(nucleotide_percentage_summary_df.shape[0], False, args.use_matplotlib):
this_nuc_conv_plot_name = _jp(amplicon_plot_name + 'Nucleotide_conversion_map')
conversion_map_input = {
'nuc_pct_df': nucleotide_percentage_summary_df,
Expand All @@ -737,7 +735,7 @@ def main():
crispresso2_info['results']['general_plots']['summary_plot_datas'][plot_name] = [('Nucleotide frequencies', os.path.basename(nucleotide_frequency_summary_filename)), ('Modification frequencies', os.path.basename(modification_frequency_summary_filename))]

else: # guides are not the same
if not args.suppress_plots and not args.suppress_batch_summary_plots:
if not args.suppress_plots and not args.suppress_batch_summary_plots and should_plot_large_plots(nucleotide_percentage_summary_df.shape[0], C2PRO_INSTALLED, args.use_matplotlib):
this_nuc_pct_quilt_plot_name = _jp(amplicon_plot_name.replace('.', '') + 'Nucleotide_percentage_quilt')
nucleotide_quilt_input = {
'nuc_pct_df': nucleotide_percentage_summary_df,
Expand All @@ -755,7 +753,7 @@ def main():
nuc_pct_quilt_plot_names.append(plot_name)
crispresso2_info['results']['general_plots']['summary_plot_labels'][plot_name] = 'Composition of each base for the amplicon ' + amplicon_name
crispresso2_info['results']['general_plots']['summary_plot_datas'][plot_name] = [('Nucleotide frequencies', os.path.basename(nucleotide_frequency_summary_filename)), ('Modification frequencies', os.path.basename(modification_frequency_summary_filename))]
if args.base_editor_output and (sub_nucleotide_percentage_summary_df.shape[0] / 6) < large_plot_cutoff:
if args.base_editor_output and should_plot_large_plots(nucleotide_percentage_summary_df.shape[0], False, args.use_matplotlib):
this_nuc_conv_plot_name = _jp(amplicon_plot_name + 'Nucleotide_percentage_quilt')
conversion_map_input = {
'nuc_pct_df': nucleotide_percentage_summary_df,
Expand All @@ -776,7 +774,7 @@ def main():
crispresso2_info['results']['general_plots']['summary_plot_datas'][plot_name] = [('Nucleotide frequencies', os.path.basename(nucleotide_frequency_summary_filename)), ('Modification frequencies', os.path.basename(modification_frequency_summary_filename))]

# allele modification frequency heatmap and line plots
if C2PRO_INSTALLED and not args.use_matplotlib and not args.suppress_plots and not args.suppress_batch_summary_plots and (nucleotide_percentage_summary_df.shape[0] / 6) < large_plot_cutoff:
if C2PRO_INSTALLED and not args.use_matplotlib and not args.suppress_plots and not args.suppress_batch_summary_plots:
if guides_all_same:
sgRNA_intervals = [consensus_sgRNA_intervals] * modification_frequency_summary_df.shape[0]
else:
Expand Down Expand Up @@ -808,7 +806,7 @@ def main():
'sample_sgRNA_intervals': sgRNA_intervals,
'plot_path': plot_path,
'title': modification_type,
'amplicon_name': amplicon_name,
'div_id': heatmap_div_id,
}
debug('Plotting allele modification heatmap for {0}'.format(amplicon_name))
plot(
Expand Down Expand Up @@ -842,7 +840,7 @@ def main():
'sample_sgRNA_intervals': sgRNA_intervals,
'plot_path': plot_path,
'title': modification_type,
'amplicon_name': amplicon_name,
'div_id': line_div_id,
}
debug('Plotting allele modification line plot for {0}'.format(amplicon_name))
plot(
Expand Down
2 changes: 2 additions & 0 deletions CRISPResso2/CRISPRessoCORE.py
Original file line number Diff line number Diff line change
Expand Up @@ -4207,6 +4207,7 @@ def count_alternate_alleles(sub_base_vectors, ref_name, ref_sequence, ref_total_
'quantification_window_idxs': include_idxs_list,
'sgRNA_names': sgRNA_names,
'sgRNA_mismatches': sgRNA_mismatches,
'sgRNA_sequences': sgRNA_sequences,
'custom_colors': custom_config["colors"],
}
debug('Plotting HDR nucleotide quilt')
Expand Down Expand Up @@ -4792,6 +4793,7 @@ def get_scaffold_len(row, scaffold_start_loc, scaffold_seq):
sgRNA_intervals = refs[ref_names[0]]['sgRNA_intervals']
sgRNA_names = refs[ref_names[0]]['sgRNA_names']
sgRNA_mismatches = refs[ref_names[0]]['sgRNA_mismatches']
sgRNA_sequences = refs[ref_names[0]]['sgRNA_sequences']
include_idxs_list = refs[ref_names[0]]['include_idxs']

plot_root = _jp('11a.Prime_editing_nucleotide_percentage_quilt')
Expand Down
1 change: 1 addition & 0 deletions CRISPResso2/CRISPRessoReports/CRISPRessoReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ def fill_default(dictionary, key, default_type=list):
allele_modification_line_plot_titles=allele_modification_line_plot['titles'],
allele_modification_line_plot_labels=allele_modification_line_plot['labels'],
allele_modification_line_plot_datas=allele_modification_line_plot['datas'],
allele_modification_line_plot_divs=allele_modification_line_plot['divs'],
C2PRO_INSTALLED=C2PRO_INSTALLED,
))

Expand Down
2 changes: 1 addition & 1 deletion CRISPResso2/CRISPRessoReports/templates/batchReport.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<h5 id="CRISPResso2_Batch_Output">{{report_name}}</h5>
</div>
<div class='card-body p-0'>
<div class="list-group list-group-flush">
<div class="list-group list-group-flush" style="max-height: 25vh; overflow-y: scroll;">
{% for run_name in run_names %}
<a href="{{sub_html_files[run_name]}}" class="list-group-item list-group-item-action" id="{{run_name}}">{{run_name}}</a>
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h5 id="failed_runs" class="mb-0 text-white">Failed Runs</h5>
</div>

<div class='card-body p-0'>
<div class="list-group list-group-flush">
<div class="list-group list-group-flush" style="max-height: 25vh; overflow-y: scroll;">
{% for failed_run in failed_runs %}
{# Toggle the description visibility on click #}
<a href="javascript:void(0)" class="list-group-item list-group-item-action failed-run-name bg-light text-dark"
Expand Down

0 comments on commit 3891baf

Please sign in to comment.