jglaser commited on
Commit
36d87d5
1 Parent(s): 6297930

Filter common ligands and ligands with <3 atoms

Browse files

also expand multiple copies of the same ligand binding to the same
receptor into separate rows (e.g., one bound ligand per chain)

Files changed (3) hide show
  1. README.md +11 -1
  2. data/pdb.parquet +2 -2
  3. parse_complexes.py +44 -13
README.md CHANGED
@@ -10,7 +10,7 @@ tags:
10
  ## How to use the data sets
11
 
12
  This dataset contains more about 80,000 unique pairs of protein sequences and ligand SMILES, and the coordinates
13
- of their complexes from the PDB. Only ligands with a molecular weight >= 100 Da are included.
14
 
15
  SMILES are assumed to be tokenized by the regex from P. Schwaller.
16
 
@@ -20,6 +20,16 @@ Every receptor coordinate maps onto the Calpha coordinate of that residue.
20
 
21
  The dataset can be used to fine-tune a language model, all data comes from PDBind-cn.
22
 
 
 
 
 
 
 
 
 
 
 
23
  ### Use the already preprocessed data
24
 
25
  Load a test/train split using
 
10
  ## How to use the data sets
11
 
12
  This dataset contains more about 80,000 unique pairs of protein sequences and ligand SMILES, and the coordinates
13
+ of their complexes from the PDB.
14
 
15
  SMILES are assumed to be tokenized by the regex from P. Schwaller.
16
 
 
20
 
21
  The dataset can be used to fine-tune a language model, all data comes from PDBind-cn.
22
 
23
+ ## Ligand selection criteria
24
+
25
+ Only ligands with
26
+
27
+ - at least 3 atoms,
28
+ - a molecular weight >= 100 Da,
29
+ - that don't occur more than 75 times in different PDB complexes (this includes common additives like PEG, ADP, ..)
30
+
31
+ are considered.
32
+
33
  ### Use the already preprocessed data
34
 
35
  Load a test/train split using
data/pdb.parquet CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:c503ec9218e87f192d710838a0123f01ac1e48b75b288f0adc229cb025d1b592
3
- size 1005021071
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bbe6a448b46a5e6c2dd1b32ca878b5a658505f06334c173aa7565a3a6a848413
3
+ size 988455052
parse_complexes.py CHANGED
@@ -38,6 +38,28 @@ molecule_regex = r"""(\[[^\]]+]|Br?|Cl?|N|O|S|P|F|I|b|c|n|o|s|p|\(|\)|\.|=|#|-|\
38
  max_seq = 2046 # = 2048 - 2 (accounting for [CLS] and [SEP])
39
  max_smiles = 510 # = 512 - 2
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  def get_protein_sequence_and_coords(receptor):
42
  calpha = receptor.select('calpha')
43
  xyz = calpha.getCoords()
@@ -120,15 +142,20 @@ def process_ligand(ligand, res_name, expo_dict):
120
  :param expo_dict: dictionary with LigandExpo
121
  :return: molecule with bond orders assigned
122
  """
123
- output = StringIO()
124
- sub_mol = ligand.select(f"resname {res_name}")
125
  sub_smiles = expo_dict['SMILES'][res_name]
126
  template = AllChem.MolFromSmiles(sub_smiles)
127
- writePDBStream(output, sub_mol)
128
- pdb_string = output.getvalue()
129
- rd_mol = AllChem.MolFromPDBBlock(pdb_string)
130
- new_mol = AllChem.AssignBondOrdersFromTemplate(template, rd_mol)
131
- return new_mol, template
 
 
 
 
 
 
 
132
 
133
  def process_entry(df_dict, pdb_fn):
134
  try:
