add protein local frames
Browse files- data/pdbbind.parquet +2 -2
- pdbbind.py +16 -2
- pdbbind_complexes.py +3 -1
data/pdbbind.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cf8f01b7178290658968bc0bd73851dfcdde1937c7e5f27f6a03e058e82a8333
|
| 3 |
+
size 712225770
|
pdbbind.py
CHANGED
|
@@ -88,12 +88,24 @@ def parse_complex(fn):
|
|
| 88 |
warnings.simplefilter("ignore")
|
| 89 |
structure = parser.get_structure('protein',fn+'/'+name+'_protein.pdb')
|
| 90 |
|
|
|
|
|
|
|
|
|
|
| 91 |
ppb = CaPPBuilder()
|
| 92 |
seq = []
|
| 93 |
xyz_receptor = []
|
|
|
|
| 94 |
for pp in ppb.build_peptides(structure):
|
| 95 |
seq.append(str(pp.get_sequence()))
|
| 96 |
xyz_receptor += [tuple(a.get_vector()) for a in pp.get_ca_list()]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
seq = ''.join(seq)
|
| 98 |
|
| 99 |
# parse ligand, convert to SMILES and map atoms
|
|
@@ -125,7 +137,7 @@ def parse_complex(fn):
|
|
| 125 |
token_pos.append((np.nan, np.nan, np.nan))
|
| 126 |
token_rot.append(np.eye(3).flatten().tolist())
|
| 127 |
|
| 128 |
-
return name, seq, smi, xyz_receptor, token_pos, token_rot
|
| 129 |
|
| 130 |
except Exception as e:
|
| 131 |
print(e)
|
|
@@ -149,11 +161,13 @@ if __name__ == '__main__':
|
|
| 149 |
all_xyz_receptor = [r[3] for r in result if r is not None]
|
| 150 |
all_xyz_ligand = [r[4] for r in result if r is not None]
|
| 151 |
all_rot_ligand = [r[5] for r in result if r is not None]
|
|
|
|
| 152 |
|
| 153 |
import pandas as pd
|
| 154 |
df = pd.DataFrame({'name': names, 'seq': seqs,
|
| 155 |
'smiles': all_smiles,
|
| 156 |
'receptor_xyz': all_xyz_receptor,
|
| 157 |
'ligand_xyz': all_xyz_ligand,
|
| 158 |
-
'ligand_rot': all_rot_ligand
|
|
|
|
| 159 |
df.to_parquet('data/pdbbind.parquet',index=False)
|
|
|
|
| 88 |
warnings.simplefilter("ignore")
|
| 89 |
structure = parser.get_structure('protein',fn+'/'+name+'_protein.pdb')
|
| 90 |
|
| 91 |
+
res_frames = []
|
| 92 |
+
|
| 93 |
+
# extract sequence, Calpha positions and local coordinate frames using the AF2 convention
|
| 94 |
ppb = CaPPBuilder()
|
| 95 |
seq = []
|
| 96 |
xyz_receptor = []
|
| 97 |
+
R_receptor = []
|
| 98 |
for pp in ppb.build_peptides(structure):
|
| 99 |
seq.append(str(pp.get_sequence()))
|
| 100 |
xyz_receptor += [tuple(a.get_vector()) for a in pp.get_ca_list()]
|
| 101 |
+
|
| 102 |
+
for res in pp:
|
| 103 |
+
N = np.array(tuple(res['N'].get_vector()))
|
| 104 |
+
C = np.array(tuple(res['C'].get_vector()))
|
| 105 |
+
CA = np.array(tuple(res['CA'].get_vector()))
|
| 106 |
+
|
| 107 |
+
R_receptor.append(rot_from_two_vecs(N-CA,C-CA).flatten().tolist())
|
| 108 |
+
|
| 109 |
seq = ''.join(seq)
|
| 110 |
|
| 111 |
# parse ligand, convert to SMILES and map atoms
|
|
|
|
| 137 |
token_pos.append((np.nan, np.nan, np.nan))
|
| 138 |
token_rot.append(np.eye(3).flatten().tolist())
|
| 139 |
|
| 140 |
+
return name, seq, smi, xyz_receptor, token_pos, token_rot, R_receptor
|
| 141 |
|
| 142 |
except Exception as e:
|
| 143 |
print(e)
|
|
|
|
| 161 |
all_xyz_receptor = [r[3] for r in result if r is not None]
|
| 162 |
all_xyz_ligand = [r[4] for r in result if r is not None]
|
| 163 |
all_rot_ligand = [r[5] for r in result if r is not None]
|
| 164 |
+
all_rot_receptor = [r[6] for r in result if r is not None]
|
| 165 |
|
| 166 |
import pandas as pd
|
| 167 |
df = pd.DataFrame({'name': names, 'seq': seqs,
|
| 168 |
'smiles': all_smiles,
|
| 169 |
'receptor_xyz': all_xyz_receptor,
|
| 170 |
'ligand_xyz': all_xyz_ligand,
|
| 171 |
+
'ligand_rot': all_rot_ligand,
|
| 172 |
+
'receptor_rot': all_rot_receptor})
|
| 173 |
df.to_parquet('data/pdbbind.parquet',index=False)
|
pdbbind_complexes.py
CHANGED
|
@@ -57,7 +57,7 @@ _URLs = {name: _URL+_file_names[name] for name in _file_names}
|
|
| 57 |
class PDBBindComplexes(datasets.ArrowBasedBuilder):
|
| 58 |
"""List of protein sequences, ligand SMILES, and complex coordinates."""
|
| 59 |
|
| 60 |
-
VERSION = datasets.Version("1.
|
| 61 |
|
| 62 |
def _info(self):
|
| 63 |
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
|
@@ -78,6 +78,8 @@ class PDBBindComplexes(datasets.ArrowBasedBuilder):
|
|
| 78 |
"smiles": datasets.Value("string"),
|
| 79 |
"ligand_xyz": datasets.Sequence(datasets.Sequence(datasets.Value('float32'))),
|
| 80 |
"receptor_xyz": datasets.Sequence(datasets.Sequence(datasets.Value('float32'))),
|
|
|
|
|
|
|
| 81 |
# These are the features of your dataset like images, labels ...
|
| 82 |
}
|
| 83 |
)
|
|
|
|
| 57 |
class PDBBindComplexes(datasets.ArrowBasedBuilder):
|
| 58 |
"""List of protein sequences, ligand SMILES, and complex coordinates."""
|
| 59 |
|
| 60 |
+
VERSION = datasets.Version("1.3.0")
|
| 61 |
|
| 62 |
def _info(self):
|
| 63 |
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
|
|
|
| 78 |
"smiles": datasets.Value("string"),
|
| 79 |
"ligand_xyz": datasets.Sequence(datasets.Sequence(datasets.Value('float32'))),
|
| 80 |
"receptor_xyz": datasets.Sequence(datasets.Sequence(datasets.Value('float32'))),
|
| 81 |
+
"ligand_rot": datasets.Sequence(datasets.Sequence(datasets.Value('float32'))),
|
| 82 |
+
"receptor_rot": datasets.Sequence(datasets.Sequence(datasets.Value('float32'))),
|
| 83 |
# These are the features of your dataset like images, labels ...
|
| 84 |
}
|
| 85 |
)
|