Skip to content

Commit 9a55f0d

Browse files
committed
Flake Changes NO_JIRA
1 parent a98eb19 commit 9a55f0d

11 files changed

+26
-31
lines changed

api_paper_2024/example_1/ReadMe.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
# Extending Substructure Searching using the CSD Python API
2-
1+
# Extending Substructure Searching using the CSD Python API
32
By searching the CSD using a SMARTS query through the CSD Python API and further inspect molecules as required.
43
Using SMARTS, it is possible to express a complex Isoflavone query which is recursive in nature.
5-
6-
7-
## To Run:
4+
## To Run
85
```bash
96
python isovflavone_search.py
10-
```
7+
```

api_paper_2024/example_1/isovflavone_search.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"""
1313
Credit - this code was written by Jason C. Cole, Natalie Johnson and Alex Moldovan
1414
"""
15+
import argparse
1516

1617
from ccdc.io import EntryReader
1718
from ccdc.search import SubstructureSearch, SMARTSSubstructure
@@ -106,12 +107,12 @@ def run(self):
106107
if __name__ == "__main__":
107108

108109
sub = "$([#1]),$([OH1]),$([OX1H0]),$(O[CH3]),$(Oc1ccccc1)"
109-
query_string = f"c(!@[{sub}:1])1c(!@[{sub}:2])c(!@[{sub}:3])c(!@[{sub}:4])c(OC(!@[{sub}:5])=C(c2c(!@[{sub}:6])c(!@[{sub}:7])c(!@[{sub}:8])c(!@[{sub}:9])c(!@[{sub}:10])2)C(=O)c1)" # noqa
110+
query_string = (f"c(!@[{sub}:1])1c(!@[{sub}:2])c(!@[{sub}:3])c(!@[{sub}:4])c(OC(!@[{sub}:5])"
111+
f"=C(c2c(!@[{sub}:6])c(!@[{sub}:7])c(!@[{sub}:8])c(!@[{sub}:9])c(!@[{sub}:10])2)C(=O)c1)") # noqa
110112

111-
112-
import argparse
113113
parser = argparse.ArgumentParser()
114-
parser.add_argument('-d','--database', default='CSD',help='Path to the file to search or "CSD" to use the CSD')
114+
parser.add_argument('-d', '--database', default='CSD',
115+
help='Path to the file to search or "CSD" to use the CSD')
115116
args = parser.parse_args()
116117

117118
database = 'tiny.sdf'

api_paper_2024/example_2/ReadMe.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
# Mining third-party resources for structural context
2-
32
The CSD Python API, combined with other Python and REST APIs, can be very powerful for mining for such relationships.
43
Each CCDC refcode has associated publication information, and many have an associated publication document object
5-
identifier (DOI). ##TODO Add very quick summary of tool.
4+
identifier (DOI).
65

76
## Dependencies
8-
97
- habanero
108

119
Optional:
1210

1311
- wordcloud
14-
- nltk (after install please consult https://www.nltk.org/data.html)
12+
- nltk (after install please consult <https://www.nltk.org/data.html>)
1513

1614
```conda install -c conda-forge habanero wordcloud nltk```
1715

1816
## To Run
19-
2017
Add script folder through CSD Python API drop down menu.
21-
With a structure opened, click `about_entry.py` in menu dropdown.
18+
With a structure opened, click `about_entry.py` in menu dropdown.

api_paper_2024/example_2/about_entry.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# through mercury.
1818
import warnings
1919

20-
warnings.filterwarnings("ignore", category=DeprecationWarning)
20+
warnings.filterwarnings("ignore", category=DeprecationWarning) # noqa
2121
import os
2222
import time
2323

api_paper_2024/example_2/language_processing.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# For now, to prevent deprecation warnings tripping things up
2929
import warnings
3030

31-
warnings.filterwarnings("ignore", category=DeprecationWarning)
31+
warnings.filterwarnings("ignore", category=DeprecationWarning) # noqa
3232

3333
from wordcloud import WordCloud
3434

@@ -37,6 +37,7 @@
3737
from nltk.stem.wordnet import WordNetLemmatizer
3838

3939
import pandas as pd
40+
from csv import writer
4041

4142

4243
class FrequencyCalculator:
@@ -83,7 +84,7 @@ def write_word_frequency_table(self, how_many, filename='single_word_frequencies
8384
n_elements, rowdata = self.most_common_words(how_many)
8485

8586
with open(filename, 'w', newline='', encoding='utf-8') as csvfile:
86-
w = writer(csvfile) ## Writer is not assigned - missing import?
87+
w = writer(csvfile)
8788
w.writerow(['word', 'count', 'frequency'])
8889
for row in rowdata:
8990
towrite = [row[0], row[1], row[1] * 100.0 / n_elements]

api_paper_2024/example_2/opencitations.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ def run(self, doi):
174174

175175
def test_dois():
176176
test_dois_links = ['10.1021/jp103212z', '10.1016/j.jorganchem.2012.03.020',
177-
'10.1016/j.poly.2018.06.030', '10.1002/bip.360231115',
178-
'10.1007/978-1-4684-1354-0_4', '10.1002/chin.197846077',
179-
'10.1038/292055a0']
177+
'10.1016/j.poly.2018.06.030', '10.1002/bip.360231115',
178+
'10.1007/978-1-4684-1354-0_4', '10.1002/chin.197846077',
179+
'10.1038/292055a0']
180180

181181
import ccdc.utilities
182182

api_paper_2024/example_2/url_requesting.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def run(self, url, retries=3):
5555

5656
try:
5757
return request.json()
58-
except requests.exceptions.JSONDecodeError as exc:
58+
except requests.exceptions.JSONDecodeError:
5959
if self._logger is not None:
6060
self._logger.warning(f"Decode of request failed {request} {url}")
6161
raise URLRequestError(f"Decode of request failed {request} {url}", -9999)

api_paper_2024/example_3/ReadMe.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
A key feature used in this script is GOLD in interactive docking mode;
44
this allows a user to set up a GOLD daemon object on a socket and send individual molecules to the socket for docking.
55
This avoids repeated initialisation when used to receive ligands from external data sources.
6-
The ChEMBL Python API (Davies et al., 2015) is used to facilitate similarity searching in the ChEMBL database.
6+
The ChEMBL Python API (Davies et al., 2015) is used to facilitate similarity searching in the ChEMBL database.
77

88
## Dependencies
99

1010
Optional:
11-
- chembl_webresource_client
1211

12+
- chembl_webresource_client
1313

14-
## To Run
14+
## To Run
1515
```bash
1616
python similarity_docking.py Example/unconstrained.conf
17-
```
17+
```

