Ejemplo n.º 1
0
void Run(Vergil* vergil) {
  std::string input_directory = "/Users/Violet/data/peptide_design/2D_lattice/C4459/P422/structure";
  std::string output_directory = "/Users/Violet/data/peptide_design/2D_lattice/C4459/P422/structure/P422_a31.2_Cu/";
  std::string pdb_filename = input_directory + "/C4459_P422_a31.2_mP_type_wCap_W_H_segX0.pdb";
  //std::string pdb_filename = input_directory + "/C4459_P422_a31.7fix_19W_27H.pdb";

  //Geometry variables
  double chi_incr = 1.0;
  std::vector<double> chi_stdev;
  chi_stdev.push_back(180.0);
  chi_stdev.push_back(180.0);
  std::string lp_atom = "NE2";
  double unit_cell_length = 31.2;
  double angle_tolerance = 5.0;

  //Create a local Timer instance
  Timer timer;

  //Load force field and design topology
  vergil->LoadAMBERUnitedAtom();
  vergil->LoadSavenDesignStandards();
  unsigned int max_dunbrack_rots = 9;
  vergil->LoadDunbrackRotamerLibrary(2002, max_dunbrack_rots);

  std::string scaffold = "protein and backbone or not site 23";
  InputPDBScaffold input(vergil->domain(), scaffold);
  input.KeepSitesWithMissingAtoms();
  input.Read(pdb_filename);
  Log->print_tag("INPUT", "PDB scaffold -- " + pdb_filename);

  std::string typelist[] = { "ASP", "GLN", "GLU", "ILE", "ARG", "GLN", "MET", "ALA", "GLU", "TRP", "ILE", "LYS", "LYS",
      "MET", "ALA", "GLN", "MET", "ILE", "ASP", "LYS", "MET", "ALA", "HIS", "ARG", "ILE", "ASP", "ARG", "GLU", "ALA",
      "NH2" };
//  std::string typelist[] = { "ASP", "GLN", "GLU", "ILE", "ARG", "GLN", "MET", "ALA", "GLU", "GLU", "ILE", "ARG", "LYS",
//      "MET", "ALA", "GLN", "GLN", "ILE", "TRP", "GLU", "MET", "ALA", "LYS", "ARG", "ILE", "ASP", "HIS", "GLU", "ALA", "NH2"};
  size_t i = 0;
  for (Domain::SiteIterator it = vergil->domain()->SiteIterator_Begin(); it != vergil->domain()->SiteIterator_End();
      ++it) {
    it->Add(typelist[i]);
    ++i;
  }

  vergil->BuildDomain();

  timer.Stamp();
  Conformer* ligand = &vergil->domain()[0]["X0"]["A"][0][23]["HIS"][0];
  OptimizeLigandGeomety(*ligand, chi_incr, chi_stdev, lp_atom, unit_cell_length, angle_tolerance, output_directory);
  Log->print_tag("RUNTIME", "Optimize ligand geometry time: " + timer.ElapsedToString());

  vergil->domain()->Clear();
}
Ejemplo n.º 2
0
void Design(Vergil* vergil) {

  //set design parameters
  double beta = 0.5;
  double ref_beta = ROOM_TEMPERATURE_BETA;
  double twobody_energy_cap = 30;
  double a_list[] = { 31.7 };

  std::string input_directory = "/Users/Violet/data/peptide_design/tetramer_29/fullseq_design_approved_by_Jeff";
  //std::string input_directory = "/Users/Violet/data/peptide_design/2D_lattice/C4459/P422/structure";
  std::string output_directory = "/Users/Violet/data/peptide_design/2D_lattice/C4459/P422/vergil_design";
  std::string pdb_filename = input_directory + "/C4459a_chainA_fixed_adg_NH2cap_for_vergil.pdb";
  //std::string pdb_filename = input_directory + "/C4459_P422_a31.2_mP_type_wCap_W_H_segX0.pdb";

  //Create a local Timer instance
  Timer timer;

  //Load force field and design topology
  vergil->LoadAMBERUnitedAtom();
  vergil->LoadSavenDesignStandards();
  unsigned int max_dunbrack_rots = 81;
  vergil->LoadDunbrackRotamerLibrary(2002, max_dunbrack_rots);

  //Compute and time the reference energy
  timer.Stamp();
  Log->print("Computing reference energies....");
  PotentialUnfoldedFreeEnergy unfolded_compute(PotentialUnfoldedFreeEnergy::AMBER_KONO,
                                             vergil->forcefield_parameter_library(), vergil->topology_library(),
                                             vergil->conformer_library());
  unfolded_compute.set_beta(ref_beta);
  unfolded_compute.AddPotential(vergil->potential("dihedral"));
  unfolded_compute.AddPotential(vergil->potential("vanderwaals"));
  unfolded_compute.AddPotential(vergil->potential("electrostatic"));
  unfolded_compute.GenerateUnfoldedFreeEnergies();
  Log->print_tag("RUNTIME", "Reference energy calculation: " + timer.ElapsedToString());

  for (int idx = 0; idx < 1; ++idx) {
    std::string output_fileprefix = output_directory + "/C4459_P422_a" + Log->to_str(a_list[idx]) + "fix_19W_27H";
    // Load scaffold
    std::string scaffold = "protein and backbone or site 1 4 7 8 11 14 15 18 21 22 25 28 29 30";
//    std::string scaffold = "protein and backbone or site 1 to 15 or site 17 to 30";
    InputPDBScaffold input(vergil->domain(), scaffold);
    input.KeepSitesWithMissingAtoms();
    input.Read(pdb_filename);
    Log->print_tag("INPUT", "PDB scaffold -- " + pdb_filename);

// Type each site in the domain
    int num_amino_acids = 18;
    std::string amino_acid_set[] = {"ALA", "ARG", "ASN", "ASP", "GLN", "GLU", "GLY", "HIS", "ILE", "LEU", "LYS","MET",
      "PHE", "SER", "THR", "TRP", "TYR", "VAL"};

    std::string typelist[] = {"ASP", "ILE", "MET", "ALA", "ILE", "MET", "ALA", "ILE", "MET", "ALA", "ILE", "GLU", "ALA"};
    //std::string typelist_ex[] = { "GLN", "GLU", "ARG", "GLN", "GLU", "TRP", "LYS", "LYS", "LEU", "MET", "ASP", "LYS", "HIS", "ARG", "ASP", "ARG", "NH2" };

    size_t i = 0;
//    size_t j = 0;
    for (Domain::SiteIterator it = vergil->domain()->SiteIterator_Begin(); it != vergil->domain()->SiteIterator_End();
        ++it) {
      size_t heptad_id = it->name() % 7;
      if (heptad_id == 1 || heptad_id == 4 || heptad_id == 0) {
        it->Add(typelist[i]);
        ++i;
//      } else {
//        //must only add the reference type to the fixed sites
//        it->Add(typelist_ex[j]);
//        ++j;
//      }
      } else if (it->name() == 27) {
        it->Add("HIS");
      } else if (it->name() == 19) {
        it->Add("TRP");
      } else if (it->name() == 30) {
        it->Add("NH2");
      } else {
        for (int j = 0; j < num_amino_acids; ++j)
        it->Add(amino_acid_set[j]);
      }
    }

    // Build all conformers
    vergil->BuildDomain();
    vergil->TrimDomain(30.0);

    //Offset the domain(ASU) to the correct position in the unit cell
    const Vector3 offset(a_list[idx] / 2, 0, 0);
    vergil->domain()->TransformBy(Geometry::Transformation(Vector3(0, 0, 0), 0.0, offset));

    //Set up symmetry and build lattice
    vergil->domain()->set_unit_cell_parameters("P422", a_list[idx], a_list[idx], 1000, 90.0, 90.0, 90.0);
    SymmetryGenerator<Domain> symexp("P422", a_list[idx], a_list[idx], 1000, 90.0, 90.0, 90.0);
    symexp.BuildLattice(*vergil->domain(), -1, -1, 0, 1, 1, 0);
    std::vector<Domain>* symmetry_related_elements = symexp.lattice();

    //Trim rotamers that clash with the scaffold
    vergil->TrimDomain(30.0, symmetry_related_elements);

    // Set up energy function
    timer.Stamp();
    Log->print("Setting up energy function...");
    FunctionMeanFieldEnergyLattice energy(vergil->domain(), symmetry_related_elements);
    energy.set_pairwise_energy_cap_values(twobody_energy_cap, twobody_energy_cap);
    energy.AddPotential(vergil->potential("dihedral"));
    energy.AddPotential(vergil->potential("vanderwaals"));
    energy.AddPotential(vergil->potential("electrostatic"));
    energy.ComputeEnergies();
    Log->print_tag("RUNTIME", "Energy Matrix Fill Time: " + timer.ElapsedToString());

    // Initialize probabilities
    vergil->domain()->SetUniformConformerProbabilities();

    // Set up the problem and solve the unconstrained problem
    FunctionFreeEnergyWithReference free_energy(&energy, beta, &unfolded_compute);
    vergil->InitProbabilityProblem(free_energy);
    vergil->SolveProbabilityProblem();

    //Output standard files (pdb, psf, seq, csv)
    vergil->StandardOutput(output_fileprefix);

    for (Domain::SiteIterator it = vergil->domain()->SiteIterator_Begin(); it != vergil->domain()->SiteIterator_End(); ++it) {
      it->SetAggregatedTypeProbability();
    }
    vergil->RenameSymmetrySegname(symmetry_related_elements);
    OutputPDB output1(output_fileprefix + "_lattice.pdb", vergil->domain());
    output1.WriteLattice(symmetry_related_elements);
    Log->print("Most Probable PDB -- " + output_fileprefix + "_lattice.pdb");

    vergil->domain()->Clear();
  }
}
Ejemplo n.º 3
0
void Design(Vergil* vergil) {

  //Variables for the design
  double design_beta = 0.5;
  unsigned int max_dunbrack_rots = 10;
  std::string pdb_filename = VERGIL_PATH "/working/input/4JKV.pdb";
  std::string output_fileprefix = VERGIL_PATH "/working/output/example_output";

  //Designable sites
  int num_designable_sites = 22;
  int designable_sites[] = { 243, 246, 253, 316, 362, 363, 369, 370, 373, 410, 413, 420, 424, 454, 457, 458, 460, 464,
      471, 537, 542, 543 };

  //Construct scaffold selection text from the array of designable sites
  std::string scaffold_seltext = "chain A and resid 190 to 550";  //Only consider residues 190-550 on chain A
  scaffold_seltext += " and (backbone or not resid ";  //Fix the backbone atoms, or all the atoms in sites that are NOT designable
  for (int i = 0; i < num_designable_sites; ++i) {
    scaffold_seltext += Log->to_str(designable_sites[i]) + " ";
  }
  scaffold_seltext += ")";

  //Create a local Timer instance
  Timer timer;

  //Load force field, dunbrack library, and scaffold from PDB file
  vergil->LoadAMBERUnitedAtom();
  vergil->LoadSavenDesignStandards();
  vergil->LoadDunbrackRotamerLibrary(2002, max_dunbrack_rots);
  vergil->LoadScaffoldFromPDB(pdb_filename, scaffold_seltext);

  //The three usual computes are automatically loaded into Vergil: "dihedral", "vanderwaals", and "electrostatic"
  //  for the AMBER84 modified ff, where "vanderwaals" is the KonoModified compute with hbonding

  //Compute and time the reference energy
  timer.Stamp();
  Log->print("Computing reference energies....");
  ComputeUnfoldedFreeEnergy unfolded_compute(ComputeUnfoldedFreeEnergy::AMBER_KONO, vergil->forcefield_parameter_library(),
                                             vergil->topology_library(), vergil->conformer_library());
  unfolded_compute.set_beta(ROOM_TEMPERATURE_BETA);
  unfolded_compute.set_grid_space(90);
  unfolded_compute.AddCompute(vergil->compute("dihedral"));
  unfolded_compute.AddCompute(vergil->compute("vanderwaals"));
  unfolded_compute.AddCompute(vergil->compute("electrostatic"));
  unfolded_compute.GenerateUnfoldedFreeEnergies();
  Log->print_tag("RUNTIME", "Reference energy calculation: " + timer.ElapsedToString());

  //Type each site in the domain
  Path* chain = &(*vergil->domain())["4JKV"]["A"][0];

  //Disulfide bridges
  (*chain)[193].reference_type()->set_name("CYX");
  (*chain)[213].reference_type()->set_name("CYX");
  (*chain)[193].ConnectNextSiteWithIterface((*chain)[213], "DISU");

  (*chain)[217].reference_type()->set_name("CYX");
  (*chain)[295].reference_type()->set_name("CYX");
  (*chain)[217].ConnectNextSiteWithIterface((*chain)[295], "DISU");

  (*chain)[314].reference_type()->set_name("CYX");
  (*chain)[390].reference_type()->set_name("CYX");
  (*chain)[314].ConnectNextSiteWithIterface((*chain)[390], "DISU");

  (*chain)[490].reference_type()->set_name("CYX");
  (*chain)[507].reference_type()->set_name("CYX");
  (*chain)[490].ConnectNextSiteWithIterface((*chain)[507], "DISU");

  int num_amino_acids = 20;  //All 20 natural amino acids
  std::string amino_acid_set[] = { "ALA", "ARG", "ASN", "ASP", "CYS", "GLN", "GLU", "GLY", "HIS", "ILE", "LEU", "LYS",
      "MET", "PHE", "PRO", "SER", "THR", "TRP", "TYR", "VAL" };
  for (int i = 0; i < num_designable_sites; ++i) {
    for (int j = 0; j < num_amino_acids; ++j) {
      (*chain)[designable_sites[i]].Add(amino_acid_set[j]);
    }
  }

  // Build all conformers
  vergil->BuildDomain();

  //Trim rotamers that clash with the backbone
  vergil->TrimDomain(30.0);

  // Set up energy function
  timer.Stamp();
  Log->print("Setting up energy function...");
  FunctionMeanFieldEnergy energy(vergil->domain());
  energy.set_pairwise_energy_cap_values(30.0, 30.0);
  energy.AddCompute(vergil->compute("dihedral"));
  energy.AddCompute(vergil->compute("vanderwaals"));
  energy.AddCompute(vergil->compute("electrostatic"));
  energy.ComputeEnergies();
  Log->print_tag("RUNTIME", "Energy Matrix Fill Time: " + timer.ElapsedToString());

  // Initialize probabilities
  vergil->domain()->SetUniformConformerProbabilities();

  // Set up the problem and solve the unconstrained problem
  FunctionFreeEnergyWithReference free_energy(&energy, design_beta, &unfolded_compute);
  vergil->InitProbabilityProblem(free_energy);
  vergil->SolveProbabilityProblem();

  //Environmental Energy function
  double Eenv_target = 0.0;
  FunctionEnvironmentalEnergy environmental_energy(*vergil->domain(), ENVIRONMENTAL_ENERGY_FILE);

  //Print out the Environmental Energy value
  VectorN w = vergil->ConformerProbabilityVector();
  Log->print(environmental_energy.to_string(w));

  //Output standard files (pdb, psf, seq, csv)
  vergil->StandardOutput(output_fileprefix + "_unconstrained");

  //Now add the Environmental Energy constraint and resolve the problem
  vergil->problem()->AddConstraint("Eenv", &environmental_energy, Eenv_target);
  vergil->SolveProbabilityProblem();

  //Print out the Environmental Energy value to check its been constrainted properly
  w = vergil->ConformerProbabilityVector();
  Log->print(environmental_energy.to_string(w));

  //Output standard files (pdb, psf, seq, csv)
  vergil->StandardOutput(output_fileprefix);
}