Update README.md
Browse files
README.md
CHANGED
|
@@ -27,3 +27,46 @@ configs:
|
|
| 27 |
- split: test
|
| 28 |
path: data/test-*
|
| 29 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
- split: test
|
| 28 |
path: data/test-*
|
| 29 |
---
|
| 30 |
+
|
| 31 |
+
[DLKcat](https://github.com/SysBioChalmers/DLKcat) (BRENDA and SABIO-RK) with splits from [Biomap](https://huggingface.co/datasets/Bo1015/enzyme_catalytic_efficiency), and repeated and short sequences removed. Enzymes with multiple reactions have their kcat averaged.
|
| 32 |
+
|
| 33 |
+
The kcat is log10 normalized, so the unit is log10(1/s). However, because it is averaged over reactions and also reaction ambiguous, it is really just a general proxy for catalytic rate. Higher is faster.
|
| 34 |
+
|
| 35 |
+
Processing:
|
| 36 |
+
```
|
| 37 |
+
import pandas as pd
|
| 38 |
+
from datasets import Dataset, DatasetDict, concatenate_datasets
|
| 39 |
+
|
| 40 |
+
def process_dataset(dataset_dict):
|
| 41 |
+
precedence = ['train', 'valid', 'test']
|
| 42 |
+
# Add a 'split' column to each dataset
|
| 43 |
+
for split in dataset_dict.keys():
|
| 44 |
+
dataset_dict[split] = dataset_dict[split].add_column('split', [split]*len(dataset_dict[split]))
|
| 45 |
+
# Concatenate all splits into one dataset
|
| 46 |
+
all_data = concatenate_datasets([dataset_dict[split] for split in dataset_dict.keys()])
|
| 47 |
+
# Convert to pandas DataFrame
|
| 48 |
+
df = all_data.to_pandas()
|
| 49 |
+
# Remove sequences with length less than 50
|
| 50 |
+
df['seq_length'] = df['seqs'].apply(len)
|
| 51 |
+
df = df[df['seq_length'] >= 50]
|
| 52 |
+
# Group by 'seqs' to find duplicates and average the labels
|
| 53 |
+
def aggregate_group(group):
|
| 54 |
+
avg_label = group['labels'].mean()
|
| 55 |
+
# Assign the sequence to the highest-precedence split it appears in
|
| 56 |
+
for p in precedence:
|
| 57 |
+
if p in group['split'].values:
|
| 58 |
+
selected_split = p
|
| 59 |
+
break
|
| 60 |
+
return pd.Series({'labels': avg_label, 'split': selected_split})
|
| 61 |
+
df_grouped = df.groupby('seqs').apply(aggregate_group).reset_index()
|
| 62 |
+
# Split the DataFrame back into the original splits without overlapping sequences
|
| 63 |
+
new_dataset_dict = DatasetDict()
|
| 64 |
+
for split in precedence:
|
| 65 |
+
df_split = df_grouped[df_grouped['split'] == split]
|
| 66 |
+
new_dataset_dict[split] = Dataset.from_pandas(df_split[['seqs', 'labels']], preserve_index=False)
|
| 67 |
+
return new_dataset_dict
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
From [DLKcat paper](https://www.nature.com/articles/s41929-022-00798-z)
|
| 71 |
+

|
| 72 |
+
|