Download scripts for the CSD Python API from the CSD GitHub repository
Back To Discover
March 18, 2022
The CSD GitHub repository is the place to download, edit, and share python scripts to perform chemistry tasks and analyses using the CSD Python API. Here we’ll explain how to access it.
Find scripts for the CSD Python APIYou can now download scripts to use with the CSD Python API from our new CSD GitHub repository. This replaces the old CSD Python API forum, making it easier to merge changes and manage the scripts.
>> Access the CSD GitHub repository here to download, edit and submit scripts for the CSD Python API. <<Jump to:
- What can you do with the CSD Python API
- How to use the CSD Python API
- How to use the CSD GitHub repo
- How to download CSD Python API scripts from the CSD GitHub repo
- How to submit scripts to the CSD GitHub repo
- How to get help on the CSD Python API or the CSD GitHub repo
What can you do with the CSD Python API?The possibilities are almost endless. The CSD Python API gives you programmatic access to the Cambridge Structural Database (CSD) as well as features in the CSD software such as Mercury, GOLD, and CSD-CrossMiner. To give a few examples:
- Use SMARTS and SMILES - from searching, to selecting, to generating a SMILES from a structure. See how in this blog.
- Generate a 3D molecular structure from a SMILES string - learn how in this blog.
- Mine data from the CSD to isolate only what is relevant for your work—as shown in this case study with webinar.
- Perform docking with GOLD, as described here.
- Run advanced search and analysis, as described in this step-by-step tutorial.
- Perform ligand-based virtual screening, as described in this step-by-step tutorial.
How to use the CSD Python APIFind the documentation for the CSD Python API here. This includes release and installation notes, examples and tips. If you're getting started with the CSD Python API, try our on-demand 90-minute module here: Programmatic access to the CSD 101 — CSD Python API. You do need knowledge of Python to get started. If you're learning Python, realpython.com is a great resource to get started.
How to use the CSD GitHub repoEach script in the repository comes with an associated ReadMe file that contains a summary of what the script does, how to use it, any dependencies, and any licences required. For those familiar with GitHub, we suggest creating a fork of the repository so you can keep up to date with any changes. If you’re new to GitHub, there are some great resources online to get started. If you have any questions about submitting a script or downloading and using scripts, contact us on .
How to download CSD Python API scripts from the CSD GitHub repoTo download 1 set of scripts from the CSD GitHub repo, follow the instructions here. If you just want quick access to the scripts in one click, you can download a snapshot of the repository to a zip file that contains all the scripts. To download and run one script in the CSD Python API:
- Go to the CSD GitHub Repo.
- Click on the green “Code” button
- Download ZIP
- Unpack the compressed file.
- Navigate to your script of choice (each script contains a ReadMe describing what it does and how to use it)
- Run the script using the CSD Python API conda environment (or your own!).
1 "CCDCPython_API_2022minicondaScriptsactivate.bat" 2 python script_example.py
How to submit scripts to the CSD GitHub repoIts possible for you our user community to submit scripts. If you have a script you think others would find useful—please share it! You can also modify existing scripts, to add functionality or improve them. We welcome python scripts to perform any tasks relating to the CSD, from the simple to complex. Some of our most popular scripts perform simple tasks such as concatenating files or generating inputs for other programs, so nothing is too big or small. To submit or modify a script yourself:
- Create a Fork of the repository (A fork is a copy of a repository that you manage. Forks let you make changes to a project without affecting the CSD GitHub repo. You can fetch updates from or submit changes to the CSD GitHub repo with pull requests.
- Commit your changes to the forked repository.
- Create a Pull Request on the CSD GitHub repo.
- Once the code has been reviewed it will be merged into the CSD GitHub repo by our team.
- Create a Form of the CSD Python API Scripts Repo
- Clone the forked repository onto your PC
git clone <username/forked-repo>
- Make changes/add new script and don't forget the ReadMe file. Example script can be found in the repo.
- Create a new branch to add to your script
1 git branch <new_script_branch> 2 git checkout <new_script_branch>
- Commit changes
1 git add new_script.py 2 git commit -m "Adding new_script" 3 git push --set-upstream origin <new_script_branch>
- Switching to your new branch in GitHub, you can click on the "Contribute" button in your forked repo
- Click Pull Request
- Select the appropriate target and base
- Add information in the header and description
- Click create Pull Request
- Now wait for our team to read your code and provide feedback.
How to get help on the CSD Python API or the CSD GitHub repoIf you have questions about using the CSD Python API, our technical support team are here to help. Contact us on as normal.
CSD Python API (12)