From: Горелов Сергей Васильевич Date: Mon, 3 Oct 2022 10:37:16 +0000 (+0300) Subject: Пробую поменять тюрны X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=d2f254ef68c850c8f9c098021a67a28400ee32e2;p=alexxy%2Fgromacs-dssp.git Пробую поменять тюрны --- diff --git a/src/dssptools.cpp b/src/dssptools.cpp index d50c630..2e261ee 100644 --- a/src/dssptools.cpp +++ b/src/dssptools.cpp @@ -402,7 +402,7 @@ void secondaryStructures::analyzeTurnsAndHelicesPatterns(){ for (std::size_t k {1}; k < stride; ++k){ if( SecondaryStructuresStatusMap[j + k].getStatus(i) == HelixPositions::None ){ SecondaryStructuresStatusMap[j + k].setStatus(HelixPositions::Middle, i); - SecondaryStructuresStatusMap[j + k].setStatus(secondaryStructureTypes::Turn); +// SecondaryStructuresStatusMap[j + k].setStatus(secondaryStructureTypes::Turn); } } @@ -451,20 +451,20 @@ void secondaryStructures::analyzeTurnsAndHelicesPatterns(){ /* Не знаю зач они в дссп так сделали, этож полное говно */ -// for(std::size_t i {1}; i + 1 < SecondaryStructuresStatusMap.size(); ++i){ -// if (SecondaryStructuresStatusMap[i].getStatus() == secondaryStructureTypes::Loop || SecondaryStructuresStatusMap[i].getStatus(secondaryStructureTypes::Bend)){ -// bool isTurn = false; -// for(const turnsTypes &j : {turnsTypes::Turn_3, turnsTypes::Turn_4, turnsTypes::Turn_5}){ -// std::size_t stride {static_cast(j) + 3}; -// for(std::size_t k {1}; k < stride and !isTurn; ++k){ -// isTurn = (i >= k) && (SecondaryStructuresStatusMap[i - k].getStatus(j) == HelixPositions::Start || SecondaryStructuresStatusMap[i - k].getStatus(j) == HelixPositions::Start_AND_End) ; -// } -// } -// if (isTurn){ -// SecondaryStructuresStatusMap[i].setStatus(secondaryStructureTypes::Turn); -// } -// } -// } + for(std::size_t i {1}; i + 1 < SecondaryStructuresStatusMap.size(); ++i){ + if (static_cast(SecondaryStructuresStatusMap[i].getStatus()) <= static_cast(secondaryStructureTypes::Turn)){ + bool isTurn = false; + for(const turnsTypes &j : {turnsTypes::Turn_3, turnsTypes::Turn_4, turnsTypes::Turn_5}){ + std::size_t stride {static_cast(j) + 3}; + for(std::size_t k {1}; k < stride and !isTurn; ++k){ + isTurn = (i >= k) && (SecondaryStructuresStatusMap[i - k].getStatus(j) == HelixPositions::Start || SecondaryStructuresStatusMap[i - k].getStatus(j) == HelixPositions::Start_AND_End) ; + } + } + if (isTurn){ + SecondaryStructuresStatusMap[i].setStatus(secondaryStructureTypes::Turn); + } + } + } } @@ -771,27 +771,27 @@ float DsspTool::CalculateDihedralAngle(const int &A, const int &B, const int &C, y[i] = (z[j] * x[k]) - (z[k] * x[j]); } - std::cout << "v12 = " << v12[0] << ", " << v12[1] << ", " << v12[2] << std::endl; - std::cout << "v43 = " << v43[0] << ", " << v43[1] << ", " << v43[2] << std::endl; - std::cout << "z = " << z[0] << ", " << z[1] << ", " << z[2] << std::endl; - std::cout << "p = " << p[0] << ", " << p[1] << ", " << p[2] << std::endl; - std::cout << "x = " << x[0] << ", " << x[1] << ", " << x[2] << std::endl; - std::cout << "y = " << y[0] << ", " << y[1] << ", " << y[2] << std::endl; +// std::cout << "v12 = " << v12[0] << ", " << v12[1] << ", " << v12[2] << std::endl; +// std::cout << "v43 = " << v43[0] << ", " << v43[1] << ", " << v43[2] << std::endl; +// std::cout << "z = " << z[0] << ", " << z[1] << ", " << z[2] << std::endl; +// std::cout << "p = " << p[0] << ", " << p[1] << ", " << p[2] << std::endl; +// std::cout << "x = " << x[0] << ", " << x[1] << ", " << x[2] << std::endl; +// std::cout << "y = " << y[0] << ", " << y[1] << ", " << y[2] << std::endl; u = (x[XX] * x[XX]) + (x[YY] * x[YY]) + (x[ZZ] * x[ZZ]); v = (y[XX] * y[XX]) + (y[YY] * y[YY]) + (y[ZZ] * y[ZZ]); - std::cout << "u = " << u << std::endl; - std::cout << "v = " << v << std::endl; +// std::cout << "u = " << u << std::endl; +// std::cout << "v = " << v << std::endl; if (u > 0 and v > 0){ u = ((p[XX] * x[XX]) + (p[YY] * x[YY]) + (p[ZZ] * x[ZZ])) / std::sqrt(u); v = ((p[XX] * y[XX]) + (p[YY] * y[YY]) + (p[ZZ] * y[ZZ])) / std::sqrt(v); - std::cout << "new u = " << u << std::endl; - std::cout << "new v = " << v << std::endl; +// std::cout << "new u = " << u << std::endl; +// std::cout << "new v = " << v << std::endl; if (u != 0 or v != 0){ result = std::atan2(v, u) * gmx::c_rad2Deg; - std::cout << "result = " << result << std::endl; +// std::cout << "result = " << result << std::endl; } } return result; @@ -810,7 +810,7 @@ void DsspTool::calculateDihedrals(const t_trxframe &fr, const t_pbc *pbc){ // psi.resize(IndexMap.size(), 360); for (std::size_t i = 1; i + 1 < IndexMap.size(); ++i){ // TODO add index verifictaion (check if those atom indexes exist) - std::cout << "For resi " << i << " :" << std::endl; +// std::cout << "For resi " << i << " :" << std::endl; phi[i] = CalculateDihedralAngle(static_cast(IndexMap[i - 1].getIndex(backboneAtomTypes::AtomC)), static_cast(IndexMap[i].getIndex(backboneAtomTypes::AtomN)), static_cast(IndexMap[i].getIndex(backboneAtomTypes::AtomCA)), @@ -824,8 +824,8 @@ void DsspTool::calculateDihedrals(const t_trxframe &fr, const t_pbc *pbc){ fr, pbc); // std::cout << "For " << i << " phi = " << phi[i] << ", psi = " << psi[i] << std::endl; - std::cout << "phi[" << i << "] = " << phi[i] << std::endl; - std::cout << "psi[" << i << "] = " << psi[i] << std::endl; +// std::cout << "phi[" << i << "] = " << phi[i] << std::endl; +// std::cout << "psi[" << i << "] = " << psi[i] << std::endl; } for (std::size_t i = 1; i + 3 < IndexMap.size(); ++i){