def build_database(database_path_file, pdbqt_path_file): line = "" f_database = open(database_path_file, 'w') line = str(";Ligand\t") + str("Torsion\t") + str("Atoms\t") + str("\n") f_database.write(line) all_pdbqt = pdbqt.get_files_pdbqt_no_sort(pdbqt_path_file) for f_pdbqt in all_pdbqt: ligand_name = pdbqt.get_name_ligand(f_pdbqt) torsion_angle = int(pdbqt.get_number_torsion_angle(f_pdbqt)) atom_number = int(pdbqt.get_number_atom(f_pdbqt)) line = ligand_name + str("\t")+ str(torsion_angle) + str("\t") + str(atom_number) + str("\n") f_database.write(line) f_database.close()
def get_files_pdbqt(mypath): only_pdbqt_file = [] for root, dirs, files in os.walk(mypath): for file in files: if file.endswith(".pdbqt"): f_path = os.path.join(root, file) only_pdbqt_file.append(f_path) #Prepare to return a list sorted by torsion angles present in pdbqt d_docking = {} for f in only_pdbqt_file: f_name = str(str(os.path.basename(f)).split(".")[0]) d_docking[f_name] = pdbqt.get_number_torsion_angle(f) sorted_log_dict = pdbqt.sort_dictionary(d_docking) root, dirs, files in os.walk(mypath) only_pdbqt_file = [] for l_item in sorted_log_dict: f_lig = str(l_item[0]) + ".pdbqt" f_path = os.path.join(root, f_lig) only_pdbqt_file.append(f_path) return only_pdbqt_file
def get_files_pdbqt(mypath): only_pdbqt_file = [] for root, dirs, files in os.walk(mypath): for file in files: if file.endswith(".pdbqt"): f_path = os.path.join(root, file) only_pdbqt_file.append(f_path) # Prepare to return a list sorted by torsion angles present in pdbqt d_docking = {} for f in only_pdbqt_file: f_name = str(str(os.path.basename(f)).split(".")[0]) d_docking[f_name] = pdbqt.get_number_torsion_angle(f) sorted_log_dict = pdbqt.sort_dictionary(d_docking) root, dirs, files in os.walk(mypath) only_pdbqt_file = [] for l_item in sorted_log_dict: f_lig = str(l_item[0]) + ".pdbqt" f_path = os.path.join(root, f_lig) only_pdbqt_file.append(f_path) return only_pdbqt_file