diff --git a/.spelling b/.spelling new file mode 100644 index 0000000000000000000000000000000000000000..0b5aca64943dfa6b724918aa34d2ad73cd47cfeb --- /dev/null +++ b/.spelling @@ -0,0 +1,18 @@ +Biopython +CIF +FastA +Jupyter +MSA +ModelCIF +PAE +PDB +PPI +coevolution +modeled +modeling +multimer +polypeptide +pre +repo +reproducibility +subdirectory diff --git a/convert_to_modelcif.py b/convert_to_modelcif.py index 0c7a11a4297673371c44fae3a3d76ca2e717e181..dbfae0fb71a9f9dfaaf8f180b73d0043b9fa775a 100755 --- a/convert_to_modelcif.py +++ b/convert_to_modelcif.py @@ -77,7 +77,7 @@ class _GlobalPTM(modelcif.qa_metric.Global, modelcif.qa_metric.PTM): class _GlobalIPTM(modelcif.qa_metric.Global, modelcif.qa_metric.IpTM): - # python-modelcif reads the first line of class-doc has description of a + # `python-modelcif` reads the first line of class-doc has description of a # score, so we need to allow long lines, here. # pylint: disable=line-too-long """Predicted protein-protein interface score, based on the TM-score score in [0,1].""" @@ -111,7 +111,7 @@ class _LocalPairwisePAE(modelcif.qa_metric.LocalPairwise, _PAE): class _Biopython2ModelCIF(modelcif.model.AbInitioModel): - """Map Biopython PDB.Structure object to ihm.model""" + """Map Biopython `PDB.Structure()` object to `ihm.model()`.""" def __init__(self, *args, **kwargs): """Initialise a model""" @@ -152,7 +152,7 @@ class _Biopython2ModelCIF(modelcif.model.AbInitioModel): ) # local scores - # iterate polypetide chains + # iterate polypeptide chains # local PLDDT i = 0 lpae = [] @@ -239,7 +239,7 @@ def _get_step_output_method_type(method_type, protocol_steps): """Get the output of a protocol step of a certain type.""" for step in protocol_steps: if step.method_type == method_type: - # modelcif.data.DataGroup is some kind of list + # `modelcif.data.DataGroup()` is some kind of list if isinstance(step.output_data, list): return step.output_data return modelcif.data.DataGroup(step.output_data) @@ -309,12 +309,16 @@ def _get_modelcif_protocol( # add software w/o individual parameters sw_grp.append(sw_dict[pss]) # add software with individual parameters + # Commented out code does not need spelling check, so disable + # it in Pylint + # pylint: disable=wrong-spelling-in-comment # sw_grp.append( # modelcif.SoftwareWithParameters( # sw_dict[pss], # [modelcif.SoftwareParameter(<name>, <value>)], # ) # ) + # pylint: enable=wrong-spelling-in-comment # ToDo: make sure AlphaPulldown is first in the SoftwareGroup() list, # AlphaFold second; that influences citation order in the ModelCIF # file. @@ -334,7 +338,7 @@ def _get_modelcif_protocol( def _get_modelcif_ref_dbs(meta_json): - """Get sequence DBs used for monomer features.""" + """Get sequence databases used for monomer features.""" # vendor formatting for DB names/ URLs, extend on KeyError db_info = { "uniref90": { @@ -435,13 +439,13 @@ def _store_as_modelcif( # pickle files quickly exceeds reasonable storage use # - 'modeling' (run_multimer_jobs.py), are the four modes reflected by # the JSON data/ does the JSON data look different for each mode? - # - are the scores only calculated by alpha-analysis.sif or do they + # - are the scores only calculated by `alpha-analysis.sif` or do they # come out of run_multimer_jobs.py? Does this go into its own step? # - what about including the tabular summary? # - model selection: only if just a certain model is translated to # ModelCIF, or mix it with scoring step? # - # - cancer-PPI-domains has 'coevolutin MSA' + # - cancer-PPI-domains has 'coevolution MSA' # - then modelling # - do we have an example with a split MSA & modelling step? # - model selection like for Tara @@ -457,7 +461,7 @@ def _store_as_modelcif( ) ) - # write modelcif.System to file + # write `modelcif.System()` to file # NOTE: this will dump PAE on path provided in add_scores # -> hence we cheat by changing path and back while being exception-safe... oldpwd = os.getcwd() @@ -484,7 +488,7 @@ def _store_as_modelcif( def _compress_cif_file(cif_file): - """Compress cif file and delete original.""" + """Compress CIF file and delete original.""" with open(cif_file, "rb") as f_in: with gzip.open(cif_file + ".gz", "wb") as f_out: shutil.copyfileobj(f_in, f_out) @@ -495,7 +499,7 @@ def _get_model_details(cmplx_name: str, data_json: dict) -> str: """Get the model description.""" ap_versions = [] af2_version = None - for mnmr in data_json["__meta__"]: # mnmr = monomer + for mnmr in data_json["__meta__"]: # `mnmr = monomer` if ( data_json["__meta__"][mnmr]["software"]["AlphaPulldown"]["version"] not in ap_versions @@ -632,7 +636,7 @@ def _get_scores(cif_json: dict, scr_file: str) -> None: def _get_software_data(meta_json: dict) -> list: - """Turn meta data about software into modelcif.Software objects.""" + """Turn meta data about software into `modelcif.Software()` objects.""" cite_hhsuite = ihm.Citation( pmid="31521110", title="HH-suite3 for fast remote homology detection and deep " @@ -651,7 +655,7 @@ def _get_software_data(meta_json: dict) -> list: ], doi="10.1186/s12859-019-3019-7", ) - # {key from json: dict needed to produce sw entry plus internal key} + # {key from JSON: dict needed to produce software entry plus internal key} sw_data = { "AlphaFold": modelcif.Software( "AlphaFold-Multimer", @@ -811,7 +815,7 @@ def _get_protocol_steps(modelcif_json): # model selection step <- ask if there is automated selection, if only # manual, skip this step here? - # ToDo: Example 1 in the GitHub repo has a 3rd step: "Evalutaion and + # ToDo: Example 1 in the GitHub repo has a 3rd step: "Evaluation and # visualisation" return protocol @@ -980,6 +984,3 @@ if __name__ == "__main__": # From former discussions: # - including Jupyter notebooks would require adding the pickle files to the # associated files (too much storage needed for that) - -# LocalWords: ToDo AlphaPulldown PAEs dir struct coevolution MSA py modeling -# LocalWords: multimer sif Jupyter aa MSAs diff --git a/pyproject.toml b/pyproject.toml index f9bbc980b0989ac6396bd77332b9b7c90f98df8a..39913b661df304953bcf89905003eda628206c19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,4 +21,19 @@ max-line-length = 81 [tool.pylint.deprecated_builtins] # We want to use proper logging, so we can control *ALL* output bei the Abseil # logger, hence: deprecate 'print' -bad-functions = ["map", "filter", "print"] \ No newline at end of file +bad-functions = ["map", "filter", "print"] + +# Run the spell check every once in a while, having it enabled always, is too +# annoying. +#[tool.pylint.spelling] +#max-spelling-suggestions = 4 +# +#spelling-dict = "en_GB" +# +#spelling-ignore-comment-directives = "fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:" +# +#spelling-ignore-words = "" +# +#spelling-private-dict-file = ".spelling" +# +#spelling-store-unknown-words = false \ No newline at end of file