10XGenomics/cellranger

Generating alerts.json in the count pipeline

Closed this issue · 2 comments

Hello,

I'd like to read alerts shown in the web summary in a machine-readable format. I read in the Release Notes of Cell ranger 2.0 that alerts.json [is generated] as an output of the SUMMARIZE_REPORTS stage. I couldn't find an alerts JSON file or a CLI option to activate the generation of this file (I'm using Cell ranger 7.0).

Did I miss an option or is it not possible to generate this output any longer?

Thanks,
Jérémy

That is no longer a fully supported option. However, it's pretty easy to extract that data as it's stored in the web_summary file as JSON. Here's a quick program to extract all the web summary data:

#!/usr/bin/env python

import json
import re
import sys

def extractJsonNew(content):
    finder = re.compile("const\sdata\s=\s([^\n]*)")
    comp_data = finder.search(content)
    return comp_data.group(1)

if __name__ == "__main__":
    infile = sys.argv[1]
    content = open(infile).read()
    content = extractJsonNew(content)
    data = json.loads(content)
    print(json.dumps(data, sort_keys=True, indent=2, separators=(",", ": ")))

You can call that via:

./that_file web_summary.html > web_summary_data.json

And then if you load that json file, you'll find the alerts at x["summary"]["alarms"]["alarms"]

Thank you, extracting the elements of the alarms-Array of the HTML report is the approach I followed now.
Have a nice day.