/** * \file ensemble_analysis.cpp * * Copyright 2007-2013 IMP Inventors. All rights reserved. */ #include #include #include #include #include IMPMULTIFIT_BEGIN_NAMESPACE #if 0 namespace { atom::Hierarchy create_protein( const std::string &name,int prot_ind, int num_beads,float bead_radius,Model *mdl, IntKey order_key, IntKey path_ind_key, IntKey anchor_key, float max_conn_rest_val){ IMP_LOG_TERSE("create protein "<set_name(name); prot->add_attribute(order_key,prot_ind); prot->add_attribute(path_ind_key,-1); atom::Selections sel; //create the beads std::cout<<"number of children "<add_attribute(anchor_key,0); core::XYZ(bead_child).set_coordinates_are_optimized(true); atom::Hierarchy::setup_particle(bead_child); std::stringstream ss; ss<set_name(ss.str()); prot.add_child(atom::Hierarchy(bead_child)); sel.push_back(atom::Selection(atom::Hierarchy(bead_child))); } int k=1;//todo - make this a parameter!! // //TODO - do we need this restraint if (sel.size()>1){ Restraint *r = atom::create_connectivity_restraint(sel,k); IMP_INTERNAL_CHECK(r!=NULL, "Create connectivity failed for protein:"<add_restraint(r); r->set_log_level(VERBOSE); std::stringstream ss; ss<<"conn."<set_name(ss.str()); //only allow the particles to penetrate or separate by 1 angstrom IMP_LOG_VERBOSE( "max conn restraint:"<set_maximum_score(r,max_conn_rest_val); } return prot; } } #endif Ensemble* load_ensemble(multifit::SettingsData *sd,Model *mdl, const ProteinsAnchorsSamplingSpace &mapping_data) { IMP_NEW(Ensemble, ens, (sd,mapping_data)); for (int i=0;i<(int)sd->get_number_of_component_headers();i++) { atom::Hierarchy mh = atom::read_pdb(sd->get_component_header(i) ->get_filename(),mdl); mh->set_name(sd->get_component_header(i)->get_name()); mh->add_attribute(StringKey("filename"), sd->get_component_header(i)->get_filename()); //create_rigid_body atom::create_rigid_body(mh); multifit::FittingSolutionRecords fits = multifit::read_fitting_solutions(sd->get_component_header(i) ->get_transformations_fn().c_str()); ens->add_component_and_fits(mh,fits); } return ens.release(); } void Ensemble::load_combination(Ints fit_comb) { // std::cout<<"For combination:"<get_component_header(i)->get_name()<get_name()<get_component_header(i)->get_name()); // std::cout<get_component_header(i)->get_name()); int fit_ind=fit_inds[fit_comb[i]][0]; core::transform(rb, fits_[i][fit_ind].get_fit_transformation().get_inverse()); } } void Ensemble::add_component_and_fits( atom::Hierarchy mh, const multifit::FittingSolutionRecords &fits) { mhs_.push_back(mh); std::cout<<"Adding molecule:"<get_name()< Ensemble::score_by_restraints( Restraints rs, const IntsList &combinations ) { std::vector scores(combinations.size()); boost::progress_display show_progress(combinations.size()); for(int i=0;i<(int)combinations.size();i++) { load_combination(combinations[i]); std::cout<<"i:"<get_name()<evaluate(false); } std::cout<<"===step3"<