diff --git a/Dockerfile b/Dockerfile index 5e325e1394f06d5b8638e58bb507d3105d8972c7..8b8dd17a78f68da0d5138dd0470d25bcbfd9574d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,8 @@ COPY requirements.txt ${SRC_DIR} WORKDIR ${SRC_DIR} RUN set -e pipefail; \ apt-get update -y; \ - apt-get install -y git pip; \ + # for development, install venv + apt-get install -y git pip python3.8-venv; \ pip install -r requirements.txt; \ # for development, install black & PyLint pip install black pylint; \ diff --git a/translate2modelcif.py b/translate2modelcif.py index deb555130964f17ab3a31ac4f0645c6e663f4835..b092c6e1489c0f9e5366c38a4f6a200a79d5bc32 100644 --- a/translate2modelcif.py +++ b/translate2modelcif.py @@ -1,6 +1,5 @@ #! /usr/local/bin/ost """Translate models from Tara/ Xabi from PDB + extra data into ModelCIF.""" -# ToDo [internal]: Add software group for ColabFold and AF2-Multimer # ToDo [internal]: get DB versions in - https://colabfold.mmseqs.com, scroll # down to "Database Information" @@ -57,7 +56,6 @@ def _parse_args(): class _GlobalPTM(modelcif.qa_metric.Global, modelcif.qa_metric.PTM): """Predicted accuracy according to the TM-score score in [0,1].""" - # ToDo [input]: Add software name = "pTM" software = None @@ -220,9 +218,10 @@ def _check_model_extra_files_present(model_dir, pdb_file): def _get_audit_authors(): """Return the list of authors that produced this model.""" + # ToDo: tell Xabi that his name can't have a á in mmCIF return ( "Bartolec T", - "Vázquez-Campos X", + "Vazquez-Campos X", "Johnson M", "Norman A", "Payne R", @@ -267,7 +266,7 @@ def _get_protocol_steps_and_software(cnfg_file): "year": 2022, "authors": [ "Mirdita M", - "Schütze K", + "Schuetze K", "Moriwaki Y", "Heo L", "Ovchinnikov S", @@ -294,7 +293,7 @@ def _get_protocol_steps_and_software(cnfg_file): "authors": [ "Mirdita M", "Steinegger M", - "Söding J", + "Soeding J", ], "doi": "10.1093/bioinformatics/bty1057", }, @@ -321,7 +320,7 @@ def _get_protocol_steps_and_software(cnfg_file): "Antropova N", "Senior A", "Green T", - "Žídek A", + "Zidek A", "Bates R", "Blackwell S", "Yim J", @@ -613,16 +612,20 @@ def _get_modelcif_protocol(protocol_steps, target_entities, model): for sft in js_step["software"]: sftwre.append(_assemble_modelcif_software(sft)) sftwre = modelcif.SoftwareGroup(elements=sftwre) - # if js_step['software_parameters']: - # params = [] - # # ToDo [internal]: handle lists! - # for k, v in js_step['software_parameters'].items(): - # params.append( - # modelcif.SoftwareParameter(k, v) - # ) - # sftwre = modelcif.SoftwareGroup( - # elements=(sftwre,), parameters=params - # ) + # ToDo [internal]: add software parameters + if js_step['software_parameters']: + params = [] + # ToDo [internal]: handle lists! + for k, v in js_step['software_parameters'].items(): + params.append( + modelcif.SoftwareParameter(k, v) + ) + if isinstance(sftwre, modelcif.SoftwareGroup): + sftwre.parameters = params + else: + sftwre = modelcif.SoftwareGroup( + elements=(sftwre,), parameters=params + ) if js_step["input"] == "target_sequences": input_data = modelcif.data.DataGroup(target_entities) @@ -710,7 +713,7 @@ def _store_as_modelcif(interaction_name, data_json, ost_ent, file_prfx): # write modelcif System to file print(" write to disk...", end="", flush=True) pstart = timer() - with open(f"{file_prfx}.cif", "w", encoding="utf8") as mmcif_fh: + with open(f"{file_prfx}.cif", "w", encoding="ascii") as mmcif_fh: modelcif.dumper.write(mmcif_fh, [system]) print(f" ({timer()-pstart:.2f}s)")