File size: 867 Bytes
9216aa6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/python

import pandas as pd
import numpy as np
from rdkit import Chem
from rdkit.Chem import Descriptors
from utils import *

raw_data = pd.read_csv('raw/PDB-query_rawdata.csv')

print(f'length of data before processing: {len(raw_data)}')

# fill rows (containing different ligands) corresponding with the same crystal 
df_filled = fill_nans_iteratively(raw_data)

print(f'length of data after filling NaN values (length should be the same): {len(df_filled)}')

# filter by molecular weight of ligands to remove cofactors, crystallization agents, and ions
df_filtered = filter_by_molecular_weight(df_filled)

print(f'length of data after removing cofactors, crystallization factors, or ions: {len(df_filtered)}')

df_filtered.to_csv('processed/processed_data.csv')

print(f'data cleaning successful, resulting csv written to: processed/processed_data.csv')