summaryrefslogtreecommitdiff
path: root/mmdb2/mmdb_model.cpp
diff options
context:
space:
mode:
authorPicca Frédéric-Emmanuel <picca@debian.org>2016-08-16 09:21:51 +0200
committerPicca Frédéric-Emmanuel <picca@debian.org>2016-08-16 09:21:51 +0200
commit855a8bf20ea3712eed7b73183921bcd2510a3ec1 (patch)
treedcdf05af2d3dbfb997d105d5a549e3c19bfa4553 /mmdb2/mmdb_model.cpp
parentf3af8fbe7a5ae3222c781b26bad4c548b6166e65 (diff)
Imported Upstream version 2.0.5
Diffstat (limited to 'mmdb2/mmdb_model.cpp')
-rw-r--r--mmdb2/mmdb_model.cpp106
1 files changed, 72 insertions, 34 deletions
diff --git a/mmdb2/mmdb_model.cpp b/mmdb2/mmdb_model.cpp
index ca1d537..23e63ae 100644
--- a/mmdb2/mmdb_model.cpp
+++ b/mmdb2/mmdb_model.cpp
@@ -22,7 +22,7 @@
//
// =================================================================
//
-// 12.09.13 <-- Date of Last Modification.
+// 11.09.15 <-- Date of Last Modification.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// -----------------------------------------------------------------
//
@@ -46,7 +46,7 @@
// mmdb::CisPep ( CisPep data )
// mmdb::Model ( PDB model )
//
-// Copyright (C) E. Krissinel 2000-2013
+// Copyright (C) E. Krissinel 2000-2015
//
// =================================================================
//
@@ -2116,14 +2116,15 @@ namespace mmdb {
strcpy ( chainID2," " ); // chain ID of 2nd linked atom
seqNum2 = 0; // sequence number of 2nd linked atom
strcpy ( insCode2," " ); // insertion code of 2nd linked atom
- s1 = 1; // sym id of 1st atom
- i1 = 5;
- j1 = 5;
- k1 = 5;
- s2 = 1; // sym id of 2nd atom
- i2 = 5;
- j2 = 5;
- k2 = 5;
+ s1 = 1; // sym id of 1st atom
+ i1 = 5;
+ j1 = 5;
+ k1 = 5;
+ s2 = 1; // sym id of 2nd atom
+ i2 = 5;
+ j2 = 5;
+ k2 = 5;
+ dist = -1.0; // no distance
}
@@ -2157,6 +2158,9 @@ namespace mmdb {
PutInteger ( &(S[70]),j2,1 );
PutInteger ( &(S[71]),k2,1 );
+ if (dist>0.0)
+ PutRealF ( &(S[73]),dist,5,3 );
+
}
@@ -2184,6 +2188,8 @@ namespace mmdb {
Loop->AddLoopTag ( CIFTAG_CONN_PTNR1_SYMMETRY );
Loop->AddLoopTag ( CIFTAG_CONN_PTNR2_SYMMETRY );
+ Loop->AddLoopTag ( CIFTAG_CONN_DIST );
+
}
@@ -2219,6 +2225,8 @@ namespace mmdb {
sprintf ( S,"%i%i%i%i",s2,i2,j2,k2 );
Loop->AddString ( S );
+ Loop->AddReal ( dist );
+
}
ERROR_CODE Link::ConvertPDBASCII ( cpstr S ) {
@@ -2245,6 +2253,8 @@ namespace mmdb {
GetInteger ( j2,&(S[70]),1 );
GetInteger ( k2,&(S[71]),1 );
+ if (!GetReal(dist,&(S[73]),5)) dist = -1.0;
+
return Error_NoError;
}
@@ -2336,6 +2346,10 @@ namespace mmdb {
s2 = atoi(S);
}
+ rc = CIFGetReal ( dist,Loop,CIFTAG_CONN_DIST,n );
+ if (rc==Error_NoData) return Error_EmptyCIF;
+ if (rc!=Error_NoError) return rc;
+
n++;
return Error_NoError;
@@ -2368,10 +2382,12 @@ namespace mmdb {
j2 = PLink(Link)->j2;
k2 = PLink(Link)->k2;
+ dist = PLink(Link)->dist;
+
}
void Link::write ( io::RFile f ) {
- byte Version=1;
+ byte Version=2;
f.WriteByte ( &Version );
@@ -2399,6 +2415,8 @@ namespace mmdb {
f.WriteInt ( &j2 );
f.WriteInt ( &k2 );
+ f.WriteReal ( &dist );
+
}
void Link::read ( io::RFile f ) {
@@ -2430,6 +2448,9 @@ namespace mmdb {
f.ReadInt ( &j2 );
f.ReadInt ( &k2 );
+ if (Version>1)
+ f.ReadReal ( &dist );
+
}
MakeStreamFunctions(Link)
@@ -2553,7 +2574,7 @@ namespace mmdb {
void LinkR::MakeCIF ( mmcif::PData CIF, int N ) {
UNUSED_ARGUMENT(N);
mmcif::PLoop Loop;
- int RC;
+ int RC;
RC = CIF->AddLoop ( CIFCAT_STRUCT_LINKR,Loop );
if (RC!=mmcif::CIFRC_Ok) // the category was (re)created, provide tags
@@ -5048,6 +5069,7 @@ namespace mmdb {
ncontacts = 0;
manager->SeekContacts ( Ca,nres, Ca,nres, 2.0,10.0, 2,
contact,ncontacts,0 );
+ manager->RemoveBricks();
if (ncontacts<=0) {
delete[] Res;
delete[] Ca;
@@ -5268,12 +5290,16 @@ namespace mmdb {
void Model::write ( io::RFile f ) {
int i,k;
- byte Version=3;
-
- f.WriteByte ( &Version );
-
- ProModel::write ( f );
-
+ byte Version=4;
+ bool compactBinary = false;
+
+ PManager M = GetCoordHierarchy();
+ if (M)
+ compactBinary = M->isCompactBinary();
+
+ f.WriteByte ( &Version );
+ f.WriteBool ( &compactBinary );
+
f.WriteInt ( &serNum );
f.WriteInt ( &nChains );
@@ -5284,25 +5310,31 @@ namespace mmdb {
if (chain[i]) chain[i]->write ( f );
}
- hetCompounds.write ( f );
- helices .write ( f );
- sheets .write ( f );
- turns .write ( f );
- links .write ( f );
- linkRs .write ( f );
+ if (!compactBinary) {
+
+ ProModel::write ( f );
+
+ hetCompounds.write ( f );
+ helices .write ( f );
+ sheets .write ( f );
+ turns .write ( f );
+ links .write ( f );
+ linkRs .write ( f );
+
+ }
}
void Model::read ( io::RFile f ) {
int i,k;
byte Version;
+ bool compactBinary;
FreeMemory();
- f.ReadByte ( &Version );
-
- ProModel::read ( f );
-
+ f.ReadByte ( &Version );
+ f.ReadBool ( &compactBinary );
+
f.ReadInt ( &serNum );
f.ReadInt ( &nChains );
nChainsAlloc = nChains;
@@ -5318,12 +5350,18 @@ namespace mmdb {
}
}
- hetCompounds.read ( f );
- helices .read ( f );
- sheets .read ( f );
- turns .read ( f );
- if (Version>1) links .read ( f );
- if (Version>2) linkRs.read ( f );
+ if (!compactBinary) {
+
+ ProModel::read ( f );
+
+ hetCompounds.read ( f );
+ helices .read ( f );
+ sheets .read ( f );
+ turns .read ( f );
+ links .read ( f );
+ linkRs .read ( f );
+
+ }
}