Update README.md
Browse files
README.md
CHANGED
|
@@ -77,26 +77,54 @@ Of particular note, the train, valid, and test splits are deduplicated and heavi
|
|
| 77 |
For more information on the original dataset compilation, please read their [paper](https://github.com/pinder-org/pinder), [GitHub](https://github.com/pinder-org/pinder), or [docs](https://pinder-org.github.io/pinder/readme.html).
|
| 78 |
|
| 79 |
## Differences between this version and the official version
|
| 80 |
-
We further processed the dataset into
|
| 81 |
-
Importantly, any entry with a sequence involved in a [NEGATOME](https://huggingface.co/datasets/Synthyra/NEGATOME) pair was removed.
|
| 82 |
-
This removed a few thousand from the training and one entry from the valid split.
|
| 83 |
`invalid` split entries were removed and info based on holo (bound), apo (unbound), as well as if an entry is computationally predicted was included.
|
| 84 |
We also limited the pair length to 2044 (2048 with special tokens), removed entries with sequences less than 20 amino acids, and removed entries with `X` amino acid characters.
|
| 85 |
|
| 86 |
```python
|
| 87 |
import pandas as pd
|
| 88 |
-
from datasets import Dataset, DatasetDict
|
| 89 |
-
from pinder.core import get_index
|
| 90 |
from pinder.core.index.utils import get_sequence_database
|
| 91 |
|
| 92 |
-
|
|
|
|
| 93 |
index = get_index()
|
|
|
|
| 94 |
seq_db = get_sequence_database()
|
| 95 |
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
df = (
|
| 98 |
pd.merge(
|
| 99 |
-
index[[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
seq_db[["pdb", "sequence"]].rename(
|
| 101 |
columns={"pdb": "holo_R_pdb", "sequence": "receptor_sequence"}
|
| 102 |
),
|
|
@@ -108,16 +136,16 @@ df = (
|
|
| 108 |
),
|
| 109 |
how="left"
|
| 110 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
.drop(columns=["holo_R_pdb", "holo_L_pdb"])
|
| 112 |
)
|
| 113 |
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
negatome_seqs = set()
|
| 117 |
-
for name, split in negatome.items():
|
| 118 |
-
for sample in split:
|
| 119 |
-
negatome_seqs.add(sample['SeqA'])
|
| 120 |
-
negatome_seqs.add(sample['SeqB'])
|
| 121 |
|
| 122 |
# --- Filter for valid split entries (only 'test', 'val', and 'train') ---
|
| 123 |
allowed_splits = ['test', 'val', 'train']
|
|
@@ -126,9 +154,6 @@ df = df[df['split'].isin(allowed_splits)].copy()
|
|
| 126 |
# --- Rename the splits: 'val' -> 'valid' ---
|
| 127 |
df['split'] = df['split'].replace({'val': 'valid'})
|
| 128 |
|
| 129 |
-
# --- Remove entries with sequences found in the negatome ---
|
| 130 |
-
df = df[~(df['receptor_sequence'].isin(negatome_seqs) | df['ligand_sequence'].isin(negatome_seqs))].copy()
|
| 131 |
-
|
| 132 |
# --- Create the Huggingface DatasetDict with the desired splits ---
|
| 133 |
split_datasets = {}
|
| 134 |
for split in ['train', 'valid', 'test']:
|
|
@@ -147,6 +172,7 @@ hf_dataset = hf_dataset.filter(lambda x: (len(x['receptor_sequence']) + len(x['l
|
|
| 147 |
|
| 148 |
# --- Push the dataset to the hub ---
|
| 149 |
hf_dataset.push_to_hub('Synthyra/PINDER')
|
|
|
|
| 150 |
```
|
| 151 |
|
| 152 |
## Please cite
|
|
|
|
| 77 |
For more information on the original dataset compilation, please read their [paper](https://github.com/pinder-org/pinder), [GitHub](https://github.com/pinder-org/pinder), or [docs](https://pinder-org.github.io/pinder/readme.html).
|
| 78 |
|
| 79 |
## Differences between this version and the official version
|
| 80 |
+
We further processed the dataset into via the script below.
|
|
|
|
|
|
|
| 81 |
`invalid` split entries were removed and info based on holo (bound), apo (unbound), as well as if an entry is computationally predicted was included.
|
| 82 |
We also limited the pair length to 2044 (2048 with special tokens), removed entries with sequences less than 20 amino acids, and removed entries with `X` amino acid characters.
|
| 83 |
|
| 84 |
```python
|
| 85 |
import pandas as pd
|
| 86 |
+
from datasets import Dataset, DatasetDict
|
| 87 |
+
from pinder.core import get_index, get_metadata
|
| 88 |
from pinder.core.index.utils import get_sequence_database
|
| 89 |
|
| 90 |
+
|
| 91 |
+
# --- Load the data ---
|
| 92 |
index = get_index()
|
| 93 |
+
metadata = get_metadata()
|
| 94 |
seq_db = get_sequence_database()
|
| 95 |
|
| 96 |
+
annotations = [
|
| 97 |
+
"id",
|
| 98 |
+
"probability",
|
| 99 |
+
"link_density",
|
| 100 |
+
"planarity",
|
| 101 |
+
"n_residue_pairs",
|
| 102 |
+
"n_residues",
|
| 103 |
+
"buried_sasa",
|
| 104 |
+
"intermolecular_contacts",
|
| 105 |
+
"charged_charged_contacts",
|
| 106 |
+
"charged_polar_contacts",
|
| 107 |
+
"charged_apolar_contacts",
|
| 108 |
+
"polar_polar_contacts",
|
| 109 |
+
"apolar_polar_contacts",
|
| 110 |
+
"apolar_apolar_contacts",
|
| 111 |
+
]
|
| 112 |
+
|
| 113 |
+
# --- Merge the data ---
|
| 114 |
df = (
|
| 115 |
pd.merge(
|
| 116 |
+
index[[
|
| 117 |
+
"id",
|
| 118 |
+
"split",
|
| 119 |
+
"holo_R_pdb",
|
| 120 |
+
"holo_L_pdb",
|
| 121 |
+
"predicted_R",
|
| 122 |
+
"predicted_L",
|
| 123 |
+
"apo_R",
|
| 124 |
+
"apo_L",
|
| 125 |
+
"holo_R",
|
| 126 |
+
"holo_L",
|
| 127 |
+
]],
|
| 128 |
seq_db[["pdb", "sequence"]].rename(
|
| 129 |
columns={"pdb": "holo_R_pdb", "sequence": "receptor_sequence"}
|
| 130 |
),
|
|
|
|
| 136 |
),
|
| 137 |
how="left"
|
| 138 |
)
|
| 139 |
+
.merge(
|
| 140 |
+
metadata[annotations],
|
| 141 |
+
on="id",
|
| 142 |
+
how="left"
|
| 143 |
+
)
|
| 144 |
.drop(columns=["holo_R_pdb", "holo_L_pdb"])
|
| 145 |
)
|
| 146 |
|
| 147 |
+
print(df.head())
|
| 148 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
|
| 150 |
# --- Filter for valid split entries (only 'test', 'val', and 'train') ---
|
| 151 |
allowed_splits = ['test', 'val', 'train']
|
|
|
|
| 154 |
# --- Rename the splits: 'val' -> 'valid' ---
|
| 155 |
df['split'] = df['split'].replace({'val': 'valid'})
|
| 156 |
|
|
|
|
|
|
|
|
|
|
| 157 |
# --- Create the Huggingface DatasetDict with the desired splits ---
|
| 158 |
split_datasets = {}
|
| 159 |
for split in ['train', 'valid', 'test']:
|
|
|
|
| 172 |
|
| 173 |
# --- Push the dataset to the hub ---
|
| 174 |
hf_dataset.push_to_hub('Synthyra/PINDER')
|
| 175 |
+
|
| 176 |
```
|
| 177 |
|
| 178 |
## Please cite
|