/** * \file gmm_em_main.cpp * \brief Find an anchor graph segmentation of a density map * * Copyright 2007-2013 IMP Inventors. All rights reserved. **/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include //others #include #include using namespace IMP; using namespace boost; namespace { int parse_input(int argc, char *argv[], std::string &density_filename,float &apix,int &num_means, float &t, float &xorigin, float &yorigin, float &zorigin, std::string &cmm_filename,std::string &pdb_filename, std::string &seg_filename,std::string &cmm_max_filename, std::string &txt_filename) { xorigin=INT_MAX;yorigin=INT_MAX,zorigin=INT_MAX;apix=INT_MAX; pdb_filename=""; seg_filename=""; cmm_max_filename=""; txt_filename=""; std::stringstream usage; usage<<"The program segments all voxels above a given threshold into K "<< "clusters and links"<< " between neighboring ones.\n\nUsage: density2anchors "<< " "<< " \n\n"; program_options::options_description optional_params("Allowed options"), po,ao,required_params("Hideen options"); required_params.add_options() ("density",program_options::value(&density_filename), "assembly density filename") ("num_means",program_options::value(&num_means), "the number of clusters to use") ("t",program_options::value(&t),"density cutoff") ("output-pdb",program_options::value(&pdb_filename), "cluster centers as CA atoms in a PDB file"); program_options::positional_options_description p; std::stringstream seg_help; seg_help<<"print each cluster as a MRC file _i.mrc, and write "<< "load_segmentation.cmd file to easily load all segments into Chimera"; p.add("density", 1); p.add("num_means", 1); p.add("t", 1); p.add("output-pdb", 1); // Declare a group of options that will be // allowed from the command line optional_params.add_options() ("help", usage.str().c_str()) ("apix",program_options::value(&apix), "the a/pix of the density map") ("x",program_options::value(&xorigin), "the X origin of the density map") ("y",program_options::value(&yorigin), "the Y origin of the density map") ("z",program_options::value(&zorigin), "the Z origin of the density map") ("cmm",program_options::value(&cmm_filename), "write results in cmm format") ("cmm-max",program_options::value(&cmm_max_filename), "Max point of each cluster stored in a CMM file.") ("seg",program_options::value(&seg_filename), seg_help.str().c_str()) ("txt",program_options::value(&txt_filename), "anchors points in txt file format"); program_options::options_description all; all.add(optional_params).add(required_params); program_options::variables_map vm; program_options::store( program_options::command_line_parser(argc, argv).options(all).positional(p).run(), vm); program_options::notify(vm); if (vm.count("help")) { std::cout <get_spacing(); } else { dmap->update_voxel_size(apix); } algebra::Vector3D v = dmap->get_origin(); if (xorigin == INT_MAX) { xorigin = v[0]; } if (yorigin == INT_MAX) { yorigin = v[1]; } if (zorigin == INT_MAX) { zorigin = v[2]; } dmap->set_origin(xorigin, yorigin, zorigin); set_log_level(VERBOSE); IMP_LOG_VERBOSE("============= parameters ============"<set_origin(xorigin,yorigin,zorigin); IMP_LOG_VERBOSE("start setting trn_em"<