Skip to content

Instantly share code, notes, and snippets.

@Colelyman
Created November 3, 2025 21:57
Show Gist options
  • Select an option

  • Save Colelyman/24f1f89d1bee44c45a071e0da0b6144c to your computer and use it in GitHub Desktop.

Select an option

Save Colelyman/24f1f89d1bee44c45a071e0da0b6144c to your computer and use it in GitHub Desktop.
Extract Quantification Windows from CRISPResso Runs
"""Report the quantification window indexes used from a CRISPResso run.
The script expects to be adjacent to any number of CRISPResso runs, it will
search among the runs and extract each CRISPResso2_info.json file and print
out the quantification windows for each amplicon.
"""
import glob
import json
def print_qwc(c2_info_path):
with open(c2_info_path) as fh:
c2_info = json.load(fh)
for amplicon in c2_info['results']['ref_names']:
if isinstance(c2_info['results']['refs'][amplicon]['include_idxs'], dict):
print(f'{c2_info_path} QWC for {amplicon}', c2_info['results']['refs'][amplicon]['include_idxs']['value'])
else:
print(f'{c2_info_path} QWC for {amplicon}', c2_info['results']['refs'][amplicon]['include_idxs'])
if __name__ == '__main__':
for c2_info_path in glob.glob(f'./*/**/CRISPResso2_info.json'):
print_qwc(c2_info_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment