Skip to content

Instantly share code, notes, and snippets.

@mwalzer
Last active April 27, 2020 11:03
Show Gist options
  • Save mwalzer/e12f02894ee7600ea79e5fa5b9c0f7df to your computer and use it in GitHub Desktop.
Save mwalzer/e12f02894ee7600ea79e5fa5b9c0f7df to your computer and use it in GitHub Desktop.
Exploring jsonpath with mzQC
N.b.: before pasting into tools like http://jsonpath.herokuapp.com/ or http://www.jsonquerytool.com/ remove excess , and ...,
...
"qualityMetrics": [
{"cvRef": "ref_not_prefix", "accession": "QC:123", "name": "metric1", "value": 1},...
],
"controlledVocabularies": [
{"ref": "ref_not_prefix", "name": "Proteomics Standards Initiative Quality Control Ontology", "uri": "https://github.com/HUPO-PSI/qcML-development/blob/master/cv/v0_1_0/qc-cv.obo", "version": "0.1.0"},
{"ref": "MS", "name": "Proteomics Standards Initiative Mass Spectrometry Ontology", "uri": "https://github.com/HUPO-PSI/psi-ms-CV/blob/master/psi-ms.obo", "version": "4.1.7"}
]
...
$.qualityMetrics[?(@.accession=="QC:123")].value
->
[
1
]
...
"qualityMetrics": [
{"cvRef": "ref_not_prefix", "accession": "QC:123", "name": "metric1", "value": 1},
{"cvRef": "also_ref", "accession": "QC:123", "name": "metric1", "value": 1.0001},...
],
"controlledVocabularies": [
{"ref": "ref_not_prefix", "name": "Proteomics Standards Initiative Quality Control Ontology", "uri": "https://github.com/HUPO-PSI/qcML-development/blob/master/cv/v0_1_0/qc-cv.obo", "version": "0.1.0"},
{"ref": "MS", "name": "Proteomics Standards Initiative Mass Spectrometry Ontology", "uri": "https://github.com/HUPO-PSI/psi-ms-CV/blob/master/psi-ms.obo", "version": "4.1.7"},
{"ref": "also_ref", "name": "Proteomics Standards Initiative Quality Control Ontology", "uri": "https://github.com/HUPO-PSI/qcML-development/blob/master/cv/v0_1_0/qc-cv.obo", "version": "0.1.1"}
]
...
$.qualityMetrics[?(@.accession=="QC:123")].value
->
[
1,
1.0001
]
target_ref = $.controlledVocabularies[?(@.uri=="https://github.com/HUPO-PSI/qcML-development/blob/master/cv/v0_1_0/qc-cv.obo"&&@.version=="0.1.1")].ref[0] // [also_ref]
$.qualityMetrics[?(@.accession=="QC:123"&&@.cvRef=="also_ref")].value
->
[
1.0001
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment