Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions database/scoring/weights/hrf_gbm.wts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hrf_gbm 9.0
1 change: 1 addition & 0 deletions source/src/basic/options/options_rosetta.py
Original file line number Diff line number Diff line change
Expand Up @@ -1533,6 +1533,7 @@

Option( 'covalent_labeling_input', 'File', desc='Input covalent labeling data in the form of neighbor counts'),
Option( 'hrf_dynamics_input', 'File', desc='Input covalent labeling data in the form of protection factors for FA'),
Option( 'hrf_gbm_input', 'File', desc='File that contains expected residue neighbor counts used for hrf_gbm scoring'),
Option( 'covalent_labeling_fa_input', 'File', desc='Input covalent labeling data in the form of neighbor counts for FA'),
Option( 'depc_ms_input', 'File', desc='Input DEPC covalent labeling MS data in the form of His/Lys/Ser/Thr/Tyr residue numbers and labeling status of labeled (L) or unlabeled (U)'),
Option( 'elec_min_dis', 'Real', desc='changes the minimum distance cut-off for hack-elec energy', default='1.6'),
Expand Down
1 change: 1 addition & 0 deletions source/src/core.4.src.settings
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ sources = {
"GenBornEnergy",
"GenericBondedEnergy",
"HRFDynamicsEnergy",
"HRF_GBM_Energy",
"HRF_MSLabelingEnergy",
"CCS_IMMSEnergy",
"MultipoleElecEnergy",
Expand Down
154 changes: 154 additions & 0 deletions source/src/core/energy_methods/HRF_GBM_Energy.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
// -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
// vi: set ts=2 noet:
//
// (c) Copyright Rosetta Commons Member Institutions.
// (c) This file is part of the Rosetta software suite and is made available under license.
// (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
// (c) For more information, see http://www.rosettacommons.org. Questions about this can be
// (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.

/// @file core/energy_methods/HRF_GBM_Energy.cc
/// @brief Score term assesses neighbor count agreement between decoy and expected value generated from external lightGBM model. Model uses experimental HRF data as input feature. Detailed in manuscript published in 2025.
/// @author Elijah Day (ehday@ucla.edu)

#include <core/energy_methods/HRF_GBM_Energy.hh>
#include <core/energy_methods/HRF_GBM_EnergyCreator.hh>
#include <core/conformation/Residue.hh>
#include <core/pose/Pose.hh>
#include <core/scoring/EnergyMap.hh>
#include <core/scoring/ContextGraphTypes.hh>
#include <core/scoring/methods/EnergyMethodOptions.hh>


#include <utility/io/izstream.hh>
#include <utility/vector1.hh>
#include <numeric/NumericTraits.hh>

#include <basic/options/keys/OptionKeys.hh> // AUTO IWYU For OptionKeys,

namespace core {
namespace energy_methods {


/// @details Returns fresh instance of the HRF_GBM_Energy class.
core::scoring::methods::EnergyMethodOP
HRF_GBM_EnergyCreator::create_energy_method(
core::scoring::methods::EnergyMethodOptions const & options
) const {
return utility::pointer::make_shared< HRF_GBM_Energy >( options );
}

core::scoring::ScoreTypes
HRF_GBM_EnergyCreator::score_types_for_method() const {
using namespace core::scoring;
ScoreTypes sts;
sts.push_back(hrf_gbm);
return sts;
}

void
HRF_GBM_Energy::setup_for_scoring(
pose::Pose & pose, core::scoring::ScoreFunction const &
) const {
pose.update_residue_neighbors();

}

// constructor
HRF_GBM_Energy::HRF_GBM_Energy( core::scoring::methods::EnergyMethodOptions const & options ) :
parent( utility::pointer::make_shared< HRF_GBM_EnergyCreator >() ),
hrf_gbm_input_file_( options.hrf_gbm_input() )
{
init_from_file();
}

/// clone
core::scoring::methods::EnergyMethodOP
HRF_GBM_Energy::clone() const {
return utility::pointer::make_shared< HRF_GBM_Energy >( *this );
}

/////////////////////////////////////////////////////////////////////////////
// scoring
/////////////////////////////////////////////////////////////////////////////

void
HRF_GBM_Energy::residue_energy(
core::conformation::Residue const & residue,
core::pose::Pose const & pose,
core::scoring::EnergyMap & emap
) const {

core::Size const number_residues (pose.total_residue());
core::Real pose_neighbor_count (0.0);
core::Real nc_from_file (0.0);
core::Real distance (0.0);
core::Real angle (0.0);


for ( core::Size j=1; j <= input_nc_.size(); j++ ) {
if ( input_nc_[j].first == residue.seqpos() ) {
nc_from_file = input_nc_[j].second; // Predicted neighbor count values were obtained from the external lightGBM model described in the Day 2025 manuscript. Briefly, the model takes in sequence derived features (PSSM profile, predicted SSE, etc.) and experimental mass spec data to generated an expected neighbor count for the residue. Those neighbor counts are passed as an input for the hrf_gbm score term.
std::string target_atom ("CB");
if ( residue.type().name1() == 'G' ) {
target_atom = "1HA";
}
for ( core::Size res_count_neighbor = 1; res_count_neighbor <= number_residues; res_count_neighbor++ ) {
if ( residue.seqpos() != pose.residue(res_count_neighbor).seqpos() ) {
std::string neighbor_atom ("CB");
if ( pose.residue(res_count_neighbor).type().name1() == 'G' ) {
neighbor_atom = "1HA";
}
distance = residue.xyz("CA").distance(pose.residue(res_count_neighbor).xyz(neighbor_atom));
numeric::xyzVector<core::Real> norm_CA_target_vector = (residue.xyz(target_atom) - residue.xyz("CA")).normalize()/(residue.xyz(target_atom).distance(residue.xyz("CA")));
numeric::xyzVector<core::Real> norm_neighbor_vector = (pose.residue(res_count_neighbor).xyz(neighbor_atom)-residue.xyz("CA"))/(pose.residue(res_count_neighbor).xyz(neighbor_atom).distance(residue.xyz("CA")));
angle = std::acos(norm_CA_target_vector.dot(norm_neighbor_vector));
pose_neighbor_count += 1.0/(1.0 + std::exp(1.0*(distance-9.0)))*1.0/(1.0 + std::exp(numeric::NumericTraits< float >::pi()*2.0*(angle-numeric::NumericTraits< float >::pi()/2.0)));
}
}
emap[ core::scoring::hrf_gbm] += -1.0/(1.0 + std::exp(2.9*(std::abs(pose_neighbor_count - nc_from_file)-2.1))); //2.9 and 2.1 were optimized in the Day 2025 manuscript
}
}
}

void
HRF_GBM_Energy::indicate_required_context_graphs( utility::vector1< bool > & context_graphs_required ) const
{
context_graphs_required[ core::scoring::twelve_A_neighbor_graph ] = false;
}


core::Size
HRF_GBM_Energy::version() const
{
return 1;
}

void HRF_GBM_Energy::init_from_file() {
using namespace basic::options;
using namespace basic::options::OptionKeys;

utility::io::izstream input(hrf_gbm_input_file_);
if ( !input.good() ) {
std::string const msg( "Error opening file: " + hrf_gbm_input_file_ );
utility_exit_with_message( msg );
}

std::string line;

while ( getline(input,line) ) {
if ( line.substr(0,1) == "#" ) continue;
std::istringstream ss(line);
core::Size resi;
core::Real nc;

ss >> resi >> nc;

runtime_assert_string_msg( !(ss.fail() || ss.bad()), "Error in HRF_GBM_Energy::init_from_file(): Could not parse line \"" + line + "\"." );
input_nc_.push_back( std::pair< core::Size, core::Real >(resi, nc) );
}

}

} // scoring
} // core
32 changes: 32 additions & 0 deletions source/src/core/energy_methods/HRF_GBM_Energy.fwd.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
// vi: set ts=2 noet:
//
// (c) Copyright Rosetta Commons Member Institutions.
// (c) This file is part of the Rosetta software suite and is made available under license.
// (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
// (c) For more information, see http://www.rosettacommons.org. Questions about this can be
// (c) addressed to University of Washington CoMotion, email: license@uw.edu.

/// @file core/energy_methods/HRF_GBM_Energy.hh
/// @brief Score term using predicted neighbor counts from experimentally derived HRF-MS data
/// @author Elijah Day (ehday@ucla.edu)


#ifndef INCLUDED_core_energy_methods_HRF_GBM_Energy_fwd_hh
#define INCLUDED_core_energy_methods_HRF_GBM_Energy_fwd_hh

// Unit Headers

// Package headers

// Project headers

// Utility headers


namespace core {
namespace energy_methods {
class HRF_GBM_Energy;
}
}
#endif // INCLUDED_core_energy_methods_HRF_GBM_Energy_fwd_hh
79 changes: 79 additions & 0 deletions source/src/core/energy_methods/HRF_GBM_Energy.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
// vi: set ts=2 noet:
//
// (c) Copyright Rosetta Commons Member Institutions.
// (c) This file is part of the Rosetta software suite and is made available under license.
// (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
// (c) For more information, see http://www.rosettacommons.org. Questions about this can be
// (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.

/// @file core/energy_methods/HRF_GBM_Energy.hh
/// @brief Energy term used for scoring HRF_GBM_Energy
/// @author Elijah Day (ehday@ucla.edu)

#ifndef INCLUDED_core_energy_methods_HRF_GBM_Energy_hh
#define INCLUDED_core_energy_methods_HRF_GBM_Energy_hh

#include <core/scoring/methods/ContextDependentOneBodyEnergy.hh>
#include <core/scoring/ScoreFunction.fwd.hh>
#include <core/pose/Pose.fwd.hh>
#include <utility/vector1.hh>

#include <core/scoring/methods/EnergyMethodOptions.fwd.hh> // AUTO IWYU For EnergyMethodOptions


namespace core {
namespace energy_methods {



class HRF_GBM_Energy : public core::scoring::methods::ContextDependentOneBodyEnergy {
public:

typedef core::scoring::methods::ContextDependentOneBodyEnergy parent;
HRF_GBM_Energy( core::scoring::methods::EnergyMethodOptions const & options );

/// clone
core::scoring::methods::EnergyMethodOP
clone() const override;

/////////////////////////////////////////////////////////////////////////////
// scoring
/////////////////////////////////////////////////////////////////////////////

void
residue_energy(
conformation::Residue const & rsd,
pose::Pose const & pose,
core::scoring::EnergyMap & emap
) const override;

void
setup_for_scoring(
pose::Pose & pose, core::scoring::ScoreFunction const &
) const override;

void
finalize_total_energy(
pose::Pose &,
core::scoring::ScoreFunction const &,
core::scoring::EnergyMap &
) const override {}

core::Size version() const override;

void
indicate_required_context_graphs(
utility::vector1< bool > & /*context_graphs_required*/
) const override;

private:
std::string hrf_gbm_input_file_;
void init_from_file();
utility::vector1< std::pair< core::Size, core::Real > > input_nc_;
};

}
}

#endif // INCLUDED_core_energy_methods_HRF_GBM_Energy_hh
42 changes: 42 additions & 0 deletions source/src/core/energy_methods/HRF_GBM_EnergyCreator.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
// vi: set ts=2 noet:
//
// (c) Copyright Rosetta Commons Member Institutions.
// (c) This file is part of the Rosetta software suite and is made available under license.
// (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
// (c) For more information, see http://www.rosettacommons.org. Questions about this can be
// (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.

/// @file src/core/energy_methods/HRF_GBM_EnergyCreator.hh
/// @brief Declaration of class that connects HRF_GBM_Energy with the ScoringManager
/// @author Elijah Day (ehday@ucla.edu)

#ifndef INCLUDED_core_energy_methods_HRF_GBM_EnergyCreator_hh
#define INCLUDED_core_energy_methods_HRF_GBM_EnergyCreator_hh

#include <core/scoring/methods/EnergyMethodCreator.hh>

namespace core {
namespace energy_methods {


class HRF_GBM_EnergyCreator : public core::scoring::methods::EnergyMethodCreator
{
public:
/// @brief Instantiate a new HRF_GBM_Energy
core::scoring::methods::EnergyMethodOP
create_energy_method(
core::scoring::methods::EnergyMethodOptions const &
) const override;

/// @brief Return the set of score types claimed by the EnergyMethod
/// this EnergyMethodCreator creates in its create_energy_method() function
core::scoring::ScoreTypes
score_types_for_method() const override;

};

}
}

#endif // INCLUDED_core_energy_methods_HRF_GBM_EnergyCreator_hh
2 changes: 2 additions & 0 deletions source/src/core/init/init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
#include <core/energy_methods/Burial_v2EnergyCreator.hh>
#include <core/energy_methods/HRF_MSLabelingEnergyCreator.hh>
#include <core/energy_methods/HRFDynamicsEnergyCreator.hh>
#include <core/energy_methods/HRF_GBM_EnergyCreator.hh>
#include <core/energy_methods/CCS_IMMSEnergyCreator.hh>
#include <core/energy_methods/CCS_IMMSComplexEnergyCreator.hh>
#include <core/energy_methods/CCS_IMMS_with_CryoEMEnergyCreator.hh>
Expand Down Expand Up @@ -487,6 +488,7 @@ static EnergyMethodRegistrator< energy_methods::CovalentLabelingEnergyCreator> C
static EnergyMethodRegistrator< energy_methods::CovalentLabelingFAEnergyCreator> CovalentLabelingFAEnergyCreator_registrator;
static EnergyMethodRegistrator< energy_methods::DEPC_MS_EnergyCreator > DEPC_MS_EnergyCreator_registrator;
static EnergyMethodRegistrator< energy_methods::HRFDynamicsEnergyCreator > HRFDynamicsEnergyCreator_registrator;
static EnergyMethodRegistrator< energy_methods::HRF_GBM_EnergyCreator > HRF_GBM_EnergyCreator_registrator;
static EnergyMethodRegistrator< energy_methods::HRF_MSLabelingEnergyCreator > HRF_MSLabelingEnergyCreator_registrator;
static EnergyMethodRegistrator< energy_methods::CCS_IMMSEnergyCreator > CCS_IMMSEnergyCreator_registrator;
static EnergyMethodRegistrator< energy_methods::CCS_IMMSComplexEnergyCreator > CCS_IMMSComplexEnergyCreator_registrator;
Expand Down
1 change: 1 addition & 0 deletions source/src/core/scoring/ScoreType.hh
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ enum ScoreType {
covalent_labeling_fa, //FA form of covalent labeling
hrf_ms_labeling,
hrf_dynamics,
hrf_gbm,
ccs_imms,
ccs_imms_complex,
ccs_imms_cryoem,
Expand Down
1 change: 1 addition & 0 deletions source/src/core/scoring/ScoreTypeManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ ScoreTypeManager::setup_score_type_names()
name2score_type_[ "covalent_labeling_fa" ] = covalent_labeling_fa;
name2score_type_[ "hrf_ms_labeling" ] = hrf_ms_labeling;
name2score_type_[ "hrf_dynamics" ] = hrf_dynamics;
name2score_type_[" hrf_gbm" ] = hrf_gbm;
name2score_type_[ "ccs_imms" ] = ccs_imms;
name2score_type_[ "ccs_imms_complex" ] = ccs_imms_complex;
name2score_type_[ "ccs_imms_cryoem" ] = ccs_imms_cryoem;
Expand Down
Loading