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

Failed batch runs #33

Merged
merged 8 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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