pierrepo / grodecoder

GroDecoder extracts and identifies the molecular components of a structure file (PDB or GRO) issued from a molecular dynamics simulation.
https://grodecoder.streamlit.app/
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Improve JSON export #46

Closed pierrepo closed 4 months ago

pierrepo commented 4 months ago

@KarinDuong the JSON export looks really great :tada:

Here are a couple of improvements:

JSON file name

The actual name of the JSON file is something like barstar_2024-05-23_07:34.json, could you make it like 2024-05-23_07-34-23_barstar.json?

Filename field

When running this command:

python grodecoder.py --input data/examples/barstar.gro

The filename field in the JSON contains only the filename.

Could you rename the filename field into file_path and get the full relative path? For instance:

"file_path": "data/examples/barstar.gro"

Date field

Also the date field in currently:

"date": "2024-05-23_07:34"

could you make it like this:

"date": "YYYY-MM-DD HH-MM-SS"

For instance:

"date": "2024-05-23 07-47-13"

Residue ids

Could you try to export the residue ids (intervals) for each molecule in the JSON?

I'm not sure about the appropriate format. You could try something like this:

"residue_ids": "34-56 67 83 88-102 106-184 189-212"
pierrepo commented 4 months ago

Bonus question: did you find a nice JSON viewer in VS Code?

pierrepo commented 4 months ago

One last thing, could you try filling the formula_no_h field?

KarinDuong commented 4 months ago

Bonus question: did you find a nice JSON viewer in VS Code?

I forgot to add indentation to the function json.dump(). Now it should be prettier, and it can be open with VS without specific viewer (imo)