api_paper_2024/example_3/similarity_docking.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1616
This has been adapted from the example program provided in the CSD Python API to allow for
1717
use of other data sources.
18-
18+
1919
Original program written by Richard Sykes
2020
Modified for use with Chembl by Jason C. Cole and Alex Moldovan
2121
"""
@@ -75,7 +75,7 @@ def __init__(self, smiles, identifier):
7575
raise ChemblParseError(smiles, identifier, f"{e}")
7676

7777
if conformers is None or len(conformers) == 0:
78-
raise ChemblParseError(smiles, identifier, f"No conformers generated ")
78+
raise ChemblParseError(smiles, identifier, "No conformers generated ")
7979

8080
self.molecule = conformers[0].molecule.copy()
8181
self.molecule.identifier = identifier

api_paper_2024/example_4/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ maximum radius for interactions
4141

4242
## Author
4343

44-
Chris Kingsbury (2024)
44+
Chris Kingsbury (2024)

api_paper_2024/example_5/ReadMe.md

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ The structure loading and morphology calculations can be replaced with customise
55
The main shape classification is carried out in `shape_classification.py` whilst the visualisation is handled
66
in `visualiser.py`
77

8-
98
## Dependencies
109
- plotly
1110
```conda install -c conda-forge plotly```

0 commit comments

Comments
 (0)