本文整理汇总了C++中protein::get_residue_ref_of_index方法的典型用法代码示例。如果您正苦于以下问题:C++ protein::get_residue_ref_of_index方法的具体用法?C++ protein::get_residue_ref_of_index怎么用?C++ protein::get_residue_ref_of_index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类protein
的用法示例。
在下文中一共展示了protein::get_residue_ref_of_index方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_check
/// \brief TODOCUMENT
///
/// Things for investigation:
/// * raw/final score from alignment
/// * expected raw/final score
/// * top categorised reasons by raw score
/// * repeat for varying scan_stride (can just be called by nmnf fn)
alignment_scan_comparison check_scan_on_final_alignment::do_check(const alignment &arg_alignment, ///< TODOCUMENT
const protein &arg_protein_a, ///< TODOCUMENT
const protein &arg_protein_b, ///< TODOCUMENT
const quad_criteria &arg_criteria, ///< TODOCUMENT
const scan_stride &arg_scan_stride ///< TODOCUMENT
) const {
const auto aln_range = irange( 0_z, arg_alignment.length() );
cerr << "SHOULD THE RANGE BE 7.0 RATHER THAN SQRT(40.0)????\n";
return accumulate(
cross( aln_range, aln_range ),
alignment_scan_comparison{},
[&] (alignment_scan_comparison x, const size_size_tpl &y) {
const size_t aln_from_ctr = get<0>( y );
const size_t aln_to_ctr = get<1>( y );
const bool from_alns_both = has_both_positions_of_index( arg_alignment, aln_from_ctr );
const bool to_alns_both = has_both_positions_of_index( arg_alignment, aln_to_ctr );
if ( from_alns_both && to_alns_both ) {
const auto a_from = get_a_position_of_index( arg_alignment, aln_from_ctr );
const auto b_from = get_b_position_of_index( arg_alignment, aln_from_ctr );
const auto a_to = get_a_position_of_index( arg_alignment, aln_to_ctr );
const auto b_to = get_b_position_of_index( arg_alignment, aln_to_ctr );
const bool a_included = difference( a_from, a_to ) > NUM_EXCLUDED_ON_SIDES;
const bool b_included = difference( b_from, b_to ) > NUM_EXCLUDED_ON_SIDES;
if ( a_included && b_included ) {
const auto the_distance = distance_between_points(
view_vector_of_residue_pair(
arg_protein_a.get_residue_ref_of_index( a_from ),
arg_protein_a.get_residue_ref_of_index( a_to )
),
view_vector_of_residue_pair(
arg_protein_b.get_residue_ref_of_index( b_from ),
arg_protein_b.get_residue_ref_of_index( b_to )
)
);
// const auto score = ( the_distance >= 7.0 ) ? 0.0 : ( 1.0 - the_distance / 7.0 );
const auto score = ( the_distance >= sqrt( 40.0 ) ) ? 0.0 : ( 1.0 - the_distance / 7.0 );
if ( score > 0.0 ) {
const auto scan_result = quad_and_rep_criteria_result_of(
arg_protein_a,
arg_protein_b,
arg_criteria,
arg_scan_stride,
numeric_cast<index_type>( a_from ),
numeric_cast<index_type>( a_to ),
numeric_cast<index_type>( b_from ),
numeric_cast<index_type>( b_to )
);
x += make_pair( scan_result, score );
}
}
}
return x;
}
);
}
示例2: to_psi_angle_difference
/// \brief Get the (wrapped) difference between the two pairs' to_residue psi angles
inline angle_type to_psi_angle_difference(const size_size_pair &arg_indices_a, ///< The indices of the from/to residues in the first protein
const size_size_pair &arg_indices_b, ///< The indices of the from/to residues in the second protein
const protein &arg_protein_a, ///< The first protein
const protein &arg_protein_b ///< The second protein
) {
const residue &to_a_res = arg_protein_a.get_residue_ref_of_index( arg_indices_a.second );
const residue &to_b_res = arg_protein_b.get_residue_ref_of_index( arg_indices_b.second );
const angle_type &to_psi_a = geom::make_angle_from_radians<angle_base_type>( angle_in_radians( to_a_res.get_psi_angle() ) );
const angle_type &to_psi_b = geom::make_angle_from_radians<angle_base_type>( angle_in_radians( to_b_res.get_psi_angle() ) );
return wrapped_difference( to_psi_a, to_psi_b );
}
示例3: from_psi_angle_difference
/// \brief Get the (wrapped) difference between the two pairs' from_residue psi angles
inline angle_type from_psi_angle_difference(const size_size_pair &arg_indices_a, ///< The indices of the from/to residues in the first protein
const size_size_pair &arg_indices_b, ///< The indices of the from/to residues in the second protein
const protein &arg_protein_a, ///< The first protein
const protein &arg_protein_b ///< The second protein
) {
const residue &from_a_res = arg_protein_a.get_residue_ref_of_index( arg_indices_a.first );
const residue &from_b_res = arg_protein_b.get_residue_ref_of_index( arg_indices_b.first );
const auto from_psi_a = geom::convert_angle_type<angle_base_type>( from_a_res.get_psi_angle() );
const auto from_psi_b = geom::convert_angle_type<angle_base_type>( from_b_res.get_psi_angle() );
return wrapped_difference( from_psi_a, from_psi_b );
}
示例4: rep_quad_criteria_result_of
/// \brief TODOCUMENT
///
/// Provide functions that allow this function to be expressed slightly more tightly
quad_criteria_result check_scan_on_final_alignment::rep_quad_criteria_result_of(const protein &arg_query_protein, ///< TODOCUMENT
const protein &arg_index_protein, ///< TODOCUMENT
const quad_criteria &arg_criteria, ///< TODOCUMENT
const scan_stride &arg_scan_stride, ///< TODOCUMENT
const index_type &arg_query_from_index, ///< TODOCUMENT
const index_type &arg_query_to_index, ///< TODOCUMENT
const index_type &arg_index_from_index, ///< TODOCUMENT
const index_type &arg_index_to_index ///< TODOCUMENT
) {
const auto from_rep_indices = get_from_rep_of_indices( arg_scan_stride, arg_query_from_index, arg_index_from_index );
const auto to_rep_indices = get_to_rep_of_indices ( arg_scan_stride, arg_query_to_index, arg_index_to_index );
if ( ! from_rep_indices || ! to_rep_indices ) {
return quad_criteria_result::HAS_NO_REP;
}
const auto query_from_rep_index = from_rep_indices->first;
const auto query_to_rep_index = to_rep_indices->first;
const auto index_from_rep_index = from_rep_indices->second;
const auto index_to_rep_index = to_rep_indices->second;
const auto query_res_pair = make_multi_struc_res_rep_pair(
arg_query_protein.get_residue_ref_of_index( get_index_of_rep_index( arg_scan_stride.get_query_from_strider(), query_from_rep_index ) ),
arg_query_protein.get_residue_ref_of_index( get_index_of_rep_index( arg_scan_stride.get_query_to_strider (), query_to_rep_index ) ),
0,
query_from_rep_index,
query_to_rep_index
);
const auto index_res_pair = make_multi_struc_res_rep_pair(
arg_index_protein.get_residue_ref_of_index( get_index_of_rep_index( arg_scan_stride.get_index_from_strider(), index_from_rep_index ) ),
arg_index_protein.get_residue_ref_of_index( get_index_of_rep_index( arg_scan_stride.get_index_to_strider (), index_to_rep_index ) ),
0,
index_from_rep_index,
index_to_rep_index
);
const auto result = criteria_result_of( arg_criteria, query_res_pair, index_res_pair );
// if ( result != quad_criteria_result::PASS && result != quad_criteria_result::QUERY_FAILS_SINGLE_CHECKS && result != quad_criteria_result::INDEX_FAILS_SINGLE_CHECKS ) {
// quad_criteria_result::PASS;
cerr << "Quad: [(" << setw( 2 ) << right << arg_query_from_index
<< "," << setw( 2 ) << right << arg_index_from_index
<< ")->(" << setw( 2 ) << right << arg_query_to_index
<< "," << setw( 2 ) << right << arg_index_to_index
<< ")], Rep[(" << setw( 2 ) << right << query_from_rep_index
<< "," << setw( 2 ) << right << index_from_rep_index
<< ")->(" << setw( 2 ) << right << query_to_rep_index
<< "," << setw( 2 ) << right << index_to_rep_index
<< ")]=" << setw( 25 ) << right << result
// << ",A/" << query_res_pair
// << ",B/" << index_res_pair
<< "\n";
// }
return result;
}
示例5:
/// \brief TODOCUMENT
void cath::test::dssp_wolf_file_test_suite_fixture::check_pdb_and_dssp_built_protein(const string &arg_example_id ///< TODOCUMENT
) {
ostringstream build_prot_warn_stream;
const auto the_pdb_file = read_pdb_file ( pdb_file_of_example_id( arg_example_id ) );
const auto the_dssp_file = read_dssp_file( dssp_file_of_example_id( arg_example_id ) );
const auto pdb_prot = build_protein_of_pdb( the_pdb_file, reference_wrapper<ostream>{ build_prot_warn_stream } );
const auto num_non_null_dssp_residues = get_num_non_null_residues( the_dssp_file );
const auto num_pdb_residues = pdb_prot.get_length();
BOOST_CHECK_EQUAL( build_prot_warn_stream.str(), "" );
ostringstream test_ss;
const log_to_ostream_guard the_guard{ test_ss };
const protein combi_prot_with_all_pdb_residues = protein_from_dssp_and_pdb(the_dssp_file, the_pdb_file, dssp_skip_policy::DONT_SKIP__BREAK_ANGLES );
const protein combi_prot_with_dssp_only_residues = protein_from_dssp_and_pdb(the_dssp_file, the_pdb_file, dssp_skip_policy::SKIP__BREAK_ANGLES );
BOOST_REQUIRE_EQUAL( num_non_null_dssp_residues, combi_prot_with_dssp_only_residues.get_length() );
BOOST_REQUIRE_EQUAL( num_pdb_residues, combi_prot_with_all_pdb_residues.get_length() );
// Compare the combi's residues with the DSSP residues
//( this requires two counters to handle skipping null DSSP residues)
size_t combi_residue_ctr = 0;
for (const residue dssp_residue : the_dssp_file) {
// If this is a null DSSP residue then just move onto the next one
if ( is_null_residue(dssp_residue) ) {
continue;
}
const residue built_residue = combi_prot_with_dssp_only_residues.get_residue_ref_of_index( combi_residue_ctr );
BOOST_CHECK_EQUAL( dssp_residue.get_pdb_residue_id(), built_residue.get_pdb_residue_id() );
BOOST_CHECK_EQUAL( dssp_residue.get_sec_struc_number(), built_residue.get_sec_struc_number() );
BOOST_CHECK_EQUAL( dssp_residue.get_sec_struc_type(), built_residue.get_sec_struc_type() );
// cerr << dssp_residue << endl;
// cerr << built_residue << endl;
// cerr << endl;
++combi_residue_ctr;
}
for (size_t pdb_residue_ctr = 0; pdb_residue_ctr < num_pdb_residues; ++pdb_residue_ctr) {
const pdb_residue the_pdb_residue = the_pdb_file.get_residue_cref_of_index__backbone_unchecked(pdb_residue_ctr);
const residue built_residue = combi_prot_with_all_pdb_residues.get_residue_ref_of_index( pdb_residue_ctr );
BOOST_CHECK_EQUAL( the_pdb_residue.get_residue_id(), built_residue.get_pdb_residue_id() );
BOOST_CHECK_EQUAL( get_carbon_alpha_coord( the_pdb_residue ), built_residue.get_carbon_alpha_coord() );
BOOST_CHECK_EQUAL( get_or_predict_carbon_beta_coord_of_residue( the_pdb_residue ), built_residue.get_carbon_beta_coord() );
// cerr << pdb_residue << endl;
// cerr << built_residue << endl;
// cerr << endl;
}
}
示例6: squared_distance
/// \brief Calculate the squared distance between the views of the two residue pairs
///
/// Each view is the location of the to_residue's carbon-beta atom as seen from
/// the coordinate frame of the from_residue
inline double squared_distance(const size_size_pair &arg_indices_a, ///< The indices of the from/to residues in the first protein
const size_size_pair &arg_indices_b, ///< The indices of the from/to residues in the second protein
const protein &arg_protein_a, ///< The first protein
const protein &arg_protein_b ///< The second protein
) {
const residue &from_a_res = arg_protein_a.get_residue_ref_of_index( arg_indices_a.first );
const residue &to_a_res = arg_protein_a.get_residue_ref_of_index( arg_indices_a.second );
const residue &from_b_res = arg_protein_b.get_residue_ref_of_index( arg_indices_b.first );
const residue &to_b_res = arg_protein_b.get_residue_ref_of_index( arg_indices_b.second );
const geom::coord view_a = view_vector_of_residue_pair( from_a_res, to_a_res );
const geom::coord view_b = view_vector_of_residue_pair( from_b_res, to_b_res );
return squared_distance_between_points( view_a, view_b );
}
示例7: add_structure_to_store
void add_structure_to_store(T &arg_store, ///< TODOCUMENT
const index_type &arg_structure_index, ///< TODOCUMENT
const protein &arg_protein, ///< TODOCUMENT
const scan_policy<KPs...> &arg_scan_policy, ///< TODOCUMENT
const scan_role &arg_scan_role ///< TODOCUMENT
) {
const auto &the_keyer = arg_scan_policy.get_keyer();
// BOOST_LOG_TRIVIAL( warning ) << "Keyer is : " << the_keyer;
const auto roled_stride = roled_scan_stride{ arg_scan_role, arg_scan_policy.get_scan_stride() };
const auto num_residues = debug_unwarned_numeric_cast<index_type>( arg_protein.get_length() );
const auto from_rep_strider = get_this_from_strider( roled_stride );
const auto to_rep_strider = get_this_to_strider ( roled_stride );
for (const auto &from_rep_index : get_rep_indices_range( from_rep_strider, num_residues ) ) {
// BOOST_LOG_TRIVIAL( warning ) << "\tFrom rep " << from_rep_index;
for (const auto &to_rep_index : get_rep_indices_range( to_rep_strider, num_residues ) ) {
if ( from_rep_index != to_rep_index ) {
const auto the_res_pair = make_multi_struc_res_rep_pair(
arg_protein.get_residue_ref_of_index( get_index_of_rep_index( from_rep_strider, from_rep_index ) ),
arg_protein.get_residue_ref_of_index( get_index_of_rep_index( to_rep_strider, to_rep_index ) ),
arg_structure_index,
from_rep_index,
to_rep_index
);
// BOOST_LOG_TRIVIAL( warning ) << "\t\tTo rep " << to_rep_index << " - the rep : " << the_res_pair;
arg_store.push_back_entry_to_cell( the_keyer.make_key( the_res_pair ), the_res_pair );
}
}
}
}
示例8: view_frame
/// \brief Calculate the view_frame of the pair
/// (ie the coordinate frame of the to_residue's atoms in terms of the coordinate from of the from_residue's atoms)
inline cath::geom::rotation view_frame(const protein &arg_protein, ///< The protein containing the two residues
const size_t &arg_from_index, ///< The index of the from_residue
const size_t &arg_to_index ///< The index of the to_residue
) {
return view_frame(
arg_protein.get_residue_ref_of_index( arg_from_index ),
arg_protein.get_residue_ref_of_index( arg_to_index )
);
}
示例9: build_views
/// \brief Private static method that implements the process of building the views from proteins
coord_vec_vec view_cache::build_views(const protein &arg_protein ///< The protein which the view_cache should be built to represent
) {
// Grab the number of residues and prepare the views accordingly
const size_t num_residues = arg_protein.get_length();
coord_vec_vec new_views( num_residues );
for (coord_vec &view_of : new_views) {
view_of.reserve( num_residues );
}
// Loop over the all from-versus-to residue pairs and add the resulting views
for (const size_t &from_res_ctr : irange( 0_z, num_residues ) ) {
for (const size_t &to_res_ctr : irange( 0_z, num_residues ) ) {
coord_vec &view_of_from = new_views[ from_res_ctr ];
view_of_from.push_back( view_vector_of_residue_pair(
arg_protein.get_residue_ref_of_index( from_res_ctr ),
arg_protein.get_residue_ref_of_index( to_res_ctr )
) );
}
}
return new_views;
}
示例10: make_pair
/// \brief TODOCUMENT
pair<str_vec, str_vec> check_scan_on_final_alignment::get_rep_name_lists(const protein &arg_protein, ///< TODOCUMENT
const roled_scan_stride &arg_roled_scan_stride ///< TODOCUMENT
) const {
// const auto &num_residues = arg_protein.get_length();
const auto rep_list_indices = get_rep_index_lists( arg_roled_scan_stride, numeric_cast<index_type>( arg_protein.get_length() ) );
const auto residue_name_of_index = [&] (const index_type &x) { return get_pdb_residue_name_string( arg_protein.get_residue_ref_of_index( x ) ); };
return make_pair(
transform_build<str_vec>( rep_list_indices.first, residue_name_of_index ),
transform_build<str_vec>( rep_list_indices.second, residue_name_of_index )
);
}
示例11: dense_add_structure_to_store
void dense_add_structure_to_store(T &arg_store, ///< TODOCUMENT
const index_type &arg_structure_index, ///< TODOCUMENT
const protein &arg_protein, ///< TODOCUMENT
const scan_policy<KPs...> &arg_scan_policy, ///< TODOCUMENT
const scan_role &arg_scan_role ///< TODOCUMENT
) {
const auto &the_criteria = arg_scan_policy.get_criteria();
const auto &the_keyer = arg_scan_policy.get_keyer();
// BOOST_LOG_TRIVIAL( warning ) << "Keyer is : " << the_keyer;
const auto roled_stride = roled_scan_stride{ arg_scan_role, arg_scan_policy.get_scan_stride() };
const auto num_residues = debug_unwarned_numeric_cast<index_type>( arg_protein.get_length() );
const auto from_rep_strider = get_this_from_strider( roled_stride );
const auto to_rep_strider = get_this_to_strider ( roled_stride );
for (const auto &from_rep_index : get_rep_indices_range( from_rep_strider, num_residues ) ) {
// BOOST_LOG_TRIVIAL( warning ) << "\tFrom rep " << from_rep_index;
for (const auto &to_rep_index : get_rep_indices_range( to_rep_strider, num_residues ) ) {
// BOOST_LOG_TRIVIAL( warning ) << "\t\tTo rep " << to_rep_index;
if ( from_rep_index != to_rep_index ) {
const auto the_res_pair = make_multi_struc_res_rep_pair(
arg_protein.get_residue_ref_of_index( get_index_of_rep_index( from_rep_strider, from_rep_index ) ),
arg_protein.get_residue_ref_of_index( get_index_of_rep_index( to_rep_strider, to_rep_index ) ),
arg_structure_index,
from_rep_index,
to_rep_index
);
// BOOST_LOG_TRIVIAL( warning ) << "\t\tMade multi_struc_res_rep_pair : " << the_res_pair;
// const auto the_key = the_keyer.make_key ( the_res_pair );
// BOOST_LOG_TRIVIAL( warning ) << "\t\tThe actual key itself is : " << output_key(the_key );
const auto close_keys = the_keyer.make_close_keys( the_res_pair, the_criteria );
// BOOST_LOG_TRIVIAL( warning ) << "\t\t\t(from_phi : "
// << the_res_pair.get_res_pair_core().get_from_phi_angle()
// << ") There are "
// << boost::distance( common::cross( close_keys ) )
// << " keys close to "
// << output_key( the_keyer.make_key( the_res_pair ) );
// BOOST_LOG_TRIVIAL( warning ) << "\t\tRange 0 : \"" << boost::algorithm::join ( std::get<0>( close_keys ) | boost::adaptors::transformed( [](const uint8_t &x) { return std::to_string( static_cast<size_t>( x) ); } ) , "\", \"") << "\"";
// BOOST_LOG_TRIVIAL( warning ) << "\t\tRange 1 : \"" << boost::algorithm::join ( std::get<1>( close_keys ) | boost::adaptors::transformed( [](const uint8_t &x) { return std::to_string( static_cast<size_t>( x) ); } ) , "\", \"") << "\"";
// BOOST_LOG_TRIVIAL( warning ) << "\t\tRange 2 : \"" << boost::algorithm::join ( std::get<2>( close_keys ) | boost::adaptors::transformed( [](const uint8_t &x) { return std::to_string( static_cast<size_t>( x) ); } ) , "\", \"") << "\"";
// BOOST_LOG_TRIVIAL( warning ) << "\t\tRange 3 : \"" << boost::algorithm::join ( std::get<3>( close_keys ) | boost::adaptors::transformed( [](const uint8_t &x) { return std::to_string( static_cast<size_t>( x) ); } ) , "\", \"") << "\"";
// BOOST_LOG_TRIVIAL( warning ) << "\t\tRange 4 : \"" << boost::algorithm::join ( std::get<4>( close_keys ) | common::lexical_casted<std::string>() , "\", \"") << "\"";
// BOOST_LOG_TRIVIAL( warning ) << "\t\tRange 5 : \"" << boost::algorithm::join ( std::get<5>( close_keys ) | common::lexical_casted<std::string>() , "\", \"") << "\"";
// BOOST_LOG_TRIVIAL( warning ) << "\t\tRange 6 : \"" << boost::algorithm::join ( std::get<6>( close_keys ) | common::lexical_casted<std::string>() , "\", \"") << "\"";
// BOOST_LOG_TRIVIAL( warning ) << "\t\tRange 7 : \"" << boost::algorithm::join ( std::get<7>( close_keys ) | common::lexical_casted<std::string>() , "\", \"") << "\"";
// KEYER_PARTS: tuple<
// res_pair_phi_psi_angle_keyer_part<res_pair_from_phi_keyer_part_spec>,
// res_pair_phi_psi_angle_keyer_part<res_pair_from_psi_keyer_part_spec>,
// res_pair_phi_psi_angle_keyer_part<res_pair_to_phi_keyer_part_spec>,
// res_pair_phi_psi_angle_keyer_part<res_pair_to_psi_keyer_part_spec>,
// res_pair_index_dirn_keyer_part,
// res_pair_view_axis_keyer_part<res_pair_view_x_keyer_part_spec>,
// res_pair_view_axis_keyer_part<res_pair_view_y_keyer_part_spec>,
// res_pair_view_axis_keyer_part<res_pair_view_z_keyer_part_spec>
// >
// KEY: tuple<unsigned char, unsigned char, unsigned char, unsigned char, res_pair_dirn, short, short, short>
// CLOSE_KEYS: tuple<
// joined_range<const integer_range<unsigned char>, const integer_range<unsigned char> >,
// joined_range<const integer_range<unsigned char>, const integer_range<unsigned char> >,
// joined_range<const integer_range<unsigned char>, const integer_range<unsigned char> >,
// joined_range<const integer_range<unsigned char>, const integer_range<unsigned char> >,
// array<res_pair_dirn, 1u>,
// integer_range<short int>,
// integer_range<short int>,
// integer_range<short int>
// >;
// ELEMENT_OF_CLOSE_KEYS: tuple<unsigned char, unsigned char, unsigned char, unsigned char, const res_pair_dirn &, short, short, short>
// const bool contains_key = common::contains( common::cross( close_keys ), the_keyer.make_key( the_res_pair ) );
// if ( contains_key ) {
// BOOST_LOG_TRIVIAL( warning ) << "\t\t\tDoes contain the central key";
// }
// else {
// BOOST_LOG_TRIVIAL( warning ) << "\t\t\t***** Doesn't contain the central key";
// }
// size_t counter = 0;
for (const auto &x : common::cross( close_keys ) ) {
// if ( ! contains_key ) {
// BOOST_LOG_TRIVIAL( warning ) << "\t\t\t\t[" << counter << "] : Adding entry for close key " << output_key( x );
// }
arg_store.push_back_entry_to_cell( x, the_res_pair );
// ++counter;
}
}
}
}
arg_store.summarize();
}