Ejemplo n.º 1
0
Archivo: EMFit.cpp Proyecto: sirusb/imp
void EMFit::output(std::string out_file_name, std::string out_pdb_file_name) {
  std::ofstream out_file(out_file_name.c_str());
  out_file << "receptorPdb (str) " << rec_file_name_ << std::endl;
  out_file << "ligandPdb (str) " << lig_file_name_ << std::endl;
  FitResult::print_header(out_file);
  out_file.setf(std::ios::fixed, std::ios::floatfield);
  out_file.setf(std::ios::right, std::ios::adjustfield);

  IMP::algebra::Vector3Ds lig_points;
  IMP::saxs::get_coordinates(lig_particles_, lig_points);
  for (unsigned int i = 0; i < fit_results_.size(); i++) {
    out_file << fit_results_[i] << std::endl;
  }
  out_file.close();
  if (fit_results_.size() == 1) {  // output PDB
    IMP::algebra::Transformation3D tr = fit_results_[0].get_map_trans();
    IMP::kernel::Particles ps = rec_particles_;
    ps.insert(ps.end(), lig_particles_.begin(), lig_particles_.end());
    // transform
    for (IMP::kernel::Particles::iterator it = ps.begin(); it != ps.end();
         it++) {
      IMP::core::XYZ d(*it);
      d.set_coordinates(tr * d.get_coordinates());
    }
    // output
    std::ofstream out_file2(out_pdb_file_name.c_str());
    IMP::kernel::ParticlesTemp pst = ps;
    IMP::atom::write_pdb(pst, out_file2);
    out_file2.close();
  }
}
Ejemplo n.º 2
0
void read_pdb_ca_atoms(const std::string file_name, IMP::kernel::Particles& particles) {
  IMP::kernel::Model *model = new IMP::kernel::Model();
  IMP::atom::Hierarchy mhd = IMP::atom::read_pdb(file_name, model,
                             new IMP::atom::CAlphaPDBSelector(), true, true);
  particles=IMP::get_as<IMP::kernel::Particles>(get_by_type(mhd, IMP::atom::ATOM_TYPE));
  std::cout << "Number of CA atom particles " << particles.size() << std::endl;
}
Ejemplo n.º 3
0
Archivo: EMFit.cpp Proyecto: sirusb/imp
void EMFit::read_pdb_atoms(IMP::kernel::Model* model,
                           const std::string file_name,
                           IMP::kernel::Particles& particles) {
  IMP::atom::Hierarchy mhd = IMP::atom::read_pdb(
      file_name, model, new IMP::atom::NonWaterNonHydrogenPDBSelector(), true,
      true);
  particles = get_by_type(mhd, IMP::atom::ATOM_TYPE);
  std::cout << "Number of atom particles " << particles.size() << std::endl;
}
Ejemplo n.º 4
0
Archivo: EMFit.cpp Proyecto: sirusb/imp
float EMFit::compute_volume(const IMP::kernel::Particles& particles) {
  IMP::saxs::FormFactorTable* ft = IMP::saxs::get_default_form_factor_table();
  float volume = 0.0;
  float c = (4.0 / 3.0) * IMP::algebra::PI;
  for (unsigned int pindex = 0; pindex < particles.size(); pindex++) {
    float radius = ft->get_radius(particles[pindex]);
    // volume = 4/3 * pi * r^3
    volume += c * radius * radius * radius;
    // add radius to particle. it is needed later for sampled density map
    IMP::core::XYZR::setup_particle(particles[pindex], radius);
  }
  return volume;
}
Ejemplo n.º 5
0
void transform(IMP::kernel::Particles& ps, IMP::algebra::Transformation3D& t) {
  for(IMP::kernel::Particles::iterator it = ps.begin(); it != ps.end(); it++) {
    IMP::core::XYZ d(*it);
    d.set_coordinates(t * d.get_coordinates());
  }
}