Skip to content
Snippets Groups Projects
Commit 20ed8793 authored by Gerardo Tauriello's avatar Gerardo Tauriello
Browse files

SCHWED-1740: handle loops of length 0 in SidechainReconstructor

parent c7719f48
No related branches found
No related tags found
No related merge requests found
......@@ -44,8 +44,12 @@ SidechainReconstructor::Reconstruct(uint start_resnum, uint num_residues,
std::vector<uint> indices = idx_handler_->ToIdxVector(start_resnum,
num_residues,
chain_idx);
std::vector<uint> loop_start_indices(1, 0);
std::vector<uint> loop_lengths(1, num_residues);
std::vector<uint> loop_start_indices;
std::vector<uint> loop_lengths;
if (num_residues > 0) {
loop_start_indices.push_back(0);
loop_lengths.push_back(num_residues);
}
return ReconstructFromIndices(indices, loop_start_indices, loop_lengths);
}
......@@ -399,6 +403,9 @@ void SidechainReconstructor::SolveSystem_(
// prepare solution
res->env_pos->all_pos = all_pos_->Extract(res_indices);
loop::AllAtomPositions& out_pos = *(res->env_pos->all_pos);
// nothing to be done if empty
if (res_indices.empty()) return;
// collect frame residues and cysteins (if needed)
std::vector<sidechain::FrameResiduePtr> frame_residues;
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -102,12 +102,32 @@ void CheckLoopRec(const SidechainReconstructorPtr sc_rec,
}
}
void CheckEmptyLoop(const SidechainReconstructionDataPtr sc_data,
uint num_residues) {
// must all be valid and empty
BOOST_CHECK_EQUAL(sc_data->env_pos->res_indices.size(), 0u);
BOOST_CHECK_EQUAL(sc_data->env_pos->all_pos->GetNumResidues(), 0u);
BOOST_CHECK_EQUAL(sc_data->loop_start_indices.size(), 0u);
BOOST_CHECK_EQUAL(sc_data->loop_lengths.size(), 0u);
BOOST_CHECK_EQUAL(sc_data->rotamer_res_indices.size(), 0u);
BOOST_CHECK_EQUAL(sc_data->disulfid_bridges.size(), 0u);
BOOST_CHECK_EQUAL(sc_data->is_n_ter.size(), 0u);
BOOST_CHECK_EQUAL(sc_data->is_c_ter.size(), 0u);
BOOST_CHECK_EQUAL(sc_data->rigid_frame_indices.size(), 0u);
BOOST_CHECK_EQUAL(sc_data->all_pos->GetNumResidues(), num_residues);
}
} // anon ns
BOOST_AUTO_TEST_CASE(test_sidechain_reconstructor_loops) {
// setup
ost::mol::EntityHandle test_ent = LoadTestStructure("data/1eye_sc_test.pdb");
// NOTE: missing sidechains from res.idx. 4 to 67 and at 126 (total: 270 res.)
// -> missing at least 1 sidechain for each AA (total: 270 res., 30 sc cut)
// -> sc cut: ['PRO1', 'VAL2', 'GLN3', 'MET5', 'LEU8', 'ASN9', 'THR11',
// 'ASP12', 'SER14', 'PHE15', 'CYS20', 'TYR21', 'LYS29', 'HIS30',
// 'ILE41', 'GLU47', 'SER48', 'SER49', 'ARG50', 'PRO51', 'THR54',
// 'ARG55', 'VAL56', 'ASP57', 'PRO58', 'VAL60', 'GLU61', 'THR62',
// 'ARG64', 'TRP123']
uint num_residues = test_ent.GetResidueCount();
SidechainReconstructorPtr sc_rec = GetScRec(test_ent);
......@@ -115,6 +135,16 @@ BOOST_AUTO_TEST_CASE(test_sidechain_reconstructor_loops) {
CheckLoopRec(sc_rec, 1, 4, num_residues);
CheckLoopRec(sc_rec, 100, 3, num_residues);
CheckLoopRec(sc_rec, num_residues-4, 5, num_residues);
// try empty loop
SidechainReconstructionDataPtr sc_data = sc_rec->Reconstruct(2, 0);
CheckEmptyLoop(sc_data, num_residues);
// same with "multi-loop" signature
std::vector<uint> start_resnums(1, 2);
std::vector<uint> loop_lengths(1, 0);
std::vector<uint> chain_indices(1, 0);
sc_data = sc_rec->Reconstruct(start_resnums, loop_lengths, chain_indices);
CheckEmptyLoop(sc_data, num_residues);
}
BOOST_AUTO_TEST_CASE(test_sidechain_reconstructor_loops_crn) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment