Skip to content

Add --report_json flag for machine-readable export of report tables#589

Open
TianYuan-Liu wants to merge 1 commit intomasterfrom
feature/report-json-export
Open

Add --report_json flag for machine-readable export of report tables#589
TianYuan-Liu wants to merge 1 commit intomasterfrom
feature/report-json-export

Conversation

@TianYuan-Liu
Copy link
Member

Summary

  • Adds a new --report_json CLI flag that exports all SQANTI3 report tables as a structured JSON file ({prefix}_report_tables.json)
  • Works alongside any --report format (html/pdf/both) and also with --report skip to produce only JSON without HTML/PDF output
  • JSON includes: metadata, summary counts (isoform/gene classification), splice junction classification, polyA motifs, CAGE peaks, and quality metrics (RT-switching, non-canonical SJ, NMD, SJ coverage)

Changes

  • src/qc_argparse.py — new --report_json CLI flag (boolean, default False)
  • src/qc_output.py — forward flag to R script as 6th argument
  • src/qc_pipeline.py — run R script when --report skip --report_json is used
  • src/parallel.py — mirror wiring for parallel/chunked execution
  • src/write_parameters.py — log ReportJSON parameter
  • src/utilities/report_qc/SQANTI3_report.Rexport_tables_to_json() function using jsonlite, accept "skip" format, fixed pdf/html branch logic
  • test/integration/test_report_json.py — 4 integration tests covering: JSON+HTML, JSON+skip, no-flag backward compatibility, quality metrics structure

JSON structure

{
  "metadata": { "generated_at": "...", "classification_file": "...", "junction_file": "..." },
  "summary": {
    "unique_genes": 123,
    "unique_isoforms": 456,
    "isoform_classification": [{"category": "FSM", "n_isoforms": 100}, ...],
    "gene_classification": [{"category": "FSM", "n_genes": 50}, ...],
    "splice_junction_classification": [{"category": "canonical_known", "n_sjs": 200, "percent": 95.2}, ...]
  },
  "polya": { "by_category": [...], "motif_frequency": [...] },
  "cage": { "by_category": [...] },
  "quality_metrics": {
    "rt_switching": [{"structural_category": "...", "count": 5, "total": 100, "percent": 5.0}],
    "noncanonical_sj": [...],
    "nmd_prediction": [...],
    "sj_coverage": [...]
  }
}

Validation

All JSON values validated against classification/junction files on example data — counts match exactly.

Closes #218

Test plan

  • Run sqanti3_qc.py --report_json with example data and verify JSON output
  • Run sqanti3_qc.py --report skip --report_json and verify JSON-only output
  • Run without --report_json and verify no JSON file is created
  • Run integration tests: pytest test/integration/test_report_json.py -v

🤖 Generated with Claude Code

Adds a new --report_json CLI flag that exports all SQANTI3 report tables
(summary counts, isoform/gene classification, splice junctions, polyA,
CAGE, and quality metrics) as a structured JSON file. The JSON export
works alongside any --report format and can also be used with
--report skip to produce only the JSON without HTML/PDF output.

Closes #218

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cursor
Copy link

cursor bot commented Mar 10, 2026

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on April 7.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@TianYuan-Liu TianYuan-Liu requested a review from pabloati March 10, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to write TSV for each report table

1 participant