Skip to content

Commit

Permalink
Fix loading of crispresso info from WGS and Pooled
Browse files Browse the repository at this point in the history
  • Loading branch information
kclem committed Jul 20, 2022
1 parent b68a432 commit 49740ba
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 1 addition & 3 deletions CRISPResso2/CRISPRessoPooledCORE.py
Expand Up @@ -420,9 +420,7 @@ def main():
can_finish_incomplete_run = False
if args.no_rerun:
if os.path.exists(crispresso2_info_file):
previous_run_data = CRISPRessoShared.load_crispresso_info(
OUTPUT_DIRECTORY,
)
previous_run_data = CRISPRessoShared.load_crispresso_info(crispresso_info_file_path=crispresso2_info_file)
if previous_run_data['running_info']['version'] == CRISPRessoShared.__version__:
args_are_same = True
for arg in vars(args):
Expand Down
11 changes: 11 additions & 0 deletions CRISPResso2/CRISPRessoShared.py
Expand Up @@ -554,13 +554,21 @@ def object_hook(self, obj):
def load_crispresso_info(
crispresso_output_folder="",
crispresso_info_file_name='CRISPResso2_info.json',
crispresso_info_file_path=None
):
"""Load the CRISPResso2 info for a CRISPResso run.
If crispresso_info_file_path is given, attempt to read info file at that location
Otherwise, read file at crispresso_output_folder/crispresso_info_file_name
Parameters
----------
crispresso_output_folder : string
Path to CRISPResso folder
crispresso_info_file_name : string
Name of info file in CRISPResso folder
crispresso_info_path: string
Path to info file
Returns
-------
Expand All @@ -571,6 +579,9 @@ def load_crispresso_info(
crispresso_info_file = os.path.join(
crispresso_output_folder, crispresso_info_file_name,
)
if crispresso_info_file_path is not None:
crispresso_info_file = crispresso_info_file_path

if not os.path.isfile(crispresso_info_file):
raise Exception('Cannot open CRISPResso info file at ' + crispresso_info_file)
try:
Expand Down
3 changes: 1 addition & 2 deletions CRISPResso2/CRISPRessoWGSCORE.py
Expand Up @@ -6,7 +6,6 @@
'''


import argparse
from datetime import datetime
import gzip
import os
Expand Down Expand Up @@ -381,7 +380,7 @@ def print_stacktrace_if_debug():
can_finish_incomplete_run = False
if args.no_rerun:
if os.path.exists(crispresso2_info_file):
previous_run_data = CRISPRessoShared.load_crispresso_info(OUTPUT_DIRECTORY)
previous_run_data = CRISPRessoShared.load_crispresso_info(crispresso_info_file_path=crispresso2_info_file)
if previous_run_data['running_info']['version'] == CRISPRessoShared.__version__:
args_are_same = True
for arg in vars(args):
Expand Down

0 comments on commit 49740ba

Please sign in to comment.