input_file = open('250k_rndm_zinc_drugs_clean_3.txt', 'r')
smiles_file = open('smiles', 'w')
logp_file = open('logp', 'w')
qed_file = open('qed', 'w')
sas_file = open('sas', 'w')
input_file.readline()
num_samples = 249455
smiles_file.write(str(num_samples) + '\n')
logp_file.write(str(num_samples) + '\n')
qed_file.write(str(num_samples) + '\n')
sas_file.write(str(num_samples) + '\n')
for sample in range(num_samples):
    line1 = input_file.readline()
    line2 = input_file.readline()
    smiles = line1[1:len(line1)-1]
    line2 = line2[2:].split(',')
    logp = float(line2[0])
    qed = float(line2[1])
    sas = float(line2[2])
    smiles_file.write(smiles + '\n')
    logp_file.write(str(logp) + '\n')
    qed_file.write(str(qed) + '\n')
    sas_file.write(str(sas) + '\n')
input_file.close()
smiles_file.close()
logp_file.close()
qed_file.close()
sas_file.close()
