-
Notifications
You must be signed in to change notification settings - Fork 4
/
bprestr.cpp
50 lines (44 loc) · 1.63 KB
/
bprestr.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <sstream>
#include "tatom.h"
#include "bprestr.h"
//---------------------------------------------------------------------------------------------------
TBasePairRestrDescr::TBasePairRestrDescr(std::string _sLine): bIsUsed(false), sLine(_sLine)
{
for(unsigned int u = 0; u < _sLine.length(); ++u)
{
if(_sLine[u] == '/') _sLine[u] = ' ';
if(_sLine[u] == ',') _sLine[u] = '.';
}
std::istringstream issIn(_sLine);
std::string sLabel, sChainCode1, sChainCode2;
if(issIn >> sLabel >> sChainCode1 >> iResNumber1 >> sChainCode2 >> iResNumber2)
{
if(sLabel == "BASEPAIR" &&
!sChainCode1.empty() && !sChainCode2.empty() && iResNumber1 > 0 && iResNumber2 > 0)
{
cChainCode1 = sChainCode1[0];
cChainCode2 = sChainCode2[0];
isOK = true;
}
else isOK = false;
}
else isOK = false;
}
//---------------------------------------------------------------------------------------------------
bool TBasePairRestrDescr::bAtomFits(const TAtom* pat) const
{
return pat != NULL && (
(pat->iGetResidueNumber() == iResNumber1 && pat->cGetChainCode() == cChainCode1) ||
(pat->iGetResidueNumber() == iResNumber2 && pat->cGetChainCode() == cChainCode2) );
}
//---------------------------------------------------------------------------------------------------
bool TBasePairRestrDescr::bIsOK() const
{
return isOK;
}
//---------------------------------------------------------------------------------------------------
const std::string& TBasePairRestrDescr::sGetLine() const
{
return sLine;
}
//---------------------------------------------------------------------------------------------------