Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libcifpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
libcifpp
Commits
9c4170d9
Unverified
Commit
9c4170d9
authored
May 03, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Added more const members
- change PDB writing interface
parent
4a82a8d5
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
93 additions
and
67 deletions
+93
-67
CMakeLists.txt
+1
-1
changelog
+4
-0
include/cif++/Cif++.hpp
+13
-0
include/cif++/Cif2PDB.hpp
+6
-6
src/Cif++.cpp
+21
-0
src/Cif2PDB.cpp
+47
-59
src/Structure.cpp
+1
-1
No files found.
CMakeLists.txt
View file @
9c4170d9
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
cmake_minimum_required
(
VERSION 3.16
)
cmake_minimum_required
(
VERSION 3.16
)
# set the project name
# set the project name
project
(
cifpp VERSION 4.0.
0
LANGUAGES CXX
)
project
(
cifpp VERSION 4.0.
1
LANGUAGES CXX
)
list
(
PREPEND CMAKE_MODULE_PATH
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake"
)
list
(
PREPEND CMAKE_MODULE_PATH
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake"
)
...
...
changelog
View file @
9c4170d9
Version
4.0.1
-
Added
a
bunch
of
const
methods
to
Datablock
and
Category
.
-
Changed
PDB
writing
interface
to
accept
Datablock
instead
of
File
.
Version
4.0.0
Version
4.0.0
-
getResidue
in
mmcif
::
Structure
now
requires
both
a
-
getResidue
in
mmcif
::
Structure
now
requires
both
a
sequence
ID
and
an
auth
sequence
ID
.
As
a
result
the
code
was
cleaned
sequence
ID
and
an
auth
sequence
ID
.
As
a
result
the
code
was
cleaned
...
...
include/cif++/Cif++.hpp
View file @
9c4170d9
...
@@ -254,8 +254,15 @@ class Datablock
...
@@ -254,8 +254,15 @@ class Datablock
const_iterator
begin
()
const
{
return
mCategories
.
begin
();
}
const_iterator
begin
()
const
{
return
mCategories
.
begin
();
}
const_iterator
end
()
const
{
return
mCategories
.
end
();
}
const_iterator
end
()
const
{
return
mCategories
.
end
();
}
/// \brief Access to the category with name \a name, will create it if it doesn't exist.
Category
&
operator
[](
std
::
string_view
name
);
Category
&
operator
[](
std
::
string_view
name
);
// /// \brief Access to the category with name \a name, will throw if it doesn't exist.
// const Category &operator[](std::string_view name) const;
/// \brief Access to the category with name \a name, will return an empty category if is doesn't exist.
const
Category
&
operator
[](
std
::
string_view
name
)
const
;
std
::
tuple
<
iterator
,
bool
>
emplace
(
std
::
string_view
name
);
std
::
tuple
<
iterator
,
bool
>
emplace
(
std
::
string_view
name
);
bool
isValid
();
bool
isValid
();
...
@@ -285,6 +292,9 @@ class Datablock
...
@@ -285,6 +292,9 @@ class Datablock
std
::
string
mName
;
std
::
string
mName
;
const
Validator
*
mValidator
;
const
Validator
*
mValidator
;
Datablock
*
mNext
;
Datablock
*
mNext
;
// for returning empty categories in the const operator[]
mutable
std
::
unique_ptr
<
Category
>
mNullCategory
;
};
};
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -1863,6 +1873,9 @@ class Category
...
@@ -1863,6 +1873,9 @@ class Category
Row
front
()
{
return
Row
(
mHead
);
}
Row
front
()
{
return
Row
(
mHead
);
}
Row
back
()
{
return
Row
(
mTail
);
}
Row
back
()
{
return
Row
(
mTail
);
}
const
Row
front
()
const
{
return
Row
(
mHead
);
}
const
Row
back
()
const
{
return
Row
(
mTail
);
}
Row
operator
[](
Condition
&&
cond
);
Row
operator
[](
Condition
&&
cond
);
const
Row
operator
[](
Condition
&&
cond
)
const
;
const
Row
operator
[](
Condition
&&
cond
)
const
;
...
...
include/cif++/Cif2PDB.hpp
View file @
9c4170d9
...
@@ -28,12 +28,12 @@
...
@@ -28,12 +28,12 @@
#include "cif++/Cif++.hpp"
#include "cif++/Cif++.hpp"
void
WritePDBFile
(
std
::
ostream
&
pdbFile
,
cif
::
File
&
cifFile
);
void
WritePDBFile
(
std
::
ostream
&
os
,
const
cif
::
Datablock
&
data
);
/// \brief Just the HEADER, COMPND, SOURCE and AUTHOR lines
/// \brief Just the HEADER, COMPND, SOURCE and AUTHOR lines
void
WritePDBHeaderLines
(
std
::
ostream
&
os
,
cif
::
File
&
cifFile
);
void
WritePDBHeaderLines
(
std
::
ostream
&
os
,
const
cif
::
Datablock
&
data
);
std
::
string
GetPDBHEADERLine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBHEADERLine
(
c
onst
cif
::
Datablock
&
data
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBCOMPNDLine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBCOMPNDLine
(
c
onst
cif
::
Datablock
&
data
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBSOURCELine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBSOURCELine
(
c
onst
cif
::
Datablock
&
data
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBAUTHORLine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBAUTHORLine
(
c
onst
cif
::
Datablock
&
data
,
std
::
string
::
size_type
truncate_at
=
127
);
src/Cif++.cpp
View file @
9c4170d9
...
@@ -409,6 +409,22 @@ Category &Datablock::operator[](std::string_view name)
...
@@ -409,6 +409,22 @@ Category &Datablock::operator[](std::string_view name)
return
*
i
;
return
*
i
;
}
}
const
Category
&
Datablock
::
operator
[](
std
::
string_view
name
)
const
{
using
namespace
std
::
literals
;
auto
result
=
get
(
name
);
if
(
result
==
nullptr
)
// throw std::out_of_range("The category with name " + std::string(name) + " does not exist");
{
std
::
unique_lock
lock
(
mLock
);
if
(
not
mNullCategory
)
mNullCategory
.
reset
(
new
Category
(
const_cast
<
Datablock
&>
(
*
this
),
"<null>"
,
nullptr
));
result
=
mNullCategory
.
get
();
}
return
*
result
;
}
Category
*
Datablock
::
get
(
std
::
string_view
name
)
Category
*
Datablock
::
get
(
std
::
string_view
name
)
{
{
std
::
shared_lock
lock
(
mLock
);
std
::
shared_lock
lock
(
mLock
);
...
@@ -1525,6 +1541,11 @@ void Category::drop(const std::string &field)
...
@@ -1525,6 +1541,11 @@ void Category::drop(const std::string &field)
}
}
}
}
const
Row
Category
::
operator
[](
Condition
&&
cond
)
const
{
return
const_cast
<
Category
*>
(
this
)
->
operator
[](
std
::
forward
<
Condition
>
(
cond
));
}
Row
Category
::
operator
[](
Condition
&&
cond
)
Row
Category
::
operator
[](
Condition
&&
cond
)
{
{
Row
result
;
Row
result
;
...
...
src/Cif2PDB.cpp
View file @
9c4170d9
...
@@ -146,7 +146,7 @@ std::string cif2pdbSymmetry(std::string s)
...
@@ -146,7 +146,7 @@ std::string cif2pdbSymmetry(std::string s)
return
s
;
return
s
;
}
}
std
::
string
cif2pdbAtomName
(
std
::
string
name
,
std
::
string
resName
,
Datablock
&
db
)
std
::
string
cif2pdbAtomName
(
std
::
string
name
,
std
::
string
resName
,
const
Datablock
&
db
)
{
{
if
(
name
.
length
()
<
4
)
if
(
name
.
length
()
<
4
)
{
{
...
@@ -166,7 +166,7 @@ std::string cif2pdbAtomName(std::string name, std::string resName, Datablock& db
...
@@ -166,7 +166,7 @@ std::string cif2pdbAtomName(std::string name, std::string resName, Datablock& db
enum
SoftwareType
{
eRefinement
,
eDataScaling
,
eDataExtraction
,
eDataReduction
,
ePhasing
};
enum
SoftwareType
{
eRefinement
,
eDataScaling
,
eDataExtraction
,
eDataReduction
,
ePhasing
};
std
::
string
cifSoftware
(
Datablock
&
db
,
SoftwareType
sw
)
std
::
string
cifSoftware
(
const
Datablock
&
db
,
SoftwareType
sw
)
{
{
std
::
string
result
=
"NULL"
;
std
::
string
result
=
"NULL"
;
...
@@ -210,7 +210,7 @@ std::string cifSoftware(Datablock& db, SoftwareType sw)
...
@@ -210,7 +210,7 @@ std::string cifSoftware(Datablock& db, SoftwareType sw)
}
}
// Map asym ID's back to PDB Chain ID's
// Map asym ID's back to PDB Chain ID's
std
::
vector
<
std
::
string
>
MapAsymIDs2ChainIDs
(
const
std
::
vector
<
std
::
string
>&
asymIDs
,
Datablock
&
db
)
std
::
vector
<
std
::
string
>
MapAsymIDs2ChainIDs
(
const
std
::
vector
<
std
::
string
>&
asymIDs
,
const
Datablock
&
db
)
{
{
std
::
set
<
std
::
string
>
result
;
std
::
set
<
std
::
string
>
result
;
...
@@ -275,7 +275,7 @@ size_t WriteOneContinuedLine(std::ostream& pdbFile, std::string header, int cLen
...
@@ -275,7 +275,7 @@ size_t WriteOneContinuedLine(std::ostream& pdbFile, std::string header, int cLen
return
WriteContinuedLine
(
pdbFile
,
header
,
count
,
cLen
,
line
,
lStart
);
return
WriteContinuedLine
(
pdbFile
,
header
,
count
,
cLen
,
line
,
lStart
);
}
}
size_t
WriteCitation
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
,
Row
r
,
int
reference
)
size_t
WriteCitation
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
,
Row
r
,
int
reference
)
{
{
size_t
result
=
0
;
size_t
result
=
0
;
...
@@ -361,7 +361,7 @@ size_t WriteCitation(std::ostream& pdbFile, Datablock& db, Row r, int reference)
...
@@ -361,7 +361,7 @@ size_t WriteCitation(std::ostream& pdbFile, Datablock& db, Row r, int reference)
return
result
;
return
result
;
}
}
void
WriteHeaderLines
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteHeaderLines
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
// 0 1 2 3 4 5 6 7 8
// 0 1 2 3 4 5 6 7 8
// HEADER xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxDDDDDDDDD IIII
// HEADER xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxDDDDDDDDD IIII
...
@@ -592,7 +592,7 @@ void WriteHeaderLines(std::ostream& pdbFile, Datablock& db)
...
@@ -592,7 +592,7 @@ void WriteHeaderLines(std::ostream& pdbFile, Datablock& db)
WriteOneContinuedLine
(
pdbFile
,
"AUTHOR "
,
2
,
ba
::
join
(
authors
,
","
));
WriteOneContinuedLine
(
pdbFile
,
"AUTHOR "
,
2
,
ba
::
join
(
authors
,
","
));
}
}
void
WriteTitle
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteTitle
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
WriteHeaderLines
(
pdbFile
,
db
);
WriteHeaderLines
(
pdbFile
,
db
);
...
@@ -644,7 +644,7 @@ void WriteTitle(std::ostream& pdbFile, Datablock& db)
...
@@ -644,7 +644,7 @@ void WriteTitle(std::ostream& pdbFile, Datablock& db)
}
}
}
}
void
WriteRemark1
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark1
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
int
reference
=
0
;
int
reference
=
0
;
...
@@ -662,7 +662,7 @@ void WriteRemark1(std::ostream& pdbFile, Datablock& db)
...
@@ -662,7 +662,7 @@ void WriteRemark1(std::ostream& pdbFile, Datablock& db)
}
}
}
}
void
WriteRemark2
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark2
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
auto
&
refine
=
db
[
"refine"
];
auto
&
refine
=
db
[
"refine"
];
if
(
refine
.
empty
())
if
(
refine
.
empty
())
...
@@ -698,7 +698,7 @@ class FBase
...
@@ -698,7 +698,7 @@ class FBase
protected
:
protected
:
FBase
(
Row
r
,
const
char
*
f
)
FBase
(
Row
r
,
const
char
*
f
)
:
mRow
(
r
),
mField
(
f
)
{}
:
mRow
(
r
),
mField
(
f
)
{}
FBase
(
Category
&
cat
,
cif
::
Condition
&&
cond
,
const
char
*
f
)
FBase
(
const
Category
&
cat
,
cif
::
Condition
&&
cond
,
const
char
*
f
)
:
mField
(
f
)
:
mField
(
f
)
{
{
auto
r
=
cat
.
find
(
std
::
move
(
cond
));
auto
r
=
cat
.
find
(
std
::
move
(
cond
));
...
@@ -714,7 +714,7 @@ class Fi : public FBase
...
@@ -714,7 +714,7 @@ class Fi : public FBase
{
{
public
:
public
:
Fi
(
Row
r
,
const
char
*
f
)
:
FBase
(
r
,
f
)
{}
Fi
(
Row
r
,
const
char
*
f
)
:
FBase
(
r
,
f
)
{}
Fi
(
Category
&
cat
,
cif
::
Condition
&&
cond
,
const
char
*
f
)
:
FBase
(
cat
,
std
::
move
(
cond
),
f
)
{}
Fi
(
const
Category
&
cat
,
cif
::
Condition
&&
cond
,
const
char
*
f
)
:
FBase
(
cat
,
std
::
move
(
cond
),
f
)
{}
virtual
void
out
(
std
::
ostream
&
os
)
virtual
void
out
(
std
::
ostream
&
os
)
{
{
...
@@ -734,7 +734,7 @@ class Ff : public FBase
...
@@ -734,7 +734,7 @@ class Ff : public FBase
{
{
public
:
public
:
Ff
(
Row
r
,
const
char
*
f
)
:
FBase
(
r
,
f
)
{}
Ff
(
Row
r
,
const
char
*
f
)
:
FBase
(
r
,
f
)
{}
Ff
(
Category
&
cat
,
cif
::
Condition
&&
cond
,
const
char
*
f
)
:
FBase
(
cat
,
std
::
move
(
cond
),
f
)
{}
Ff
(
const
Category
&
cat
,
cif
::
Condition
&&
cond
,
const
char
*
f
)
:
FBase
(
cat
,
std
::
move
(
cond
),
f
)
{}
virtual
void
out
(
std
::
ostream
&
os
)
virtual
void
out
(
std
::
ostream
&
os
)
{
{
...
@@ -765,7 +765,7 @@ class Fs : public FBase
...
@@ -765,7 +765,7 @@ class Fs : public FBase
{
{
public
:
public
:
Fs
(
Row
r
,
const
char
*
f
,
int
remarkNr
=
3
)
:
FBase
(
r
,
f
),
mNr
(
remarkNr
)
{}
Fs
(
Row
r
,
const
char
*
f
,
int
remarkNr
=
3
)
:
FBase
(
r
,
f
),
mNr
(
remarkNr
)
{}
Fs
(
Category
&
cat
,
cif
::
Condition
&&
cond
,
const
char
*
f
,
int
remarkNr
=
3
)
:
FBase
(
cat
,
std
::
move
(
cond
),
f
),
mNr
(
remarkNr
)
{}
Fs
(
const
Category
&
cat
,
cif
::
Condition
&&
cond
,
const
char
*
f
,
int
remarkNr
=
3
)
:
FBase
(
cat
,
std
::
move
(
cond
),
f
),
mNr
(
remarkNr
)
{}
virtual
void
out
(
std
::
ostream
&
os
)
virtual
void
out
(
std
::
ostream
&
os
)
{
{
...
@@ -831,7 +831,7 @@ std::ostream& operator<<(std::ostream& os, SEP&& sep)
...
@@ -831,7 +831,7 @@ std::ostream& operator<<(std::ostream& os, SEP&& sep)
// --------------------------------------------------------------------
// --------------------------------------------------------------------
void
WriteRemark3BusterTNT
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark3BusterTNT
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
auto
refine
=
db
[
"refine"
].
front
();
auto
refine
=
db
[
"refine"
].
front
();
auto
ls_shell
=
db
[
"refine_ls_shell"
].
front
();
auto
ls_shell
=
db
[
"refine_ls_shell"
].
front
();
...
@@ -1009,7 +1009,7 @@ void WriteRemark3BusterTNT(std::ostream& pdbFile, Datablock& db)
...
@@ -1009,7 +1009,7 @@ void WriteRemark3BusterTNT(std::ostream& pdbFile, Datablock& db)
// --------------------------------------------------------------------
// --------------------------------------------------------------------
void
WriteRemark3CNS
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark3CNS
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
auto
refine
=
db
[
"refine"
].
front
();
auto
refine
=
db
[
"refine"
].
front
();
auto
ls_shell
=
db
[
"refine_ls_shell"
].
front
();
auto
ls_shell
=
db
[
"refine_ls_shell"
].
front
();
...
@@ -1149,7 +1149,7 @@ void WriteRemark3CNS(std::ostream& pdbFile, Datablock& db)
...
@@ -1149,7 +1149,7 @@ void WriteRemark3CNS(std::ostream& pdbFile, Datablock& db)
// --------------------------------------------------------------------
// --------------------------------------------------------------------
void
WriteRemark3Refmac
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark3Refmac
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
auto
refine
=
db
[
"refine"
].
front
();
auto
refine
=
db
[
"refine"
].
front
();
auto
ls_shell
=
db
[
"refine_ls_shell"
].
front
();
auto
ls_shell
=
db
[
"refine_ls_shell"
].
front
();
...
@@ -1476,7 +1476,7 @@ void WriteRemark3Refmac(std::ostream& pdbFile, Datablock& db)
...
@@ -1476,7 +1476,7 @@ void WriteRemark3Refmac(std::ostream& pdbFile, Datablock& db)
<<
RM3
(
""
)
<<
std
::
endl
;
<<
RM3
(
""
)
<<
std
::
endl
;
}
}
void
WriteRemark3Shelxl
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark3Shelxl
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
auto
refine
=
db
[
"refine"
].
front
();
auto
refine
=
db
[
"refine"
].
front
();
// auto ls_shell = db["refine_ls_shell"].front();
// auto ls_shell = db["refine_ls_shell"].front();
...
@@ -1555,7 +1555,7 @@ void WriteRemark3Shelxl(std::ostream& pdbFile, Datablock& db)
...
@@ -1555,7 +1555,7 @@ void WriteRemark3Shelxl(std::ostream& pdbFile, Datablock& db)
<<
RM3
(
""
)
<<
std
::
endl
;
<<
RM3
(
""
)
<<
std
::
endl
;
}
}
void
WriteRemark3Phenix
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark3Phenix
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
auto
refine
=
db
[
"refine"
].
front
();
auto
refine
=
db
[
"refine"
].
front
();
// auto ls_shell = db["refine_ls_shell"].front();
// auto ls_shell = db["refine_ls_shell"].front();
...
@@ -1782,7 +1782,7 @@ void WriteRemark3Phenix(std::ostream& pdbFile, Datablock& db)
...
@@ -1782,7 +1782,7 @@ void WriteRemark3Phenix(std::ostream& pdbFile, Datablock& db)
pdbFile
<<
RM3
(
""
)
<<
std
::
endl
;
pdbFile
<<
RM3
(
""
)
<<
std
::
endl
;
}
}
void
WriteRemark3XPlor
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark3XPlor
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
auto
refine
=
db
[
"refine"
].
front
();
auto
refine
=
db
[
"refine"
].
front
();
auto
ls_shell
=
db
[
"refine_ls_shell"
].
front
();
auto
ls_shell
=
db
[
"refine_ls_shell"
].
front
();
...
@@ -1897,7 +1897,7 @@ void WriteRemark3XPlor(std::ostream& pdbFile, Datablock& db)
...
@@ -1897,7 +1897,7 @@ void WriteRemark3XPlor(std::ostream& pdbFile, Datablock& db)
<<
RM3
(
""
)
<<
std
::
endl
;
<<
RM3
(
""
)
<<
std
::
endl
;
}
}
void
WriteRemark3NuclSQ
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark3NuclSQ
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
auto
refine
=
db
[
"refine"
].
front
();
auto
refine
=
db
[
"refine"
].
front
();
auto
pdbx_refine
=
db
[
"pdbx_refine"
].
front
();
auto
pdbx_refine
=
db
[
"pdbx_refine"
].
front
();
...
@@ -2001,7 +2001,7 @@ void WriteRemark3NuclSQ(std::ostream& pdbFile, Datablock& db)
...
@@ -2001,7 +2001,7 @@ void WriteRemark3NuclSQ(std::ostream& pdbFile, Datablock& db)
<<
RM3
(
""
)
<<
std
::
endl
;
<<
RM3
(
""
)
<<
std
::
endl
;
}
}
void
WriteRemark3ProlSQ
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark3ProlSQ
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
auto
refine
=
db
[
"refine"
].
front
();
auto
refine
=
db
[
"refine"
].
front
();
auto
pdbx_refine
=
db
[
"pdbx_refine"
].
front
();
auto
pdbx_refine
=
db
[
"pdbx_refine"
].
front
();
...
@@ -2120,7 +2120,7 @@ void WriteRemark3ProlSQ(std::ostream& pdbFile, Datablock& db)
...
@@ -2120,7 +2120,7 @@ void WriteRemark3ProlSQ(std::ostream& pdbFile, Datablock& db)
<<
RM3
(
""
)
<<
std
::
endl
;
<<
RM3
(
""
)
<<
std
::
endl
;
}
}
void
WriteRemark3
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark3
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
std
::
string
program
,
authors
;
std
::
string
program
,
authors
;
...
@@ -2200,7 +2200,7 @@ void WriteRemark3(std::ostream& pdbFile, Datablock& db)
...
@@ -2200,7 +2200,7 @@ void WriteRemark3(std::ostream& pdbFile, Datablock& db)
}
}
}
}
void
WriteRemark200
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark200
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
typedef
RM
<
200
>
RM
;
typedef
RM
<
200
>
RM
;
...
@@ -2335,7 +2335,7 @@ void WriteRemark200(std::ostream& pdbFile, Datablock& db)
...
@@ -2335,7 +2335,7 @@ void WriteRemark200(std::ostream& pdbFile, Datablock& db)
}
}
}
}
void
WriteRemark280
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark280
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
typedef
RM
<
280
>
RM
;
typedef
RM
<
280
>
RM
;
...
@@ -2397,7 +2397,7 @@ void WriteRemark280(std::ostream& pdbFile, Datablock& db)
...
@@ -2397,7 +2397,7 @@ void WriteRemark280(std::ostream& pdbFile, Datablock& db)
}
}
}
}
void
WriteRemark350
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark350
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
auto
&
c1
=
db
[
"pdbx_struct_assembly"
];
auto
&
c1
=
db
[
"pdbx_struct_assembly"
];
if
(
c1
.
empty
())
if
(
c1
.
empty
())
...
@@ -2517,7 +2517,7 @@ void WriteRemark350(std::ostream& pdbFile, Datablock& db)
...
@@ -2517,7 +2517,7 @@ void WriteRemark350(std::ostream& pdbFile, Datablock& db)
}
}
}
}
void
WriteRemark400
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark400
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
for
(
auto
&
r
:
db
[
"pdbx_entry_details"
])
for
(
auto
&
r
:
db
[
"pdbx_entry_details"
])
{
{
...
@@ -2527,7 +2527,7 @@ void WriteRemark400(std::ostream& pdbFile, Datablock& db)
...
@@ -2527,7 +2527,7 @@ void WriteRemark400(std::ostream& pdbFile, Datablock& db)
}
}
}
}
void
WriteRemark450
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark450
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
for
(
auto
&
r
:
db
[
"pdbx_entry_details"
])
for
(
auto
&
r
:
db
[
"pdbx_entry_details"
])
{
{
...
@@ -2538,7 +2538,7 @@ void WriteRemark450(std::ostream& pdbFile, Datablock& db)
...
@@ -2538,7 +2538,7 @@ void WriteRemark450(std::ostream& pdbFile, Datablock& db)
}
}
}
}
void
WriteRemark465
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark465
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
bool
first
=
true
;
bool
first
=
true
;
typedef
RM
<
465
>
RM
;
typedef
RM
<
465
>
RM
;
...
@@ -2587,7 +2587,7 @@ void WriteRemark465(std::ostream& pdbFile, Datablock& db)
...
@@ -2587,7 +2587,7 @@ void WriteRemark465(std::ostream& pdbFile, Datablock& db)
}
}
}
}
void
WriteRemark470
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark470
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
typedef
RM
<
470
>
RM
;
typedef
RM
<
470
>
RM
;
boost
::
format
fmt
(
"REMARK 470 %3.3s %3.3s %1.1s%4.4d%1.1s "
);
boost
::
format
fmt
(
"REMARK 470 %3.3s %3.3s %1.1s%4.4d%1.1s "
);
...
@@ -2646,12 +2646,12 @@ void WriteRemark470(std::ostream& pdbFile, Datablock& db)
...
@@ -2646,12 +2646,12 @@ void WriteRemark470(std::ostream& pdbFile, Datablock& db)
}
}
}
}
void
WriteRemark610
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark610
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
// #warning("unimplemented!");
// #warning("unimplemented!");
}
}
void
WriteRemark800
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark800
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
int
nr
=
0
;
int
nr
=
0
;
for
(
auto
r
:
db
[
"struct_site"
])
for
(
auto
r
:
db
[
"struct_site"
])
...
@@ -2676,7 +2676,7 @@ void WriteRemark800(std::ostream& pdbFile, Datablock& db)
...
@@ -2676,7 +2676,7 @@ void WriteRemark800(std::ostream& pdbFile, Datablock& db)
}
}
}
}
void
WriteRemark999
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark999
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
for
(
auto
&
r
:
db
[
"pdbx_entry_details"
])
for
(
auto
&
r
:
db
[
"pdbx_entry_details"
])
{
{
...
@@ -2687,7 +2687,7 @@ void WriteRemark999(std::ostream& pdbFile, Datablock& db)
...
@@ -2687,7 +2687,7 @@ void WriteRemark999(std::ostream& pdbFile, Datablock& db)
}
}
}
}
void
WriteRemarks
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemarks
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
WriteRemark1
(
pdbFile
,
db
);
WriteRemark1
(
pdbFile
,
db
);
WriteRemark2
(
pdbFile
,
db
);
WriteRemark2
(
pdbFile
,
db
);
...
@@ -2709,7 +2709,7 @@ void WriteRemarks(std::ostream& pdbFile, Datablock& db)
...
@@ -2709,7 +2709,7 @@ void WriteRemarks(std::ostream& pdbFile, Datablock& db)
WriteRemark999
(
pdbFile
,
db
);
WriteRemark999
(
pdbFile
,
db
);
}
}
int
WritePrimaryStructure
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
int
WritePrimaryStructure
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
int
numSeq
=
0
;
int
numSeq
=
0
;
...
@@ -2863,7 +2863,7 @@ int WritePrimaryStructure(std::ostream& pdbFile, Datablock& db)
...
@@ -2863,7 +2863,7 @@ int WritePrimaryStructure(std::ostream& pdbFile, Datablock& db)
return
numSeq
;
return
numSeq
;
}
}
int
WriteHeterogen
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
int
WriteHeterogen
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
int
numHet
=
0
;
int
numHet
=
0
;
...
@@ -3132,7 +3132,7 @@ int WriteHeterogen(std::ostream& pdbFile, Datablock& db)
...
@@ -3132,7 +3132,7 @@ int WriteHeterogen(std::ostream& pdbFile, Datablock& db)
return
numHet
;
return
numHet
;
}
}
std
::
tuple
<
int
,
int
>
WriteSecondaryStructure
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
std
::
tuple
<
int
,
int
>
WriteSecondaryStructure
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
int
numHelix
=
0
,
numSheet
=
0
;
int
numHelix
=
0
,
numSheet
=
0
;
...
@@ -3290,7 +3290,7 @@ std::tuple<int,int> WriteSecondaryStructure(std::ostream& pdbFile, Datablock& db
...
@@ -3290,7 +3290,7 @@ std::tuple<int,int> WriteSecondaryStructure(std::ostream& pdbFile, Datablock& db
return
std
::
make_tuple
(
numHelix
,
numSheet
);
return
std
::
make_tuple
(
numHelix
,
numSheet
);
}
}
void
WriteConnectivity
(
std
::
ostream
&
pdbFile
,
cif
::
Datablock
&
db
)
void
WriteConnectivity
(
std
::
ostream
&
pdbFile
,
c
onst
c
if
::
Datablock
&
db
)
{
{
// SSBOND
// SSBOND
// have to filter out alts
// have to filter out alts
...
@@ -3406,7 +3406,7 @@ void WriteConnectivity(std::ostream& pdbFile, cif::Datablock& db)
...
@@ -3406,7 +3406,7 @@ void WriteConnectivity(std::ostream& pdbFile, cif::Datablock& db)
}
}
}
}
int
WriteMiscellaneousFeatures
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
int
WriteMiscellaneousFeatures
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
int
numSite
=
0
;
int
numSite
=
0
;
...
@@ -3459,7 +3459,7 @@ int WriteMiscellaneousFeatures(std::ostream& pdbFile, Datablock& db)
...
@@ -3459,7 +3459,7 @@ int WriteMiscellaneousFeatures(std::ostream& pdbFile, Datablock& db)
return
numSite
;
return
numSite
;
}
}
void
WriteCrystallographic
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteCrystallographic
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
auto
r
=
db
[
"symmetry"
][
cif
::
Key
(
"entry_id"
)
==
db
.
getName
()];
auto
r
=
db
[
"symmetry"
][
cif
::
Key
(
"entry_id"
)
==
db
.
getName
()];
std
::
string
symmetry
=
r
[
"space_group_name_H-M"
].
as
<
std
::
string
>
();
std
::
string
symmetry
=
r
[
"space_group_name_H-M"
].
as
<
std
::
string
>
();
...
@@ -3479,7 +3479,7 @@ void WriteCrystallographic(std::ostream& pdbFile, Datablock& db)
...
@@ -3479,7 +3479,7 @@ void WriteCrystallographic(std::ostream& pdbFile, Datablock& db)
%
r
[
"Z_PDB"
].
as
<
double
>
())
<<
std
::
endl
;
%
r
[
"Z_PDB"
].
as
<
double
>
())
<<
std
::
endl
;
}
}
int
WriteCoordinateTransformation
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
int
WriteCoordinateTransformation
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
int
result
=
0
;
int
result
=
0
;
...
@@ -3520,7 +3520,7 @@ int WriteCoordinateTransformation(std::ostream& pdbFile, Datablock& db)
...
@@ -3520,7 +3520,7 @@ int WriteCoordinateTransformation(std::ostream& pdbFile, Datablock& db)
return
result
;
return
result
;
}
}
std
::
tuple
<
int
,
int
>
WriteCoordinatesForModel
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
,
std
::
tuple
<
int
,
int
>
WriteCoordinatesForModel
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
,
const
std
::
map
<
std
::
string
,
std
::
tuple
<
std
::
string
,
int
,
std
::
string
>>&
last_resseq_for_chain_map
,
const
std
::
map
<
std
::
string
,
std
::
tuple
<
std
::
string
,
int
,
std
::
string
>>&
last_resseq_for_chain_map
,
std
::
set
<
std
::
string
>&
TERminatedChains
,
int
model_nr
)
std
::
set
<
std
::
string
>&
TERminatedChains
,
int
model_nr
)
{
{
...
@@ -3658,7 +3658,7 @@ std::tuple<int,int> WriteCoordinatesForModel(std::ostream& pdbFile, Datablock& d
...
@@ -3658,7 +3658,7 @@ std::tuple<int,int> WriteCoordinatesForModel(std::ostream& pdbFile, Datablock& d
return
std
::
make_tuple
(
numCoord
,
numTer
);
return
std
::
make_tuple
(
numCoord
,
numTer
);
}
}
std
::
tuple
<
int
,
int
>
WriteCoordinate
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
std
::
tuple
<
int
,
int
>
WriteCoordinate
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
{
// residues known from seqres
// residues known from seqres
// map<tuple<std::string,int,std::string>,std::string> res2chain_map;
// map<tuple<std::string,int,std::string>,std::string> res2chain_map;
...
@@ -3718,7 +3718,7 @@ std::tuple<int,int> WriteCoordinate(std::ostream& pdbFile, Datablock& db)
...
@@ -3718,7 +3718,7 @@ std::tuple<int,int> WriteCoordinate(std::ostream& pdbFile, Datablock& db)
return
result
;
return
result
;
}
}
void
WritePDBFile
(
std
::
ostream
&
pdbFile
,
c
if
::
File
&
cifFile
)
void
WritePDBFile
(
std
::
ostream
&
pdbFile
,
c
onst
Datablock
&
db
)
{
{
io
::
filtering_ostream
out
;
io
::
filtering_ostream
out
;
out
.
push
(
FillOutLineFilter
());
out
.
push
(
FillOutLineFilter
());
...
@@ -3727,8 +3727,6 @@ void WritePDBFile(std::ostream& pdbFile, cif::File& cifFile)
...
@@ -3727,8 +3727,6 @@ void WritePDBFile(std::ostream& pdbFile, cif::File& cifFile)
auto
filter
=
out
.
component
<
FillOutLineFilter
>
(
0
);
auto
filter
=
out
.
component
<
FillOutLineFilter
>
(
0
);
assert
(
filter
);
assert
(
filter
);
auto
&
db
=
cifFile
.
firstDatablock
();
int
numRemark
=
0
,
numHet
=
0
,
numHelix
=
0
,
numSheet
=
0
,
numTurn
=
0
,
numSite
=
0
,
numXform
=
0
,
numCoord
=
0
,
numTer
=
0
,
numConect
=
0
,
numSeq
=
0
;
int
numRemark
=
0
,
numHet
=
0
,
numHelix
=
0
,
numSheet
=
0
,
numTurn
=
0
,
numSite
=
0
,
numXform
=
0
,
numCoord
=
0
,
numTer
=
0
,
numConect
=
0
,
numSeq
=
0
;
WriteTitle
(
out
,
db
);
WriteTitle
(
out
,
db
);
...
@@ -3753,7 +3751,7 @@ void WritePDBFile(std::ostream& pdbFile, cif::File& cifFile)
...
@@ -3753,7 +3751,7 @@ void WritePDBFile(std::ostream& pdbFile, cif::File& cifFile)
<<
"END"
<<
std
::
endl
;
<<
"END"
<<
std
::
endl
;
}
}
void
WritePDBHeaderLines
(
std
::
ostream
&
os
,
c
if
::
File
&
cifFile
)
void
WritePDBHeaderLines
(
std
::
ostream
&
os
,
c
onst
Datablock
&
db
)
{
{
// io::filtering_ostream out;
// io::filtering_ostream out;
// out.push(FillOutLineFilter());
// out.push(FillOutLineFilter());
...
@@ -3762,8 +3760,6 @@ void WritePDBHeaderLines(std::ostream& os, cif::File& cifFile)
...
@@ -3762,8 +3760,6 @@ void WritePDBHeaderLines(std::ostream& os, cif::File& cifFile)
// auto filter = out.component<FillOutLineFilter>(0);
// auto filter = out.component<FillOutLineFilter>(0);
// assert(filter);
// assert(filter);
auto
&
db
=
cifFile
.
firstDatablock
();
WriteHeaderLines
(
os
,
db
);
WriteHeaderLines
(
os
,
db
);
}
}
...
@@ -3779,10 +3775,8 @@ std::string FixStringLength(const std::string& s, std::string::size_type l)
...
@@ -3779,10 +3775,8 @@ std::string FixStringLength(const std::string& s, std::string::size_type l)
return
result
;
return
result
;
}
}
std
::
string
GetPDBHEADERLine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
)
std
::
string
GetPDBHEADERLine
(
c
onst
Datablock
&
db
,
std
::
string
::
size_type
truncate_at
)
{
{
auto
&
db
=
cifFile
.
firstDatablock
();
// 0 1 2 3 4 5 6 7 8
// 0 1 2 3 4 5 6 7 8
// HEADER xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxDDDDDDDDD IIII
// HEADER xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxDDDDDDDDD IIII
const
char
kHeader
[]
=
const
char
kHeader
[]
=
...
@@ -3825,10 +3819,8 @@ std::string GetPDBHEADERLine(cif::File& cifFile, std::string::size_type truncate
...
@@ -3825,10 +3819,8 @@ std::string GetPDBHEADERLine(cif::File& cifFile, std::string::size_type truncate
return
FixStringLength
((
boost
::
format
(
kHeader
)
%
keywords
%
date
%
db
.
getName
()).
str
(),
truncate_at
);
return
FixStringLength
((
boost
::
format
(
kHeader
)
%
keywords
%
date
%
db
.
getName
()).
str
(),
truncate_at
);
}
}
std
::
string
GetPDBCOMPNDLine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
)
std
::
string
GetPDBCOMPNDLine
(
c
onst
Datablock
&
db
,
std
::
string
::
size_type
truncate_at
)
{
{
auto
&
db
=
cifFile
.
firstDatablock
();
// COMPND
// COMPND
using
namespace
std
::
placeholders
;
using
namespace
std
::
placeholders
;
...
@@ -3886,10 +3878,8 @@ std::string GetPDBCOMPNDLine(cif::File& cifFile, std::string::size_type truncate
...
@@ -3886,10 +3878,8 @@ std::string GetPDBCOMPNDLine(cif::File& cifFile, std::string::size_type truncate
return
FixStringLength
(
"COMPND "
+
ba
::
join
(
cmpnd
,
"; "
),
truncate_at
);
return
FixStringLength
(
"COMPND "
+
ba
::
join
(
cmpnd
,
"; "
),
truncate_at
);
}
}
std
::
string
GetPDBSOURCELine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
)
std
::
string
GetPDBSOURCELine
(
c
onst
Datablock
&
db
,
std
::
string
::
size_type
truncate_at
)
{
{
auto
&
db
=
cifFile
.
firstDatablock
();
// SOURCE
// SOURCE
int
molID
=
0
;
int
molID
=
0
;
...
@@ -3971,10 +3961,8 @@ std::string GetPDBSOURCELine(cif::File& cifFile, std::string::size_type truncate
...
@@ -3971,10 +3961,8 @@ std::string GetPDBSOURCELine(cif::File& cifFile, std::string::size_type truncate
return
FixStringLength
(
"SOURCE "
+
ba
::
join
(
source
,
"; "
),
truncate_at
);
return
FixStringLength
(
"SOURCE "
+
ba
::
join
(
source
,
"; "
),
truncate_at
);
}
}
std
::
string
GetPDBAUTHORLine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
)
std
::
string
GetPDBAUTHORLine
(
c
onst
Datablock
&
db
,
std
::
string
::
size_type
truncate_at
)
{
{
auto
&
db
=
cifFile
.
firstDatablock
();
// AUTHOR
// AUTHOR
std
::
vector
<
std
::
string
>
author
;
std
::
vector
<
std
::
string
>
author
;
for
(
auto
r
:
db
[
"audit_author"
])
for
(
auto
r
:
db
[
"audit_author"
])
...
...
src/Structure.cpp
View file @
9c4170d9
...
@@ -1380,7 +1380,7 @@ void File::save(const std::filesystem::path &path)
...
@@ -1380,7 +1380,7 @@ void File::save(const std::filesystem::path &path)
out
.
push
(
outFile
);
out
.
push
(
outFile
);
if
(
file
.
extension
()
==
".pdb"
)
if
(
file
.
extension
()
==
".pdb"
)
WritePDBFile
(
out
,
*
this
);
WritePDBFile
(
out
,
data
()
);
else
else
cif
::
File
::
save
(
out
);
cif
::
File
::
save
(
out
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment