Skip to content

Commit

Permalink
Failed batch runs (#33)
Browse files Browse the repository at this point in the history
* Reports, add reports to packages, colors, ordered pandas sort (#28)

* Sort by #Reads instead of %Reads to avoid floating point errors

* Fix x-axis spacing on some reports

* Add break to header matching loop to prevent match statements being printed after failure

* Check all headers and only error if there are unmatched values

* Fix indent

* Remove missing_header variable

* Fix tick marks

* Squashed 'CRISPResso2/CRISPRessoReports/' changes from 7d9b4e5..e18807d

* X-axis tick fix on fig 6a

* Fix function name from styles to config

* Squashed 'CRISPResso2/CRISPRessoReports/' changes from e18807d..e9da7bf

git-subtree-dir: CRISPResso2/CRISPRessoReports
git-subtree-split: e9da7bff794058e1fcdb3dc9ced79871c6a30e18

* Add CRISPRessoReports to packages

* Colors only with pro

* changed tuple to list for matplotlib change (#31)

* wgs and batch failed runs implementation

* Added failed run functionality including shared function, edits to Report, and displaying with HTML and Javascript

* Merge CRISPRessoReports master into failed-batch-runs

* Cole's failed-batch-runs review and changes (#36)

* Fix showing link to report in CLI (only show in web)

* Remove styling of jumbotron

The p-5 added some weird space at the top of the container, the rounded-3 did
not make a difference (because there is no background), and the h-100 also did
not make a difference.

* Remove extra spaces at end of the line

* Remove color legend from figure caption in plot 4f

* Refactor fig_reports.html partial to reduce duplication

* Add opacity to custom colors on allele quilt plot

* Remove extra spaces

* Change default color of deletion

It looked too similar to `N` and was difficult to tell apart.

* Refactor plot 10c, refactor displaying of figures

This commit adds flexbox to the plots, this was mainly for plots 10b and 10c
because their alignment was off.

* Add more plots to get the correct percentages for width

* Remove setting the height of the plots

* Check for failed batch info before retrieving it in `make_multi_report_from_folder`

* Fix extraneous whitespace in `fig_reports` partial

* Only load certain resources when on web mode

* Move jQuery import to bottom of the page to improve performance

* Extract out report footer buttons to partial

* Fix too many closing divs in batchReport.html

* Refactor failed runs to be a partial

* Move the failed run JS to the partial

This has the benefit of keeping the relevant code close, and also prevents the
error that we were running into before where `chevronIcon` wasn't found when
there were no failed runs (because the element wasn't there).

* Remove `report_name` id because it probably has spaces

* Move existing Plotly plots to batchReport from multiReport

* Fix typo in fig 11c and resize it to 40%

---------

Co-authored-by: Samuel Nichols <[email protected]>
Co-authored-by: mbowcut2 <[email protected]>
Co-authored-by: Cole Lyman <[email protected]>
  • Loading branch information
4 people committed Jun 19, 2024
1 parent ea6a39e commit 3fd84d0
Show file tree
Hide file tree
Showing 33 changed files with 2,264 additions and 1,235 deletions.
2 changes: 1 addition & 1 deletion CRISPResso2/CRISPRessoAggregateCORE.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from datetime import datetime
from CRISPResso2 import CRISPRessoShared
from CRISPResso2 import CRISPRessoPlot
from CRISPResso2 import CRISPRessoReport
from CRISPResso2.CRISPRessoReports import CRISPRessoReport
from CRISPResso2.CRISPRessoMultiProcessing import get_max_processes, run_plot


Expand Down
21 changes: 17 additions & 4 deletions CRISPResso2/CRISPRessoBatchCORE.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from CRISPResso2 import CRISPRessoShared
from CRISPResso2 import CRISPRessoPlot
from CRISPResso2 import CRISPRessoMultiProcessing
from CRISPResso2 import CRISPRessoReport
from CRISPResso2.CRISPRessoReports import CRISPRessoReport

import logging

Expand Down Expand Up @@ -91,6 +91,7 @@ def main():
crispresso_options_for_batch = list(crispresso_options-options_to_ignore)

CRISPRessoShared.check_file(args.batch_settings)
config = CRISPRessoShared.check_custom_config(args)

if args.zip_output and not args.place_report_in_output_folder:
warn('Invalid arguement combination: If zip_output is True then place_report_in_output_folder must also be True. Setting place_report_in_output_folder to True.')
Expand Down Expand Up @@ -301,12 +302,16 @@ def main():
amplicon_names = {}
amplicon_counts = {}
completed_batch_arr = []
failed_batch_arr = []
failed_batch_arr_desc = []
for idx, row in batch_params.iterrows():
batch_name = CRISPRessoShared.slugify(row["name"])
folder_name = os.path.join(OUTPUT_DIRECTORY, 'CRISPResso_on_%s' % batch_name)
run_data_file = os.path.join(folder_name, 'CRISPResso2_info.json')
if not os.path.isfile(run_data_file):
info("Skipping folder '%s'. Cannot find run data at '%s'."%(folder_name, run_data_file))
# check if run failed
failed_run_bool, failed_status_string = CRISPRessoShared.check_if_failed_run(folder_name, info)
if failed_run_bool:
failed_batch_arr.append(batch_name)
failed_batch_arr_desc.append(failed_status_string)
run_datas.append(None)
continue

Expand All @@ -326,6 +331,8 @@ def main():

completed_batch_arr.append(batch_name)

crispresso2_info['results']['failed_batch_arr'] = failed_batch_arr
crispresso2_info['results']['failed_batch_arr_desc'] = failed_batch_arr_desc
crispresso2_info['results']['completed_batch_arr'] = completed_batch_arr

# make sure amplicon names aren't super long
Expand Down Expand Up @@ -596,6 +603,7 @@ def main():
'save_also_png': save_png,
'sgRNA_intervals': sub_sgRNA_intervals,
'quantification_window_idxs': include_idxs,
'custom_colors': config['colors'],
}
debug('Plotting nucleotide percentage quilt for amplicon {0}, sgRNA {1}'.format(amplicon_name, sgRNA))
plot(
Expand All @@ -620,6 +628,7 @@ def main():
'save_also_png': save_png,
'sgRNA_intervals': sub_sgRNA_intervals,
'quantification_window_idxs': include_idxs,
'custom_colors': config['colors']
}
debug('Plotting nucleotide conversion map for amplicon {0}, sgRNA {1}'.format(amplicon_name, sgRNA))
plot(
Expand All @@ -646,6 +655,7 @@ def main():
'save_also_png': save_png,
'sgRNA_intervals': consensus_sgRNA_intervals,
'quantification_window_idxs': include_idxs,
'custom_colors': config['colors'],
}
debug('Plotting nucleotide quilt for {0}'.format(amplicon_name))
plot(
Expand All @@ -669,6 +679,7 @@ def main():
'save_also_png': save_png,
'sgRNA_intervals': consensus_sgRNA_intervals,
'quantification_window_idxs': include_idxs,
'custom_colors': config['colors']
}
debug('Plotting nucleotide conversion map for {0}'.format(amplicon_name))
plot(
Expand All @@ -692,6 +703,7 @@ def main():
'mod_pct_df': modification_percentage_summary_df,
'fig_filename_root': this_nuc_pct_quilt_plot_name,
'save_also_png': save_png,
'custom_colors': config['colors'],
}
debug('Plotting nucleotide quilt for {0}'.format(amplicon_name))
plot(
Expand All @@ -710,6 +722,7 @@ def main():
'conversion_nuc_from': args.conversion_nuc_from,
'conversion_nuc_to': args.conversion_nuc_to,
'save_also_png': save_png,
'custom_colors': config['colors']
}
debug('Plotting BE nucleotide conversion map for {0}'.format(amplicon_name))
plot(
Expand Down
Loading

0 comments on commit 3fd84d0

Please sign in to comment.