File size: 882 Bytes
af8d6bf
a6869dd
af8d6bf
 
 
 
a6869dd
af8d6bf
a6869dd
 
 
 
af8d6bf
a6869dd
af8d6bf
 
 
 
a6869dd
 
 
 
 
 
 
 
 
 
af8d6bf
 
 
 
 
 
 
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
import os
import pandas as pd
from datasets import load_dataset

def main():
    data_dirs = [
        "./BindingDB_filtered",
        "./CATS",
        "./HIF2A",
        "./HSP90",
        "./LeakyPDB",
        "./MCL1",
        "./Mpro",
        "./SYK",
    ]

    for data_dir in data_dirs:
        print(data_dir)
        filepath = os.path.join(data_dir, "data.csv")

        df = pd.read_csv(filepath)
        # Add Index column, make sure it's the left most column
        if "Index" not in df.columns:
            df["Index"] = df.index
            df = df[["Index"] + [col for col in df.columns if col != "Index"]]
            df.to_csv(filepath, index=False)

        dataset = load_dataset("csv", data_files=filepath, delimiter=",")
        print(dataset)
        print("Saving to disk...")
        dataset.save_to_disk(data_dir)


if __name__ == "__main__":
    main()