@@ -141,6 +168,8 @@ def process_entry(df_dict, pdb_fn):
141
  """
142
  protein, ligand = get_pdb_components(pdb_fn)
143
 
 
 
144
  ligand_mols = []
145
  ligand_names = []
146
 
@@ -148,19 +177,21 @@ def process_entry(df_dict, pdb_fn):
148
  # filter ligands by molecular weight
149
  res_name_list = list(set(ligand.getResnames()))
150
  for res in res_name_list:
151
- mol, template = process_ligand(ligand, res, df_dict)
152
 
153
  mol_wt = ExactMolWt(template)
154
  natoms = template.GetNumAtoms()
155
 
156
- if mol_wt >= mol_wt_cutoff and natoms >= min_atoms:
157
- ligand_mols.append(mol)
158
- ligand_names.append(res)
 
 
 
159
 
160
  ligand_smiles = []
161
  ligand_xyz = []
162
 
163
- pdb_name = os.path.basename(pdb_fn).split('.')[-3][3:]
164
  for mol, name in zip(ligand_mols, ligand_names):
165
  print('Processing {} and {}'.format(pdb_name, name))
166
  smi, xyz = tokenize_ligand(mol)
@@ -184,7 +215,7 @@ if __name__ == '__main__':
184
  # read ligand table
185
  df_dict = read_ligand_expo()
186
 
187
- result = executor.map(partial(process_entry, df_dict), filenames, chunksize=512)
188
  result = list(result)
189
 
190
  # expand sequences and ligands
 
38
  max_seq = 2046 # = 2048 - 2 (accounting for [CLS] and [SEP])
39
  max_smiles = 510 # = 512 - 2
40
 
41
+ # filter out these common additives which occur in more than 75 complexes in the PDB
42
+ ubiquitous_ligands = ['PEG', 'ADP', 'FAD', 'NAD', 'ATP', 'MPD', 'NAP', 'GDP', 'MES',
43
+ 'GTP', 'FMN', 'HEC', 'TRS', 'CIT', 'PGE', 'ANP', 'SAH', 'NDP',
44
+ 'PG4', 'EPE', 'AMP', 'COA', 'MLI', 'FES', 'GNP', 'MRD', 'GSH',
45
+ 'FLC', 'AGS', 'NAI', 'SAM', 'PCW', '1PE', 'TLA', 'BOG', 'CYC',
46
+ 'UDP', 'PX4', 'NAG', 'IMP', 'POP', 'UMP', 'PLM', 'HEZ', 'TPP',
47
+ 'ACP', 'LDA', 'ACO', 'CLR', 'BGC', 'P6G', 'LMT', 'OGA', 'DTT',
48
+ 'POV', 'FBP', 'AKG', 'MLA', 'ADN', 'NHE', '7Q9', 'CMP', 'BTB',
49
+ 'PLP', 'CAC', 'SIN', 'C2E', '2AN', 'OCT', '17F', 'TAR', 'BTN',
50
+ 'XYP', 'MAN', '5GP', 'GAL', 'GLC', 'DTP', 'DGT', 'PEB', 'THP',
51
+ 'BEZ', 'CTP', 'GSP', 'HED', 'ADE', 'TYD', 'TTP', 'BNG', 'IHP',
52
+ 'FDA', 'PEP', 'ALF', 'APR', 'MTX', 'MLT', 'LU8', 'UTP', 'APC',
53
+ 'BLA', 'C8E', 'D10', 'CHT', 'BO2', '3BV', 'ORO', 'MPO', 'Y01',
54
+ 'OLC', 'B3P', 'G6P', 'PMP', 'D12', 'NDG', 'A3P', '78M', 'F6P',
55
+ 'U5P', 'PRP', 'UPG', 'THM', 'SFG', 'MYR', 'FEO', 'PG0', 'CXS',
56
+ 'AR6', 'CHD', 'WO4', 'C5P', 'UFP', 'GCP', 'HDD', 'SRT', 'STU',
57
+ 'CDP', 'TCL', '04C', 'MYA', 'URA', 'PLG', 'MTA', 'BMP', 'SAL',
58
+ 'TA1', 'UD1', 'OLA', 'BCN', 'LMR', 'BMA', 'OAA', 'TAM', 'MBO',
59
+ 'MMA', 'SPD', 'MTE', 'AP5', 'TMP', 'PGA', 'GLA', '3PG', 'FUL',
60
+ 'PQQ', '9TY', 'DUR', 'PPV', 'SPM', 'SIA', 'DUP', 'GTX', '1PG',
61
+ 'GUN', 'ETF', 'FDP', 'MFU', 'G2P', 'PC', 'DST', 'INI']
62
+
63
  def get_protein_sequence_and_coords(receptor):
64
  calpha = receptor.select('calpha')
65
  xyz = calpha.getCoords()
 
142
  :param expo_dict: dictionary with LigandExpo
143
  :return: molecule with bond orders assigned
144
  """
 
 
145
  sub_smiles = expo_dict['SMILES'][res_name]
146
  template = AllChem.MolFromSmiles(sub_smiles)
147
+
148
+ allres = ligand.select(f"resname {res_name}")
149
+ res = np.unique(allres.getResindices())
150
+ mols = []
151
+ for i in res:
152
+ sub_mol = ligand.select(f"resname {res_name} and resindex {i}")
153
+ output = StringIO()
154
+ writePDBStream(output, sub_mol)
155
+ pdb_string = output.getvalue()
156
+ rd_mol = AllChem.MolFromPDBBlock(pdb_string)
157
+ mols.append(AllChem.AssignBondOrdersFromTemplate(template, rd_mol))
158
+ return mols, template
159
 
160
  def process_entry(df_dict, pdb_fn):
161
  try:
 
168
  """
169
  protein, ligand = get_pdb_components(pdb_fn)
170
 
171
+ pdb_name = os.path.basename(pdb_fn).split('.')[-3][3:]
172
+
173
  ligand_mols = []
174
  ligand_names = []
175
 
 
177
  # filter ligands by molecular weight
178
  res_name_list = list(set(ligand.getResnames()))
179
  for res in res_name_list:
180
+ mols, template = process_ligand(ligand, res, df_dict)
181
 
182
  mol_wt = ExactMolWt(template)
183
  natoms = template.GetNumAtoms()
184
 
185
+ if mol_wt >= mol_wt_cutoff and natoms >= min_atoms and res not in ubiquitous_ligands:
186
+ if len(mols) > 1:
187
+ print('Found {} copies of {} ligand {}'.format(len(mols),pdb_name,res))
188
+ ligand_mols += mols
189
+ ligand_names += [res]*len(mols)
190
+
191
 
192
  ligand_smiles = []
193
  ligand_xyz = []
194
 
 
195
  for mol, name in zip(ligand_mols, ligand_names):
196
  print('Processing {} and {}'.format(pdb_name, name))
197
  smi, xyz = tokenize_ligand(mol)
 
215
  # read ligand table
216
  df_dict = read_ligand_expo()
217
 
218
+ result = executor.map(partial(process_entry, df_dict), filenames, chunksize=2048)
219
  result = list(result)
220
 
221
  # expand sequences and ligands