void get_residue_solvent_accessibility(const IMP::Particles& atom_particles, const IMP::Particles& residue_particles, const std::vector<int>& atom_2_residue_map, std::vector<float>& residue_solvent_accessibility) { IMP::saxs::FormFactorTable* ft = IMP::saxs::default_form_factor_table(); IMP::saxs::FormFactorType ff_type = IMP::saxs::HEAVY_ATOMS; for(unsigned int i=0; i<atom_particles.size(); i++) { float radius = ft->get_radius(atom_particles[i], ff_type); IMP::core::XYZR::setup_particle(atom_particles[i], 2.0*radius); } IMP::Floats surface_area; IMP::saxs::SolventAccessibleSurface s; surface_area = s.get_solvent_accessibility(IMP::core::XYZRs(atom_particles)); // sum up individual atom areas into residue area residue_solvent_accessibility.clear(); residue_solvent_accessibility.insert(residue_solvent_accessibility.begin(), residue_particles.size(), 0.0); for(unsigned int i=0; i<atom_particles.size(); i++) { // convert from 0-1 range to actual area in A^2 float radius = IMP::core::XYZR(atom_particles[i]).get_radius(); float area = surface_area[i] * 4*IMP::algebra::PI*radius*radius; residue_solvent_accessibility[atom_2_residue_map[i]] += area; } // compute solvent accessability percentage std::map<IMP::atom::ResidueType, float> residue_type_area_map_; residue_type_area_map_[IMP::atom::ALA] = 113.0; residue_type_area_map_[IMP::atom::ARG] = 241.0; residue_type_area_map_[IMP::atom::ASP] = 151.0; residue_type_area_map_[IMP::atom::ASN] = 158.0; residue_type_area_map_[IMP::atom::CYS] = 140.0; residue_type_area_map_[IMP::atom::GLN] = 189.0; residue_type_area_map_[IMP::atom::GLU] = 183.0; residue_type_area_map_[IMP::atom::GLY] = 85.0; residue_type_area_map_[IMP::atom::HIS] = 194.0; residue_type_area_map_[IMP::atom::ILE] = 182.0; residue_type_area_map_[IMP::atom::LEU] = 180.0; residue_type_area_map_[IMP::atom::LYS] = 211.0; residue_type_area_map_[IMP::atom::MET] = 204.0; residue_type_area_map_[IMP::atom::PHE] = 218.0; residue_type_area_map_[IMP::atom::PRO] = 143.0; residue_type_area_map_[IMP::atom::SER] = 122.0; residue_type_area_map_[IMP::atom::THR] = 146.0; residue_type_area_map_[IMP::atom::TYR] = 229.0; residue_type_area_map_[IMP::atom::TRP] = 259.0; residue_type_area_map_[IMP::atom::VAL] = 160.0; residue_type_area_map_[IMP::atom::UNK] = 113.0; for(unsigned int i=0; i<residue_particles.size(); i++) { IMP::atom::ResidueType residue_type = IMP::atom::Residue(residue_particles[i]).get_residue_type(); float residue_area = residue_type_area_map_.find(residue_type)->second; std::cerr << residue_type.get_string() << " " << residue_solvent_accessibility[i] << " " << residue_area << std::endl; residue_solvent_accessibility[i] /= residue_area; } }
void get_residue_solvent_accessibility(const IMP::Particles& residue_particles, IMP::Floats& residue_solvent_accessibility) { IMP::saxs::FormFactorTable* ft = IMP::saxs::default_form_factor_table(); IMP::saxs::FormFactorType ff_type = IMP::saxs::CA_ATOMS; for(unsigned int p_index=0; p_index<residue_particles.size(); p_index++) { float radius = ft->get_radius(residue_particles[p_index], ff_type); IMP::core::XYZR::setup_particle(residue_particles[p_index], radius); } IMP::saxs::SolventAccessibleSurface s; residue_solvent_accessibility = s.get_solvent_accessibility(IMP::core::XYZRs(residue_particles)); }
float EMFit::compute_volume(const IMP::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; }