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
54728d49
Commit
54728d49
authored
Jun 22, 2020
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replacing boost libraries with standard version, where possible
parent
2afddc23
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
175 additions
and
152 deletions
+175
-152
configure.ac
+1
-1
include/cif++/AtomType.h
+0
-1
include/cif++/Cif++.h
+3
-4
include/cif++/CifValidator.h
+0
-2
include/cif++/Compound.h
+1
-1
include/cif++/MapMaker.h
+11
-12
include/cif++/Point.h
+0
-1
include/cif++/Structure.h
+3
-4
src/Cif++.cpp
+35
-25
src/CifUtils.cpp
+12
-11
src/Compound.cpp
+18
-13
src/DistanceMap.cpp
+0
-2
src/MapMaker.cpp
+31
-21
src/PDB2Cif.cpp
+22
-23
src/Structure.cpp
+38
-27
src/Symmetry.cpp
+0
-2
src/TlsParser.cpp
+0
-2
No files found.
configure.ac
View file @
54728d49
...
@@ -64,7 +64,7 @@ LDFLAGS="$OLD_LDFLAGS"
...
@@ -64,7 +64,7 @@ LDFLAGS="$OLD_LDFLAGS"
LIBS="$OLD_LIBS"
LIBS="$OLD_LIBS"
AX_BOOST_IOSTREAMS
AX_BOOST_IOSTREAMS
AX_BOOST_FILESYSTEM
dnl
AX_BOOST_FILESYSTEM
AX_BOOST_THREAD
AX_BOOST_THREAD
AC_ARG_WITH([clipper],
AC_ARG_WITH([clipper],
...
...
include/cif++/AtomType.h
View file @
54728d49
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
#include "cif++/Config.h"
#include "cif++/Config.h"
#include <boost/filesystem/operations.hpp>
#include <boost/math/quaternion.hpp>
#include <boost/math/quaternion.hpp>
namespace
mmcif
namespace
mmcif
...
...
include/cif++/Cif++.h
View file @
54728d49
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
#include <boost/lexical_cast.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/any.hpp>
#include <boost/any.hpp>
#include <boost/filesystem/path.hpp>
#include "cif++/CifUtils.h"
#include "cif++/CifUtils.h"
...
@@ -1441,15 +1440,15 @@ class File
...
@@ -1441,15 +1440,15 @@ class File
File
();
File
();
File
(
std
::
istream
&
is
,
bool
validate
=
false
);
File
(
std
::
istream
&
is
,
bool
validate
=
false
);
File
(
boost
::
filesystem
::
path
p
,
bool
validate
=
false
);
File
(
const
std
::
string
&
path
,
bool
validate
=
false
);
File
(
File
&&
rhs
);
File
(
File
&&
rhs
);
File
(
const
File
&
rhs
)
=
delete
;
File
(
const
File
&
rhs
)
=
delete
;
File
&
operator
=
(
const
File
&
rhs
)
=
delete
;
File
&
operator
=
(
const
File
&
rhs
)
=
delete
;
~
File
();
~
File
();
void
load
(
boost
::
filesystem
::
path
p
);
void
load
(
const
std
::
string
&
p
);
void
save
(
boost
::
filesystem
::
path
p
);
void
save
(
const
std
::
string
&
p
);
void
load
(
std
::
istream
&
is
);
void
load
(
std
::
istream
&
is
);
void
save
(
std
::
ostream
&
os
);
void
save
(
std
::
ostream
&
os
);
...
...
include/cif++/CifValidator.h
View file @
54728d49
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
#include "cif++/Cif++.h"
#include "cif++/Cif++.h"
#include <boost/filesystem/path.hpp>
//// the std regex of gcc is crashing....
//// the std regex of gcc is crashing....
#include <boost/regex.hpp>
#include <boost/regex.hpp>
...
...
include/cif++/Compound.h
View file @
54728d49
...
@@ -108,7 +108,7 @@ class Compound
...
@@ -108,7 +108,7 @@ class Compound
{
{
public
:
public
:
Compound
(
const
boost
::
filesystem
::
path
&
file
,
const
std
::
string
&
id
,
const
std
::
string
&
name
,
Compound
(
const
std
::
string
&
file
,
const
std
::
string
&
id
,
const
std
::
string
&
name
,
const
std
::
string
&
group
);
const
std
::
string
&
group
);
// factory method, create a Compound based on the three letter code
// factory method, create a Compound based on the three letter code
...
...
include/cif++/MapMaker.h
View file @
54728d49
#pragma once
#pragma once
#include <clipper/clipper.h>
#include <clipper/clipper.h>
#include <boost/filesystem/path.hpp>
#include "cif++/Structure.h"
#include "cif++/Structure.h"
...
@@ -29,11 +28,11 @@ class Map
...
@@ -29,11 +28,11 @@ class Map
const
Xmap
&
get
()
const
{
return
mMap
;
}
const
Xmap
&
get
()
const
{
return
mMap
;
}
// These routines work with CCP4 map files
// These routines work with CCP4 map files
void
read
(
const
boost
::
filesystem
::
path
&
f
);
void
read
(
const
std
::
string
&
f
);
void
write
(
const
boost
::
filesystem
::
path
&
f
);
void
write
(
const
std
::
string
&
f
);
void
write_masked
(
std
::
ostream
&
os
,
clipper
::
Grid_range
range
);
void
write_masked
(
std
::
ostream
&
os
,
clipper
::
Grid_range
range
);
void
write_masked
(
const
boost
::
filesystem
::
path
&
f
,
void
write_masked
(
const
std
::
string
&
f
,
clipper
::
Grid_range
range
);
clipper
::
Grid_range
range
);
clipper
::
Spacegroup
spacegroup
()
const
{
return
mMap
.
spacegroup
();
}
clipper
::
Spacegroup
spacegroup
()
const
{
return
mMap
.
spacegroup
();
}
...
@@ -59,7 +58,7 @@ using clipper::Grid_sampling;
...
@@ -59,7 +58,7 @@ using clipper::Grid_sampling;
// --------------------------------------------------------------------
// --------------------------------------------------------------------
bool
IsMTZFile
(
const
boost
::
filesystem
::
path
&
p
);
bool
IsMTZFile
(
const
std
::
string
&
p
);
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -80,7 +79,7 @@ class MapMaker
...
@@ -80,7 +79,7 @@ class MapMaker
MapMaker
(
const
MapMaker
&
)
=
delete
;
MapMaker
(
const
MapMaker
&
)
=
delete
;
MapMaker
&
operator
=
(
const
MapMaker
&
)
=
delete
;
MapMaker
&
operator
=
(
const
MapMaker
&
)
=
delete
;
void
loadMTZ
(
const
boost
::
filesystem
::
path
&
mtzFile
,
void
loadMTZ
(
const
std
::
string
&
mtzFile
,
float
samplingRate
,
float
samplingRate
,
std
::
initializer_list
<
std
::
string
>
fbLabels
=
{
"FWT"
,
"PHWT"
},
std
::
initializer_list
<
std
::
string
>
fbLabels
=
{
"FWT"
,
"PHWT"
},
std
::
initializer_list
<
std
::
string
>
fdLabels
=
{
"DELFWT"
,
"PHDELWT"
},
std
::
initializer_list
<
std
::
string
>
fdLabels
=
{
"DELFWT"
,
"PHDELWT"
},
...
@@ -89,12 +88,12 @@ class MapMaker
...
@@ -89,12 +88,12 @@ class MapMaker
std
::
initializer_list
<
std
::
string
>
faLabels
=
{
"FAN"
,
"PHAN"
});
std
::
initializer_list
<
std
::
string
>
faLabels
=
{
"FAN"
,
"PHAN"
});
void
loadMaps
(
void
loadMaps
(
const
boost
::
filesystem
::
path
&
fbMapFile
,
const
std
::
string
&
fbMapFile
,
const
boost
::
filesystem
::
path
&
fdMapFile
,
const
std
::
string
&
fdMapFile
,
float
reshi
,
float
reslo
);
float
reshi
,
float
reslo
);
// following works on both mtz files and structure factor files in CIF format
// following works on both mtz files and structure factor files in CIF format
void
calculate
(
const
boost
::
filesystem
::
path
&
hklin
,
void
calculate
(
const
std
::
string
&
hklin
,
const
Structure
&
structure
,
const
Structure
&
structure
,
bool
noBulk
,
AnisoScalingFlag
anisoScaling
,
bool
noBulk
,
AnisoScalingFlag
anisoScaling
,
float
samplingRate
,
bool
electronScattering
=
false
,
float
samplingRate
,
bool
electronScattering
=
false
,
...
@@ -107,7 +106,7 @@ class MapMaker
...
@@ -107,7 +106,7 @@ class MapMaker
void
printStats
();
void
printStats
();
void
writeMTZ
(
const
boost
::
filesystem
::
path
&
file
,
void
writeMTZ
(
const
std
::
string
&
file
,
const
std
::
string
&
project
,
const
std
::
string
&
crystal
);
const
std
::
string
&
project
,
const
std
::
string
&
crystal
);
MapType
&
fb
()
{
return
mFb
;
}
MapType
&
fb
()
{
return
mFb
;
}
...
@@ -127,8 +126,8 @@ class MapMaker
...
@@ -127,8 +126,8 @@ class MapMaker
private
:
private
:
void
loadFoFreeFromReflectionsFile
(
const
boost
::
filesystem
::
path
&
hklin
);
void
loadFoFreeFromReflectionsFile
(
const
std
::
string
&
hklin
);
void
loadFoFreeFromMTZFile
(
const
boost
::
filesystem
::
path
&
hklin
,
void
loadFoFreeFromMTZFile
(
const
std
::
string
&
hklin
,
std
::
initializer_list
<
std
::
string
>
foLabels
,
std
::
initializer_list
<
std
::
string
>
foLabels
,
std
::
initializer_list
<
std
::
string
>
freeLabels
);
std
::
initializer_list
<
std
::
string
>
freeLabels
);
...
...
include/cif++/Point.h
View file @
54728d49
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
#include "cif++/Config.h"
#include "cif++/Config.h"
#include <boost/filesystem/operations.hpp>
#include <boost/math/quaternion.hpp>
#include <boost/math/quaternion.hpp>
#include "clipper/core/coords.h"
#include "clipper/core/coords.h"
...
...
include/cif++/Structure.h
View file @
54728d49
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
#include <numeric>
#include <numeric>
#include <boost/filesystem/operations.hpp>
#include <boost/math/quaternion.hpp>
#include <boost/math/quaternion.hpp>
#include <boost/any.hpp>
#include <boost/any.hpp>
...
@@ -330,14 +329,14 @@ class File : public std::enable_shared_from_this<File>
...
@@ -330,14 +329,14 @@ class File : public std::enable_shared_from_this<File>
{
{
public
:
public
:
File
();
File
();
File
(
boost
::
filesystem
::
path
p
);
File
(
const
std
::
string
&
path
);
~
File
();
~
File
();
File
(
const
File
&
)
=
delete
;
File
(
const
File
&
)
=
delete
;
File
&
operator
=
(
const
File
&
)
=
delete
;
File
&
operator
=
(
const
File
&
)
=
delete
;
void
load
(
boost
::
filesystem
::
path
p
);
void
load
(
const
std
::
string
&
path
);
void
save
(
boost
::
filesystem
::
path
p
);
void
save
(
const
std
::
string
&
path
);
Structure
*
model
(
size_t
nr
=
1
);
Structure
*
model
(
size_t
nr
=
1
);
...
...
src/Cif++.cpp
View file @
54728d49
...
@@ -8,10 +8,17 @@
...
@@ -8,10 +8,17 @@
#include <set>
#include <set>
#include <unordered_map>
#include <unordered_map>
#include <numeric>
#include <numeric>
#include <fstream>
#if __has_include(<filesystem>)
#include <filesystem>
namespace
fs
=
std
::
filesystem
;
#elif __has_include(<boost/filesystem.hpp>)
#include <boost/filesystem.hpp>
namespace
fs
=
boost
::
filesystem
;
#endif
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/bzip2.hpp>
#include <boost/iostreams/filter/bzip2.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filter/gzip.hpp>
...
@@ -26,7 +33,6 @@
...
@@ -26,7 +33,6 @@
using
namespace
std
;
using
namespace
std
;
namespace
ba
=
boost
::
algorithm
;
namespace
ba
=
boost
::
algorithm
;
namespace
fs
=
boost
::
filesystem
;
namespace
io
=
boost
::
iostreams
;
namespace
io
=
boost
::
iostreams
;
namespace
cif
namespace
cif
...
@@ -2789,16 +2795,16 @@ File::File(istream& is, bool validate)
...
@@ -2789,16 +2795,16 @@ File::File(istream& is, bool validate)
load
(
is
);
load
(
is
);
}
}
File
::
File
(
boost
::
filesystem
::
path
p
,
bool
validate
)
File
::
File
(
const
std
::
string
&
path
,
bool
validate
)
:
File
()
:
File
()
{
{
try
try
{
{
load
(
p
);
load
(
p
ath
);
}
}
catch
(
const
exception
&
ex
)
catch
(
const
exception
&
ex
)
{
{
cerr
<<
"Error while loading file "
<<
p
<<
endl
;
cerr
<<
"Error while loading file "
<<
p
ath
<<
endl
;
throw
;
throw
;
}
}
}
}
...
@@ -2841,24 +2847,26 @@ void File::append(Datablock* e)
...
@@ -2841,24 +2847,26 @@ void File::append(Datablock* e)
}
}
}
}
void
File
::
load
(
fs
::
path
p
)
void
File
::
load
(
const
std
::
string
&
p
)
{
{
fs
::
ifstream
inFile
(
p
,
ios_base
::
in
|
ios_base
::
binary
);
fs
::
path
path
(
p
);
std
::
ifstream
inFile
(
p
,
ios_base
::
in
|
ios_base
::
binary
);
if
(
not
inFile
.
is_open
())
if
(
not
inFile
.
is_open
())
throw
runtime_error
(
"Could not open file: "
+
p
.
string
());
throw
runtime_error
(
"Could not open file: "
+
p
ath
.
string
());
io
::
filtering_stream
<
io
::
input
>
in
;
io
::
filtering_stream
<
io
::
input
>
in
;
string
ext
;
st
d
::
st
ring
ext
;
if
(
p
.
extension
()
==
".bz2"
)
if
(
p
ath
.
extension
()
==
".bz2"
)
{
{
in
.
push
(
io
::
bzip2_decompressor
());
in
.
push
(
io
::
bzip2_decompressor
());
ext
=
p
.
stem
().
extension
().
string
();
ext
=
p
ath
.
stem
().
extension
().
string
();
}
}
else
if
(
p
.
extension
()
==
".gz"
)
else
if
(
p
ath
.
extension
()
==
".gz"
)
{
{
in
.
push
(
io
::
gzip_decompressor
());
in
.
push
(
io
::
gzip_decompressor
());
ext
=
p
.
stem
().
extension
().
string
();
ext
=
p
ath
.
stem
().
extension
().
string
();
}
}
in
.
push
(
inFile
);
in
.
push
(
inFile
);
...
@@ -2869,25 +2877,27 @@ void File::load(fs::path p)
...
@@ -2869,25 +2877,27 @@ void File::load(fs::path p)
}
}
catch
(
const
exception
&
ex
)
catch
(
const
exception
&
ex
)
{
{
cerr
<<
"Error loading file "
<<
p
<<
endl
;
cerr
<<
"Error loading file "
<<
p
ath
<<
endl
;
throw
;
throw
;
}
}
}
}
void
File
::
save
(
fs
::
path
p
)
void
File
::
save
(
const
std
::
string
&
p
)
{
{
fs
::
ofstream
outFile
(
p
,
ios_base
::
out
|
ios_base
::
binary
);
fs
::
path
path
(
p
);
std
::
ofstream
outFile
(
p
,
ios_base
::
out
|
ios_base
::
binary
);
io
::
filtering_stream
<
io
::
output
>
out
;
io
::
filtering_stream
<
io
::
output
>
out
;
if
(
p
.
extension
()
==
".gz"
)
if
(
p
ath
.
extension
()
==
".gz"
)
{
{
out
.
push
(
io
::
gzip_compressor
());
out
.
push
(
io
::
gzip_compressor
());
p
=
p
.
stem
();
p
ath
=
path
.
stem
();
}
}
else
if
(
p
.
extension
()
==
".bz2"
)
else
if
(
p
ath
.
extension
()
==
".bz2"
)
{
{
out
.
push
(
io
::
bzip2_compressor
());
out
.
push
(
io
::
bzip2_compressor
());
p
=
p
.
stem
();
p
ath
=
path
.
stem
();
}
}
out
.
push
(
outFile
);
out
.
push
(
outFile
);
...
@@ -2985,13 +2995,13 @@ void File::loadDictionary(const char* dict)
...
@@ -2985,13 +2995,13 @@ void File::loadDictionary(const char* dict)
{
{
for
(;;)
for
(;;)
{
{
string
name
(
dict
);
fs
::
path
name
(
dict
);
try
try
{
{
if
(
fs
::
exists
(
name
))
if
(
fs
::
exists
(
name
))
{
{
fs
::
ifstream
is
(
name
);
std
::
ifstream
is
(
name
);
loadDictionary
(
is
);
loadDictionary
(
is
);
break
;
break
;
}
}
...
@@ -3004,7 +3014,7 @@ void File::loadDictionary(const char* dict)
...
@@ -3004,7 +3014,7 @@ void File::loadDictionary(const char* dict)
{
{
if
(
fs
::
exists
(
dictFile
))
if
(
fs
::
exists
(
dictFile
))
{
{
fs
::
ifstream
is
(
dictFile
);
std
::
ifstream
is
(
dictFile
);
loadDictionary
(
is
);
loadDictionary
(
is
);
break
;
break
;
}
}
...
@@ -3029,7 +3039,7 @@ void File::loadDictionary(const char* dict)
...
@@ -3029,7 +3039,7 @@ void File::loadDictionary(const char* dict)
break
;
break
;
}
}
throw
runtime_error
(
"Dictionary not found or defined ("
+
name
+
")"
);
throw
runtime_error
(
"Dictionary not found or defined ("
+
name
.
string
()
+
")"
);
}
}
}
}
...
...
src/CifUtils.cpp
View file @
54728d49
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
#include <iostream>
#include <iostream>
#include <cstdio>
#include <cstdio>
#include <atomic>
#include <atomic>
#include <mutex>
#include <thread>
#if defined(_MSC_VER)
#if defined(_MSC_VER)
#define TERM_WIDTH 80
#define TERM_WIDTH 80
...
@@ -15,7 +17,6 @@
...
@@ -15,7 +17,6 @@
#endif
#endif
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/thread.hpp>
#if BOOST_VERSION >= 104800
#if BOOST_VERSION >= 104800
#include <boost/timer/timer.hpp>
#include <boost/timer/timer.hpp>
#endif
#endif
...
@@ -436,7 +437,7 @@ struct ProgressImpl
...
@@ -436,7 +437,7 @@ struct ProgressImpl
{
{
ProgressImpl
(
int64_t
inMax
,
const
string
&
inAction
)
ProgressImpl
(
int64_t
inMax
,
const
string
&
inAction
)
:
mMax
(
inMax
),
mConsumed
(
0
),
mAction
(
inAction
),
mMessage
(
inAction
)
:
mMax
(
inMax
),
mConsumed
(
0
),
mAction
(
inAction
),
mMessage
(
inAction
)
,
mThread
(
boost
::
bind
(
&
ProgressImpl
::
Run
,
this
))
{}
,
mThread
(
std
::
bind
(
&
ProgressImpl
::
Run
,
this
))
{}
void
Run
();
void
Run
();
...
@@ -448,8 +449,8 @@ struct ProgressImpl
...
@@ -448,8 +449,8 @@ struct ProgressImpl
int64_t
mLastConsumed
=
0
;
int64_t
mLastConsumed
=
0
;
int
mSpinnerIndex
=
0
;
int
mSpinnerIndex
=
0
;
string
mAction
,
mMessage
;
string
mAction
,
mMessage
;
boost
::
mutex
mMutex
;
std
::
mutex
mMutex
;
boost
::
thread
mThread
;
std
::
thread
mThread
;
boost
::
timer
::
cpu_timer
boost
::
timer
::
cpu_timer
mTimer
;
mTimer
;
};
};
...
@@ -460,11 +461,11 @@ void ProgressImpl::Run()
...
@@ -460,11 +461,11 @@ void ProgressImpl::Run()
try
try
{
{
boost
::
this_thread
::
sleep
(
boost
::
posix_time
::
seconds
(
5
));
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
5
));
for
(;;)
for
(;;)
{
{
boost
::
mutex
::
scoped
_lock
lock
(
mMutex
);
std
::
unique
_lock
lock
(
mMutex
);
if
(
mConsumed
==
mMax
)
if
(
mConsumed
==
mMax
)
break
;
break
;
...
@@ -472,7 +473,7 @@ void ProgressImpl::Run()
...
@@ -472,7 +473,7 @@ void ProgressImpl::Run()
PrintProgress
();
PrintProgress
();
printedAny
=
true
;
printedAny
=
true
;
boost
::
this_thread
::
sleep
(
boost
::
posix_time
::
milliseconds
(
5
00
));
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
1
00
));
}
}
}
}
catch
(...)
{}
catch
(...)
{}
...
@@ -591,7 +592,7 @@ Progress::~Progress()
...
@@ -591,7 +592,7 @@ Progress::~Progress()
{
{
if
(
mImpl
!=
nullptr
and
mImpl
->
mThread
.
joinable
())
if
(
mImpl
!=
nullptr
and
mImpl
->
mThread
.
joinable
())
{
{
mImpl
->
mThread
.
interrupt
();
//
mImpl->mThread.interrupt();
mImpl
->
mThread
.
join
();
mImpl
->
mThread
.
join
();
}
}
...
@@ -604,7 +605,7 @@ void Progress::consumed(int64_t inConsumed)
...
@@ -604,7 +605,7 @@ void Progress::consumed(int64_t inConsumed)
(
mImpl
->
mConsumed
+=
inConsumed
)
>=
mImpl
->
mMax
and
(
mImpl
->
mConsumed
+=
inConsumed
)
>=
mImpl
->
mMax
and
mImpl
->
mThread
.
joinable
())
mImpl
->
mThread
.
joinable
())
{
{
mImpl
->
mThread
.
interrupt
();
//
mImpl->mThread.interrupt();
mImpl
->
mThread
.
join
();
mImpl
->
mThread
.
join
();
}
}
}
}
...
@@ -615,7 +616,7 @@ void Progress::progress(int64_t inProgress)
...
@@ -615,7 +616,7 @@ void Progress::progress(int64_t inProgress)
(
mImpl
->
mConsumed
=
inProgress
)
>=
mImpl
->
mMax
and
(
mImpl
->
mConsumed
=
inProgress
)
>=
mImpl
->
mMax
and
mImpl
->
mThread
.
joinable
())
mImpl
->
mThread
.
joinable
())
{
{
mImpl
->
mThread
.
interrupt
();
//
mImpl->mThread.interrupt();
mImpl
->
mThread
.
join
();
mImpl
->
mThread
.
join
();
}
}
}
}
...
@@ -624,7 +625,7 @@ void Progress::message(const std::string& inMessage)
...
@@ -624,7 +625,7 @@ void Progress::message(const std::string& inMessage)
{
{
if
(
mImpl
!=
nullptr
)
if
(
mImpl
!=
nullptr
)
{
{
boost
::
mutex
::
scoped
_lock
lock
(
mImpl
->
mMutex
);
std
::
unique
_lock
lock
(
mImpl
->
mMutex
);
mImpl
->
mMessage
=
inMessage
;
mImpl
->
mMessage
=
inMessage
;
}
}
}
}
...
...
src/Compound.cpp
View file @
54728d49
...
@@ -4,11 +4,17 @@
...
@@ -4,11 +4,17 @@
#include <map>
#include <map>
#include <numeric>
#include <numeric>
#include <shared_mutex>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/fstream.hpp>
#if __has_include(<filesystem>)
#include <boost/thread.hpp>
#include <filesystem>
namespace
fs
=
std
::
filesystem
;
#elif __has_include(<boost/filesystem.hpp>)
#include <boost/filesystem.hpp>
namespace
fs
=
boost
::
filesystem
;
#endif
#include "cif++/Cif++.h"
#include "cif++/Cif++.h"
#include "cif++/Point.h"
#include "cif++/Point.h"
...
@@ -19,7 +25,6 @@
...
@@ -19,7 +25,6 @@
using
namespace
std
;
using
namespace
std
;
namespace
ba
=
boost
::
algorithm
;
namespace
ba
=
boost
::
algorithm
;
namespace
fs
=
boost
::
filesystem
;
namespace
mmcif
namespace
mmcif
{
{
...
@@ -310,7 +315,7 @@ bool StructuresAreIsomeric(vector<CompoundAtom> atomsA, const vector<CompoundBon
...
@@ -310,7 +315,7 @@ bool StructuresAreIsomeric(vector<CompoundAtom> atomsA, const vector<CompoundBon
// --------------------------------------------------------------------
// --------------------------------------------------------------------
// Compound
// Compound
Compound
::
Compound
(
const
fs
::
path
&
file
,
const
std
::
string
&
id
,
Compound
::
Compound
(
const
std
::
string
&
file
,
const
std
::
string
&
id
,
const
std
::
string
&
name
,
const
std
::
string
&
group
)
const
std
::
string
&
name
,
const
std
::
string
&
group
)
:
mId
(
id
),
mName
(
name
),
mGroup
(
group
)
:
mId
(
id
),
mName
(
name
),
mGroup
(
group
)
{
{
...
@@ -1018,7 +1023,7 @@ const map<string,char> kBaseMap{
...
@@ -1018,7 +1023,7 @@ const map<string,char> kBaseMap{
class
CompoundFactoryImpl
class
CompoundFactoryImpl
{
{
public
:
public
:
CompoundFactoryImpl
(
fs
::
path
file
,
CompoundFactoryImpl
*
next
);
CompoundFactoryImpl
(
const
std
::
string
&
file
,
CompoundFactoryImpl
*
next
);
~
CompoundFactoryImpl
()
~
CompoundFactoryImpl
()
{
{
...
@@ -1074,9 +1079,9 @@ class CompoundFactoryImpl
...
@@ -1074,9 +1079,9 @@ class CompoundFactoryImpl
}
}
private
:
private
:
boost
::
shared_mutex
mMutex
;
std
::
shared_timed_mutex
mMutex
;
fs
::
path
mPath
;
std
::
string
mPath
;
vector
<
Compound
*>
mCompounds
;
vector
<
Compound
*>
mCompounds
;
vector
<
const
Link
*>
mLinks
;
vector
<
const
Link
*>
mLinks
;
/*unordered_*/
set
<
string
>
mKnownPeptides
;
/*unordered_*/
set
<
string
>
mKnownPeptides
;
...
@@ -1089,7 +1094,7 @@ class CompoundFactoryImpl
...
@@ -1089,7 +1094,7 @@ class CompoundFactoryImpl
// --------------------------------------------------------------------
// --------------------------------------------------------------------
CompoundFactoryImpl
::
CompoundFactoryImpl
(
fs
::
path
file
,
CompoundFactoryImpl
*
next
)
CompoundFactoryImpl
::
CompoundFactoryImpl
(
const
std
::
string
&
file
,
CompoundFactoryImpl
*
next
)
:
mPath
(
file
),
mFile
(
file
),
mChemComp
(
mFile
.
firstDatablock
()[
"chem_comp"
]),
mNext
(
next
)
:
mPath
(
file
),
mFile
(
file
),
mChemComp
(
mFile
.
firstDatablock
()[
"chem_comp"
]),
mNext
(
next
)
{
{
const
std
::
regex
peptideRx
(
"(?:[lmp]-)?peptide"
,
std
::
regex
::
icase
);
const
std
::
regex
peptideRx
(
"(?:[lmp]-)?peptide"
,
std
::
regex
::
icase
);
...
@@ -1185,7 +1190,7 @@ CompoundFactoryImpl::CompoundFactoryImpl(fs::path file, CompoundFactoryImpl* nex
...
@@ -1185,7 +1190,7 @@ CompoundFactoryImpl::CompoundFactoryImpl(fs::path file, CompoundFactoryImpl* nex
Compound
*
CompoundFactoryImpl
::
get
(
string
id
)
Compound
*
CompoundFactoryImpl
::
get
(
string
id
)
{
{
boost
::
shared_lock
<
boost
::
shared_mutex
>
lock
(
mMutex
);
std
::
shared_lock
lock
(
mMutex
);
ba
::
to_upper
(
id
);
ba
::
to_upper
(
id
);
...
@@ -1213,7 +1218,7 @@ Compound* CompoundFactoryImpl::create(std::string id)
...
@@ -1213,7 +1218,7 @@ Compound* CompoundFactoryImpl::create(std::string id)
Compound
*
result
=
get
(
id
);
Compound
*
result
=
get
(
id
);
if
(
result
==
nullptr
and
mMissing
.
count
(
id
)
==
0
)
if
(
result
==
nullptr
and
mMissing
.
count
(
id
)
==
0
)
{
{
boost
::
upgrade_lock
<
boost
::
shared_mutex
>
lock
(
mMutex
);
std
::
unique_lock
lock
(
mMutex
);
auto
rs
=
mChemComp
.
find
(
cif
::
Key
(
"three_letter_code"
)
==
id
);
auto
rs
=
mChemComp
.
find
(
cif
::
Key
(
"three_letter_code"
)
==
id
);
...
@@ -1262,7 +1267,7 @@ Compound* CompoundFactoryImpl::create(std::string id)
...
@@ -1262,7 +1267,7 @@ Compound* CompoundFactoryImpl::create(std::string id)
const
Link
*
CompoundFactoryImpl
::
getLink
(
string
id
)
const
Link
*
CompoundFactoryImpl
::
getLink
(
string
id
)
{
{
boost
::
shared_lock
<
boost
::
shared_mutex
>
lock
(
mMutex
);
std
::
shared_lock
lock
(
mMutex
);
ba
::
to_upper
(
id
);
ba
::
to_upper
(
id
);
...
@@ -1291,7 +1296,7 @@ const Link* CompoundFactoryImpl::createLink(std::string id)
...
@@ -1291,7 +1296,7 @@ const Link* CompoundFactoryImpl::createLink(std::string id)
if
(
result
==
nullptr
)
if
(
result
==
nullptr
)
{
{
boost
::
upgrade_lock
<
boost
::
shared_mutex
>
lock
(
mMutex
);
std
::
unique_lock
lock
(
mMutex
);
auto
db
=
mFile
.
get
(
"link_"
+
id
);
auto
db
=
mFile
.
get
(
"link_"
+
id
);
if
(
db
!=
nullptr
)
if
(
db
!=
nullptr
)
...
...
src/DistanceMap.cpp
View file @
54728d49
...
@@ -5,8 +5,6 @@
...
@@ -5,8 +5,6 @@
#include <atomic>
#include <atomic>
#include <mutex>
#include <mutex>
#include <boost/thread.hpp>
#include "cif++/DistanceMap.h"
#include "cif++/DistanceMap.h"
#include "cif++/CifUtils.h"
#include "cif++/CifUtils.h"
...
...
src/MapMaker.cpp
View file @
54728d49
#include "cif++/Config.h"
#include "cif++/Config.h"
#include <iomanip>
#include <iomanip>
#include <fstream>
#if __has_include(<filesystem>)
#include <filesystem>
namespace
fs
=
std
::
filesystem
;
#elif __has_include(<boost/filesystem.hpp>)
#include <boost/filesystem.hpp>
namespace
fs
=
boost
::
filesystem
;
#endif
#include <boost/format.hpp>
#include <boost/format.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/bzip2.hpp>
#include <boost/iostreams/filter/bzip2.hpp>
...
@@ -18,7 +26,6 @@
...
@@ -18,7 +26,6 @@
#include "cif++/ResolutionCalculator.h"
#include "cif++/ResolutionCalculator.h"
using
namespace
std
;
using
namespace
std
;
namespace
fs
=
boost
::
filesystem
;
namespace
io
=
boost
::
iostreams
;
namespace
io
=
boost
::
iostreams
;
namespace
ba
=
boost
::
algorithm
;
namespace
ba
=
boost
::
algorithm
;
...
@@ -249,11 +256,11 @@ void writeCCP4MapFile(ostream& os, clipper::Xmap<FTYPE>& xmap, clipper::Grid_ran
...
@@ -249,11 +256,11 @@ void writeCCP4MapFile(ostream& os, clipper::Xmap<FTYPE>& xmap, clipper::Grid_ran
// --------------------------------------------------------------------
// --------------------------------------------------------------------
bool
IsMTZFile
(
const
fs
::
path
&
p
)
bool
IsMTZFile
(
const
std
::
string
&
p
)
{
{
bool
result
=
false
;
bool
result
=
false
;
fs
::
ifstream
f
(
p
);
std
::
ifstream
f
(
p
);
if
(
f
.
is_open
())
if
(
f
.
is_open
())
{
{
char
sig
[
5
]
=
{};
char
sig
[
5
]
=
{};
...
@@ -307,8 +314,9 @@ void Map<FTYPE>::calculateStats()
...
@@ -307,8 +314,9 @@ void Map<FTYPE>::calculateStats()
}
}
template
<
typename
FTYPE
>
template
<
typename
FTYPE
>
void
Map
<
FTYPE
>::
read
(
const
fs
::
path
&
mapFile
)
void
Map
<
FTYPE
>::
read
(
const
std
::
string
&
f
)
{
{
fs
::
path
mapFile
(
f
);
fs
::
path
dataFile
=
mapFile
;
fs
::
path
dataFile
=
mapFile
;
if
(
cif
::
VERBOSE
)
if
(
cif
::
VERBOSE
)
...
@@ -323,7 +331,7 @@ void Map<FTYPE>::read(const fs::path& mapFile)
...
@@ -323,7 +331,7 @@ void Map<FTYPE>::read(const fs::path& mapFile)
io
::
filtering_stream
<
io
::
input
>
in
;
io
::
filtering_stream
<
io
::
input
>
in
;
fs
::
ifstream
fi
(
mapFile
);
std
::
ifstream
fi
(
mapFile
);
if
(
mapFile
.
extension
()
==
".gz"
)
if
(
mapFile
.
extension
()
==
".gz"
)
in
.
push
(
io
::
gzip_decompressor
());
in
.
push
(
io
::
gzip_decompressor
());
...
@@ -337,7 +345,7 @@ void Map<FTYPE>::read(const fs::path& mapFile)
...
@@ -337,7 +345,7 @@ void Map<FTYPE>::read(const fs::path& mapFile)
throw
runtime_error
(
string
(
"Could not create temp file for map: "
)
+
strerror
(
errno
));
throw
runtime_error
(
string
(
"Could not create temp file for map: "
)
+
strerror
(
errno
));
dataFile
=
fs
::
path
(
tmpFileName
);
dataFile
=
fs
::
path
(
tmpFileName
);
fs
::
ofstream
out
(
dataFile
);
std
::
ofstream
out
(
dataFile
);
io
::
copy
(
in
,
out
);
io
::
copy
(
in
,
out
);
}
}
...
@@ -358,7 +366,7 @@ void Map<FTYPE>::read(const fs::path& mapFile)
...
@@ -358,7 +366,7 @@ void Map<FTYPE>::read(const fs::path& mapFile)
}
}
template
<
typename
FTYPE
>
template
<
typename
FTYPE
>
void
Map
<
FTYPE
>::
write
(
const
fs
::
path
&
f
)
void
Map
<
FTYPE
>::
write
(
const
std
::
string
&
f
)
{
{
write_masked
(
f
,
mMap
.
grid_asu
());
write_masked
(
f
,
mMap
.
grid_asu
());
}
}
...
@@ -370,11 +378,11 @@ void Map<FTYPE>::write_masked(ostream& os, clipper::Grid_range r)
...
@@ -370,11 +378,11 @@ void Map<FTYPE>::write_masked(ostream& os, clipper::Grid_range r)
}
}
template
<
typename
FTYPE
>
template
<
typename
FTYPE
>
void
Map
<
FTYPE
>::
write_masked
(
const
fs
::
path
&
f
,
clipper
::
Grid_range
r
)
void
Map
<
FTYPE
>::
write_masked
(
const
std
::
string
&
f
,
clipper
::
Grid_range
r
)
{
{
fs
::
ofstream
file
(
f
,
ios_base
::
binary
);
std
::
ofstream
file
(
f
,
ios_base
::
binary
);
if
(
not
file
.
is_open
())
if
(
not
file
.
is_open
())
throw
runtime_error
(
"Could not open map file for writing: "
+
f
.
string
()
);
throw
runtime_error
(
"Could not open map file for writing: "
+
f
);
write_masked
(
file
,
r
);
write_masked
(
file
,
r
);
}
}
...
@@ -395,11 +403,13 @@ MapMaker<FTYPE>::~MapMaker()
...
@@ -395,11 +403,13 @@ MapMaker<FTYPE>::~MapMaker()
}
}
template
<
typename
FTYPE
>
template
<
typename
FTYPE
>
void
MapMaker
<
FTYPE
>::
loadMTZ
(
const
fs
::
path
&
hklin
,
float
samplingRate
,
void
MapMaker
<
FTYPE
>::
loadMTZ
(
const
std
::
string
&
f
,
float
samplingRate
,
initializer_list
<
string
>
fbLabels
,
initializer_list
<
string
>
fdLabels
,
initializer_list
<
string
>
fbLabels
,
initializer_list
<
string
>
fdLabels
,
initializer_list
<
string
>
foLabels
,
initializer_list
<
string
>
fcLabels
,
initializer_list
<
string
>
foLabels
,
initializer_list
<
string
>
fcLabels
,
initializer_list
<
string
>
faLabels
)
initializer_list
<
string
>
faLabels
)
{
{
fs
::
path
hklin
(
f
);
if
(
cif
::
VERBOSE
)
if
(
cif
::
VERBOSE
)
cerr
<<
"Reading map from "
<<
hklin
<<
endl
cerr
<<
"Reading map from "
<<
hklin
<<
endl
<<
" with labels: FB: "
<<
ba
::
join
(
fbLabels
,
","
)
<<
endl
<<
" with labels: FB: "
<<
ba
::
join
(
fbLabels
,
","
)
<<
endl
...
@@ -419,7 +429,7 @@ void MapMaker<FTYPE>::loadMTZ(const fs::path& hklin, float samplingRate,
...
@@ -419,7 +429,7 @@ void MapMaker<FTYPE>::loadMTZ(const fs::path& hklin, float samplingRate,
io
::
filtering_stream
<
io
::
input
>
in
;
io
::
filtering_stream
<
io
::
input
>
in
;
fs
::
ifstream
fi
(
hklin
);
std
::
ifstream
fi
(
hklin
);
if
(
hklin
.
extension
()
==
".gz"
)
if
(
hklin
.
extension
()
==
".gz"
)
in
.
push
(
io
::
gzip_decompressor
());
in
.
push
(
io
::
gzip_decompressor
());
...
@@ -433,7 +443,7 @@ void MapMaker<FTYPE>::loadMTZ(const fs::path& hklin, float samplingRate,
...
@@ -433,7 +443,7 @@ void MapMaker<FTYPE>::loadMTZ(const fs::path& hklin, float samplingRate,
throw
runtime_error
(
string
(
"Could not create temp file for mtz: "
)
+
strerror
(
errno
));
throw
runtime_error
(
string
(
"Could not create temp file for mtz: "
)
+
strerror
(
errno
));
dataFile
=
fs
::
path
(
tmpFileName
);
dataFile
=
fs
::
path
(
tmpFileName
);
fs
::
ofstream
out
(
dataFile
);
std
::
ofstream
out
(
dataFile
);
io
::
copy
(
in
,
out
);
io
::
copy
(
in
,
out
);
}
}
...
@@ -542,7 +552,7 @@ void MapMaker<FTYPE>::loadMTZ(const fs::path& hklin, float samplingRate,
...
@@ -542,7 +552,7 @@ void MapMaker<FTYPE>::loadMTZ(const fs::path& hklin, float samplingRate,
template
<
typename
FTYPE
>
template
<
typename
FTYPE
>
void
MapMaker
<
FTYPE
>::
loadMaps
(
void
MapMaker
<
FTYPE
>::
loadMaps
(
const
fs
::
path
&
fbMapFile
,
const
fs
::
path
&
fdMapFile
,
float
reshi
,
float
reslo
)
const
std
::
string
&
fbMapFile
,
const
std
::
string
&
fdMapFile
,
float
reshi
,
float
reslo
)
{
{
mResHigh
=
reshi
;
mResHigh
=
reshi
;
mResLow
=
reslo
;
mResLow
=
reslo
;
...
@@ -568,7 +578,7 @@ ostream& operator<<(ostream& os, const clipper::HKL& hkl)
...
@@ -568,7 +578,7 @@ ostream& operator<<(ostream& os, const clipper::HKL& hkl)
// --------------------------------------------------------------------
// --------------------------------------------------------------------
template
<
typename
FTYPE
>
template
<
typename
FTYPE
>
void
MapMaker
<
FTYPE
>::
calculate
(
const
fs
::
path
&
hklin
,
void
MapMaker
<
FTYPE
>::
calculate
(
const
std
::
string
&
hklin
,
const
Structure
&
structure
,
bool
noBulk
,
AnisoScalingFlag
anisoScaling
,
const
Structure
&
structure
,
bool
noBulk
,
AnisoScalingFlag
anisoScaling
,
float
samplingRate
,
bool
electronScattering
,
float
samplingRate
,
bool
electronScattering
,
initializer_list
<
std
::
string
>
foLabels
,
initializer_list
<
std
::
string
>
freeLabels
)
initializer_list
<
std
::
string
>
foLabels
,
initializer_list
<
std
::
string
>
freeLabels
)
...
@@ -584,7 +594,7 @@ void MapMaker<FTYPE>::calculate(const fs::path& hklin,
...
@@ -584,7 +594,7 @@ void MapMaker<FTYPE>::calculate(const fs::path& hklin,
// --------------------------------------------------------------------
// --------------------------------------------------------------------
template
<
typename
FTYPE
>
template
<
typename
FTYPE
>
void
MapMaker
<
FTYPE
>::
loadFoFreeFromReflectionsFile
(
const
fs
::
path
&
hklin
)
void
MapMaker
<
FTYPE
>::
loadFoFreeFromReflectionsFile
(
const
std
::
string
&
hklin
)
{
{
using
clipper
::
HKL
;
using
clipper
::
HKL
;
...
@@ -701,7 +711,7 @@ void MapMaker<FTYPE>::loadFoFreeFromReflectionsFile(const fs::path& hklin)
...
@@ -701,7 +711,7 @@ void MapMaker<FTYPE>::loadFoFreeFromReflectionsFile(const fs::path& hklin)
// --------------------------------------------------------------------
// --------------------------------------------------------------------
template
<
typename
FTYPE
>
template
<
typename
FTYPE
>
void
MapMaker
<
FTYPE
>::
loadFoFreeFromMTZFile
(
const
fs
::
path
&
hklin
,
void
MapMaker
<
FTYPE
>::
loadFoFreeFromMTZFile
(
const
std
::
string
&
hklin
,
initializer_list
<
std
::
string
>
foLabels
,
initializer_list
<
std
::
string
>
freeLabels
)
initializer_list
<
std
::
string
>
foLabels
,
initializer_list
<
std
::
string
>
freeLabels
)
{
{
if
(
cif
::
VERBOSE
)
if
(
cif
::
VERBOSE
)
...
@@ -712,7 +722,7 @@ void MapMaker<FTYPE>::loadFoFreeFromMTZFile(const fs::path& hklin,
...
@@ -712,7 +722,7 @@ void MapMaker<FTYPE>::loadFoFreeFromMTZFile(const fs::path& hklin,
using
clipper
::
CCP4MTZfile
;
using
clipper
::
CCP4MTZfile
;
CCP4MTZfile
mtzin
;
CCP4MTZfile
mtzin
;
mtzin
.
open_read
(
hklin
.
string
()
);
mtzin
.
open_read
(
hklin
);
mtzin
.
import_hkl_info
(
mHKLInfo
);
mtzin
.
import_hkl_info
(
mHKLInfo
);
mtzin
.
import_hkl_data
(
mFoData
,
mtzin
.
import_hkl_data
(
mFoData
,
...
@@ -1082,7 +1092,7 @@ void MapMaker<FTYPE>::printStats()
...
@@ -1082,7 +1092,7 @@ void MapMaker<FTYPE>::printStats()
}
}
template
<
typename
FTYPE
>
template
<
typename
FTYPE
>
void
MapMaker
<
FTYPE
>::
writeMTZ
(
const
fs
::
path
&
file
,
const
string
&
pname
,
const
string
&
cname
)
void
MapMaker
<
FTYPE
>::
writeMTZ
(
const
std
::
string
&
file
,
const
string
&
pname
,
const
string
&
cname
)
{
{
if
(
mHKLInfo
.
is_null
())
if
(
mHKLInfo
.
is_null
())
throw
runtime_error
(
"HKL info not initialized"
);
throw
runtime_error
(
"HKL info not initialized"
);
...
@@ -1093,7 +1103,7 @@ void MapMaker<FTYPE>::writeMTZ(const fs::path& file, const string& pname, const
...
@@ -1093,7 +1103,7 @@ void MapMaker<FTYPE>::writeMTZ(const fs::path& file, const string& pname, const
const
string
col
=
"/"
+
pname
+
"/"
+
cname
+
"/"
;
const
string
col
=
"/"
+
pname
+
"/"
+
cname
+
"/"
;
mtz
.
open_write
(
file
.
string
()
);
mtz
.
open_write
(
file
);
mtz
.
export_hkl_info
(
mHKLInfo
);
mtz
.
export_hkl_info
(
mHKLInfo
);
mtz
.
export_crystal
(
crystal
,
col
);
mtz
.
export_crystal
(
crystal
,
col
);
mtz
.
export_dataset
(
dataset
,
col
);
mtz
.
export_dataset
(
dataset
,
col
);
...
...
src/PDB2Cif.cpp
View file @
54728d49
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
#include <map>
#include <map>
#include <set>
#include <set>
#include <
boost/regex.hpp
>
#include <
system_error
>
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string.hpp>
...
@@ -40,11 +40,11 @@ namespace error
...
@@ -40,11 +40,11 @@ namespace error
namespace
detail
namespace
detail
{
{
class
pdbCategory
:
public
boost
::
system
::
error_category
class
pdbCategory
:
public
std
::
error_category
{
{
public
:
public
:
const
char
*
name
()
const
BOOST_SYSTEM_NOEXCEPT
const
char
*
name
()
const
noexcept
{
{
return
"pdb"
;
return
"pdb"
;
}
}
...
@@ -66,20 +66,20 @@ namespace error
...
@@ -66,20 +66,20 @@ namespace error
};
};
}
}
boost
::
system
::
error_category
&
pdbCategory
()
std
::
error_category
&
pdbCategory
()
{
{
static
detail
::
pdbCategory
impl
;
static
detail
::
pdbCategory
impl
;
return
impl
;
return
impl
;
}
}
inline
boost
::
system
::
error_code
make_error_code
(
pdbErrors
e
)
inline
std
::
error_code
make_error_code
(
pdbErrors
e
)
{
{
return
boost
::
system
::
error_code
(
static_cast
<
int
>
(
e
),
pdbCategory
());
return
std
::
error_code
(
static_cast
<
int
>
(
e
),
pdbCategory
());
}
}
}
}
namespace
boost
{
namespace
std
namespace
system
{
{
template
<>
struct
is_error_code_enum
<
error
::
pdbErrors
>
template
<>
struct
is_error_code_enum
<
error
::
pdbErrors
>
{
{
...
@@ -87,7 +87,6 @@ template<> struct is_error_code_enum<error::pdbErrors>
...
@@ -87,7 +87,6 @@ template<> struct is_error_code_enum<error::pdbErrors>
};
};
}
}
}
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -636,7 +635,7 @@ class PDBFileParser
...
@@ -636,7 +635,7 @@ class PDBFileParser
}
}
}
}
tuple
<
string
,
int
,
bool
>
MapResidue
(
char
chainID
,
int
resSeq
,
char
iCode
,
boost
::
system
::
error_code
&
ec
)
const
tuple
<
string
,
int
,
bool
>
MapResidue
(
char
chainID
,
int
resSeq
,
char
iCode
,
std
::
error_code
&
ec
)
const
{
{
auto
key
=
make_tuple
(
chainID
,
resSeq
,
iCode
);
auto
key
=
make_tuple
(
chainID
,
resSeq
,
iCode
);
...
@@ -697,7 +696,7 @@ class PDBFileParser
...
@@ -697,7 +696,7 @@ class PDBFileParser
vector
<
string
>
SplitCSV
(
const
string
&
value
);
vector
<
string
>
SplitCSV
(
const
string
&
value
);
string
pdb2cifDate
(
string
s
,
boost
::
system
::
error_code
&
ec
)
string
pdb2cifDate
(
string
s
,
std
::
error_code
&
ec
)
{
{
smatch
m
;
smatch
m
;
const
regex
const
regex
...
@@ -750,7 +749,7 @@ class PDBFileParser
...
@@ -750,7 +749,7 @@ class PDBFileParser
string
pdb2cifDate
(
string
s
)
string
pdb2cifDate
(
string
s
)
{
{
boost
::
system
::
error_code
ec
;
std
::
error_code
ec
;
return
pdb2cifDate
(
s
,
ec
);
return
pdb2cifDate
(
s
,
ec
);
}
}
...
@@ -2701,7 +2700,7 @@ void PDBFileParser::ParseRemark200()
...
@@ -2701,7 +2700,7 @@ void PDBFileParser::ParseRemark200()
});
});
string
collectionDate
;
string
collectionDate
;
boost
::
system
::
error_code
ec
;
std
::
error_code
ec
;
collectionDate
=
pdb2cifDate
(
rm200
(
"DATE OF DATA COLLECTION"
,
diffrnNr
),
ec
);
collectionDate
=
pdb2cifDate
(
rm200
(
"DATE OF DATA COLLECTION"
,
diffrnNr
),
ec
);
if
(
ec
)
if
(
ec
)
{
{
...
@@ -3807,7 +3806,7 @@ void PDBFileParser::ConstructEntities()
...
@@ -3807,7 +3806,7 @@ void PDBFileParser::ConstructEntities()
string
asym
,
seqNum
;
string
asym
,
seqNum
;
int
labelSeq
=
-
1
;
int
labelSeq
=
-
1
;
boost
::
system
::
error_code
ec
;
std
::
error_code
ec
;
tie
(
asym
,
labelSeq
,
ignore
)
=
MapResidue
(
seqadv
.
chainID
,
seqadv
.
seqNum
,
seqadv
.
iCode
,
ec
);
tie
(
asym
,
labelSeq
,
ignore
)
=
MapResidue
(
seqadv
.
chainID
,
seqadv
.
seqNum
,
seqadv
.
iCode
,
ec
);
if
(
ec
)
if
(
ec
)
...
@@ -4128,7 +4127,7 @@ void PDBFileParser::ConstructEntities()
...
@@ -4128,7 +4127,7 @@ void PDBFileParser::ConstructEntities()
string
asymId
;
string
asymId
;
int
seq
;
int
seq
;
boost
::
system
::
error_code
ec
;
std
::
error_code
ec
;
tie
(
asymId
,
seq
,
ignore
)
=
MapResidue
(
chainID
,
seqNum
,
iCode
,
ec
);
tie
(
asymId
,
seq
,
ignore
)
=
MapResidue
(
chainID
,
seqNum
,
iCode
,
ec
);
if
(
ec
)
// no need to write a modres if it could not be found
if
(
ec
)
// no need to write a modres if it could not be found
...
@@ -4221,7 +4220,7 @@ void PDBFileParser::ConstructEntities()
...
@@ -4221,7 +4220,7 @@ void PDBFileParser::ConstructEntities()
bool
isPolymer
=
false
;
bool
isPolymer
=
false
;
string
asymId
,
compId
=
unobs
.
res
;
string
asymId
,
compId
=
unobs
.
res
;
int
seqNr
=
0
;
int
seqNr
=
0
;
boost
::
system
::
error_code
ec
;
std
::
error_code
ec
;
tie
(
asymId
,
seqNr
,
isPolymer
)
=
MapResidue
(
unobs
.
chain
,
unobs
.
seq
,
unobs
.
iCode
,
ec
);
tie
(
asymId
,
seqNr
,
isPolymer
)
=
MapResidue
(
unobs
.
chain
,
unobs
.
seq
,
unobs
.
iCode
,
ec
);
if
(
ec
)
if
(
ec
)
...
@@ -4300,7 +4299,7 @@ void PDBFileParser::ParseSecondaryStructure()
...
@@ -4300,7 +4299,7 @@ void PDBFileParser::ParseSecondaryStructure()
string
begAsymId
,
endAsymId
;
string
begAsymId
,
endAsymId
;
int
begSeq
,
endSeq
;
int
begSeq
,
endSeq
;
boost
::
system
::
error_code
ec
;
std
::
error_code
ec
;
tie
(
begAsymId
,
begSeq
,
ignore
)
=
MapResidue
(
vC
(
20
),
vI
(
22
,
25
),
vC
(
26
),
ec
);
tie
(
begAsymId
,
begSeq
,
ignore
)
=
MapResidue
(
vC
(
20
),
vI
(
22
,
25
),
vC
(
26
),
ec
);
if
(
not
ec
)
if
(
not
ec
)
...
@@ -4421,7 +4420,7 @@ void PDBFileParser::ParseSecondaryStructure()
...
@@ -4421,7 +4420,7 @@ void PDBFileParser::ParseSecondaryStructure()
string
begAsymId
,
endAsymId
;
string
begAsymId
,
endAsymId
;
int
begSeq
,
endSeq
;
int
begSeq
,
endSeq
;
boost
::
system
::
error_code
ec
;
std
::
error_code
ec
;
tie
(
begAsymId
,
begSeq
,
ignore
)
=
MapResidue
(
vC
(
22
),
vI
(
23
,
26
),
vC
(
27
),
ec
);
tie
(
begAsymId
,
begSeq
,
ignore
)
=
MapResidue
(
vC
(
22
),
vI
(
23
,
26
),
vC
(
27
),
ec
);
if
(
not
ec
)
if
(
not
ec
)
...
@@ -4458,7 +4457,7 @@ void PDBFileParser::ParseSecondaryStructure()
...
@@ -4458,7 +4457,7 @@ void PDBFileParser::ParseSecondaryStructure()
{
{
string
r1AsymId
,
r2AsymId
;
string
r1AsymId
,
r2AsymId
;
int
r1Seq
,
r2Seq
;
int
r1Seq
,
r2Seq
;
boost
::
system
::
error_code
ec
;
std
::
error_code
ec
;
tie
(
r1AsymId
,
r1Seq
,
ignore
)
=
MapResidue
(
vC
(
65
),
vI
(
66
,
69
),
vC
(
70
),
ec
);
tie
(
r1AsymId
,
r1Seq
,
ignore
)
=
MapResidue
(
vC
(
65
),
vI
(
66
,
69
),
vC
(
70
),
ec
);
if
(
not
ec
)
if
(
not
ec
)
...
@@ -4556,7 +4555,7 @@ void PDBFileParser::ParseConnectivtyAnnotation()
...
@@ -4556,7 +4555,7 @@ void PDBFileParser::ParseConnectivtyAnnotation()
string
p1Asym
,
p2Asym
;
string
p1Asym
,
p2Asym
;
int
p1Seq
,
p2Seq
;
int
p1Seq
,
p2Seq
;
boost
::
system
::
error_code
ec
;
std
::
error_code
ec
;
tie
(
p1Asym
,
p1Seq
,
ignore
)
=
MapResidue
(
vC
(
16
),
vI
(
18
,
21
),
vC
(
22
),
ec
);
tie
(
p1Asym
,
p1Seq
,
ignore
)
=
MapResidue
(
vC
(
16
),
vI
(
18
,
21
),
vC
(
22
),
ec
);
if
(
not
ec
)
if
(
not
ec
)
...
@@ -4674,7 +4673,7 @@ void PDBFileParser::ParseConnectivtyAnnotation()
...
@@ -4674,7 +4673,7 @@ void PDBFileParser::ParseConnectivtyAnnotation()
string
p1Asym
,
p2Asym
;
string
p1Asym
,
p2Asym
;
int
p1Seq
,
p2Seq
;
int
p1Seq
,
p2Seq
;
bool
isResseq1
,
isResseq2
;
bool
isResseq1
,
isResseq2
;
boost
::
system
::
error_code
ec
;
std
::
error_code
ec
;
tie
(
p1Asym
,
p1Seq
,
isResseq1
)
=
MapResidue
(
vC
(
22
),
vI
(
23
,
26
),
vC
(
27
),
ec
);
tie
(
p1Asym
,
p1Seq
,
isResseq1
)
=
MapResidue
(
vC
(
22
),
vI
(
23
,
26
),
vC
(
27
),
ec
);
if
(
not
ec
)
if
(
not
ec
)
...
@@ -4778,7 +4777,7 @@ void PDBFileParser::ParseConnectivtyAnnotation()
...
@@ -4778,7 +4777,7 @@ void PDBFileParser::ParseConnectivtyAnnotation()
string
lAsym1
,
lAsym2
;
string
lAsym1
,
lAsym2
;
int
lResSeq1
,
lResSeq2
;
int
lResSeq1
,
lResSeq2
;
boost
::
system
::
error_code
ec
;
std
::
error_code
ec
;
tie
(
lAsym1
,
lResSeq1
,
ignore
)
=
MapResidue
(
chainID1
,
seqNum1
,
iCode1
,
ec
);
tie
(
lAsym1
,
lResSeq1
,
ignore
)
=
MapResidue
(
chainID1
,
seqNum1
,
iCode1
,
ec
);
if
(
not
ec
)
if
(
not
ec
)
...
@@ -4848,7 +4847,7 @@ void PDBFileParser::ParseMiscellaneousFeatures()
...
@@ -4848,7 +4847,7 @@ void PDBFileParser::ParseMiscellaneousFeatures()
int
labelSeq
;
int
labelSeq
;
string
asym
;
string
asym
;
bool
isResseq
;
bool
isResseq
;
boost
::
system
::
error_code
ec
;
std
::
error_code
ec
;
tie
(
asym
,
labelSeq
,
isResseq
)
=
MapResidue
(
chainID
,
seq
,
iCode
,
ec
);
tie
(
asym
,
labelSeq
,
isResseq
)
=
MapResidue
(
chainID
,
seq
,
iCode
,
ec
);
...
...
src/Structure.cpp
View file @
54728d49
...
@@ -3,9 +3,17 @@
...
@@ -3,9 +3,17 @@
#include "cif++/Structure.h"
#include "cif++/Structure.h"
#include <numeric>
#include <numeric>
#include <fstream>
#if __has_include(<filesystem>)
#include <filesystem>
namespace
fs
=
std
::
filesystem
;
#elif __has_include(<boost/filesystem.hpp>)
#include <boost/filesystem.hpp>
namespace
fs
=
boost
::
filesystem
;
#endif
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/bzip2.hpp>
#include <boost/iostreams/filter/bzip2.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filter/gzip.hpp>
...
@@ -19,7 +27,6 @@
...
@@ -19,7 +27,6 @@
using
namespace
std
;
using
namespace
std
;
namespace
ba
=
boost
::
algorithm
;
namespace
ba
=
boost
::
algorithm
;
namespace
fs
=
boost
::
filesystem
;
namespace
io
=
boost
::
iostreams
;
namespace
io
=
boost
::
iostreams
;
extern
int
cif
::
VERBOSE
;
extern
int
cif
::
VERBOSE
;
...
@@ -35,28 +42,30 @@ struct FileImpl
...
@@ -35,28 +42,30 @@ struct FileImpl
cif
::
File
mData
;
cif
::
File
mData
;
cif
::
Datablock
*
mDb
=
nullptr
;
cif
::
Datablock
*
mDb
=
nullptr
;
void
load
(
fs
::
path
p
);
void
load
(
const
std
::
string
&
p
);
void
save
(
fs
::
path
p
);
void
save
(
const
std
::
string
&
p
);
};
};
void
FileImpl
::
load
(
fs
::
path
p
)
void
FileImpl
::
load
(
const
std
::
string
&
p
)
{
{
fs
::
ifstream
inFile
(
p
,
ios_base
::
in
|
ios_base
::
binary
);
fs
::
path
path
(
p
);
std
::
ifstream
inFile
(
path
,
ios_base
::
in
|
ios_base
::
binary
);
if
(
not
inFile
.
is_open
())
if
(
not
inFile
.
is_open
())
throw
runtime_error
(
"No such file: "
+
p
.
string
());
throw
runtime_error
(
"No such file: "
+
p
ath
.
string
());
io
::
filtering_stream
<
io
::
input
>
in
;
io
::
filtering_stream
<
io
::
input
>
in
;
string
ext
=
p
.
extension
().
string
();
string
ext
=
p
ath
.
extension
().
string
();
if
(
p
.
extension
()
==
".bz2"
)
if
(
p
ath
.
extension
()
==
".bz2"
)
{
{
in
.
push
(
io
::
bzip2_decompressor
());
in
.
push
(
io
::
bzip2_decompressor
());
ext
=
p
.
stem
().
extension
().
string
();
ext
=
p
ath
.
stem
().
extension
().
string
();
}
}
else
if
(
p
.
extension
()
==
".gz"
)
else
if
(
p
ath
.
extension
()
==
".gz"
)
{
{
in
.
push
(
io
::
gzip_decompressor
());
in
.
push
(
io
::
gzip_decompressor
());
ext
=
p
.
stem
().
extension
().
string
();
ext
=
p
ath
.
stem
().
extension
().
string
();
}
}
in
.
push
(
inFile
);
in
.
push
(
inFile
);
...
@@ -88,11 +97,11 @@ void FileImpl::load(fs::path p)
...
@@ -88,11 +97,11 @@ void FileImpl::load(fs::path p)
if
(
inFile
.
is_open
())
if
(
inFile
.
is_open
())
inFile
.
seekg
(
0
);
inFile
.
seekg
(
0
);
else
else
inFile
.
open
(
p
,
ios_base
::
in
|
ios
::
binary
);
inFile
.
open
(
p
ath
,
ios_base
::
in
|
ios
::
binary
);
if
(
p
.
extension
()
==
".bz2"
)
if
(
p
ath
.
extension
()
==
".bz2"
)
in
.
push
(
io
::
bzip2_decompressor
());
in
.
push
(
io
::
bzip2_decompressor
());
else
if
(
p
.
extension
()
==
".gz"
)
else
if
(
p
ath
.
extension
()
==
".gz"
)
in
.
push
(
io
::
gzip_decompressor
());
in
.
push
(
io
::
gzip_decompressor
());
in
.
push
(
inFile
);
in
.
push
(
inFile
);
...
@@ -103,7 +112,7 @@ void FileImpl::load(fs::path p)
...
@@ -103,7 +112,7 @@ void FileImpl::load(fs::path p)
}
}
catch
(
const
exception
&
ex
)
catch
(
const
exception
&
ex
)
{
{
cerr
<<
"Error trying to load file "
<<
p
<<
endl
;
cerr
<<
"Error trying to load file "
<<
p
ath
<<
endl
;
throw
;
throw
;
}
}
...
@@ -117,25 +126,27 @@ void FileImpl::load(fs::path p)
...
@@ -117,25 +126,27 @@ void FileImpl::load(fs::path p)
cerr
<<
"Invalid mmCIF file"
<<
(
cif
::
VERBOSE
?
"."
:
" use --verbose option to see errors"
)
<<
endl
;
cerr
<<
"Invalid mmCIF file"
<<
(
cif
::
VERBOSE
?
"."
:
" use --verbose option to see errors"
)
<<
endl
;
}
}
void
FileImpl
::
save
(
fs
::
path
p
)
void
FileImpl
::
save
(
const
std
::
string
&
p
)
{
{
fs
::
ofstream
outFile
(
p
,
ios_base
::
out
|
ios_base
::
binary
);
fs
::
path
path
(
p
);
std
::
ofstream
outFile
(
p
,
ios_base
::
out
|
ios_base
::
binary
);
io
::
filtering_stream
<
io
::
output
>
out
;
io
::
filtering_stream
<
io
::
output
>
out
;
if
(
p
.
extension
()
==
".gz"
)
if
(
p
ath
.
extension
()
==
".gz"
)
{
{
out
.
push
(
io
::
gzip_compressor
());
out
.
push
(
io
::
gzip_compressor
());
p
=
p
.
stem
();
p
ath
=
path
.
stem
();
}
}
else
if
(
p
.
extension
()
==
".bz2"
)
else
if
(
p
ath
.
extension
()
==
".bz2"
)
{
{
out
.
push
(
io
::
bzip2_compressor
());
out
.
push
(
io
::
bzip2_compressor
());
p
=
p
.
stem
();
p
ath
=
path
.
stem
();
}
}
out
.
push
(
outFile
);
out
.
push
(
outFile
);
if
(
p
.
extension
()
==
".pdb"
)
if
(
p
ath
.
extension
()
==
".pdb"
)
WritePDBFile
(
out
,
mData
);
WritePDBFile
(
out
,
mData
);
else
else
mData
.
save
(
out
);
mData
.
save
(
out
);
...
@@ -1318,7 +1329,7 @@ File::File()
...
@@ -1318,7 +1329,7 @@ File::File()
{
{
}
}
File
::
File
(
fs
::
path
File
)
File
::
File
(
const
std
::
string
&
File
)
:
mImpl
(
new
FileImpl
)
:
mImpl
(
new
FileImpl
)
{
{
load
(
File
);
load
(
File
);
...
@@ -1329,7 +1340,7 @@ File::~File()
...
@@ -1329,7 +1340,7 @@ File::~File()
delete
mImpl
;
delete
mImpl
;
}
}
void
File
::
load
(
fs
::
path
p
)
void
File
::
load
(
const
std
::
string
&
p
)
{
{
mImpl
->
load
(
p
);
mImpl
->
load
(
p
);
...
@@ -1385,9 +1396,9 @@ void File::load(fs::path p)
...
@@ -1385,9 +1396,9 @@ void File::load(fs::path p)
}
}
void
File
::
save
(
boost
::
filesystem
::
path
F
ile
)
void
File
::
save
(
const
std
::
string
&
f
ile
)
{
{
mImpl
->
save
(
F
ile
);
mImpl
->
save
(
f
ile
);
}
}
cif
::
Datablock
&
File
::
data
()
cif
::
Datablock
&
File
::
data
()
...
...
src/Symmetry.cpp
View file @
54728d49
...
@@ -5,8 +5,6 @@
...
@@ -5,8 +5,6 @@
#include <atomic>
#include <atomic>
#include <mutex>
#include <mutex>
#include <boost/thread.hpp>
#include "cif++/Symmetry.h"
#include "cif++/Symmetry.h"
#include "cif++/CifUtils.h"
#include "cif++/CifUtils.h"
...
...
src/TlsParser.cpp
View file @
54728d49
...
@@ -34,7 +34,6 @@
...
@@ -34,7 +34,6 @@
#include <boost/program_options.hpp>
#include <boost/program_options.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/filesystem/path.hpp>
#include "cif++/CifUtils.h"
#include "cif++/CifUtils.h"
#include "cif++/Structure.h"
#include "cif++/Structure.h"
...
@@ -43,7 +42,6 @@
...
@@ -43,7 +42,6 @@
using
namespace
std
;
using
namespace
std
;
namespace
po
=
boost
::
program_options
;
namespace
po
=
boost
::
program_options
;
namespace
ba
=
boost
::
algorithm
;
namespace
ba
=
boost
::
algorithm
;
namespace
fs
=
boost
::
filesystem
;
namespace
c
=
mmcif
;
namespace
c
=
mmcif
;
namespace
cif
namespace
cif
...
...
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