File size: 2,712 Bytes
e8ca87a
 
 
 
 
 
 
 
 
62d73f4
 
e8ca87a
62d73f4
 
e8ca87a
 
 
62d73f4
 
e8ca87a
 
 
 
 
 
 
 
 
 
b3c5c70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
dataset_info:
  features:
  - name: seqs
    dtype: string
  - name: labels
    dtype: float64
  splits:
  - name: train
    num_bytes: 2933951
    num_examples: 6837
  - name: valid
    num_bytes: 217038
    num_examples: 498
  - name: test
    num_bytes: 204262
    num_examples: 469
  download_size: 2178499
  dataset_size: 3355251
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
  - split: valid
    path: data/valid-*
  - split: test
    path: data/test-*
---

[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.

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.

Processing:
```
import pandas as pd
from datasets import Dataset, DatasetDict, concatenate_datasets

def process_dataset(dataset_dict):
    precedence = ['train', 'valid', 'test']
    # Add a 'split' column to each dataset
    for split in dataset_dict.keys():
        dataset_dict[split] = dataset_dict[split].add_column('split', [split]*len(dataset_dict[split]))
    # Concatenate all splits into one dataset
    all_data = concatenate_datasets([dataset_dict[split] for split in dataset_dict.keys()])
    # Convert to pandas DataFrame
    df = all_data.to_pandas()
    # Remove sequences with length less than 50
    df['seq_length'] = df['seqs'].apply(len)
    df = df[df['seq_length'] >= 50]
    # Group by 'seqs' to find duplicates and average the labels
    def aggregate_group(group):
        avg_label = group['labels'].mean()
        # Assign the sequence to the highest-precedence split it appears in
        for p in precedence:
            if p in group['split'].values:
                selected_split = p
                break
        return pd.Series({'labels': avg_label, 'split': selected_split})
    df_grouped = df.groupby('seqs').apply(aggregate_group).reset_index()
    # Split the DataFrame back into the original splits without overlapping sequences
    new_dataset_dict = DatasetDict()
    for split in precedence:
        df_split = df_grouped[df_grouped['split'] == split]
        new_dataset_dict[split] = Dataset.from_pandas(df_split[['seqs', 'labels']], preserve_index=False)
    return new_dataset_dict
```

From [DLKcat paper](https://www.nature.com/articles/s41929-022-00798-z)
![image/png](https://cdn-uploads.huggingface.co/production/uploads/62f2bd3bdb7cbd214b658c48/bC5PQ_O9_xKZzYEIYxuEM.png)