/** * \file single_prot_pca_fit.cpp * \brief Fit a single protein to a density map * * Copyright 2007-2013 IMP Inventors. All rights reserved. **/ //others #include #include #include #include #include #include #include #include //imp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include using namespace IMP; namespace po = boost::program_options; namespace { em::DensityMap* set_map(const std::string &density_filename, float resolution, float spacing, float x_origin, float y_origin, float z_origin) { IMP_NEW(em::MRCReaderWriter, mrw, ()); em::DensityMap *rmap; try{ rmap = em::read_map(density_filename.c_str(),mrw); } catch (const Exception &err){ std::cerr<<"Problem reading density map:"<get_header_writable()->set_resolution(resolution); rmap->update_voxel_size(spacing); algebra::Vector3D v = rmap->get_origin(); if (x_origin == INT_MAX) { x_origin = v[0]; } if (y_origin == INT_MAX) { y_origin = v[1]; } if (z_origin == INT_MAX) { z_origin = v[2]; } rmap->set_origin(x_origin, y_origin, z_origin); return rmap; } int parse_input(int argc, char *argv[],std::string &density_filename, float &spacing, float &x_origin,float &y_origin,float &z_origin, float &resolution, float &threshold, std::string &protein_filename, std::string &ref_filename, std::string &sol_filename, std::string &log_filename, std::string &pdb_fit_filename){ x_origin=INT_MAX;y_origin=INT_MAX,z_origin=INT_MAX; ref_filename=""; sol_filename="multifit.solutions.txt"; log_filename="multifit.log"; pdb_fit_filename=""; po::options_description optional_params("Allowed options"),po,ao,required_params("Hideen options"); required_params.add_options() ("density",po::value(&density_filename), "complex density filename") ("apix",po::value(&spacing), "the a/pix of the density map") ("res",po::value(&resolution), "the resolution of the density map") ("threshold",po::value(&threshold), "density threshold") ("protein",po::value(&protein_filename), "a PDB file of the first protein"); std::stringstream help_message; help_message << "single_prot_pca_fit is a program for fitting a protein"; help_message<<" into its segmented density map based on PCA matching."; help_message<<" The fitting solutions are scored based"; help_message<<" on cross-correlation between the protein and the map."; help_message<<"\n\nUsage: single_prot_pca_fit"; help_message<< " "; help_message<<" \n\n"; optional_params.add_options() ("help",help_message.str().c_str()) ("x",po::value(&x_origin), "the X origin of the density map") ("y",po::value(&y_origin), "the Y origin of the density map") ("z",po::value(&z_origin), "the Z origin of the density map") ("ref",po::value(&ref_filename), "a PDB file of the protein fitted to the density map (for testing)") ("output",po::value(&sol_filename), " The default file is multifit.solutions.txt") ("sol",po::value(&pdb_fit_filename), "Solutions will be printed in PDB format and named _i.pdb") ("log-filename",po::value(&log_filename), "write log messages here"); po::positional_options_description p; p.add("density", 1); p.add("apix", 1); p.add("res", 1); p.add("threshold", 1); p.add("protein", 1); po::options_description all; all.add(optional_params).add(required_params); po::variables_map vm; po::store( po::command_line_parser(argc, argv).options(all).positional(p).run(),vm); po::notify(vm); if (vm.count("help")) { std::cout << optional_params << "\n"; return 1; } if (! (vm.count("threshold")+ vm.count("density")+vm.count("apix")+ vm.count("res")+vm.count("protein") == 5)){ std::cout<get_refined(rb),dmap,threshold); //prepare output sols.sort(false); //note: these are CC scores coming from the FFT, not 1-CC. //save as multifit records multifit::FittingSolutionRecords final_fits; int num_sols=sols.get_number_of_solutions(); for(int i=0;i