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 @@
cmake_minimum_required
(
VERSION 3.16
)
# 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"
)
...
...
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
-
getResidue
in
mmcif
::
Structure
now
requires
both
a
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
const_iterator
begin
()
const
{
return
mCategories
.
begin
();
}
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
);
// /// \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
);
bool
isValid
();
...
...
@@ -285,6 +292,9 @@ class Datablock
std
::
string
mName
;
const
Validator
*
mValidator
;
Datablock
*
mNext
;
// for returning empty categories in the const operator[]
mutable
std
::
unique_ptr
<
Category
>
mNullCategory
;
};
// --------------------------------------------------------------------
...
...
@@ -1863,6 +1873,9 @@ class Category
Row
front
()
{
return
Row
(
mHead
);
}
Row
back
()
{
return
Row
(
mTail
);
}
const
Row
front
()
const
{
return
Row
(
mHead
);
}
const
Row
back
()
const
{
return
Row
(
mTail
);
}
Row
operator
[](
Condition
&&
cond
);
const
Row
operator
[](
Condition
&&
cond
)
const
;
...
...
include/cif++/Cif2PDB.hpp
View file @
9c4170d9
...
...
@@ -28,12 +28,12 @@
#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
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
GetPDBCOMPNDLine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBSOURCELine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBAUTHORLine
(
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
onst
cif
::
Datablock
&
data
,
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
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)
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
)
{
std
::
shared_lock
lock
(
mLock
);
...
...
@@ -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
result
;
...
...
src/Cif2PDB.cpp
View file @
9c4170d9
...
...
@@ -146,7 +146,7 @@ std::string cif2pdbSymmetry(std::string 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
)
{
...
...
@@ -166,7 +166,7 @@ std::string cif2pdbAtomName(std::string name, std::string resName, Datablock& db
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"
;
...
...
@@ -210,7 +210,7 @@ std::string cifSoftware(Datablock& db, SoftwareType sw)
}
// 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
;
...
...
@@ -275,7 +275,7 @@ size_t WriteOneContinuedLine(std::ostream& pdbFile, std::string header, int cLen
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
;
...
...
@@ -361,7 +361,7 @@ size_t WriteCitation(std::ostream& pdbFile, Datablock& db, Row r, int reference)
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
// HEADER xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxDDDDDDDDD IIII
...
...
@@ -592,7 +592,7 @@ void WriteHeaderLines(std::ostream& pdbFile, Datablock& db)
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
);
...
...
@@ -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
;
...
...
@@ -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"
];
if
(
refine
.
empty
())
...
...
@@ -698,7 +698,7 @@ class FBase
protected
:
FBase
(
Row
r
,
const
char
*
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
)
{
auto
r
=
cat
.
find
(
std
::
move
(
cond
));
...
...
@@ -714,7 +714,7 @@ class Fi : public FBase
{
public
:
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
)
{
...
...
@@ -734,7 +734,7 @@ class Ff : public FBase
{
public
:
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
)
{
...
...
@@ -765,7 +765,7 @@ class Fs : public FBase
{
public
:
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
)
{
...
...
@@ -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
ls_shell
=
db
[
"refine_ls_shell"
].
front
();
...
...
@@ -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
ls_shell
=
db
[
"refine_ls_shell"
].
front
();
...
...
@@ -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
ls_shell
=
db
[
"refine_ls_shell"
].
front
();
...
...
@@ -1476,7 +1476,7 @@ void WriteRemark3Refmac(std::ostream& pdbFile, Datablock& db)
<<
RM3
(
""
)
<<
std
::
endl
;
}
void
WriteRemark3Shelxl
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark3Shelxl
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
auto
refine
=
db
[
"refine"
].
front
();
// auto ls_shell = db["refine_ls_shell"].front();
...
...
@@ -1555,7 +1555,7 @@ void WriteRemark3Shelxl(std::ostream& pdbFile, Datablock& db)
<<
RM3
(
""
)
<<
std
::
endl
;
}
void
WriteRemark3Phenix
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark3Phenix
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
auto
refine
=
db
[
"refine"
].
front
();
// auto ls_shell = db["refine_ls_shell"].front();
...
...
@@ -1782,7 +1782,7 @@ void WriteRemark3Phenix(std::ostream& pdbFile, Datablock& db)
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
ls_shell
=
db
[
"refine_ls_shell"
].
front
();
...
...
@@ -1897,7 +1897,7 @@ void WriteRemark3XPlor(std::ostream& pdbFile, Datablock& db)
<<
RM3
(
""
)
<<
std
::
endl
;
}
void
WriteRemark3NuclSQ
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark3NuclSQ
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
auto
refine
=
db
[
"refine"
].
front
();
auto
pdbx_refine
=
db
[
"pdbx_refine"
].
front
();
...
...
@@ -2001,7 +2001,7 @@ void WriteRemark3NuclSQ(std::ostream& pdbFile, Datablock& db)
<<
RM3
(
""
)
<<
std
::
endl
;
}
void
WriteRemark3ProlSQ
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark3ProlSQ
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
auto
refine
=
db
[
"refine"
].
front
();
auto
pdbx_refine
=
db
[
"pdbx_refine"
].
front
();
...
...
@@ -2120,7 +2120,7 @@ void WriteRemark3ProlSQ(std::ostream& pdbFile, Datablock& db)
<<
RM3
(
""
)
<<
std
::
endl
;
}
void
WriteRemark3
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark3
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
std
::
string
program
,
authors
;
...
...
@@ -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
;
...
...
@@ -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
;
...
...
@@ -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"
];
if
(
c1
.
empty
())
...
...
@@ -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"
])
{
...
...
@@ -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"
])
{
...
...
@@ -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
;
typedef
RM
<
465
>
RM
;
...
...
@@ -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
;
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)
}
}
void
WriteRemark610
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark610
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
// #warning("unimplemented!");
}
void
WriteRemark800
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
void
WriteRemark800
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
int
nr
=
0
;
for
(
auto
r
:
db
[
"struct_site"
])
...
...
@@ -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"
])
{
...
...
@@ -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
);
WriteRemark2
(
pdbFile
,
db
);
...
...
@@ -2709,7 +2709,7 @@ void WriteRemarks(std::ostream& pdbFile, Datablock& db)
WriteRemark999
(
pdbFile
,
db
);
}
int
WritePrimaryStructure
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
int
WritePrimaryStructure
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
int
numSeq
=
0
;
...
...
@@ -2863,7 +2863,7 @@ int WritePrimaryStructure(std::ostream& pdbFile, Datablock& db)
return
numSeq
;
}
int
WriteHeterogen
(
std
::
ostream
&
pdbFile
,
Datablock
&
db
)
int
WriteHeterogen
(
std
::
ostream
&
pdbFile
,
const
Datablock
&
db
)
{
int
numHet
=
0
;
...
...
@@ -3132,7 +3132,7 @@ int WriteHeterogen(std::ostream& pdbFile, Datablock& db)
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
;
...
...
@@ -3290,7 +3290,7 @@ std::tuple<int,int> WriteSecondaryStructure(std::ostream& pdbFile, Datablock& db
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
// have to filter out alts
...
...
@@ -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
;
...
...
@@ -3459,7 +3459,7 @@ int WriteMiscellaneousFeatures(std::ostream& pdbFile, Datablock& db)
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
()];
std
::
string
symmetry
=
r
[
"space_group_name_H-M"
].
as
<
std
::
string
>
();
...
...
@@ -3479,7 +3479,7 @@ void WriteCrystallographic(std::ostream& pdbFile, Datablock& db)
%
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
;
...
...
@@ -3520,7 +3520,7 @@ int WriteCoordinateTransformation(std::ostream& pdbFile, Datablock& db)
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
,
std
::
set
<
std
::
string
>&
TERminatedChains
,
int
model_nr
)
{
...
...
@@ -3658,7 +3658,7 @@ std::tuple<int,int> WriteCoordinatesForModel(std::ostream& pdbFile, Datablock& d
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
// 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)
return
result
;
}
void
WritePDBFile
(
std
::
ostream
&
pdbFile
,
c
if
::
File
&
cifFile
)
void
WritePDBFile
(
std
::
ostream
&
pdbFile
,
c
onst
Datablock
&
db
)
{
io
::
filtering_ostream
out
;
out
.
push
(
FillOutLineFilter
());
...
...
@@ -3727,8 +3727,6 @@ void WritePDBFile(std::ostream& pdbFile, cif::File& cifFile)
auto
filter
=
out
.
component
<
FillOutLineFilter
>
(
0
);
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
;
WriteTitle
(
out
,
db
);
...
...
@@ -3753,7 +3751,7 @@ void WritePDBFile(std::ostream& pdbFile, cif::File& cifFile)
<<
"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;
// out.push(FillOutLineFilter());
...
...
@@ -3762,8 +3760,6 @@ void WritePDBHeaderLines(std::ostream& os, cif::File& cifFile)
// auto filter = out.component<FillOutLineFilter>(0);
// assert(filter);
auto
&
db
=
cifFile
.
firstDatablock
();
WriteHeaderLines
(
os
,
db
);
}
...
...
@@ -3779,10 +3775,8 @@ std::string FixStringLength(const std::string& s, std::string::size_type l)
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
// HEADER xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxDDDDDDDDD IIII
const
char
kHeader
[]
=
...
...
@@ -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
);
}
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
using
namespace
std
::
placeholders
;
...
...
@@ -3886,10 +3878,8 @@ std::string GetPDBCOMPNDLine(cif::File& cifFile, std::string::size_type truncate
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
int
molID
=
0
;
...
...
@@ -3971,10 +3961,8 @@ std::string GetPDBSOURCELine(cif::File& cifFile, std::string::size_type truncate
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
std
::
vector
<
std
::
string
>
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)
out
.
push
(
outFile
);
if
(
file
.
extension
()
==
".pdb"
)
WritePDBFile
(
out
,
*
this
);
WritePDBFile
(
out
,
data
()
);
else
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