Skip to content

Commit

Permalink
Prettyfied json dump
Browse files Browse the repository at this point in the history
  • Loading branch information
fu committed Dec 5, 2018
1 parent 449467b commit 45c24d4
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 6 deletions.
46 changes: 45 additions & 1 deletion uparma/styles.json
Original file line number Diff line number Diff line change
@@ -1 +1,45 @@
{'msgfplus_style_1': {'name': 'MS-GF+', 'version': ['v2018.01.30', 'v2018.06.28', 'v2018.09.12'], 'reference': "Kim S, Mischerikow N, Bandeira N, Navarro JD, Wich L, 'Mohammed S, Heck AJ, Pevzner PA. (2010) The Generating Function of CID, ETD, and CID/ETD Pairs of Tandem Mass Spectra: Applications to Database Search."}, 'msfragger_style_1': {'name': 'MSFragger', 'version': ['20170103'], 'reference': 'Kong, A. T., Leprevost, F. V, Avtonomov, D. M., Mellacheruvu, D., and Nesvizhskii, A. I. (2017) MSFragger: ultrafast and comprehensive peptide identification in mass spectrometry-based proteomics. Nature Methods 14'}, 'ursgal_style_1': {'name': 'Ursgal', 'version': ['0.6.0', '0.6.1'], 'reference': 'Kremer, L. P. M., Leufken, J., Oyunchimeg, P., Schulze, S. & Fufezan, C. (2016) Ursgal, Universal Python Module Combining Common Bottom-Up Proteomics Tools for Large-Scale Analysis. J. Proteome res. 15, 788-794.'}, 'searchgui_style_1': {}, 'searchgui_style_2': {}, 'psi_ms_style_1': {}, 'xtandem_style_1': {'name': 'X!Tandem', 'version': ['vengeance', 'alanine'], 'reference': ''}, 'masamanda_style_1': {'name': 'MS Amanda', 'version': ['2_0_0_9695', '2_0_0_9706', '2_0_0_10695']}}
{
"masamanda_style_1": {
"name": "MS Amanda",
"version": [
"2_0_0_9695",
"2_0_0_9706",
"2_0_0_10695"
]
},
"msfragger_style_1": {
"name": "MSFragger",
"reference": "Kong, A. T., Leprevost, F. V, Avtonomov, D. M., Mellacheruvu, D., and Nesvizhskii, A. I. (2017) MSFragger: ultrafast and comprehensive peptide identification in mass spectrometry-based proteomics. Nature Methods 14",
"version": [
"20170103"
]
},
"msgfplus_style_1": {
"name": "MS-GF+",
"reference": "Kim S, Mischerikow N, Bandeira N, Navarro JD, Wich L, 'Mohammed S, Heck AJ, Pevzner PA. (2010) The Generating Function of CID, ETD, and CID/ETD Pairs of Tandem Mass Spectra: Applications to Database Search.",
"version": [
"v2018.01.30",
"v2018.06.28",
"v2018.09.12"
]
},
"psi_ms_style_1": {},
"searchgui_style_1": {},
"searchgui_style_2": {},
"ursgal_style_1": {
"name": "Ursgal",
"reference": "Kremer, L. P. M., Leufken, J., Oyunchimeg, P., Schulze, S. & Fufezan, C. (2016) Ursgal, Universal Python Module Combining Common Bottom-Up Proteomics Tools for Large-Scale Analysis. J. Proteome res. 15, 788-794.",
"version": [
"0.6.0",
"0.6.1"
]
},
"xtandem_style_1": {
"name": "X!Tandem",
"reference": "",
"version": [
"vengeance",
"alanine"
]
}
}
9 changes: 8 additions & 1 deletion uparma/uparma.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ def __init__(self, refresh_jsons=False, source_style="ursgal_style_1"):
if refresh_jsons is True:
with requests.get(url) as req:
with open(full_path, 'w') as j:
print(req.json(), file=j)
print(
json.dumps(
req.json(),
indent=2,
sort_keys=True
), file=j
)
self.jsons[url_id] = req.json()
else:
for url_id, url in URLS.items():
Expand All @@ -70,6 +76,7 @@ def _parse_jsons(self):
if json_type != 'parameters':
continue
for uparma_entry in self.jsons[url_id]:
print(uparma_entry)
_id = uparma_entry['_id']
self.parameters[_id] = uparma_entry

Expand Down
4 changes: 0 additions & 4 deletions uparma/uparma_dict.py

This file was deleted.

0 comments on commit 45c24d4

Please sign in to comment.