diff --git a/.yamllint.yml b/.yamllint.yml index bc4e534..a2c76e0 100644 --- a/.yamllint.yml +++ b/.yamllint.yml @@ -5,11 +5,11 @@ # Project Homepage: https://github.com/adrienverge/yamllint # # Overriding rules in files: -# http://yamllint.readthedocs.io/en/latest/disable_with_comments.html +# https://yamllint.readthedocs.io/en/latest/disable_with_comments.html --- extends: default -# Rules documentation: http://yamllint.readthedocs.io/en/latest/rules.html +# Rules documentation: https://yamllint.readthedocs.io/en/latest/rules.html rules: document-start: disable line-length: diff --git a/api_paper_2024/example_2/about_entry.py b/api_paper_2024/example_2/about_entry.py index 05675bc..9005f14 100644 --- a/api_paper_2024/example_2/about_entry.py +++ b/api_paper_2024/example_2/about_entry.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. diff --git a/api_paper_2024/example_2/language_processing.py b/api_paper_2024/example_2/language_processing.py index 5dda924..da6a07d 100644 --- a/api_paper_2024/example_2/language_processing.py +++ b/api_paper_2024/example_2/language_processing.py @@ -23,7 +23,7 @@ pages ="7233-7241", publisher ="The Royal Society of Chemistry", doi ="10.1039/D0CE00045K", -url ="http://dx.doi.org/10.1039/D0CE00045K", +url ="https://dx.doi.org/10.1039/D0CE00045K", """ # For now, to prevent deprecation warnings tripping things up import warnings diff --git a/api_paper_2024/example_2/references.py b/api_paper_2024/example_2/references.py index f187194..df69d4c 100644 --- a/api_paper_2024/example_2/references.py +++ b/api_paper_2024/example_2/references.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. diff --git a/api_paper_2024/example_2/url_requesting.py b/api_paper_2024/example_2/url_requesting.py index b9460d3..b4ddb15 100644 --- a/api_paper_2024/example_2/url_requesting.py +++ b/api_paper_2024/example_2/url_requesting.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. diff --git a/api_paper_2024/example_4/mercury_metal_voronoi.py b/api_paper_2024/example_4/mercury_metal_voronoi.py index c9db337..1ac1c74 100644 --- a/api_paper_2024/example_4/mercury_metal_voronoi.py +++ b/api_paper_2024/example_4/mercury_metal_voronoi.py @@ -1,6 +1,6 @@ # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. diff --git a/api_paper_2024/example_4/mercury_molecular_voronoi.py b/api_paper_2024/example_4/mercury_molecular_voronoi.py index 754ce0b..a8ea7af 100644 --- a/api_paper_2024/example_4/mercury_molecular_voronoi.py +++ b/api_paper_2024/example_4/mercury_molecular_voronoi.py @@ -1,6 +1,6 @@ # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. diff --git a/api_paper_2024/example_4/voronoi.py b/api_paper_2024/example_4/voronoi.py index bf28035..65e93bb 100644 --- a/api_paper_2024/example_4/voronoi.py +++ b/api_paper_2024/example_4/voronoi.py @@ -1,6 +1,6 @@ # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. diff --git a/api_paper_2024/example_5/particle_shape.py b/api_paper_2024/example_5/particle_shape.py index 74576a4..52bcda4 100644 --- a/api_paper_2024/example_5/particle_shape.py +++ b/api_paper_2024/example_5/particle_shape.py @@ -1,6 +1,6 @@ # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. diff --git a/api_paper_2024/example_5/shape_classification.py b/api_paper_2024/example_5/shape_classification.py index b4ff62f..bb0b0f3 100644 --- a/api_paper_2024/example_5/shape_classification.py +++ b/api_paper_2024/example_5/shape_classification.py @@ -1,6 +1,6 @@ # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. diff --git a/api_paper_2024/example_5/visualiser.py b/api_paper_2024/example_5/visualiser.py index 1397f43..e6f8277 100644 --- a/api_paper_2024/example_5/visualiser.py +++ b/api_paper_2024/example_5/visualiser.py @@ -1,6 +1,6 @@ # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. diff --git a/notebooks/API_Training_Exercises/01_Simple_Report.ipynb b/notebooks/API_Training_Exercises/01_Simple_Report.ipynb index 4bfc560..195f10c 100644 --- a/notebooks/API_Training_Exercises/01_Simple_Report.ipynb +++ b/notebooks/API_Training_Exercises/01_Simple_Report.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/00_Background/00_Background.ipynb b/notebooks/Discovery/00_Background/00_Background.ipynb index 18e6fec..0f95da9 100644 --- a/notebooks/Discovery/00_Background/00_Background.ipynb +++ b/notebooks/Discovery/00_Background/00_Background.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", @@ -501,7 +501,7 @@ "source": [ "### RDKit\n", "\n", - "As noted above, the Python API is primarily intended as a means of programatically accessing the CSD and the various tools provided by the CCDC. It is not currently intended to be a full-featured cheminformatics toolkit, although the Molecule API can certainly be used for a variety of chemiformatics tasks. Where functionality is not present in the Molecule API, we normally use the [RDKit](http://rdkit.org/docs/index.html), as it is freely-available, powerful and well-supported." + "As noted above, the Python API is primarily intended as a means of programatically accessing the CSD and the various tools provided by the CCDC. It is not currently intended to be a full-featured cheminformatics toolkit, although the Molecule API can certainly be used for a variety of chemiformatics tasks. Where functionality is not present in the Molecule API, we normally use the [RDKit](https://rdkit.org/docs/index.html), as it is freely-available, powerful and well-supported." ] }, { diff --git a/notebooks/Discovery/01_CSD_Search/01_Substructure_searching_the_CSD.ipynb b/notebooks/Discovery/01_CSD_Search/01_Substructure_searching_the_CSD.ipynb index 9d4ffdf..4eb5d69 100644 --- a/notebooks/Discovery/01_CSD_Search/01_Substructure_searching_the_CSD.ipynb +++ b/notebooks/Discovery/01_CSD_Search/01_Substructure_searching_the_CSD.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", @@ -526,10 +526,10 @@ "evalue": "'NoneType' object is not subscriptable", "output_type": "error", "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[1;32mIn[26], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m (\u001b[43mconquest_df\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mRefcode\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m \u001b[38;5;241m==\u001b[39m connser_df[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mRefcode\u001b[39m\u001b[38;5;124m'\u001b[39m])\u001b[38;5;241m.\u001b[39mall()\n", - "\u001b[1;31mTypeError\u001b[0m: 'NoneType' object is not subscriptable" + "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m", + "\u001B[1;31mTypeError\u001B[0m Traceback (most recent call last)", + "Cell \u001B[1;32mIn[26], line 1\u001B[0m\n\u001B[1;32m----> 1\u001B[0m \u001B[38;5;28;01massert\u001B[39;00m (\u001B[43mconquest_df\u001B[49m\u001B[43m[\u001B[49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43mRefcode\u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[43m]\u001B[49m \u001B[38;5;241m==\u001B[39m connser_df[\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mRefcode\u001B[39m\u001B[38;5;124m'\u001B[39m])\u001B[38;5;241m.\u001B[39mall()\n", + "\u001B[1;31mTypeError\u001B[0m: 'NoneType' object is not subscriptable" ] } ], diff --git a/notebooks/Discovery/01_CSD_Search/02_Similarity_searching_the_CSD.ipynb b/notebooks/Discovery/01_CSD_Search/02_Similarity_searching_the_CSD.ipynb index 5beea0d..0ff80f6 100644 --- a/notebooks/Discovery/01_CSD_Search/02_Similarity_searching_the_CSD.ipynb +++ b/notebooks/Discovery/01_CSD_Search/02_Similarity_searching_the_CSD.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/01_CSD_Search/03_MCS_searching_the_CSD.ipynb b/notebooks/Discovery/01_CSD_Search/03_MCS_searching_the_CSD.ipynb index 422e1a9..30d31dc 100644 --- a/notebooks/Discovery/01_CSD_Search/03_MCS_searching_the_CSD.ipynb +++ b/notebooks/Discovery/01_CSD_Search/03_MCS_searching_the_CSD.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/02_Protein_Ligand/01_Protein_Ligand_Searching.ipynb b/notebooks/Discovery/02_Protein_Ligand/01_Protein_Ligand_Searching.ipynb index c8660e6..eacfd1a 100644 --- a/notebooks/Discovery/02_Protein_Ligand/01_Protein_Ligand_Searching.ipynb +++ b/notebooks/Discovery/02_Protein_Ligand/01_Protein_Ligand_Searching.ipynb @@ -7,7 +7,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/02_Protein_Ligand/02_API_Protein-Ligand_search_for_FAD.ipynb b/notebooks/Discovery/02_Protein_Ligand/02_API_Protein-Ligand_search_for_FAD.ipynb index b477ab0..92dc567 100644 --- a/notebooks/Discovery/02_Protein_Ligand/02_API_Protein-Ligand_search_for_FAD.ipynb +++ b/notebooks/Discovery/02_Protein_Ligand/02_API_Protein-Ligand_search_for_FAD.ipynb @@ -7,7 +7,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/03_Molecular_geometries/Molecular_geometries.ipynb b/notebooks/Discovery/03_Molecular_geometries/Molecular_geometries.ipynb index 4bdef41..a8fb44a 100644 --- a/notebooks/Discovery/03_Molecular_geometries/Molecular_geometries.ipynb +++ b/notebooks/Discovery/03_Molecular_geometries/Molecular_geometries.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", @@ -16,6 +16,13 @@ "```" ] }, + { + "metadata": {}, + "cell_type": "code", + "outputs": [], + "execution_count": null, + "source": "" + }, { "cell_type": "markdown", "metadata": {}, diff --git a/notebooks/Discovery/04_Conformer_generation/Conformer_generation.ipynb b/notebooks/Discovery/04_Conformer_generation/Conformer_generation.ipynb index 0a78277..d08016d 100644 --- a/notebooks/Discovery/04_Conformer_generation/Conformer_generation.ipynb +++ b/notebooks/Discovery/04_Conformer_generation/Conformer_generation.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/05_Molecular_interactions/Molecular_interactions.ipynb b/notebooks/Discovery/05_Molecular_interactions/Molecular_interactions.ipynb index 5251b28..75cdc79 100644 --- a/notebooks/Discovery/05_Molecular_interactions/Molecular_interactions.ipynb +++ b/notebooks/Discovery/05_Molecular_interactions/Molecular_interactions.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/06_Interaction_maps/Interaction_maps.ipynb b/notebooks/Discovery/06_Interaction_maps/Interaction_maps.ipynb index 8195347..4df59bb 100644 --- a/notebooks/Discovery/06_Interaction_maps/Interaction_maps.ipynb +++ b/notebooks/Discovery/06_Interaction_maps/Interaction_maps.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/07_Cavities/Cavities.ipynb b/notebooks/Discovery/07_Cavities/Cavities.ipynb index 5a3743a..70ad435 100644 --- a/notebooks/Discovery/07_Cavities/Cavities.ipynb +++ b/notebooks/Discovery/07_Cavities/Cavities.ipynb @@ -7,7 +7,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/07_Cavities/pdbe_get.ps1 b/notebooks/Discovery/07_Cavities/pdbe_get.ps1 index ff50f0a..eeeb828 100644 --- a/notebooks/Discovery/07_Cavities/pdbe_get.ps1 +++ b/notebooks/Discovery/07_Cavities/pdbe_get.ps1 @@ -4,7 +4,7 @@ $pdb_code = $pdb_code.ToLower() - $uri = [System.Uri]"http://www.ebi.ac.uk/pdbe/entry-files/download/pdb${pdb_code}.ent" + $uri = [System.Uri]"https://www.ebi.ac.uk/pdbe/entry-files/download/pdb${pdb_code}.ent" $pdb_file = Join-Path -Path $(Convert-Path '.') -ChildPath $uri.Segments[-1] # Absolute path for output file diff --git a/notebooks/Discovery/08_Docking/00a_Input_for_GOLD.ipynb b/notebooks/Discovery/08_Docking/00a_Input_for_GOLD.ipynb index 40d2dc2..d9cab2d 100644 --- a/notebooks/Discovery/08_Docking/00a_Input_for_GOLD.ipynb +++ b/notebooks/Discovery/08_Docking/00a_Input_for_GOLD.ipynb @@ -7,7 +7,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", @@ -26,7 +26,7 @@ "\n", "For optimal performance, GOLD requires a good-quality 3D ligand structure as input. The CSD [Molecule API](https://downloads.ccdc.cam.ac.uk/documentation/API/modules/molecule_api.html) and [Conformer API](https://downloads.ccdc.cam.ac.uk/documentation/API/modules/conformer_api.html) can now be used together to generate such structures. This notebook is designed to show how this can be done.\n", "\n", - "Note that it is assumed that the input structures are all in the desired charge and tautomeric states. No protonation/deprotonation or tautomer standardization/enumeration is done here. This is currently out of scope for the [CSD Python API](https://downloads.ccdc.cam.ac.uk/documentation/API/index.html), but we recommend [RDKit](http://www.rdkit.org/docs/GettingStartedInPython.html) to those who wish to investigate it further." + "Note that it is assumed that the input structures are all in the desired charge and tautomeric states. No protonation/deprotonation or tautomer standardization/enumeration is done here. This is currently out of scope for the [CSD Python API](https://downloads.ccdc.cam.ac.uk/documentation/API/index.html), but we recommend [RDKit](https://www.rdkit.org/docs/GettingStartedInPython.html) to those who wish to investigate it further." ] }, { diff --git a/notebooks/Discovery/08_Docking/00b_Input_for_GOLD-RDKit.ipynb b/notebooks/Discovery/08_Docking/00b_Input_for_GOLD-RDKit.ipynb index 3c9398b..429d80e 100644 --- a/notebooks/Discovery/08_Docking/00b_Input_for_GOLD-RDKit.ipynb +++ b/notebooks/Discovery/08_Docking/00b_Input_for_GOLD-RDKit.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", @@ -26,7 +26,7 @@ "\n", "For optimal performance, GOLD requires good-quality 3D ligand structures as input (note that it only requires a single conformer as it performs flexible docking based on the input structure). Now, the [Conformer API](https://downloads.ccdc.cam.ac.uk/documentation/API/modules/conformer_api.html) can be used to generate a 3D structure that reflects conformational preferences observed in the CSD and thus provides ideal input for GOLD. This process is illustrated in the notebook [00a_Input_for_GOLD](./00a_Input_for_GOLD.ipynb).\n", "\n", - "However, if this tool is not available (_e.g._ for licencing reasons), we recommend the use of [RDKit](http://rdkit.org/) to generate an initial 3D structure.\n", + "However, if this tool is not available (_e.g._ for licencing reasons), we recommend the use of [RDKit](https://rdkit.org/) to generate an initial 3D structure.\n", "\n", "Note that it is assumed that the input structures are all in the desired charge and tautomeric states. No protonation/deprotonation or tautomer standardization/enumeration is done here." ] diff --git a/notebooks/Discovery/08_Docking/01_Docking_foreground.ipynb b/notebooks/Discovery/08_Docking/01_Docking_foreground.ipynb index a4b712c..983bb96 100644 --- a/notebooks/Discovery/08_Docking/01_Docking_foreground.ipynb +++ b/notebooks/Discovery/08_Docking/01_Docking_foreground.ipynb @@ -7,7 +7,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/08_Docking/02_Docking_background_conf.ipynb b/notebooks/Discovery/08_Docking/02_Docking_background_conf.ipynb index 799a77e..cb0747f 100644 --- a/notebooks/Discovery/08_Docking/02_Docking_background_conf.ipynb +++ b/notebooks/Discovery/08_Docking/02_Docking_background_conf.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/08_Docking/03_Docking_interactive.ipynb b/notebooks/Discovery/08_Docking/03_Docking_interactive.ipynb index 683230f..fd8799e 100644 --- a/notebooks/Discovery/08_Docking/03_Docking_interactive.ipynb +++ b/notebooks/Discovery/08_Docking/03_Docking_interactive.ipynb @@ -7,7 +7,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/08_Docking/04_Docking_interactive_conf.ipynb b/notebooks/Discovery/08_Docking/04_Docking_interactive_conf.ipynb index 0bef360..944ec78 100644 --- a/notebooks/Discovery/08_Docking/04_Docking_interactive_conf.ipynb +++ b/notebooks/Discovery/08_Docking/04_Docking_interactive_conf.ipynb @@ -7,7 +7,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/08_Docking/05_Parameter_tests.ipynb b/notebooks/Discovery/08_Docking/05_Parameter_tests.ipynb index feeaa2b..efed8ac 100644 --- a/notebooks/Discovery/08_Docking/05_Parameter_tests.ipynb +++ b/notebooks/Discovery/08_Docking/05_Parameter_tests.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/09_Covalent_Docking/01_Ligand_Preparation_for_Covalent_Docking.ipynb b/notebooks/Discovery/09_Covalent_Docking/01_Ligand_Preparation_for_Covalent_Docking.ipynb index f190033..7cf78c4 100644 --- a/notebooks/Discovery/09_Covalent_Docking/01_Ligand_Preparation_for_Covalent_Docking.ipynb +++ b/notebooks/Discovery/09_Covalent_Docking/01_Ligand_Preparation_for_Covalent_Docking.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", @@ -113,11 +113,11 @@ "evalue": "DLL load failed while importing rdmolfiles: The specified procedure could not be found.", "output_type": "error", "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mImportError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[1;32mIn[2], line 2\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mrdkit\u001b[39;00m\n\u001b[1;32m----> 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrdkit\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Chem\n\u001b[0;32m 3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrdkit\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mChem\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m AllChem, PandasTools\n\u001b[0;32m 4\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrdkit\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mChem\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mDraw\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m IPythonConsole\n", - "File \u001b[1;32m~\\Anaconda3\\envs\\latest_csd_python_api\\lib\\site-packages\\rdkit\\Chem\\__init__.py:23\u001b[0m\n\u001b[0;32m 21\u001b[0m _HasSubstructMatchStr \u001b[38;5;241m=\u001b[39m rdchem\u001b[38;5;241m.\u001b[39m_HasSubstructMatchStr\n\u001b[0;32m 22\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrdkit\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mChem\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mrdchem\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n\u001b[1;32m---> 23\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrdkit\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mChem\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mrdmolfiles\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n\u001b[0;32m 24\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrdkit\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mChem\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mrdmolops\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n\u001b[0;32m 25\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mrdkit\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mChem\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mrdCIPLabeler\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n", - "\u001b[1;31mImportError\u001b[0m: DLL load failed while importing rdmolfiles: The specified procedure could not be found." + "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m", + "\u001B[1;31mImportError\u001B[0m Traceback (most recent call last)", + "Cell \u001B[1;32mIn[2], line 2\u001B[0m\n\u001B[0;32m 1\u001B[0m \u001B[38;5;28;01mimport\u001B[39;00m \u001B[38;5;21;01mrdkit\u001B[39;00m\n\u001B[1;32m----> 2\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mrdkit\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m Chem\n\u001B[0;32m 3\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mrdkit\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mChem\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m AllChem, PandasTools\n\u001B[0;32m 4\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mrdkit\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mChem\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mDraw\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m IPythonConsole\n", + "File \u001B[1;32m~\\Anaconda3\\envs\\latest_csd_python_api\\lib\\site-packages\\rdkit\\Chem\\__init__.py:23\u001B[0m\n\u001B[0;32m 21\u001B[0m _HasSubstructMatchStr \u001B[38;5;241m=\u001B[39m rdchem\u001B[38;5;241m.\u001B[39m_HasSubstructMatchStr\n\u001B[0;32m 22\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mrdkit\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mChem\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mrdchem\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m \u001B[38;5;241m*\u001B[39m\n\u001B[1;32m---> 23\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mrdkit\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mChem\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mrdmolfiles\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m \u001B[38;5;241m*\u001B[39m\n\u001B[0;32m 24\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mrdkit\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mChem\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mrdmolops\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m \u001B[38;5;241m*\u001B[39m\n\u001B[0;32m 25\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01mrdkit\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mChem\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mrdCIPLabeler\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m \u001B[38;5;241m*\u001B[39m\n", + "\u001B[1;31mImportError\u001B[0m: DLL load failed while importing rdmolfiles: The specified procedure could not be found." ] } ], diff --git a/notebooks/Discovery/09_Covalent_Docking/02a_Covalent_Complexes-atom.ipynb b/notebooks/Discovery/09_Covalent_Docking/02a_Covalent_Complexes-atom.ipynb index f1df6e9..d0fb4df 100644 --- a/notebooks/Discovery/09_Covalent_Docking/02a_Covalent_Complexes-atom.ipynb +++ b/notebooks/Discovery/09_Covalent_Docking/02a_Covalent_Complexes-atom.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/09_Covalent_Docking/02b_Covalent_Complexes-substructure.ipynb b/notebooks/Discovery/09_Covalent_Docking/02b_Covalent_Complexes-substructure.ipynb index 60886e8..a92d38a 100644 --- a/notebooks/Discovery/09_Covalent_Docking/02b_Covalent_Complexes-substructure.ipynb +++ b/notebooks/Discovery/09_Covalent_Docking/02b_Covalent_Complexes-substructure.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/09_Covalent_Docking/10_Prochiral_Michael_Acceptors.ipynb b/notebooks/Discovery/09_Covalent_Docking/10_Prochiral_Michael_Acceptors.ipynb index 6a6d87c..560768a 100644 --- a/notebooks/Discovery/09_Covalent_Docking/10_Prochiral_Michael_Acceptors.ipynb +++ b/notebooks/Discovery/09_Covalent_Docking/10_Prochiral_Michael_Acceptors.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/10_Editing_molecules/Editing_molecules.ipynb b/notebooks/Discovery/10_Editing_molecules/Editing_molecules.ipynb index cea6075..ac0d7d0 100644 --- a/notebooks/Discovery/10_Editing_molecules/Editing_molecules.ipynb +++ b/notebooks/Discovery/10_Editing_molecules/Editing_molecules.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/11_Working_With_Proteins/11_Working_With_Proteins.ipynb b/notebooks/Discovery/11_Working_With_Proteins/11_Working_With_Proteins.ipynb index 4c70516..9aa0b3f 100644 --- a/notebooks/Discovery/11_Working_With_Proteins/11_Working_With_Proteins.ipynb +++ b/notebooks/Discovery/11_Working_With_Proteins/11_Working_With_Proteins.ipynb @@ -6,7 +6,7 @@ "source": [ "```\n", "This script can be used for any purpose without limitation subject to the\n", - "conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be\n", "included in all copies or substantial portions of this script.\n", diff --git a/notebooks/Discovery/11_Working_With_Proteins/3kk6.cif b/notebooks/Discovery/11_Working_With_Proteins/3kk6.cif index ae372ab..1c60a49 100644 --- a/notebooks/Discovery/11_Working_With_Proteins/3kk6.cif +++ b/notebooks/Discovery/11_Working_With_Proteins/3kk6.cif @@ -4,7 +4,7 @@ _entry.id 3KK6 # _audit_conform.dict_name mmcif_pdbx.dic _audit_conform.dict_version 5.329 -_audit_conform.dict_location http://mmcif.pdb.org/dictionaries/ascii/mmcif_pdbx.dic +_audit_conform.dict_location https://mmcif.pdb.org/dictionaries/ascii/mmcif_pdbx.dic # loop_ _database_2.database_id @@ -30416,15 +30416,15 @@ _software.location _software.language _software.citation_id 1 DENZO . ? package 'Zbyszek Otwinowski' hkl@hkl-xray.com 'data reduction' -http://www.hkl-xray.com/ ? ? +https://www.hkl-xray.com/ ? ? 2 SCALEPACK . ? package 'Zbyszek Otwinowski' hkl@hkl-xray.com 'data scaling' -http://www.hkl-xray.com/ ? ? +https://www.hkl-xray.com/ ? ? 3 PHASER 1.3.3 'Wed Jul 23 12:36:49 2008' program 'Randy J. Read' cimr-phaser@lists.cam.ac.uk phasing -http://www-structmed.cimr.cam.ac.uk/phaser/ ? ? +https://www-structmed.cimr.cam.ac.uk/phaser/ ? ? 4 PHENIX . ? package 'Paul D. Adams' PDAdams@lbl.gov refinement -http://www.phenix-online.org/ C++ ? +https://www.phenix-online.org/ C++ ? 5 PDB_EXTRACT 3.005 'June 11, 2008' package PDB help@deposit.rcsb.org 'data extraction' -http://sw-tools.pdb.org/apps/PDB_EXTRACT/ C++ ? +https://sw-tools.pdb.org/apps/PDB_EXTRACT/ C++ ? # _pdbx_entry_details.entry_id 3KK6 _pdbx_entry_details.nonpolymer_details ? diff --git a/notebooks/Discovery/12_Ensemble_docking/ensemble_docking.ipynb b/notebooks/Discovery/12_Ensemble_docking/ensemble_docking.ipynb index d184a85..baabf6f 100644 --- a/notebooks/Discovery/12_Ensemble_docking/ensemble_docking.ipynb +++ b/notebooks/Discovery/12_Ensemble_docking/ensemble_docking.ipynb @@ -5,7 +5,7 @@ "id": "3e360057", "metadata": {}, "source": [ - "This script can be used for any purpose without limitation subject to the conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", + "This script can be used for any purpose without limitation subject to the conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx\n", "\n", "This permission notice and the following statement of attribution must be included in all copies or substantial portions of this script.\n", "\n", diff --git a/notebooks/ccdc_notebook_utilities/__init__.py b/notebooks/ccdc_notebook_utilities/__init__.py index 997ba00..dab1882 100644 --- a/notebooks/ccdc_notebook_utilities/__init__.py +++ b/notebooks/ccdc_notebook_utilities/__init__.py @@ -1,6 +1,6 @@ # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. diff --git a/notebooks/ccdc_notebook_utilities/create_logger.py b/notebooks/ccdc_notebook_utilities/create_logger.py index 009995a..d96f929 100644 --- a/notebooks/ccdc_notebook_utilities/create_logger.py +++ b/notebooks/ccdc_notebook_utilities/create_logger.py @@ -1,6 +1,6 @@ # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. diff --git a/notebooks/ccdc_notebook_utilities/run_hermes.py b/notebooks/ccdc_notebook_utilities/run_hermes.py index af00f99..5e7c837 100644 --- a/notebooks/ccdc_notebook_utilities/run_hermes.py +++ b/notebooks/ccdc_notebook_utilities/run_hermes.py @@ -1,6 +1,6 @@ # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. diff --git a/scripts/ReadMe.md b/scripts/ReadMe.md index 629ce2c..f0ccec1 100644 --- a/scripts/ReadMe.md +++ b/scripts/ReadMe.md @@ -3,84 +3,92 @@ This folder contains scripts submitted by users or CCDC scientists for anyone to use freely. -## Concat Mol2 +## Assorted Utilities + +Various scripts with no specific licence requirements that may be useful for a variety of purposes. + +### Concat Mol2 - Concatenates mol2 files present in working directory to a single `.mol2` file. -## Conformer demo +## Core + +### Conformer demo - A short script to generate conformers with some rudimentary analysis for a single molecule. -## Conformer Filter Density +### Conformer Filter Density - A script to filter conformers based on a variety of torsion metrics. -## Create CASTEP Input +### Create CASTEP Input - Creates input files (`.cell` and `.param`) files for a given compound through Mercury. -## Create GAUSSIAN Input +### Create GAUSSIAN Input - Create GAUSSIAN input file (`.gjf`) for a given CSD refcode or `.mol2` file. -## Filter poses +### Filter poses - A script to filter docking poses based on torsion statistics -## Find Binding Conformation +### MOF subset 2017 Chem Mater publication -- Generates idealized conformers for ligands and evaluates their RMSD to the conformation in the PDB. +- Two scripts that were supplementary information in the publication "Development of a Cambridge Structural Database Subset: + A Collection of Metal–Organic Frameworks for Past, Present, and Future" DOI: -## GOLD-multi +### Refcodes With Properties -- Use the CSD Docking API and the multiprocessing module to parallelize GOLD docking. +- A script for generating refcode lists with specific properties from an easy-to-read control file. -## Hydrogen bond propensity +### Show semiconductor properties -- Writes a `.docx report` of a hydrogen bond propensity calculation for any given `.mol2`/refcode. +- Displays semiconductor properties for the structure currently loaded in Mercury. -## MOF subset 2017 Chem Mater publication +### Void Search -- Two scripts that were supplementary information in the publication "Development of a Cambridge Structural Database Subset: - A Collection of Metal–Organic Frameworks for Past, Present, and Future" DOI: +- A script to search on pre-calculated Void properties. -## Multi-component hydrogen bond propensity +## Discovery -- Performs a multi-component HBP calculation for a given library of co-formers. +### Find Binding Conformation + +- Generates idealized conformers for ligands and evaluates their RMSD to the conformation in the PDB. -## November 2023 morphology webinar +### GOLD-multi -- A collection of scripts from the November 2023 CCDC Webinar on crystal morphologies. +- Use the CSD Docking API and the multiprocessing module to parallelize GOLD docking. -## Packing similarity dendrogram +## Materials -- Construct a dendrogram for an input set of structures based on packing-similarity analysis. +### Multi-component hydrogen bond propensity -## Particle Rugosity +- Performs a multi-component HBP calculation for a given library of co-formers. -- Calculates the simulated BFDH particle rugosity weighted by facet area. +### Packing similarity dendrogram -## Refcodes With Properties +- Construct a dendrogram for an input set of structures based on packing-similarity analysis. -- A script for generating refcode lists with specific properties from an easy-to-read control file. +## Particle -## Show semiconductor properties +### Hydrogen bond propensity -- Displays semiconductor properties for the structure currently loaded in Mercury. +- Writes a `.docx report` of a hydrogen bond propensity calculation for any given `.mol2`/refcode. -## Surface Charge +### November 2023 morphology webinar -- Calculates the surface charge for a given structure and surface terminations. Runs both from CMD and Mercury. +- A collection of scripts from the November 2023 CCDC Webinar on crystal morphologies. -## Void Search +### Particle Rugosity -- A script to search on pre-calculated Void properties. +- Calculates the simulated BFDH particle rugosity weighted by facet area. -## Tips +### Surface Charge -A section for top tips in using the repository and GitHub. +- Calculates the surface charge for a given structure and surface terminations. Runs both from CMD and Mercury. -### Searching tips +## Searching tips The search bar in GitHub allows you to search for keywords mentioned in any file throughout the repository (in the main branch). diff --git a/scripts/concat_mol2/ReadMe.md b/scripts/assorted_utilities/concat_mol2/ReadMe.md similarity index 100% rename from scripts/concat_mol2/ReadMe.md rename to scripts/assorted_utilities/concat_mol2/ReadMe.md diff --git a/scripts/concat_mol2/concat_mol2.py b/scripts/assorted_utilities/concat_mol2/concat_mol2.py similarity index 89% rename from scripts/concat_mol2/concat_mol2.py rename to scripts/assorted_utilities/concat_mol2/concat_mol2.py index 724c287..c259b0d 100644 --- a/scripts/concat_mol2/concat_mol2.py +++ b/scripts/assorted_utilities/concat_mol2/concat_mol2.py @@ -1,6 +1,6 @@ # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. @@ -9,12 +9,12 @@ # 2022-02-24: updated by Alex Moldovan, The Cambridge Crystallographic Data Centre # -import glob import argparse +import glob import os -def main(delete_separate_files): +def main(delete_separate_files: bool): mol2_files = glob.glob('*.mol2') count = 0 with open('concat.mol2', 'w') as outfile: @@ -26,7 +26,7 @@ def main(delete_separate_files): count += 1 print(f"{count} files concatenated.") - if delete_separate_files == True: + if delete_separate_files: count = 0 for f in mol2_files: if f == 'concat.mol2': diff --git a/scripts/conformer_demo/AZD9291.mol2 b/scripts/core/conformer_demo/AZD9291.mol2 similarity index 97% rename from scripts/conformer_demo/AZD9291.mol2 rename to scripts/core/conformer_demo/AZD9291.mol2 index 4533c8d..41d73e0 100644 --- a/scripts/conformer_demo/AZD9291.mol2 +++ b/scripts/core/conformer_demo/AZD9291.mol2 @@ -1,169 +1,169 @@ -@MOLECULE -A:6JWL - 72 75 1 0 1 -SMALL -NO_CHARGES -**** -Generated from the CSD - -@ATOM - 1 C13 -47.0936 -3.8091 -13.4034 C.3 1 YY31101 0.0000 - 2 N2 -47.0086 -2.7311 -14.3695 N.3 1 YY31101 0.0000 - 3 C12 -45.9115 -3.0021 -15.2755 C.3 1 YY31101 0.0000 - 4 C11 -46.7746 -1.4560 -13.7005 C.3 1 YY31101 0.0000 - 5 C10 -47.4726 -0.3070 -14.4355 C.3 1 YY31101 0.0000 - 6 N1 -48.9046 -0.5000 -14.3475 N.pl3 1 YY31101 0.0000 - 7 C28 -49.4387 -1.1750 -13.1824 C.3 1 YY31101 0.0000 - 8 C3 -50.4137 1.1840 -15.2065 C.ar 1 YY31101 0.0000 - 9 C4 -51.2787 1.6321 -16.1655 C.ar 1 YY31101 0.0000 - 10 O1 -51.9027 2.8521 -16.0285 O.3 1 YY31101 0.0000 - 11 C14 -51.6957 3.4241 -14.7895 C.3 1 YY31101 0.0000 - 12 C2 -49.8087 -0.0340 -15.3855 C.ar 1 YY31101 0.0000 - 13 C1 -50.0827 -0.7970 -16.5066 C.ar 1 YY31101 0.0000 - 14 N -49.4027 -2.0741 -16.6096 N.am 1 YY31101 0.0000 - 15 C7 -49.6557 -3.0691 -17.6256 C.2 1 YY31101 0.0000 - 16 O -50.4457 -2.8851 -18.4616 O.2 1 YY31101 0.0000 - 17 C8 -48.8456 -4.3581 -17.5956 C.3 1 YY31101 0.0000 - 18 C9 -49.6517 -5.6372 -17.7846 C.3 1 YY31101 0.0000 - 19 C6 -50.9617 -0.3360 -17.4786 C.ar 1 YY31101 0.0000 - 20 C5 -51.5537 0.9000 -17.2826 C.ar 1 YY31101 0.0000 - 21 N3 -52.4998 1.5241 -18.1876 N.pl3 1 YY31101 0.0000 - 22 C15 -52.4578 1.3800 -19.6177 C.ar 1 YY31101 0.0000 - 23 N5 -51.5097 0.6790 -20.1647 N.ar 1 YY31101 0.0000 - 24 N4 -53.3928 1.9621 -20.3097 N.ar 1 YY31101 0.0000 - 25 C16 -53.4318 1.8691 -21.6127 C.ar 1 YY31101 0.0000 - 26 C17 -52.4518 1.1400 -22.2417 C.ar 1 YY31101 0.0000 - 27 C18 -51.4837 0.5540 -21.4637 C.ar 1 YY31101 0.0000 - 28 C19 -50.3887 -0.2730 -22.1187 C.2 1 YY31101 0.0000 - 29 C26 -49.1556 -0.6420 -21.5447 C.ar 1 YY31101 0.0000 - 30 C25 -48.5396 -0.3950 -20.3087 C.ar 1 YY31101 0.0000 - 31 C24 -47.2806 -0.9140 -20.0517 C.ar 1 YY31101 0.0000 - 32 C23 -46.6356 -1.6751 -21.0187 C.ar 1 YY31101 0.0000 - 33 C22 -47.2446 -1.9131 -22.2327 C.ar 1 YY31101 0.0000 - 34 C21 -48.5256 -1.3830 -22.4878 C.ar 1 YY31101 0.0000 - 35 N6 -49.3076 -1.4780 -23.5728 N.pl3 1 YY31101 0.0000 - 36 C27 -48.9656 -2.1931 -24.7758 C.3 1 YY31101 0.0000 - 37 C20 -50.4267 -0.8280 -23.3788 C.2 1 YY31101 0.0000 - 38 H1282 -51.2463 -0.7410 -24.0905 H 1 YY31101 0.0000 - 39 H1286 -48.6942 -2.2848 -15.9139 H 1 YY31101 0.0000 - 40 H1287 -48.3421 -4.4169 -16.6318 H 1 YY31101 0.0000 - 41 H1288 -48.1031 -4.3077 -18.3906 H 1 YY31101 0.0000 - 42 H1291 -52.4429 1.0302 -23.3252 H 1 YY31101 0.0000 - 43 H1294 -45.7035 -1.2610 -13.6727 H 1 YY31101 0.0000 - 44 H1295 -47.1597 -1.5128 -12.6834 H 1 YY31101 0.0000 - 45 H1306 -47.2682 -4.7498 -13.9236 H 1 YY31101 0.0000 - 46 H1307 -47.9158 -3.6164 -12.7159 H 1 YY31101 0.0000 - 47 H1308 -46.1605 -3.8708 -12.8453 H 1 YY31101 0.0000 - 48 H1309 -48.6222 -1.4507 -12.5166 H 1 YY31101 0.0000 - 49 H1310 -49.9709 -2.0722 -13.4949 H 1 YY31101 0.0000 - 50 H1311 -50.1243 -0.5097 -12.6599 H 1 YY31101 0.0000 - 51 H1316 -46.0900 -3.9453 -15.7897 H 1 YY31101 0.0000 - 52 H1317 -44.9823 -3.0664 -14.7114 H 1 YY31101 0.0000 - 53 H1318 -45.8375 -2.1984 -16.0066 H 1 YY31101 0.0000 - 54 H1319 -50.2092 1.7814 -14.3192 H 1 YY31101 0.0000 - 55 H1321 -50.1543 -5.6101 -18.7503 H 1 YY31101 0.0000 - 56 H1322 -48.9834 -6.4962 -17.7471 H 1 YY31101 0.0000 - 57 H1323 -50.3934 -5.7194 -16.9915 H 1 YY31101 0.0000 - 58 H1324 -52.0840 2.7638 -14.0154 H 1 YY31101 0.0000 - 59 H1325 -52.2111 4.3823 -14.7413 H 1 YY31101 0.0000 - 60 H1326 -50.6288 3.5776 -14.6342 H 1 YY31101 0.0000 - 61 H1327 -53.2358 2.0970 -17.7874 H 1 YY31101 0.0000 - 62 H1331 -49.0489 0.2024 -19.5539 H 1 YY31101 0.0000 - 63 H1332 -45.6467 -2.0845 -20.8174 H 1 YY31101 0.0000 - 64 H1335 -46.7380 -2.5080 -22.9913 H 1 YY31101 0.0000 - 65 H1336 -48.8006 -3.2432 -24.5395 H 1 YY31101 0.0000 - 66 H1337 -49.7799 -2.1062 -25.4937 H 1 YY31101 0.0000 - 67 H1338 -48.0579 -1.7703 -25.2037 H 1 YY31101 0.0000 - 68 H1342 -46.7979 -0.7258 -19.0938 H 1 YY31101 0.0000 - 69 H1343 -47.1673 -0.3019 -15.4808 H 1 YY31101 0.0000 - 70 H1344 -47.2018 0.6413 -13.9736 H 1 YY31101 0.0000 - 71 H1345 -51.1782 -0.9281 -18.3665 H 1 YY31101 0.0000 - 72 H1347 -54.2200 2.3564 -22.1846 H 1 YY31101 0.0000 -@BOND - 1 1 2 1 - 2 2 3 1 - 3 2 4 1 - 4 4 5 1 - 5 5 6 1 - 6 6 7 1 - 7 8 9 ar - 8 9 10 1 - 9 10 11 1 - 10 6 12 1 - 11 8 12 ar - 12 12 13 ar - 13 13 14 1 - 14 14 15 am - 15 15 16 2 - 16 15 17 1 - 17 17 18 1 - 18 13 19 ar - 19 9 20 ar - 20 19 20 ar - 21 20 21 1 - 22 21 22 1 - 23 22 23 ar - 24 22 24 ar - 25 24 25 ar - 26 25 26 ar - 27 23 27 ar - 28 26 27 ar - 29 27 28 1 - 30 28 29 1 - 31 29 30 ar - 32 30 31 ar - 33 31 32 ar - 34 32 33 ar - 35 29 34 ar - 36 33 34 ar - 37 34 35 1 - 38 35 36 1 - 39 28 37 2 - 40 35 37 1 - 41 37 38 1 - 42 14 39 1 - 43 17 40 1 - 44 17 41 1 - 45 26 42 1 - 46 4 43 1 - 47 4 44 1 - 48 1 45 1 - 49 1 46 1 - 50 1 47 1 - 51 7 48 1 - 52 7 49 1 - 53 7 50 1 - 54 3 51 1 - 55 3 52 1 - 56 3 53 1 - 57 8 54 1 - 58 18 55 1 - 59 18 56 1 - 60 18 57 1 - 61 11 58 1 - 62 11 59 1 - 63 11 60 1 - 64 21 61 1 - 65 30 62 1 - 66 32 63 1 - 67 33 64 1 - 68 36 65 1 - 69 36 66 1 - 70 36 67 1 - 71 31 68 1 - 72 5 69 1 - 73 5 70 1 - 74 19 71 1 - 75 25 72 1 -@SUBSTRUCTURE - 1 YY31101 1 GROUP 0 A YY3 0 -@SET -CCDC_LIGAND STATIC ATOMS -72 1 2 3 4 5 6 7 8 9 \ -10 11 12 13 14 15 16 17 18 19 \ -20 21 22 23 24 25 26 27 28 29 \ -30 31 32 33 34 35 36 37 38 39 \ -40 41 42 43 44 45 46 47 48 49 \ -50 51 52 53 54 55 56 57 58 59 \ -60 61 62 63 64 65 66 67 68 69 \ -70 71 72 +@MOLECULE +A:6JWL + 72 75 1 0 1 +SMALL +NO_CHARGES +**** +Generated from the CSD + +@ATOM + 1 C13 -47.0936 -3.8091 -13.4034 C.3 1 YY31101 0.0000 + 2 N2 -47.0086 -2.7311 -14.3695 N.3 1 YY31101 0.0000 + 3 C12 -45.9115 -3.0021 -15.2755 C.3 1 YY31101 0.0000 + 4 C11 -46.7746 -1.4560 -13.7005 C.3 1 YY31101 0.0000 + 5 C10 -47.4726 -0.3070 -14.4355 C.3 1 YY31101 0.0000 + 6 N1 -48.9046 -0.5000 -14.3475 N.pl3 1 YY31101 0.0000 + 7 C28 -49.4387 -1.1750 -13.1824 C.3 1 YY31101 0.0000 + 8 C3 -50.4137 1.1840 -15.2065 C.ar 1 YY31101 0.0000 + 9 C4 -51.2787 1.6321 -16.1655 C.ar 1 YY31101 0.0000 + 10 O1 -51.9027 2.8521 -16.0285 O.3 1 YY31101 0.0000 + 11 C14 -51.6957 3.4241 -14.7895 C.3 1 YY31101 0.0000 + 12 C2 -49.8087 -0.0340 -15.3855 C.ar 1 YY31101 0.0000 + 13 C1 -50.0827 -0.7970 -16.5066 C.ar 1 YY31101 0.0000 + 14 N -49.4027 -2.0741 -16.6096 N.am 1 YY31101 0.0000 + 15 C7 -49.6557 -3.0691 -17.6256 C.2 1 YY31101 0.0000 + 16 O -50.4457 -2.8851 -18.4616 O.2 1 YY31101 0.0000 + 17 C8 -48.8456 -4.3581 -17.5956 C.3 1 YY31101 0.0000 + 18 C9 -49.6517 -5.6372 -17.7846 C.3 1 YY31101 0.0000 + 19 C6 -50.9617 -0.3360 -17.4786 C.ar 1 YY31101 0.0000 + 20 C5 -51.5537 0.9000 -17.2826 C.ar 1 YY31101 0.0000 + 21 N3 -52.4998 1.5241 -18.1876 N.pl3 1 YY31101 0.0000 + 22 C15 -52.4578 1.3800 -19.6177 C.ar 1 YY31101 0.0000 + 23 N5 -51.5097 0.6790 -20.1647 N.ar 1 YY31101 0.0000 + 24 N4 -53.3928 1.9621 -20.3097 N.ar 1 YY31101 0.0000 + 25 C16 -53.4318 1.8691 -21.6127 C.ar 1 YY31101 0.0000 + 26 C17 -52.4518 1.1400 -22.2417 C.ar 1 YY31101 0.0000 + 27 C18 -51.4837 0.5540 -21.4637 C.ar 1 YY31101 0.0000 + 28 C19 -50.3887 -0.2730 -22.1187 C.2 1 YY31101 0.0000 + 29 C26 -49.1556 -0.6420 -21.5447 C.ar 1 YY31101 0.0000 + 30 C25 -48.5396 -0.3950 -20.3087 C.ar 1 YY31101 0.0000 + 31 C24 -47.2806 -0.9140 -20.0517 C.ar 1 YY31101 0.0000 + 32 C23 -46.6356 -1.6751 -21.0187 C.ar 1 YY31101 0.0000 + 33 C22 -47.2446 -1.9131 -22.2327 C.ar 1 YY31101 0.0000 + 34 C21 -48.5256 -1.3830 -22.4878 C.ar 1 YY31101 0.0000 + 35 N6 -49.3076 -1.4780 -23.5728 N.pl3 1 YY31101 0.0000 + 36 C27 -48.9656 -2.1931 -24.7758 C.3 1 YY31101 0.0000 + 37 C20 -50.4267 -0.8280 -23.3788 C.2 1 YY31101 0.0000 + 38 H1282 -51.2463 -0.7410 -24.0905 H 1 YY31101 0.0000 + 39 H1286 -48.6942 -2.2848 -15.9139 H 1 YY31101 0.0000 + 40 H1287 -48.3421 -4.4169 -16.6318 H 1 YY31101 0.0000 + 41 H1288 -48.1031 -4.3077 -18.3906 H 1 YY31101 0.0000 + 42 H1291 -52.4429 1.0302 -23.3252 H 1 YY31101 0.0000 + 43 H1294 -45.7035 -1.2610 -13.6727 H 1 YY31101 0.0000 + 44 H1295 -47.1597 -1.5128 -12.6834 H 1 YY31101 0.0000 + 45 H1306 -47.2682 -4.7498 -13.9236 H 1 YY31101 0.0000 + 46 H1307 -47.9158 -3.6164 -12.7159 H 1 YY31101 0.0000 + 47 H1308 -46.1605 -3.8708 -12.8453 H 1 YY31101 0.0000 + 48 H1309 -48.6222 -1.4507 -12.5166 H 1 YY31101 0.0000 + 49 H1310 -49.9709 -2.0722 -13.4949 H 1 YY31101 0.0000 + 50 H1311 -50.1243 -0.5097 -12.6599 H 1 YY31101 0.0000 + 51 H1316 -46.0900 -3.9453 -15.7897 H 1 YY31101 0.0000 + 52 H1317 -44.9823 -3.0664 -14.7114 H 1 YY31101 0.0000 + 53 H1318 -45.8375 -2.1984 -16.0066 H 1 YY31101 0.0000 + 54 H1319 -50.2092 1.7814 -14.3192 H 1 YY31101 0.0000 + 55 H1321 -50.1543 -5.6101 -18.7503 H 1 YY31101 0.0000 + 56 H1322 -48.9834 -6.4962 -17.7471 H 1 YY31101 0.0000 + 57 H1323 -50.3934 -5.7194 -16.9915 H 1 YY31101 0.0000 + 58 H1324 -52.0840 2.7638 -14.0154 H 1 YY31101 0.0000 + 59 H1325 -52.2111 4.3823 -14.7413 H 1 YY31101 0.0000 + 60 H1326 -50.6288 3.5776 -14.6342 H 1 YY31101 0.0000 + 61 H1327 -53.2358 2.0970 -17.7874 H 1 YY31101 0.0000 + 62 H1331 -49.0489 0.2024 -19.5539 H 1 YY31101 0.0000 + 63 H1332 -45.6467 -2.0845 -20.8174 H 1 YY31101 0.0000 + 64 H1335 -46.7380 -2.5080 -22.9913 H 1 YY31101 0.0000 + 65 H1336 -48.8006 -3.2432 -24.5395 H 1 YY31101 0.0000 + 66 H1337 -49.7799 -2.1062 -25.4937 H 1 YY31101 0.0000 + 67 H1338 -48.0579 -1.7703 -25.2037 H 1 YY31101 0.0000 + 68 H1342 -46.7979 -0.7258 -19.0938 H 1 YY31101 0.0000 + 69 H1343 -47.1673 -0.3019 -15.4808 H 1 YY31101 0.0000 + 70 H1344 -47.2018 0.6413 -13.9736 H 1 YY31101 0.0000 + 71 H1345 -51.1782 -0.9281 -18.3665 H 1 YY31101 0.0000 + 72 H1347 -54.2200 2.3564 -22.1846 H 1 YY31101 0.0000 +@BOND + 1 1 2 1 + 2 2 3 1 + 3 2 4 1 + 4 4 5 1 + 5 5 6 1 + 6 6 7 1 + 7 8 9 ar + 8 9 10 1 + 9 10 11 1 + 10 6 12 1 + 11 8 12 ar + 12 12 13 ar + 13 13 14 1 + 14 14 15 am + 15 15 16 2 + 16 15 17 1 + 17 17 18 1 + 18 13 19 ar + 19 9 20 ar + 20 19 20 ar + 21 20 21 1 + 22 21 22 1 + 23 22 23 ar + 24 22 24 ar + 25 24 25 ar + 26 25 26 ar + 27 23 27 ar + 28 26 27 ar + 29 27 28 1 + 30 28 29 1 + 31 29 30 ar + 32 30 31 ar + 33 31 32 ar + 34 32 33 ar + 35 29 34 ar + 36 33 34 ar + 37 34 35 1 + 38 35 36 1 + 39 28 37 2 + 40 35 37 1 + 41 37 38 1 + 42 14 39 1 + 43 17 40 1 + 44 17 41 1 + 45 26 42 1 + 46 4 43 1 + 47 4 44 1 + 48 1 45 1 + 49 1 46 1 + 50 1 47 1 + 51 7 48 1 + 52 7 49 1 + 53 7 50 1 + 54 3 51 1 + 55 3 52 1 + 56 3 53 1 + 57 8 54 1 + 58 18 55 1 + 59 18 56 1 + 60 18 57 1 + 61 11 58 1 + 62 11 59 1 + 63 11 60 1 + 64 21 61 1 + 65 30 62 1 + 66 32 63 1 + 67 33 64 1 + 68 36 65 1 + 69 36 66 1 + 70 36 67 1 + 71 31 68 1 + 72 5 69 1 + 73 5 70 1 + 74 19 71 1 + 75 25 72 1 +@SUBSTRUCTURE + 1 YY31101 1 GROUP 0 A YY3 0 +@SET +CCDC_LIGAND STATIC ATOMS +72 1 2 3 4 5 6 7 8 9 \ +10 11 12 13 14 15 16 17 18 19 \ +20 21 22 23 24 25 26 27 28 29 \ +30 31 32 33 34 35 36 37 38 39 \ +40 41 42 43 44 45 46 47 48 49 \ +50 51 52 53 54 55 56 57 58 59 \ +60 61 62 63 64 65 66 67 68 69 \ +70 71 72 diff --git a/scripts/conformer_demo/description.md b/scripts/core/conformer_demo/ReadMe.md similarity index 89% rename from scripts/conformer_demo/description.md rename to scripts/core/conformer_demo/ReadMe.md index 05baf94..01729fb 100644 --- a/scripts/conformer_demo/description.md +++ b/scripts/core/conformer_demo/ReadMe.md @@ -1,26 +1,36 @@ -# Conformer Demo - -This is a short script to generate conformers with some rudimentary analysis for a single molecule. -There are also options to overlay the results to view in Hermes. - -### Example output showing what the user can expect to see: - -``` -Reading file: AZD9291.mol2 ... done. -Generating conformers, maximum of 20 ... done, generated 20 conformers. -Sampling limit reached? No. -How many rotamers had no observations? 0. -Normalised score of most probable conformer: 0.0. -Most probable conformer RMSD wrt input: 3.276; wrt minimised: 3.202. -Scores of top 10 conformers: 0.000, 0.000, 0.000, 0.027, 0.027, 0.027, 0.027, 0.027, 0.029, 0.029. -Overlaying conformers ... done. -Writing file superimposed ... done. -``` - -CCDC Python API Licence required, minimum version: 3.0.15 - -There is an accompanying mol2 file with this script, but users may use any small molecule provided in a file format readable by our API (e.g. mol, mol2, sdf, etc) - -Author: Chris Ringrose - 22/11/24 - - For feedback or to report any issues please contact support@ccdc.cam.ac.uk +# Conformer Demo + +This is a short script to generate conformers with some rudimentary analysis for a single molecule. +There are also options to overlay the results to view in Hermes. + +### Example output showing what the user can expect to see: + +``` +Reading file: AZD9291.mol2 ... done. +Generating conformers, maximum of 20 ... done, generated 20 conformers. +Sampling limit reached? No. +How many rotamers had no observations? 0. +Normalised score of most probable conformer: 0.0. +Most probable conformer RMSD wrt input: 3.276; wrt minimised: 3.202. +Scores of top 10 conformers: 0.000, 0.000, 0.000, 0.027, 0.027, 0.027, 0.027, 0.027, 0.029, 0.029. +Overlaying conformers ... done. +Writing file superimposed ... done. +``` + +## Requirements + +CCDC Python API Licence required, minimum version: 3.0.15 + +## Licensing Requirements + +- CSD-Core + +## Instructions on running + +There is an accompanying mol2 file with this script, but users may use any small molecule provided in a file format readable by our API (e.g. mol, mol2, sdf, etc) + +## Author + +Chris Ringrose - 22/11/24 + + For feedback or to report any issues please contact support@ccdc.cam.ac.uk diff --git a/scripts/conformer_demo/conformer_demo.py b/scripts/core/conformer_demo/conformer_demo.py similarity index 95% rename from scripts/conformer_demo/conformer_demo.py rename to scripts/core/conformer_demo/conformer_demo.py index 067fde8..b68f9a6 100644 --- a/scripts/conformer_demo/conformer_demo.py +++ b/scripts/core/conformer_demo/conformer_demo.py @@ -1,135 +1,135 @@ -#! /usr/bin/env python -######################################################################################################################## -# -# This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx -# -# This permission notice and the following statement of attribution must be -# included in all copies or substantial portions of this script. -# -# 2024-11-22: created by the Cambridge Crystallographic Data Centre -# -######################################################################################################################## - -from ccdc import conformer, descriptors, io, molecule -from ccdc.search import SubstructureSearch, SMARTSSubstructure - - -def read(molecule_file: str) -> molecule: - print(f'Reading file: {molecule_file} ... ', end='') - mol_reader = io.MoleculeReader(molecule_file) - mol = mol_reader[0] - print('done.') - - return mol - - -def generate_conformers(molecule: molecule, max_conformers: int = 50) -> conformer.ConformerHitList: - """ - Generate conformers for a molecule. - - :param molecule: The Molecule (ccdc Molecule object) to generate conformers for. - :param max_conformers: The maximum number of conformers to generate. - - :returns: ccdc.conformer.ConformerHitList - """ - - # Set up the ConformerGenerator - confgen = conformer.ConformerGenerator() - confgen.settings.max_conformers = max_conformers - # confgen.settings.superimpose_conformers_onto_reference = True - - # Generate conformers and assign identifiers to them before returning - conformers = confgen.generate(molecule) - - print(f'Generating conformers, maximum of {max_conformers} ... ', end='') - for i, conf in enumerate(conformers): - conf.molecule.identifier = '{}_{:04}'.format(conf.molecule.identifier, i + 1) - print(f'done, generated {len(conformers)} conformers.') - - return conformers - - -def analyse(conformers: conformer.ConformerHitList) -> molecule: - """ - Perform some basic analysis of the conformers generated. - :param conformers: Conformers generated from ConfGen - :return: The best molecule of all the conformers generated. - """ - print(f'Sampling limit reached? {"Yes." if conformers.sampling_limit_reached else "No."}') - - print(f'How many rotamers had no observations? {conformers.n_rotamers_with_no_observations}.') - - most_probable_conformer = conformers[0] - - print(f'Normalised score of most probable conformer: {round(most_probable_conformer.normalised_score, 5)}.') - print(f'Most probable conformer RMSD wrt input: {round(most_probable_conformer.rmsd(), 3)}; ' - f'wrt minimised: {round(most_probable_conformer.rmsd(wrt="minimised"), 3)}.') - - print('Scores of top 10 conformers: ', end='') - - top_ten = conformers[:10] - for i in range(len(top_ten)): - if i < len(top_ten) - 1: - print(f'{round(top_ten[i].normalised_score, 3):.3f}, ', end='') - else: - print(f'{round(top_ten[i].normalised_score, 3):.3f}.') - - return most_probable_conformer.molecule - - -def overlay(conformers, query: str, output_filename: str) -> None: - """ - Overlay conformers based on a SMARTS substructure pattern - :param conformers: Conformers generated from ConfGen - :param query: SMARTS pattern which the conformers will overlay on top of. - Should be consistent across all conformers, e.g. benzene ring. - """ - print('Overlaying conformers ... ', end='') - conformers_mols = [c.molecule for c in conformers] - ss_search = SubstructureSearch() - substructure = SMARTSSubstructure(query) - ss_search.add_substructure(substructure) - hits = ss_search.search(conformers_mols, max_hits_per_structure=1) - ref_ats = hits[0].match_atoms() - print('done.') - - print('Writing file superimposed ... ', end='') - with io.MoleculeWriter(output_filename) as writer: - for hit in hits: - hit_ats = hit.match_atoms() - atoms = zip(ref_ats, hit_ats) - ov = descriptors.MolecularDescriptors.Overlay(hits[0].molecule, hit.molecule, atoms) - superimposed_hit = ov.molecule - writer.write(superimposed_hit) - print('done.') - - -def write_conformers_to_file(conformers: conformer.ConformerHitList, filename: str) -> None: - """ - Write conformers to a file without any addition overlaying. - :param conformers: Conformer generated from ConfGen. - :param filename: The name of the output file. - """ - - with io.MoleculeWriter(filename) as writer: - for conf in conformers: - writer.write(conf.molecule) - - -if __name__ == '__main__': - - input_filename = 'AZD9291.mol2' - # Read example molecule - mol = read(input_filename) - - # Generate conformers - confs = generate_conformers(mol, 20) - - # Provide summary of analysis - analyse(confs) - - # Overlay structures based on common substructure - query = 'c1cncnc1' - output_filename = f'superimposed_{input_filename}' - overlay(confs, query, output_filename) +#! /usr/bin/env python +######################################################################################################################## +# +# This script can be used for any purpose without limitation subject to the +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# +# This permission notice and the following statement of attribution must be +# included in all copies or substantial portions of this script. +# +# 2024-11-22: created by the Cambridge Crystallographic Data Centre +# +######################################################################################################################## + +from ccdc import conformer, descriptors, io, molecule +from ccdc.search import SubstructureSearch, SMARTSSubstructure + + +def read(molecule_file: str) -> molecule: + print(f'Reading file: {molecule_file} ... ', end='') + mol_reader = io.MoleculeReader(molecule_file) + mol = mol_reader[0] + print('done.') + + return mol + + +def generate_conformers(molecule: molecule, max_conformers: int = 50) -> conformer.ConformerHitList: + """ + Generate conformers for a molecule. + + :param molecule: The Molecule (ccdc Molecule object) to generate conformers for. + :param max_conformers: The maximum number of conformers to generate. + + :returns: ccdc.conformer.ConformerHitList + """ + + # Set up the ConformerGenerator + confgen = conformer.ConformerGenerator() + confgen.settings.max_conformers = max_conformers + # confgen.settings.superimpose_conformers_onto_reference = True + + # Generate conformers and assign identifiers to them before returning + conformers = confgen.generate(molecule) + + print(f'Generating conformers, maximum of {max_conformers} ... ', end='') + for i, conf in enumerate(conformers): + conf.molecule.identifier = '{}_{:04}'.format(conf.molecule.identifier, i + 1) + print(f'done, generated {len(conformers)} conformers.') + + return conformers + + +def analyse(conformers: conformer.ConformerHitList) -> molecule: + """ + Perform some basic analysis of the conformers generated. + :param conformers: Conformers generated from ConfGen + :return: The best molecule of all the conformers generated. + """ + print(f'Sampling limit reached? {"Yes." if conformers.sampling_limit_reached else "No."}') + + print(f'How many rotamers had no observations? {conformers.n_rotamers_with_no_observations}.') + + most_probable_conformer = conformers[0] + + print(f'Normalised score of most probable conformer: {round(most_probable_conformer.normalised_score, 5)}.') + print(f'Most probable conformer RMSD wrt input: {round(most_probable_conformer.rmsd(), 3)}; ' + f'wrt minimised: {round(most_probable_conformer.rmsd(wrt="minimised"), 3)}.') + + print('Scores of top 10 conformers: ', end='') + + top_ten = conformers[:10] + for i in range(len(top_ten)): + if i < len(top_ten) - 1: + print(f'{round(top_ten[i].normalised_score, 3):.3f}, ', end='') + else: + print(f'{round(top_ten[i].normalised_score, 3):.3f}.') + + return most_probable_conformer.molecule + + +def overlay(conformers, query: str, output_filename: str) -> None: + """ + Overlay conformers based on a SMARTS substructure pattern + :param conformers: Conformers generated from ConfGen + :param query: SMARTS pattern which the conformers will overlay on top of. + Should be consistent across all conformers, e.g. benzene ring. + """ + print('Overlaying conformers ... ', end='') + conformers_mols = [c.molecule for c in conformers] + ss_search = SubstructureSearch() + substructure = SMARTSSubstructure(query) + ss_search.add_substructure(substructure) + hits = ss_search.search(conformers_mols, max_hits_per_structure=1) + ref_ats = hits[0].match_atoms() + print('done.') + + print('Writing file superimposed ... ', end='') + with io.MoleculeWriter(output_filename) as writer: + for hit in hits: + hit_ats = hit.match_atoms() + atoms = zip(ref_ats, hit_ats) + ov = descriptors.MolecularDescriptors.Overlay(hits[0].molecule, hit.molecule, atoms) + superimposed_hit = ov.molecule + writer.write(superimposed_hit) + print('done.') + + +def write_conformers_to_file(conformers: conformer.ConformerHitList, filename: str) -> None: + """ + Write conformers to a file without any addition overlaying. + :param conformers: Conformer generated from ConfGen. + :param filename: The name of the output file. + """ + + with io.MoleculeWriter(filename) as writer: + for conf in conformers: + writer.write(conf.molecule) + + +if __name__ == '__main__': + + input_filename = 'AZD9291.mol2' + # Read example molecule + mol = read(input_filename) + + # Generate conformers + confs = generate_conformers(mol, 20) + + # Provide summary of analysis + analyse(confs) + + # Overlay structures based on common substructure + query = 'c1cncnc1' + output_filename = f'superimposed_{input_filename}' + overlay(confs, query, output_filename) diff --git a/scripts/conformer_filter_density/ReadMe.md b/scripts/core/conformer_filter_density/ReadMe.md similarity index 95% rename from scripts/conformer_filter_density/ReadMe.md rename to scripts/core/conformer_filter_density/ReadMe.md index b350b82..1a9e53c 100644 --- a/scripts/conformer_filter_density/ReadMe.md +++ b/scripts/core/conformer_filter_density/ReadMe.md @@ -5,17 +5,19 @@ Filter conformers using a variety of metrics described below. A csv file will be produced with various points of analysis for unusual torsions. Optionally, files containing the conformers which pass and fail within the limits can be written to files. -CCDC Python API Licence required, minimum version: 3.0.15 +## Licensing Requirements -Script can be run with any multimolecule file e.g. sdf. +- CSD-Core ## Instructions on Running +Script can be run with any multimolecule file e.g. sdf. + positional arguments: input molecule file Input file (single- or multi-molecule file) -options: +Options: * -h, --help; Show this help message and exit * -m {absolute,relative}, --mode; Limit mode: absolute (fixed threshold) or relative (threshold based on molecule with fewest unusual torsions). WARNING: Relative mode may behave unexpectedly with conformers from @@ -28,9 +30,9 @@ multiple input molecules (default: absolute) * --failurefn; Output file for molecules that fail the filter (default: failures.mol) * -u, --unusual-torsions; Output CSV file for unusual torsion details (default: unusual_torsions.csv) +## Authors Originally created by Paul Sanschagrin Updated by Chris Ringrose For feedback or to report any issues please contact support@ccdc.cam.ac.uk - diff --git a/scripts/conformer_filter_density/conformer_filter_density.py b/scripts/core/conformer_filter_density/conformer_filter_density.py similarity index 100% rename from scripts/conformer_filter_density/conformer_filter_density.py rename to scripts/core/conformer_filter_density/conformer_filter_density.py diff --git a/scripts/create_castep_input/ReadMe.md b/scripts/core/create_castep_input/ReadMe.md similarity index 100% rename from scripts/create_castep_input/ReadMe.md rename to scripts/core/create_castep_input/ReadMe.md diff --git a/scripts/create_castep_input/assets/add_script_location.png b/scripts/core/create_castep_input/assets/add_script_location.png similarity index 100% rename from scripts/create_castep_input/assets/add_script_location.png rename to scripts/core/create_castep_input/assets/add_script_location.png diff --git a/scripts/create_castep_input/assets/file_output.png b/scripts/core/create_castep_input/assets/file_output.png similarity index 100% rename from scripts/create_castep_input/assets/file_output.png rename to scripts/core/create_castep_input/assets/file_output.png diff --git a/scripts/create_castep_input/assets/select_script.png b/scripts/core/create_castep_input/assets/select_script.png similarity index 100% rename from scripts/create_castep_input/assets/select_script.png rename to scripts/core/create_castep_input/assets/select_script.png diff --git a/scripts/create_castep_input/create_castep_input.py b/scripts/core/create_castep_input/create_castep_input.py similarity index 98% rename from scripts/create_castep_input/create_castep_input.py rename to scripts/core/create_castep_input/create_castep_input.py index 87a3ffc..2a47ee1 100644 --- a/scripts/create_castep_input/create_castep_input.py +++ b/scripts/core/create_castep_input/create_castep_input.py @@ -1,6 +1,6 @@ # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. diff --git a/scripts/create_gaussian_input/ReadMe.md b/scripts/core/create_gaussian_input/ReadMe.md similarity index 100% rename from scripts/create_gaussian_input/ReadMe.md rename to scripts/core/create_gaussian_input/ReadMe.md diff --git a/scripts/core/create_gaussian_input/create_gaussian_input.py b/scripts/core/create_gaussian_input/create_gaussian_input.py new file mode 100644 index 0000000..d3f8703 --- /dev/null +++ b/scripts/core/create_gaussian_input/create_gaussian_input.py @@ -0,0 +1,65 @@ +# +# This script can be used for any purpose without limitation subject to the +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# +# This permission notice and the following statement of attribution must be +# included in all copies or substantial portions of this script. +# +# 2015-06-17: created by Andrew Maloney the Cambridge Crystallographic Data Centre +# + +""" +This script will generate a generic Gaussian input file +Input: CSD Identifier as a string or .mol2 +Output: GJF input file +""" + +import os +import sys + +import ccdc.io + + +def file_writer(molecule, name): + """Writes a standard Gaussian input file for all molecules contained in the structure files.""" + if not mol.all_atoms_have_sites: + raise RuntimeError(f'{entry_id} has some atoms without coordinates') + mol.normalise_hydrogens() + + for i, component in enumerate(molecule.components): + + with open(f'{name}_molecule{i}.gjf', 'w') as f: + f.write('#B3LYP/6-31G** opt\n\n') + f.write(f'Standard Gaussian Input File for {name}, molecule {i}\n\n') + f.write('0 1\n') + + for atom in component.atoms: + f.write('%2s %9.6f %9.6f %9.6f\n' % (atom.atomic_symbol, + atom.coordinates.x, + atom.coordinates.y, + atom.coordinates.z)) + + f.write('\n--Link1--\n\n\n') + + +if __name__ == '__main__': + # Get the relevant structure typed by user + if len(sys.argv) != 2: + raise RuntimeError('you must supply a structure identifier.') + entry_id = sys.argv[1] + + # Checking the current directory for user cif file + if os.path.isfile(entry_id): + reader = ccdc.io.MoleculeReader(entry_id) + for mol in reader: + identifier = mol.identifier + file_writer(mol, identifier) + + else: + # Read molecule from database + reader = ccdc.io.MoleculeReader('CSD') + try: + mol = reader.molecule(entry_id) + file_writer(mol, entry_id) + except RuntimeError: + raise RuntimeError(f'{entry_id} - structure not found') diff --git a/scripts/filter_poses/ReadMe.md b/scripts/core/filter_poses/ReadMe.md similarity index 91% rename from scripts/filter_poses/ReadMe.md rename to scripts/core/filter_poses/ReadMe.md index b24fda2..564422c 100644 --- a/scripts/filter_poses/ReadMe.md +++ b/scripts/core/filter_poses/ReadMe.md @@ -3,12 +3,18 @@ This is a short script to filter molecular poses in a multi-molecule file based on the torsion probabilities. Information will be printed to screen, or can be saved to a csv file. +## Requirements + CCDC Python API Licence required, minimum version: 3.0.15 -Script can be run with any multimolecule file e.g. sdf. +## Licensing Requirements + +CSD-Core ## Instructions on Running +Script can be run with any multimolecule file e.g. sdf. + positional arguments: * input file; Input file (multi-molecule file). @@ -16,8 +22,9 @@ options: * -h, --help; Show this help message and exit. * -csv, --write-csv; Write a csv file for all the analysed conformers. +## Authors + Originally written by Jason Cole Updated by Chris Ringrose For feedback or to report any issues please contact support@ccdc.cam.ac.uk - diff --git a/scripts/filter_poses/filter_poses.py b/scripts/core/filter_poses/filter_poses.py similarity index 100% rename from scripts/filter_poses/filter_poses.py rename to scripts/core/filter_poses/filter_poses.py diff --git a/scripts/hydrogen_bond_propensity/ReadMe.md b/scripts/core/hydrogen_bond_propensity/ReadMe.md similarity index 100% rename from scripts/hydrogen_bond_propensity/ReadMe.md rename to scripts/core/hydrogen_bond_propensity/ReadMe.md diff --git a/scripts/hydrogen_bond_propensity/assets/HXACAN_Report_Screenshot_1.png b/scripts/core/hydrogen_bond_propensity/assets/HXACAN_Report_Screenshot_1.png similarity index 100% rename from scripts/hydrogen_bond_propensity/assets/HXACAN_Report_Screenshot_1.png rename to scripts/core/hydrogen_bond_propensity/assets/HXACAN_Report_Screenshot_1.png diff --git a/scripts/hydrogen_bond_propensity/assets/HXACAN_Report_Screenshot_2.png b/scripts/core/hydrogen_bond_propensity/assets/HXACAN_Report_Screenshot_2.png similarity index 100% rename from scripts/hydrogen_bond_propensity/assets/HXACAN_Report_Screenshot_2.png rename to scripts/core/hydrogen_bond_propensity/assets/HXACAN_Report_Screenshot_2.png diff --git a/scripts/hydrogen_bond_propensity/assets/HXACAN_Report_Screenshot_3.png b/scripts/core/hydrogen_bond_propensity/assets/HXACAN_Report_Screenshot_3.png similarity index 100% rename from scripts/hydrogen_bond_propensity/assets/HXACAN_Report_Screenshot_3.png rename to scripts/core/hydrogen_bond_propensity/assets/HXACAN_Report_Screenshot_3.png diff --git a/scripts/hydrogen_bond_propensity/assets/HXACAN_Report_Screenshot_4.png b/scripts/core/hydrogen_bond_propensity/assets/HXACAN_Report_Screenshot_4.png similarity index 100% rename from scripts/hydrogen_bond_propensity/assets/HXACAN_Report_Screenshot_4.png rename to scripts/core/hydrogen_bond_propensity/assets/HXACAN_Report_Screenshot_4.png diff --git a/scripts/hydrogen_bond_propensity/hydrogen_bond_propensity_report.docx b/scripts/core/hydrogen_bond_propensity/hydrogen_bond_propensity_report.docx similarity index 100% rename from scripts/hydrogen_bond_propensity/hydrogen_bond_propensity_report.docx rename to scripts/core/hydrogen_bond_propensity/hydrogen_bond_propensity_report.docx diff --git a/scripts/hydrogen_bond_propensity/hydrogen_bond_propensity_report.py b/scripts/core/hydrogen_bond_propensity/hydrogen_bond_propensity_report.py similarity index 96% rename from scripts/hydrogen_bond_propensity/hydrogen_bond_propensity_report.py rename to scripts/core/hydrogen_bond_propensity/hydrogen_bond_propensity_report.py index 164dd7d..3a6d778 100644 --- a/scripts/hydrogen_bond_propensity/hydrogen_bond_propensity_report.py +++ b/scripts/core/hydrogen_bond_propensity/hydrogen_bond_propensity_report.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. @@ -53,9 +53,8 @@ TEMPLATE_FILE = os.path.join(SCRIPT_DIR, TEMPLATE_FILENAME) -############################################################################### class PropensityCalc: - "HBP Calculator" + """HBP Calculator""" def __init__(self, crystal, work_directory, min_donor_coordination, min_acceptor_coordination, fg_count): self.crystal = crystal self.directory = work_directory @@ -124,7 +123,7 @@ def calculate(self): def make_diagram(mol, directory): - # Generates a diagram from a given structure + """Generates a diagram from a given structure""" molecule_diagram_generator = DiagramGenerator() molecule_diagram_generator.settings.line_width = 1.6 molecule_diagram_generator.settings.font_size = 12 @@ -157,7 +156,10 @@ def generate_component_pics(input_mol, molecule_diagram_generator, directory, do def make_diagram_components(crystal, molecule, directory, docx_template): - # Generates a diagram for each component in a given structure, with D/A atoms labelled if component has a donor/acceptor + """ + Generates a diagram for each component in a given structure, + with D/A atoms labelled if component has a donor/acceptor + """ molecule_diagram_generator = DiagramGenerator() molecule_diagram_generator.settings.line_width = 1.6 molecule_diagram_generator.settings.font_size = 10 @@ -182,7 +184,7 @@ def make_diagram_components(crystal, molecule, directory, docx_template): def fg_diagram(mol, directory, con): - # Create highlighted functional group diagrams + """Create highlighted functional group diagrams""" diagram_generator = DiagramGenerator() diagram_generator.settings.shrink_symbols = False diagram_generator.settings.element_coloring = False @@ -198,7 +200,7 @@ def fg_diagram(mol, directory, con): def add_picture_subdoc(picture_location, docx_template, cm=7): - # This function adds a picture to the .docx file + """Add a picture to the .docx file""" return docxtpl.InlineImage( docx_template, image_descriptor=picture_location, width=Cm(cm)) @@ -214,7 +216,7 @@ def launch_word_processor(output_file): def coordination_scores_calc(crystal, directory): - # Calculate coordination scores for the target structure + """Calculate coordination scores for the target structure""" # Provide settings for the calculation settings = CrystalDescriptors.HBondCoordination.Settings() @@ -227,7 +229,7 @@ def coordination_scores_calc(crystal, directory): def format_scores(scores, das, d_type): - # Reformat the coordination scores to make report writing easier + """Reformat the coordination scores to make report writing easier""" formatted_scores = {} for da in das: preds = scores.predictions_for_label(da.label, d_type)[1] @@ -235,8 +237,8 @@ def format_scores(scores, das, d_type): return formatted_scores -def normalize_molecule(molecule): - # Normalise bond types for the input structure (important for cifs) +def normalise_molecule(molecule): + """Normalise bond types for the input structure (important for cifs)""" if any(bond.bond_type == 'Unknown' for bond in molecule.bonds): print('Unknown type bonds in molecule will be auto assigned') molecule.assign_bond_types(which='unknown') @@ -245,7 +247,7 @@ def normalize_molecule(molecule): def chart_output(groups, work_directory, structure): - # Write out the data points of the HBP chart to a file + """Write out the data points of the HBP chart to a file""" with open(os.path.join(work_directory, '%s_chart_data.csv' % structure), 'w') as outfile: csv_writer = csv.writer(outfile) csv_writer.writerow(['Mean Propensity', 'Mean Coordination Score', 'Hydrogen Bonds']) @@ -257,7 +259,7 @@ def chart_output(groups, work_directory, structure): ) def hbp_landscape(groups, observed_groups, crystal, directory, work_directory, docx_template): - # Generate the HBP chart + """Generate the HBP chart""" # 11 colours for alternative networks chart_colours = {'#00AEEF': 'lightblue', '#D63868': 'violetred', '#6E3776': 'plum', '#B5B800': 'pear', @@ -369,7 +371,7 @@ def main(structure, directory, csdrefcode, min_donor_coordination, min_acceptor_ quit() # Bond types need to be standardised - normalize_molecule(molecule) + normalise_molecule(molecule) crystal.molecule = molecule # Set up a work directory for the HBP files diff --git a/scripts/mof_solvent_removal_2017_chem_mater_publication/Command_prompt_MOF_solvent_removal.py b/scripts/core/mof_solvent_removal_2017_chem_mater_publication/Command_prompt_MOF_solvent_removal.py similarity index 98% rename from scripts/mof_solvent_removal_2017_chem_mater_publication/Command_prompt_MOF_solvent_removal.py rename to scripts/core/mof_solvent_removal_2017_chem_mater_publication/Command_prompt_MOF_solvent_removal.py index 5ed1121..e55e01c 100644 --- a/scripts/mof_solvent_removal_2017_chem_mater_publication/Command_prompt_MOF_solvent_removal.py +++ b/scripts/core/mof_solvent_removal_2017_chem_mater_publication/Command_prompt_MOF_solvent_removal.py @@ -1,6 +1,6 @@ # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. diff --git a/scripts/mof_solvent_removal_2017_chem_mater_publication/Mercury_MOF_solvent_removal.py b/scripts/core/mof_solvent_removal_2017_chem_mater_publication/Mercury_MOF_solvent_removal.py similarity index 97% rename from scripts/mof_solvent_removal_2017_chem_mater_publication/Mercury_MOF_solvent_removal.py rename to scripts/core/mof_solvent_removal_2017_chem_mater_publication/Mercury_MOF_solvent_removal.py index 02b3b7d..9b6f6a3 100644 --- a/scripts/mof_solvent_removal_2017_chem_mater_publication/Mercury_MOF_solvent_removal.py +++ b/scripts/core/mof_solvent_removal_2017_chem_mater_publication/Mercury_MOF_solvent_removal.py @@ -1,6 +1,6 @@ # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. diff --git a/scripts/mof_solvent_removal_2017_chem_mater_publication/ReadMe.md b/scripts/core/mof_solvent_removal_2017_chem_mater_publication/ReadMe.md similarity index 100% rename from scripts/mof_solvent_removal_2017_chem_mater_publication/ReadMe.md rename to scripts/core/mof_solvent_removal_2017_chem_mater_publication/ReadMe.md diff --git a/scripts/refcodes_with_properties/ReadMe.md b/scripts/core/refcodes_with_properties/ReadMe.md similarity index 100% rename from scripts/refcodes_with_properties/ReadMe.md rename to scripts/core/refcodes_with_properties/ReadMe.md diff --git a/scripts/refcodes_with_properties/entry_property_calculator.py b/scripts/core/refcodes_with_properties/entry_property_calculator.py similarity index 56% rename from scripts/refcodes_with_properties/entry_property_calculator.py rename to scripts/core/refcodes_with_properties/entry_property_calculator.py index a6d6784..dd9dd97 100644 --- a/scripts/refcodes_with_properties/entry_property_calculator.py +++ b/scripts/core/refcodes_with_properties/entry_property_calculator.py @@ -1,110 +1,109 @@ # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. # # 2025-03-14: created by Jason C. Cole, The Cambridge Crystallographic Data Centre +from abc import ABC, abstractmethod -''' -Utility classes for filtering CSD entries based on a property control file -''' - - +# Utility classes for filtering CSD entries based on a property control file _filter_classes = {} -def register(cls): - ''' Register a filter class to use in the script. - :param cls: the class to register. - ''' - if cls.name() in _filter_classes: - raise ValueError(f"a class with the name {cls.name()} is already registered. Use a different name") - - _filter_classes[cls.name()] = cls +def get_filter(name): + """Look up a registered filter class by name.""" + return _filter_classes[name] -def filter(name): - return _filter_classes[name] +# Keep backward compatibility +filter = get_filter def helptext(): - ''' Get help text - ''' - txt = "" - for name in _filter_classes.keys(): - cls = _filter_classes[name] - txt = txt + " %s -> %s," % (name, cls.helptext()) - return txt[:-1] + """Get help text""" + return ", ".join( + f" {name} -> {cls.helptext()}" for name, cls in _filter_classes.items() + ) -class _Filter(object): +class _Filter(ABC): + """Base class for all filters. Subclasses are auto-registered unless their name starts with '_'.""" + + def __init_subclass__(cls, **kwargs): + super().__init_subclass__(**kwargs) + # Auto-register concrete filters (skip private/abstract base classes) + if not cls.__name__.startswith('_'): + try: + name = cls.name() + if name in _filter_classes: + raise ValueError( + f"a class with the name {name} is already registered. Use a different name" + ) + _filter_classes[name] = cls + except (NotImplementedError, TypeError): + pass # Abstract intermediate classes @staticmethod + @abstractmethod def name(): - raise NotImplementedError # override this + ... @staticmethod + @abstractmethod def helptext(): - raise NotImplementedError # override this + ... - @staticmethod - def argument_pair(): - raise NotImplementedError # override this + @abstractmethod + def __call__(self, entry): + ... class _ComparativeFilter(_Filter): def __init__(self, args): - value = False - if args.strip() == '1' or args.strip().lower() == 'true': - value = True - - self.expected_value = value + self.expected_value = args.strip() in ('1', 'true', 'True') + @abstractmethod def value(self, theobject): - raise NotImplementedError # override this + ... def __call__(self, theobject): - value = self.value(theobject) - return value == self.expected_value + return self.value(theobject) == self.expected_value class _RangeFilter(_Filter): def __init__(self, args): - parts = [p.strip() for p in args.split()] + parts = args.split() self.minimum = float(parts[0]) self.maximum = float(parts[1]) + @abstractmethod def value(self, theobject): - raise NotImplementedError # override this + ... def __call__(self, theobject): value = self.value(theobject) - return value >= self.minimum and value <= self.maximum + return self.minimum <= value <= self.maximum class _ValueFilter(_Filter): def __init__(self, args): - values = [p for p in args.split()] - #To do: add option for two values? - if values[0] == 'None': - self.expected_value = None - else: - self.expected_value = values[0] + value = args.split()[0] + self.expected_value = None if value == 'None' else value + @abstractmethod def value(self, theobject): - raise NotImplementedError # override this + ... def __call__(self, theobject): - value = self.value(theobject) - return value == self.expected_value + return self.value(theobject) == self.expected_value class AllowedAtomicNumbersFilter(_Filter): def __init__(self, args): - self.allowed_atomic_numbers = [int(atomic_number) for atomic_number in args.strip().split()] + self.allowed_atomic_numbers = set(int(n) for n in args.split()) @staticmethod def name(): @@ -116,18 +115,15 @@ def helptext(): def __call__(self, entry): try: - molecule = entry.crystal.molecule - return len([x for x in molecule.atoms if x.atomic_number in self.allowed_atomic_numbers]) == len(molecule.atoms) + atoms = entry.crystal.molecule.atoms + return all(a.atomic_number in self.allowed_atomic_numbers for a in atoms) except TypeError: return False -register(AllowedAtomicNumbersFilter) - - class MustContainAtomicNumbersFilter(_Filter): def __init__(self, args): - self.must_have_atomic_numbers = [int(atomic_number) for atomic_number in args.strip().split()] + self.must_have_atomic_numbers = set(int(n) for n in args.split()) @staticmethod def name(): @@ -139,28 +135,13 @@ def helptext(): def __call__(self, entry): try: - molecule = entry.crystal.molecule - - contains = set() - for x in molecule.atoms: - contains.add(x.atomic_number) - - for x in self.must_have_atomic_numbers: - if x not in contains: - return False - - return True + present = {a.atomic_number for a in entry.crystal.molecule.atoms} + return self.must_have_atomic_numbers <= present except TypeError: return False -register(MustContainAtomicNumbersFilter) - - class OrganicFilter(_ComparativeFilter): - def __init__(self, args): - super().__init__(args) - @staticmethod def name(): return "organic" @@ -173,13 +154,7 @@ def value(self, entry): return entry.is_organic -register(OrganicFilter) - - class PolymericFilter(_ComparativeFilter): - def __init__(self, args): - super().__init__(args) - @staticmethod def name(): return "polymeric" @@ -192,13 +167,7 @@ def value(self, entry): return entry.is_polymeric -register(PolymericFilter) - - class AllHaveSitesFilter(_ComparativeFilter): - def __init__(self, args): - super().__init__(args) - @staticmethod def name(): return "all atoms have sites" @@ -214,13 +183,7 @@ def value(self, entry): return False -register(AllHaveSitesFilter) - - class Has3DStructure(_ComparativeFilter): - def __init__(self, args): - super().__init__(args) - @staticmethod def name(): return "has 3D structure" @@ -233,13 +196,7 @@ def value(self, entry): return entry.has_3d_structure -register(Has3DStructure) - - class DisorderedFilter(_ComparativeFilter): - def __init__(self, args): - super().__init__(args) - @staticmethod def name(): return "disordered" @@ -252,13 +209,7 @@ def value(self, entry): return entry.has_disorder -register(DisorderedFilter) - - class AtomicWeightFilter(_RangeFilter): - def __init__(self, args): - super().__init__(args) - @staticmethod def name(): return "atomic weight" @@ -269,19 +220,12 @@ def helptext(): def value(self, entry): try: - molecule = entry.crystal.molecule - return molecule.molecular_weight + return entry.crystal.molecule.molecular_weight except TypeError: return 0.0 -register(AtomicWeightFilter) - - class AtomCountFilter(_RangeFilter): - def __init__(self, args): - super().__init__(args) - @staticmethod def name(): return "atom count" @@ -292,19 +236,12 @@ def helptext(): def value(self, entry): try: - molecule = entry.crystal.molecule - return len(molecule.atoms) + return len(entry.crystal.molecule.atoms) except TypeError: return 0 -register(AtomCountFilter) - - class RotatableBondFilter(_RangeFilter): - def __init__(self, args): - super().__init__(args) - @staticmethod def name(): return "rotatable bond count" @@ -315,19 +252,12 @@ def helptext(): def value(self, entry): try: - molecule = entry.crystal.molecule - return sum(x.is_rotatable for x in molecule.bonds) + return sum(b.is_rotatable for b in entry.crystal.molecule.bonds) except TypeError: return 0 -register(RotatableBondFilter) - - class DonorCountFilter(_RangeFilter): - def __init__(self, args): - super().__init__(args) - @staticmethod def name(): return "donor count" @@ -338,19 +268,12 @@ def helptext(): def value(self, entry): try: - molecule = entry.crystal.molecule - return len([x for x in molecule.atoms if x.is_donor]) + return sum(a.is_donor for a in entry.crystal.molecule.atoms) except TypeError: return 0 -register(DonorCountFilter) - - class AcceptorCountFilter(_RangeFilter): - def __init__(self, args): - super().__init__(args) - @staticmethod def name(): return "acceptor count" @@ -361,19 +284,12 @@ def helptext(): def value(self, entry): try: - molecule = entry.crystal.molecule - return len([x for x in molecule.atoms if x.is_acceptor]) + return sum(a.is_acceptor for a in entry.crystal.molecule.atoms) except TypeError: return 0 -register(AcceptorCountFilter) - - class ComponentCountFilter(_RangeFilter): - def __init__(self, args): - super().__init__(args) - @staticmethod def name(): return "component range" @@ -389,13 +305,7 @@ def value(self, entry): return 0 -register(ComponentCountFilter) - - class ZPrimeFilter(_RangeFilter): - def __init__(self, args): - super().__init__(args) - @staticmethod def name(): return "zprime range" @@ -408,13 +318,7 @@ def value(self, entry): return entry.crystal.z_prime -register(ZPrimeFilter) - - class AsymmUnitFilter(_RangeFilter): - def __init__(self, args): - super().__init__(args) - @staticmethod def name(): return "asymmetric unit components" @@ -427,13 +331,7 @@ def value(self, entry): return len(entry.crystal.asymmetric_unit_molecule.components) -register(AsymmUnitFilter) - - class RfactorFilter(_RangeFilter): - def __init__(self, args): - super().__init__(args) - @staticmethod def name(): return "rfactor range" @@ -446,13 +344,7 @@ def value(self, entry): return entry.r_factor -register(RfactorFilter) - - class SpacegroupNumberFilter(_RangeFilter): - def __init__(self, args): - super().__init__(args) - @staticmethod def name(): return "spacegroup number range" @@ -465,13 +357,7 @@ def value(self, entry): return entry.crystal.spacegroup_number_and_setting[0] -register(SpacegroupNumberFilter) - - class ChiralityFilter(_ValueFilter): - def __init__(self, args): - super().__init__(args) - @staticmethod def name(): return "chirality" @@ -482,17 +368,15 @@ def helptext(): def value(self, entry): try: - molecule = entry.crystal.molecule - chirality = next((atom.chirality for atom in molecule.atoms if atom.is_chiral), None) - return chirality + return next( + (atom.chirality for atom in entry.crystal.molecule.atoms if atom.is_chiral), + None + ) except TypeError: return None -register(ChiralityFilter) - - -class FilterEvaluation(object): +class FilterEvaluation: def __init__(self): self._methods = [] @@ -500,32 +384,29 @@ def add_filter(self, method): self._methods.append(method) def evaluate(self, entry): - for method in self._methods: - try: - if not method(entry): - return False - except (TypeError, RuntimeError): - return False + return all(self._safe_call(m, entry) for m in self._methods) - return True + @staticmethod + def _safe_call(method, entry): + try: + return method(entry) + except (TypeError, RuntimeError): + return False def values(self, entry): - values = {} - for method in self._methods: - if hasattr(method, "value"): - try: - values[method.name()] = method.value(entry) - except NotImplementedError: - pass - return values + return { + method.name(): method.value(entry) + for method in self._methods + if hasattr(method, "value") + } def parse_control_file(lines): evaluator = FilterEvaluation() for line in lines: - if len(line) > 0 and line[0] != '#': - parts = line.split(":") - if len(parts) > 1: - cls = _filter_classes[parts[0].strip()] - evaluator.add_filter(cls(parts[1])) + if line and not line.startswith('#'): + filter_name, sep, args = line.partition(":") + if sep: + cls = _filter_classes[filter_name.strip()] + evaluator.add_filter(cls(args)) return evaluator diff --git a/scripts/refcodes_with_properties/example_control_file.txt b/scripts/core/refcodes_with_properties/example_control_file.txt similarity index 100% rename from scripts/refcodes_with_properties/example_control_file.txt rename to scripts/core/refcodes_with_properties/example_control_file.txt diff --git a/scripts/refcodes_with_properties/more_elaborate_control.txt b/scripts/core/refcodes_with_properties/more_elaborate_control.txt similarity index 100% rename from scripts/refcodes_with_properties/more_elaborate_control.txt rename to scripts/core/refcodes_with_properties/more_elaborate_control.txt diff --git a/scripts/refcodes_with_properties/refcodes_with_properties.py b/scripts/core/refcodes_with_properties/refcodes_with_properties.py similarity index 93% rename from scripts/refcodes_with_properties/refcodes_with_properties.py rename to scripts/core/refcodes_with_properties/refcodes_with_properties.py index 474fc68..6ed7471 100644 --- a/scripts/refcodes_with_properties/refcodes_with_properties.py +++ b/scripts/core/refcodes_with_properties/refcodes_with_properties.py @@ -1,18 +1,16 @@ #!/usr/bin/env python # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. # # 2025-03-14: created by Jason C. Cole, The Cambridge Crystallographic Data Centre -''' +""" Filter a refcode list to the subset that have the desired properties -''' - -######################################################################### +""" import argparse import csv @@ -63,7 +61,7 @@ csvwriter = None for entry in reader: values = filterer.values(entry) - if csvwriter == None: + if csvwriter is None: fieldnames = ["identifier"] + values.keys() csvwriter = csv.DictWriter(outfile, fieldnames=fieldnames) csvwriter.writeheader() diff --git a/scripts/refcodes_with_properties/test_entry_property_calculator.py b/scripts/core/refcodes_with_properties/test_entry_property_calculator.py similarity index 98% rename from scripts/refcodes_with_properties/test_entry_property_calculator.py rename to scripts/core/refcodes_with_properties/test_entry_property_calculator.py index 7d4bd51..9e2509e 100644 --- a/scripts/refcodes_with_properties/test_entry_property_calculator.py +++ b/scripts/core/refcodes_with_properties/test_entry_property_calculator.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # # This script can be used for any purpose without limitation subject to the -# conditions at http://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx +# conditions at https://www.ccdc.cam.ac.uk/Community/Pages/Licences/v2.aspx # # This permission notice and the following statement of attribution must be # included in all copies or substantial portions of this script. diff --git a/scripts/core/show_semiconductor_properties/ReadMe.md b/scripts/core/show_semiconductor_properties/ReadMe.md new file mode 100644 index 0000000..0659332 --- /dev/null +++ b/scripts/core/show_semiconductor_properties/ReadMe.md @@ -0,0 +1,23 @@ +# Descs Data Plot + +## Summary + +Only works for 2024.3 onwards, please see + +for more details on the properties. +The script will display the properties for the structure currently loaded in the Mercury window when +launched from the csd-python-api dropdown in Mercury + +## Licensing Requirements + +- CSD-Core + +## Instructions on Running + +Download the whole directory and place it in the ccdc-software/mercury/scripts/ folder + +## Author + +C. Kingsbury 2024 + +For feedback or to report any issues please contact [support@ccdc.cam.ac.uk](mailto:support@ccdc.cam.ac.uk) \ No newline at end of file diff --git a/scripts/show_semiconductor_properties/hist_data.json b/scripts/core/show_semiconductor_properties/hist_data.json similarity index 100% rename from scripts/show_semiconductor_properties/hist_data.json rename to scripts/core/show_semiconductor_properties/hist_data.json diff --git a/scripts/show_semiconductor_properties/semiconductor_template.html b/scripts/core/show_semiconductor_properties/semiconductor_template.html similarity index 99% rename from scripts/show_semiconductor_properties/semiconductor_template.html rename to scripts/core/show_semiconductor_properties/semiconductor_template.html index 28319e8..3d144ee 100644 --- a/scripts/show_semiconductor_properties/semiconductor_template.html +++ b/scripts/core/show_semiconductor_properties/semiconductor_template.html @@ -60,8 +60,8 @@

Calculated Semiconductor Properties: {{ident}}

-