void read_pdb(Model *model, const std::string file, std::vector<std::string>& pdb_file_names, std::vector<IMP::Particles>& particles_vec, bool residue_level, bool heavy_atoms_only, int multi_model_pdb, bool explicit_water) { IMP::atom::Hierarchies mhds; IMP::atom::PDBSelector* selector; if (residue_level) // read CA only selector = new IMP::atom::CAlphaPDBSelector(); else if (heavy_atoms_only) { // read without hydrogens if (explicit_water) selector = new IMP::atom::NonHydrogenPDBSelector(); else selector = new IMP::atom::NonWaterNonHydrogenPDBSelector(); } else { // read with hydrogens if (explicit_water) selector = new IMP::atom::NonAlternativePDBSelector(); else selector = new IMP::atom::NonWaterPDBSelector(); } if (multi_model_pdb == 2) { mhds = read_multimodel_pdb(file, model, selector, true); } else { if (multi_model_pdb == 3) { IMP::atom::Hierarchy mhd = IMP::atom::read_pdb(file, model, selector, false, true); mhds.push_back(mhd); } else { IMP::atom::Hierarchy mhd = IMP::atom::read_pdb(file, model, selector, true, true); mhds.push_back(mhd); } } for (unsigned int h_index = 0; h_index < mhds.size(); h_index++) { IMP::ParticlesTemp ps = get_by_type(mhds[h_index], IMP::atom::ATOM_TYPE); if (ps.size() > 0) { // pdb file std::string pdb_id = file; if (mhds.size() > 1) { pdb_id = trim_extension(file) + "_m" + std::string(boost::lexical_cast<std::string>(h_index + 1)) + ".pdb"; } pdb_file_names.push_back(pdb_id); particles_vec.push_back(IMP::get_as<IMP::Particles>(ps)); if (mhds.size() > 1) { IMP_LOG_TERSE(ps.size() << " atoms were read from PDB file " << file << " MODEL " << h_index + 1 << std::endl); } else { IMP_LOG_TERSE(ps.size() << " atoms were read from PDB file " << file << std::endl); } } } }
void CFREDDoc::file_open() { CFileDialog dlg(TRUE, "iam", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Imperial Alliance Missions (*.iam)|*.iam||", NULL); dlg.m_ofn.lpstrInitialDir = current_dir; if (dlg.DoModal() == IDOK) { current_dir = dlg.m_ofn.lpstrFile; current_dir = trim_extension(current_dir); theApp.write_ini_file(); CFREDDoc::OnOpenDocument(dlg.m_ofn.lpstrFile); enabled = 1; } }