[CW-7250] fix up typography
This commit is contained in:
parent
0bd6f118b5
commit
68809a0147
@ -4,7 +4,7 @@ import json
|
||||
import math
|
||||
from pathlib import Path
|
||||
|
||||
from dominate.tags import div, h3, p, pre, strong
|
||||
from dominate.tags import div, h4, p, pre, strong
|
||||
from dominate.util import raw
|
||||
from ezcharts.components import fastcat
|
||||
from ezcharts.components.reports import labs
|
||||
@ -317,7 +317,8 @@ def main(args):
|
||||
DataTable.from_pandas(
|
||||
pd.DataFrame.from_dict(item, orient="index", columns=["Value"])
|
||||
.reset_index()
|
||||
.rename(columns={"index": "Field"})
|
||||
.rename(columns={"index": "Field"}),
|
||||
use_index=False,
|
||||
)
|
||||
|
||||
# Load bambu QC statistics
|
||||
@ -362,9 +363,10 @@ def main(args):
|
||||
pd.DataFrame(seqname_rows, columns=["Check", "Value"]),
|
||||
paging=False,
|
||||
searchable=False,
|
||||
use_index=False,
|
||||
)
|
||||
|
||||
with h3("Build and Provider Hints"):
|
||||
h4("Build and Provider Hints")
|
||||
hint_rows = [
|
||||
(
|
||||
"Reference build",
|
||||
@ -403,11 +405,12 @@ def main(args):
|
||||
pd.DataFrame(hint_rows, columns=["Evidence", "Hints"]),
|
||||
paging=False,
|
||||
searchable=False,
|
||||
use_index=False,
|
||||
)
|
||||
|
||||
examples = annotation_summary.get("unstranded_examples") or []
|
||||
if examples:
|
||||
with h3("Unstranded Annotation Examples"):
|
||||
h4("Unstranded Annotation Examples")
|
||||
pre("\n".join(examples))
|
||||
|
||||
# Add Bambu QC section with warnings
|
||||
@ -422,8 +425,7 @@ def main(args):
|
||||
level="warning",
|
||||
)
|
||||
|
||||
# Library size statistics
|
||||
with h3("Library Size Statistics"):
|
||||
h4("Library Size Statistics")
|
||||
lib_stats = pd.DataFrame(
|
||||
[
|
||||
("Samples analyzed", bambu_qc.get("samples", "N/A")),
|
||||
@ -460,10 +462,15 @@ def main(args):
|
||||
],
|
||||
columns=["Metric", "Value"],
|
||||
)
|
||||
DataTable.from_pandas(lib_stats, paging=False, searchable=False)
|
||||
DataTable.from_pandas(
|
||||
lib_stats,
|
||||
paging=False,
|
||||
searchable=False,
|
||||
use_index=False,
|
||||
)
|
||||
|
||||
# Transcript discovery statistics
|
||||
with h3("Transcript Discovery"):
|
||||
h4("Transcript Discovery")
|
||||
discovery_stats = pd.DataFrame(
|
||||
[
|
||||
(
|
||||
@ -494,11 +501,16 @@ def main(args):
|
||||
],
|
||||
columns=["Metric", "Value"],
|
||||
)
|
||||
DataTable.from_pandas(discovery_stats, paging=False, searchable=False)
|
||||
DataTable.from_pandas(
|
||||
discovery_stats,
|
||||
paging=False,
|
||||
searchable=False,
|
||||
use_index=False,
|
||||
)
|
||||
|
||||
# Per-sample library sizes
|
||||
if "library_sizes" in bambu_qc and bambu_qc["library_sizes"]:
|
||||
with h3("Per-Sample Library Sizes"):
|
||||
h4("Per-Sample Library Sizes")
|
||||
lib_size_data = []
|
||||
for sample, size in bambu_qc["library_sizes"].items():
|
||||
numeric_size = _coerce_float(size)
|
||||
@ -523,9 +535,19 @@ def main(args):
|
||||
with report.add_section("Cohort transcriptome", "Cohort"):
|
||||
cohort_metrics, cohort_classes = _cohort_summary(args.cohort_dir)
|
||||
if cohort_metrics is not None:
|
||||
DataTable.from_pandas(cohort_metrics, paging=False, searchable=False)
|
||||
DataTable.from_pandas(
|
||||
cohort_metrics,
|
||||
paging=False,
|
||||
searchable=False,
|
||||
use_index=False,
|
||||
)
|
||||
if cohort_classes is not None:
|
||||
DataTable.from_pandas(cohort_classes, paging=False, searchable=False)
|
||||
DataTable.from_pandas(
|
||||
cohort_classes,
|
||||
paging=False,
|
||||
searchable=False,
|
||||
use_index=False,
|
||||
)
|
||||
|
||||
tx_counts = _read_table(Path(args.cohort_dir) / "transcript_counts.tsv")
|
||||
if tx_counts is not None and not tx_counts.empty:
|
||||
@ -536,7 +558,12 @@ def main(args):
|
||||
tabs = Tabs()
|
||||
for sample, summary_df in _sample_summaries(args.samples_dir).items():
|
||||
with tabs.add_tab(sample):
|
||||
DataTable.from_pandas(summary_df, paging=False, searchable=False)
|
||||
DataTable.from_pandas(
|
||||
summary_df,
|
||||
paging=False,
|
||||
searchable=False,
|
||||
use_index=False,
|
||||
)
|
||||
|
||||
if args.alignment_stats_dir and Path(args.alignment_stats_dir).exists():
|
||||
with report.add_section("Alignment statistics", "Alignments"):
|
||||
@ -656,7 +683,7 @@ def main(args):
|
||||
has_warnings = True
|
||||
|
||||
# Experimental design summary
|
||||
with h3("Experimental Design"):
|
||||
h4("Experimental Design")
|
||||
covariates = _as_string_list(de_qc.get("covariates"))
|
||||
covariates_value = ", ".join(covariates) if covariates else "none"
|
||||
design_stats = pd.DataFrame(
|
||||
@ -678,11 +705,16 @@ def main(args):
|
||||
],
|
||||
columns=["Parameter", "Value"],
|
||||
)
|
||||
DataTable.from_pandas(design_stats, paging=False, searchable=False)
|
||||
DataTable.from_pandas(
|
||||
design_stats,
|
||||
paging=False,
|
||||
searchable=False,
|
||||
use_index=False,
|
||||
)
|
||||
|
||||
# Sample sizes per group
|
||||
if "samples_per_group" in de_qc:
|
||||
with h3("Sample Sizes per Group"):
|
||||
h4("Sample Sizes per Group")
|
||||
sample_size_data = []
|
||||
for group, count in de_qc["samples_per_group"].items():
|
||||
status = (
|
||||
@ -710,7 +742,7 @@ def main(args):
|
||||
use_index=False,
|
||||
)
|
||||
|
||||
with h3("Statistical Methods & Warnings"):
|
||||
h4("Statistical Methods & Warnings")
|
||||
if method_rows:
|
||||
method_df = pd.DataFrame(method_rows)
|
||||
DataTable.from_pandas(
|
||||
@ -723,7 +755,7 @@ def main(args):
|
||||
|
||||
# Per-contrast summary
|
||||
if "contrasts" in de_qc:
|
||||
with h3("Results Summary by Contrast"):
|
||||
h4("Results Summary by Contrast")
|
||||
contrast_summary_data = []
|
||||
for contrast_name, contrast_data in de_qc["contrasts"].items():
|
||||
dtu_genes = (
|
||||
@ -774,7 +806,7 @@ def main(args):
|
||||
|
||||
# Warnings summary table
|
||||
if has_warnings:
|
||||
with h3("Quality Warnings Summary"):
|
||||
h4("Quality Warnings Summary")
|
||||
warnings_data = []
|
||||
if sample_size_warnings:
|
||||
warnings_data.append(
|
||||
|
||||
@ -359,7 +359,7 @@ def test_report_main_renders_statistical_methods_and_warnings(
|
||||
monkeypatch.setattr(report.fastcat, "SeqSummary", lambda *args, **kwargs: None)
|
||||
monkeypatch.setattr(
|
||||
report,
|
||||
"h3",
|
||||
"h4",
|
||||
lambda label: (headings.append(label), _NullContext())[1],
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
@ -449,7 +449,7 @@ def test_report_main_tolerates_missing_statistical_fields(monkeypatch, tmp_path)
|
||||
monkeypatch.setattr(report.fastcat, "SeqSummary", lambda *args, **kwargs: None)
|
||||
monkeypatch.setattr(
|
||||
report,
|
||||
"h3",
|
||||
"h4",
|
||||
lambda label: (headings.append(label), _NullContext())[1],
|
||||
)
|
||||
monkeypatch.setattr(report, "_create_warning_banner", lambda *args, **kwargs: None)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user