Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# openpipeline_qc 0.2.0

## NEW FEATURES

* Add support for CosMx data in the QC Reporting workflow (PR #12).

## MINOR CHANGES

* Added support for Visium data ingestion and QC reporting (PR #16).
Expand Down
22 changes: 22 additions & 0 deletions inspect_visium.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

import mudata as mu
import pandas as pd

def inspect_h5mu(filepath, name):
print(f"--- Inspecting {name} ({filepath}) ---")
try:
mdata = mu.read_h5mu(filepath)
rna = mdata.mod['rna']
print(f"Obs columns ({len(rna.obs.columns)}):")
print(rna.obs.columns.tolist())

print(f"\nObs head:")
print(rna.obs.head())

print(f"\nObsm keys: {list(rna.obsm.keys())}")

except Exception as e:
print(f"Error reading {filepath}: {e}")
print("\n")

inspect_h5mu("resources_test/spatial_qc_sample_data/visium_tiny.qc.h5mu", "Visium")
8 changes: 8 additions & 0 deletions resources_test_scripts/qc_sample_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ viash run src/ingestion_qc/h5mu_to_qc_json/config.vsh.yaml --engine docker -- \
--output "$OUT_DIR_SPATIAL"/xenium_dataset.json \
--output_reporting_json "$OUT_DIR_SPATIAL"/xenium_report_structure.json

viash run src/ingestion_qc/h5mu_to_qc_json/config.vsh.yaml --engine docker -- \
--input "$OUT_DIR_SPATIAL"/Lung5_Rep2_tiny.qc.h5mu \
--input "$OUT_DIR_SPATIAL"/Lung5_Rep2_tiny.qc.h5mu \
--ingestion_method cosmx \
--min_num_nonzero_vars 1 \
--output "$OUT_DIR_SPATIAL"/cosmx_dataset.json \
--output_reporting_json "$OUT_DIR_SPATIAL"/cosmx_report_structure.json

viash run src/ingestion_qc/h5mu_to_qc_json/config.vsh.yaml --engine docker -- \
--input "$OUT_DIR_SPATIAL"/visium_tiny.qc.h5mu \
--input "$OUT_DIR_SPATIAL"/visium_tiny.qc.h5mu \
Expand Down
37 changes: 36 additions & 1 deletion src/ingestion_qc/h5mu_to_qc_json/config.vsh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ argument_groups:
choices:
- cellranger_multi
- xenium
- cosmx
- visium
description: Method that was used to ingest the data - this will define the structure of the report that is generated.
- name: --obs_sample_id
Expand Down Expand Up @@ -133,7 +134,41 @@ argument_groups:
description: The key in the h5mu .obs field that contains the number of control codewords.
default: control_codeword_counts

# - name: Options for CosMx reports
- name: Options for CosMx reports
arguments:
- name: --obs_area
type: string
description: The key in the h5mu .obs field that contains the cell area.
default: Area
- name: --obs_aspect_ratio
type: string
description: The key in the h5mu .obs field that contains the aspect ratio.
default: AspectRatio
- name: --obs_dapi_stain
type: string
multiple: true
description: The keys in the h5mu .obs field that contains the DAPI stain intensity.
default: [Mean.DAPI, Max.DAPI]
- name: --obs_membrane_stain
type: string
multiple: true
description: The keys in the h5mu .obs field that contains the membrane stain intensity.
default: [Mean.MembraneStain, Max.MembraneStain]
- name: --obs_panck_stain
type: string
multiple: true
description: The keys in the h5mu .obs field that contains the PanCK stain intensity.
default: [Mean.PanCK, Max.PanCK]
- name: --obs_cd45_stain
type: string
multiple: true
description: The keys in the h5mu .obs field that contains the CD45 stain intensity.
default: [Mean.CD45, Max.CD45]
- name: --obs_cd3_stain
type: string
multiple: true
description: The keys in the h5mu .obs field that contains the CD3 stain intensity.
default: [Mean.CD3, Max.CD3]

resources:
- type: python_script
Expand Down
211 changes: 211 additions & 0 deletions src/ingestion_qc/h5mu_to_qc_json/report_structure/cosmx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
{
"categories": [
{
"name": "Sample QC",
"key": "sample_summary_stats",
"additionalAxes": false,
"defaultFilters": []
},
{
"name": "Cell RNA QC",
"key": "cell_rna_stats",
"additionalAxes": true,
"defaultFilters": [
{
"type": "histogram",
"visualizationType": "histogram",
"field": "total_counts",
"label": "Total UMI per cell",
"description": "Total number of RNA molecules detected per cell. Low values typically indicate empty droplets or low-quality cells that should be filtered out.",
"cutoffMin": null,
"cutoffMax": null,
"zoomMax": null,
"nBins": 50,
"groupBy": "sample_id",
"yAxisType": "linear"
},
{
"type": "histogram",
"visualizationType": "histogram",
"field": "num_nonzero_vars",
"label": "Number of non-zero genes per cell",
"description": "Count of unique genes detected in each cell. Low gene counts often indicate poor-quality cells.",
"cutoffMin": null,
"cutoffMax": null,
"zoomMax": null,
"nBins": 50,
"groupBy": "sample_id",
"yAxisType": "linear"
},
{
"type": "histogram",
"visualizationType": "histogram",
"field": "fraction_mitochondrial",
"label": "Fraction UMI of mitochondrial genes per cell",
"description": "Proportion of cell's RNA from mitochondrial genes.",
"cutoffMin": null,
"cutoffMax": null,
"nBins": 50,
"groupBy": "sample_id",
"yAxisType": "linear"
},
{
"type": "histogram",
"visualizationType": "histogram",
"field": "fraction_ribosomal",
"label": "Fraction UMI of ribosomal genes per cell",
"description": "Proportion of cell's RNA from ribosomal protein genes. Extreme values may indicate stress responses or cell cycle abnormalities.",
"cutoffMin": null,
"cutoffMax": null,
"nBins": 50,
"groupBy": "sample_id",
"yAxisType": "linear"
},
{
"type": "histogram",
"visualizationType": "histogram",
"field": "Area",
"label": "Cell Area",
"description": "Area of the segmented cells.",
"cutoffMin": null,
"cutoffMax": null,
"nBins": 50,
"groupBy": "sample_id",
"yAxisType": "linear"
},
{
"type": "histogram",
"visualizationType": "histogram",
"field": "AspectRatio",
"label": "Aspect Ratio",
"description": "Aspect ratio of the segmented cells.",
"cutoffMin": null,
"cutoffMax": null,
"nBins": 50,
"groupBy": "sample_id",
"yAxisType": "linear"
},
{
"type": "histogram",
"visualizationType": "histogram",
"field": "Mean.DAPI",
"label": "Mean DAPI Intensity",
"description": "Mean intensity of DAPI stain.",
"cutoffMin": null,
"cutoffMax": null,
"nBins": 50,
"groupBy": "sample_id",
"yAxisType": "linear"
},
{
"type": "histogram",
"visualizationType": "histogram",
"field": "Mean.MembraneStain",
"label": "Mean Membrane Stain Intensity",
"description": "Mean intensity of Membrane stain.",
"cutoffMin": null,
"cutoffMax": null,
"nBins": 50,
"groupBy": "sample_id",
"yAxisType": "linear"
},
{
"type": "histogram",
"visualizationType": "histogram",
"field": "Mean.PanCK",
"label": "Mean PanCK Intensity",
"description": "Mean intensity of PanCK stain.",
"cutoffMin": null,
"cutoffMax": null,
"nBins": 50,
"groupBy": "sample_id",
"yAxisType": "linear"
},
{
"type": "histogram",
"visualizationType": "histogram",
"field": "Mean.CD45",
"label": "Mean CD45 Intensity",
"description": "Mean intensity of CD45 stain.",
"cutoffMin": null,
"cutoffMax": null,
"nBins": 50,
"groupBy": "sample_id",
"yAxisType": "linear"
},
{
"type": "histogram",
"visualizationType": "histogram",
"field": "Mean.CD3",
"label": "Mean CD3 Intensity",
"description": "Mean intensity of CD3 stain.",
"cutoffMin": null,
"cutoffMax": null,
"nBins": 50,
"groupBy": "sample_id",
"yAxisType": "linear"
},
{
"type": "histogram",
"visualizationType": "histogram",
"field": "Max.DAPI",
"label": "Max DAPI Intensity",
"description": "Maximum intensity of DAPI stain.",
"cutoffMin": null,
"cutoffMax": null,
"nBins": 50,
"groupBy": "sample_id",
"yAxisType": "linear"
},
{
"type": "histogram",
"visualizationType": "histogram",
"field": "Max.MembraneStain",
"label": "Max Membrane Stain Intensity",
"description": "Maximum intensity of Membrane stain.",
"cutoffMin": null,
"cutoffMax": null,
"nBins": 50,
"groupBy": "sample_id",
"yAxisType": "linear"
},
{
"type": "histogram",
"visualizationType": "histogram",
"field": "Max.PanCK",
"label": "Max PanCK Intensity",
"description": "Maximum intensity of PanCK stain.",
"cutoffMin": null,
"cutoffMax": null,
"nBins": 50,
"groupBy": "sample_id",
"yAxisType": "linear"
},
{
"type": "histogram",
"visualizationType": "histogram",
"field": "Max.CD45",
"label": "Max CD45 Intensity",
"description": "Maximum intensity of CD45 stain.",
"cutoffMin": null,
"cutoffMax": null,
"nBins": 50,
"groupBy": "sample_id",
"yAxisType": "linear"
},
{
"type": "histogram",
"visualizationType": "histogram",
"field": "Max.CD3",
"label": "Max CD3 Intensity",
"description": "Maximum intensity of CD3 stain.",
"cutoffMin": null,
"cutoffMax": null,
"nBins": 50,
"groupBy": "sample_id",
"yAxisType": "linear"
}
]
}
]
}
Loading