dest="lnuc", action='store_true', default=False) return parser.parse_args() if __name__ == '__main__': # Parse command line args = parse_command_line() log.info("Calculating interface at {:3.1f}A".format(args.cutoff)) # Get ranking ranking = read_ranking_file(args.ranking_file) # Get all the PDB structures in a given directory base_path = os.path.abspath(os.path.dirname(args.ranking_file)) structures = get_structures(ranking, base_path) restraints_receptor, restraints_ligand = get_restraints( args.restraints_file) # Total number of restraints to be satisfied total = float(len(restraints_receptor) + len(restraints_ligand)) if os.path.exists(filtered_folder): raise SystemExit("Folder {} already exists".format(filtered_folder)) else: os.makedirs(filtered_folder)
r31 = 2 * (q.x * q.z) + 2 * (q.w * q.y) r32 = 2 * (q.y * q.z) - 2 * (q.w * q.x) r33 = 1 - 2 * x2 - 2 * y2 return r11, r12, r13, r21, r22, r23, r31, r32, r33 def create_rot_file(file_name, results): t = open(file_name, 'w') for i, result in enumerate(results): q = Quaternion(result.pose[3], result.pose[4], result.pose[5], result.pose[6]) r11, r12, r13, r21, r22, r23, r31, r32, r33 = quaternion_to_matrix(q) t1 = result.pose[0] t2 = result.pose[1] t3 = result.pose[2] t.write('%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %6d\n' % (r11, r12, r13, r21, r22, r23, r31, r32, r33, t1, t2, t3, i + 1)) t.close() if __name__ == "__main__": try: # Parse command line args = parse_command_line() results = read_ranking_file(args.ranking_file) log.info('%d results read from %s' % (len(results), args.ranking_file)) create_rot_file(args.rotation_file, results) log.info("Done.") except (KeyboardInterrupt): log.info("Caught interrupt...") log.info("bye.")
return r11, r12, r13, r21, r22, r23, r31, r32, r33 def create_rot_file(file_name, results): t = open(file_name, 'w') for i, result in enumerate(results): q = Quaternion(result.pose[3], result.pose[4], result.pose[5], result.pose[6]) r11, r12, r13, r21, r22, r23, r31, r32, r33 = quaternion_to_matrix(q) t1 = result.pose[0] t2 = result.pose[1] t3 = result.pose[2] t.write( '%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %6d\n' % (r11, r12, r13, r21, r22, r23, r31, r32, r33, t1, t2, t3, i + 1)) t.close() if __name__ == "__main__": try: # Parse command line args = parse_command_line() results = read_ranking_file(args.ranking_file) log.info('%d results read from %s' % (len(results), args.ranking_file)) create_rot_file(args.rotation_file, results) log.info("Done.") except (KeyboardInterrupt): log.info("Caught interrupt...") log.info("bye.")
# Ligand structures = [] for structure in get_lightdock_structures(args.ligand_structures): log.info("Reading %s ligand PDB file..." % structure) atoms, residues, chains = parse_complex_from_file(structure) structures.append({ 'atoms': atoms, 'residues': residues, 'chains': chains, 'file_name': structure }) log.info("%s atoms, %s residues read." % (len(atoms), len(residues))) ligand = Complex.from_structures(structures) # Read ranking file predictions = read_ranking_file(args.lightdock_ranking_file) # Destination path is the same as the lightdock output destination_path = os.path.dirname(args.lightdock_ranking_file) # If normal modes used, need to read them nmodes_rec = nmodes_lig = None nm_path = os.path.abspath(os.path.dirname(args.receptor_structures)) # Check NM file for receptor nm_rec_file = os.path.join(nm_path, DEFAULT_REC_NM_FILE + '.npy') if os.path.exists(nm_rec_file): nmodes_rec = read_nmodes(nm_rec_file) # Check NM file for ligand nm_lig_file = os.path.join(nm_path, DEFAULT_LIG_NM_FILE + '.npy') if os.path.exists(nm_lig_file): nmodes_lig = read_nmodes(nm_lig_file)
parser.add_argument("ligand_chains", help="Chains on the receptor partner", metavar="ligand_chains") parser.add_argument("--cutoff", "-cutoff", "-c", help="Interaction cutoff", dest="cutoff", type=float, default=1.0) return parser.parse_args() if __name__ == '__main__': # Parse command line args = parse_command_line() log.info("Cutoff for membrane is {:3.1f}A".format(args.cutoff)) # Get ranking ranking = read_ranking_file(args.ranking_file) # Get all the PDB structures in a given directory base_path = os.path.abspath(os.path.dirname(args.ranking_file)) structures = get_structures(ranking, base_path) restraints_receptor, restraints_ligand = get_restraints(args.restraints_file) membrane_height_z = calculate_membrane_height(args.parsed_receptor_file, restraints_receptor) if os.path.exists(filtered_folder): raise SystemExit("Folder {} already exists".format(filtered_folder)) else: os.makedirs(filtered_folder) filter_passed = {}