Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding json to mmcif files as part as deposition #412

Open
TJGorrie opened this issue Mar 29, 2022 · 0 comments
Open

Adding json to mmcif files as part as deposition #412

TJGorrie opened this issue Mar 29, 2022 · 0 comments
Assignees

Comments

@TJGorrie
Copy link

TJGorrie commented Mar 29, 2022

Requirements, a python3 environment with the adding_stats_to_mmcif python package (https://github.com/berrisfordjohn/adding_stats_to_mmcif) installed.

from adding_stats_to_mmcif.add_json_data_to_mmcif import *
import argparse

def addJson2mmcif(json_file, mmcif_file):
    gc = AddJsonDataToMmcif()
    data = gc.get_data(json_file)
    # Can either overwrite existing file, or write to a new one, not sure what would be the best to do...
    if data:
        ret = gc.add_to_cif(input_mmcif_file=mmcif_file, output_mmcif_file=mmcif_file, data_dictionary=data)

if __name__ ==  "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--json", help="input json file", required=True)
    parser.add_argument("--mmcif", help="input mmcif file", required=True)
    args = parser.parse_args()
    addJson2mmcif(json_file=args['json'], mmcif_file=args['mmcif'])

For DLS I suppose the script just needs to call the function and run it on each mmcif file providing an input crystallisation conditions from @Daren-fearon is located in an agreed place.

Example Json for testing:

 {
    "_entity_src_gen":{
        "pdbx_gene_src_ncbi_taxonomy_id": "562",
        "pdbx_gene_src_scientific_name": "Escherichia coli"
    },
    "_exptl_crystal":{
        "pdbx_crystal_image": "Y",
        "pdbx_crystal_image_format": "png",
        "pdbx_crystal_image_url": "https://htxlab.embl.fr/#/bridge/plates/CD030083/inspections/6#B9-1"
    },
    "_exptl_crystal_grow":{
        "crystal_id": "1",
        "method": "vapor diffusion",
        "apparatus": "CrystalDirect CD-2 Mitegen",
        "atmosphere": "room air",
        "pH": "6.1",
        "temp": "292",
        "time": "around 2 months"

    },
    "_pdbx_exptl_crystal_grow_comp": {
        "crystal_id": ["1", "1", "1"],
        "sol_id": ["reservoir", "reservoir", "reservoir"],
        "comp_id": ["1", "2", "3"],
        "comp_name": ["tri-sodium citrate", "isopropanol", "PEG 4000"],
        "conc": ["0.1", "20", "20"],
        "conc_units": ["molar", "percent_volume_by_volume", "percent_weight_by_volume"]
    },
    "_pdbx_exptl_crystal_grow_sol": {
        "crystal_id": ["1", "1"],
        "sol_id": ["macromolecule", "reservoir"],
        "volume": ["100", "100"],
        "volume_units": ["nl", "nl"]
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants