receptor_restraints = ligand_restraints = None if args.restraints: log.info("Reading restraints from %s" % args.restraints) restraints = parse_restraints_file(args.restraints) # Calculate number of restraints in order to check them num_rec_active = len(restraints['receptor']['active']) num_rec_passive = len(restraints['receptor']['passive']) num_lig_active = len(restraints['ligand']['active']) num_lig_passive = len(restraints['ligand']['passive']) # Check if restraints have been defined for the ligand, but not to the receptor if not num_rec_active and not num_rec_passive and ( num_lig_active or num_lig_passive): raise LightDockError( "Restraints defined for ligand, but not receptor. Try switching structures." ) if not num_rec_active and not num_rec_passive and not num_lig_active and not num_lig_passive: raise LightDockError( "Restraints file specified, but not a single restraint found" ) # Check if restraints correspond with real residues receptor_restraints = get_restraints(receptor, restraints['receptor']) args.receptor_restraints = restraints['receptor'] ligand_restraints = get_restraints(ligand, restraints['ligand']) args.ligand_restraints = restraints['ligand'] log.info(
def test_raising_lightdock_exception(self): raise LightDockError("Testing")
receptor_restraints = ligand_restraints = None if args.restraints: log.info("Reading restraints from %s" % args.restraints) restraints = parse_restraints_file(args.restraints) # Calculate number of restraints in order to check them num_rec_active = len(restraints['receptor']['active']) num_rec_passive = len(restraints['receptor']['passive']) num_rec_blocked = len(restraints['receptor']['blocked']) num_lig_active = len(restraints['ligand']['active']) num_lig_passive = len(restraints['ligand']['passive']) # Complain if not a single restraint has been defined, but restraints are enabled if not num_rec_active and not num_rec_passive and not num_rec_blocked \ and not num_lig_active and not num_lig_passive: raise LightDockError("Restraints file specified, but not a single restraint found") # Check if restraints correspond with real residues receptor_restraints = get_restraints(receptor, restraints['receptor']) args.receptor_restraints = restraints['receptor'] ligand_restraints = get_restraints(ligand, restraints['ligand']) args.ligand_restraints = restraints['ligand'] log.info("Number of receptor restraints is: %d (active), %d (passive)" % (num_rec_active, num_rec_passive)) log.info("Number of ligand restraints is: %d (active), %d (passive)" % (num_lig_active, num_lig_passive)) lig_restraints = None try: lig_restraints = ligand_restraints['active'] + ligand_restraints['passive'] except: pass