hubmapconsortium / epic-obj-csv-to-mudata

GNU General Public License v3.0
1 stars 0 forks source link

Verify JSON metadata export #1

Open mruffalo opened 2 months ago

mruffalo commented 2 months ago

This is the current implementation of writing metadata in JSON format for ingest into HuBMAP infrastructure:

def extract_metadata_write_json(mdata: mudata.MuData, output_json: Path):
    data = {}
    if "ontology" in mdata.obsm:
        if "Object type" in mdata.obsm["ontology"]:
            data["object_types"] = sorted(set(mdata.obsm["ontology"]["Object type"]))
    if "Annotation tool" in mdata.obs:
        data["annotation_tools"] = sorted(set(mdata.obs["Annotation tool"]))
    with open(output_json, "w") as f:
        json.dump(data, f)

Verify this with @jpuerto-psc and others to ensure we're writing everything appropriate/useful/necessary.

mruffalo commented 2 months ago

Added the set of distinct mask names as per @jpuerto-psc.