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
1769f986
Unverified
Commit
1769f986
authored
Oct 26, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed TLS parser, and more
parent
75ffd978
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
344 additions
and
97 deletions
+344
-97
CMakeLists.txt
+2
-0
include/cif++/category.hpp
+3
-2
include/cif++/item.hpp
+10
-1
include/cif++/iterator.hpp
+248
-41
include/cif++/model.hpp
+1
-0
include/cif++/pdb/tls.hpp
+14
-16
src/category.cpp
+27
-0
src/model.cpp
+4
-4
src/pdb/pdb2cif.cpp
+34
-33
src/pdb/pdb2cif_remark_3.cpp
+1
-0
src/pdb/tls.cpp
+0
-0
No files found.
CMakeLists.txt
View file @
1769f986
...
...
@@ -198,6 +198,7 @@ set(project_sources
${
PROJECT_SOURCE_DIR
}
/src/pdb/cif2pdb.cpp
${
PROJECT_SOURCE_DIR
}
/src/pdb/pdb2cif.cpp
${
PROJECT_SOURCE_DIR
}
/src/pdb/pdb2cif_remark_3.cpp
${
PROJECT_SOURCE_DIR
}
/src/pdb/tls.cpp
)
set
(
project_headers
...
...
@@ -227,6 +228,7 @@ set(project_headers
${
PROJECT_SOURCE_DIR
}
/include/cif++/pdb/io.hpp
${
PROJECT_SOURCE_DIR
}
/include/cif++/pdb/pdb2cif.hpp
${
PROJECT_SOURCE_DIR
}
/include/cif++/pdb/pdb2cif_remark_3.hpp
${
PROJECT_SOURCE_DIR
}
/include/cif++/pdb/tls.hpp
)
add_library
(
cifpp
${
project_sources
}
${
project_headers
}
${
PROJECT_SOURCE_DIR
}
/src/symop_table_data.hpp
)
...
...
include/cif++/category.hpp
View file @
1769f986
...
...
@@ -278,7 +278,7 @@ class category
{
auto
h
=
find
<
T
>
(
pos
,
std
::
forward
<
condition
>
(
cond
),
column
);
return
h
.
size
()
==
1
?
std
::
get
<
0
>
(
*
h
.
begin
()
)
:
T
{};
return
h
.
size
()
==
1
?
*
h
.
begin
(
)
:
T
{};
}
template
<
typename
...
Ts
,
typename
...
Cs
,
typename
U
=
std
::
enable_if_t
<
sizeof
...(
Ts
)
!=
1
>>
...
...
@@ -474,7 +474,8 @@ class category
}
// --------------------------------------------------------------------
void
sort
(
std
::
function
<
int
(
row_handle
,
row_handle
)
>
f
);
void
reorder_by_index
();
// --------------------------------------------------------------------
...
...
include/cif++/item.hpp
View file @
1769f986
...
...
@@ -107,7 +107,7 @@ class item
/// \brief constructor for an item with name \a name and as
/// content a the formatted integral value \a value
template
<
typename
T
,
std
::
enable_if_t
<
std
::
is_integral_v
<
T
>
,
int
>
=
0
>
template
<
typename
T
,
std
::
enable_if_t
<
std
::
is_integral_v
<
T
>
and
not
std
::
is_same_v
<
T
,
bool
>
,
int
>
=
0
>
item
(
const
std
::
string_view
name
,
const
T
&
value
)
:
m_name
(
name
)
{
...
...
@@ -123,6 +123,15 @@ class item
}
/// \brief constructor for an item with name \a name and as
/// content a the formatted boolean value \a value
template
<
typename
T
,
std
::
enable_if_t
<
std
::
is_same_v
<
T
,
bool
>
,
int
>
=
0
>
item
(
const
std
::
string_view
name
,
const
T
&
value
)
:
m_name
(
name
)
{
m_value
.
assign
(
value
?
"y"
:
"n"
);
}
/// \brief constructor for an item with name \a name and as
/// content value \a value
item
(
const
std
::
string_view
name
,
const
std
::
string_view
value
)
:
m_name
(
name
)
...
...
include/cif++/iterator.hpp
View file @
1769f986
...
...
@@ -47,11 +47,13 @@ class iterator_impl
using
category_type
=
std
::
remove_cv_t
<
Category
>
;
using
row_type
=
std
::
conditional_t
<
std
::
is_const_v
<
Category
>
,
const
row
,
row
>
;
using
tuple_type
=
std
::
tuple
<
Ts
...
>
;
using
iterator_category
=
std
::
forward_iterator_tag
;
using
value_type
=
std
::
conditional_t
<
N
==
0
,
row_handle
,
std
::
tuple
<
Ts
...
>>
;
using
value_type
=
tuple_type
;
using
difference_type
=
std
::
ptrdiff_t
;
using
pointer
=
std
::
conditional_t
<
N
==
0
,
row_handle
,
value_type
*>
;
using
reference
=
std
::
conditional_t
<
N
==
0
,
row_handle
,
value_type
&>
;
using
pointer
=
value_type
*
;
using
reference
=
value_type
&
;
iterator_impl
()
=
default
;
...
...
@@ -66,56 +68,269 @@ class iterator_impl
{
}
template
<
typename
IRowType
>
iterator_impl
(
iterator_impl
<
IRowType
,
Ts
...
>
&
rhs
)
:
m_category
(
rhs
.
m_category
)
,
m_current
(
const_cast
<
row_type
*>
(
rhs
.
m_current
))
,
m_value
(
rhs
.
m_value
)
,
m_column_ix
(
rhs
.
m_column_ix
)
{
m_value
=
get
(
std
::
make_index_sequence
<
N
>
());
}
template
<
typename
IRowType
>
iterator_impl
(
const
iterator_impl
<
IRowType
>
&
rhs
,
const
std
::
array
<
size_t
,
N
>
&
cix
)
:
m_category
(
rhs
.
m_category
)
,
m_current
(
rhs
.
m_current
)
,
m_column_ix
(
cix
)
{
m_value
=
get
(
std
::
make_index_sequence
<
N
>
());
}
iterator_impl
&
operator
=
(
const
iterator_impl
&
i
)
{
m_category
=
i
.
m_category
;
m_current
=
i
.
m_current
;
m_column_ix
=
i
.
m_column_ix
;
m_value
=
i
.
m_value
;
return
*
this
;
}
virtual
~
iterator_impl
()
=
default
;
reference
operator
*
()
{
return
m_value
;
}
pointer
operator
->
()
{
return
&
m_value
;
}
operator
const
row_handle
()
const
{
return
{
*
m_category
,
*
m_current
};
}
operator
row_handle
()
{
return
{
*
m_category
,
*
m_current
};
}
iterator_impl
&
operator
++
()
{
if
(
m_current
!=
nullptr
)
m_current
=
m_current
->
m_next
;
m_value
=
get
(
std
::
make_index_sequence
<
N
>
());
return
*
this
;
}
iterator_impl
operator
++
(
int
)
{
iterator_impl
result
(
*
this
);
this
->
operator
++
();
return
result
;
}
bool
operator
==
(
const
iterator_impl
&
rhs
)
const
{
return
m_current
==
rhs
.
m_current
;
}
bool
operator
!=
(
const
iterator_impl
&
rhs
)
const
{
return
m_current
!=
rhs
.
m_current
;
}
template
<
typename
IRowType
,
typename
...
ITs
>
bool
operator
==
(
const
iterator_impl
<
IRowType
,
ITs
...
>
&
rhs
)
const
{
return
m_current
==
rhs
.
m_current
;
}
template
<
typename
IRowType
,
typename
...
ITs
>
bool
operator
!=
(
const
iterator_impl
<
IRowType
,
ITs
...
>
&
rhs
)
const
{
return
m_current
!=
rhs
.
m_current
;
}
private
:
template
<
std
::
size_t
...
Is
>
tuple_type
get
(
std
::
index_sequence
<
Is
...
>
)
const
{
if
(
m_current
!=
nullptr
)
{
row_handle
rh
{
*
m_category
,
*
m_current
};
return
tuple_type
{
rh
[
m_column_ix
[
Is
]].
template
as
<
Ts
>
()...};
}
return
{};
}
category_type
*
m_category
=
nullptr
;
row_type
*
m_current
=
nullptr
;
value_type
m_value
;
std
::
array
<
size_t
,
N
>
m_column_ix
;
};
template
<
typename
Category
>
class
iterator_impl
<
Category
>
{
public
:
template
<
typename
,
typename
...
>
friend
class
iterator_impl
;
friend
class
category
;
using
category_type
=
std
::
remove_cv_t
<
Category
>
;
using
row_type
=
std
::
conditional_t
<
std
::
is_const_v
<
Category
>
,
const
row
,
row
>
;
using
iterator_category
=
std
::
forward_iterator_tag
;
using
value_type
=
row_handle
;
using
difference_type
=
std
::
ptrdiff_t
;
using
pointer
=
row_handle
;
using
reference
=
row_handle
;
iterator_impl
()
=
default
;
iterator_impl
(
const
iterator_impl
&
rhs
)
=
default
;
template
<
typename
C2
>
iterator_impl
(
const
iterator_impl
<
C2
>
&
rhs
)
:
m_category
(
rhs
.
m_category
)
,
m_current
(
const_cast
<
row_type
*>
(
rhs
.
m_current
))
{
}
iterator_impl
(
Category
&
cat
,
row
*
current
)
:
m_category
(
const_cast
<
category_type
*>
(
&
cat
))
,
m_current
(
current
)
,
m_value
(
*
m_category
,
*
current
)
{
static_assert
(
N
==
0
,
"Only valid if this is a row iterator, not a row<xxx> iterator"
);
}
// iterator_impl(ItemRow *data)
// : m_current(data)
// {
// static_assert(N == 0, "Only valid if this is a row iterator, not a row<xxx> iterator");
// }
template
<
typename
IRowType
>
iterator_impl
(
const
iterator_impl
<
IRowType
>
&
rhs
,
const
std
::
array
<
size_t
,
0
>
&
cix
)
:
m_category
(
rhs
.
m_category
)
,
m_current
(
rhs
.
m_current
)
{
}
// iterator_impl(ItemRow *data, const std::array<size_t, N> &cix)
// : m_current(data)
// , m_column_ix(cix)
// {
// }
iterator_impl
&
operator
=
(
const
iterator_impl
&
i
)
{
m_category
=
i
.
m_category
;
m_current
=
i
.
m_current
;
return
*
this
;
}
virtual
~
iterator_impl
()
=
default
;
reference
operator
*
()
{
return
{
*
m_category
,
*
m_current
};
}
pointer
operator
->
()
{
return
&
m_current
;
}
operator
const
row_handle
()
const
{
return
{
*
m_category
,
*
m_current
};
}
operator
row_handle
()
{
return
{
*
m_category
,
*
m_current
};
}
iterator_impl
&
operator
++
()
{
if
(
m_current
!=
nullptr
)
m_current
=
m_current
->
m_next
;
return
*
this
;
}
iterator_impl
operator
++
(
int
)
{
iterator_impl
result
(
*
this
);
this
->
operator
++
();
return
result
;
}
bool
operator
==
(
const
iterator_impl
&
rhs
)
const
{
return
m_current
==
rhs
.
m_current
;
}
bool
operator
!=
(
const
iterator_impl
&
rhs
)
const
{
return
m_current
!=
rhs
.
m_current
;
}
template
<
typename
IRowType
,
typename
...
ITs
>
bool
operator
==
(
const
iterator_impl
<
IRowType
,
ITs
...
>
&
rhs
)
const
{
return
m_current
==
rhs
.
m_current
;
}
template
<
typename
IRowType
,
typename
...
ITs
>
bool
operator
!=
(
const
iterator_impl
<
IRowType
,
ITs
...
>
&
rhs
)
const
{
return
m_current
!=
rhs
.
m_current
;
}
private
:
category_type
*
m_category
=
nullptr
;
row_type
*
m_current
=
nullptr
;
};
template
<
typename
Category
,
typename
T
>
class
iterator_impl
<
Category
,
T
>
{
public
:
template
<
typename
,
typename
...
>
friend
class
iterator_impl
;
friend
class
category
;
using
category_type
=
std
::
remove_cv_t
<
Category
>
;
using
row_type
=
std
::
conditional_t
<
std
::
is_const_v
<
Category
>
,
const
row
,
row
>
;
using
iterator_category
=
std
::
forward_iterator_tag
;
using
value_type
=
T
;
using
difference_type
=
std
::
ptrdiff_t
;
using
pointer
=
value_type
*
;
using
reference
=
value_type
&
;
iterator_impl
()
=
default
;
iterator_impl
(
const
iterator_impl
&
rhs
)
=
default
;
template
<
typename
C2
,
typename
T2
>
iterator_impl
(
const
iterator_impl
<
C2
,
T2
>
&
rhs
)
:
m_category
(
rhs
.
m_category
)
,
m_current
(
rhs
.
m_current
)
,
m_value
(
rhs
.
m_value
)
,
m_column_ix
(
rhs
.
m_column_ix
)
{
}
template
<
typename
IRowType
>
iterator_impl
(
iterator_impl
<
IRowType
,
T
s
...
>
&
rhs
)
iterator_impl
(
iterator_impl
<
IRowType
,
T
>
&
rhs
)
:
m_category
(
rhs
.
m_category
)
,
m_current
(
const_cast
<
row_type
*>
(
rhs
.
m_current
))
,
m_value
(
rhs
.
m_value
)
,
m_column_ix
(
rhs
.
m_column_ix
)
{
if
constexpr
(
N
>
0
)
m_value
=
get
(
m_current
,
std
::
make_index_sequence
<
N
>
());
m_value
=
get
(
m_current
);
}
template
<
typename
IRowType
>
iterator_impl
(
const
iterator_impl
<
IRowType
>
&
rhs
,
const
std
::
array
<
size_t
,
N
>
&
cix
)
iterator_impl
(
const
iterator_impl
<
IRowType
>
&
rhs
,
const
std
::
array
<
size_t
,
1
>
&
cix
)
:
m_category
(
rhs
.
m_category
)
,
m_current
(
rhs
.
m_current
)
,
m_column_ix
(
cix
)
,
m_column_ix
(
cix
[
0
]
)
{
if
constexpr
(
N
>
0
)
m_value
=
get
(
std
::
make_index_sequence
<
N
>
());
m_value
=
get
();
}
iterator_impl
&
operator
=
(
const
iterator_impl
&
i
)
{
m_category
=
i
.
m_category
;
m_current
=
i
.
m_current
;
if
constexpr
(
N
!=
0
)
{
m_column_ix
=
i
.
m_column_ix
;
m_value
=
i
.
m_value
;
}
m_column_ix
=
i
.
m_column_ix
;
m_value
=
i
.
m_value
;
return
*
this
;
}
...
...
@@ -123,18 +338,12 @@ class iterator_impl
reference
operator
*
()
{
if
constexpr
(
N
==
0
)
return
{
*
m_category
,
*
m_current
};
else
return
m_value
;
return
m_value
;
}
pointer
operator
->
()
{
if
constexpr
(
N
==
0
)
return
&
m_current
;
else
return
&
m_value
;
return
&
m_value
;
}
operator
const
row_handle
()
const
...
...
@@ -152,8 +361,7 @@ class iterator_impl
if
(
m_current
!=
nullptr
)
m_current
=
m_current
->
m_next
;
if
constexpr
(
N
!=
0
)
m_value
=
get
(
std
::
make_index_sequence
<
N
>
());
m_value
=
get
();
return
*
this
;
}
...
...
@@ -181,13 +389,12 @@ class iterator_impl
}
private
:
template
<
std
::
size_t
...
Is
>
std
::
tuple
<
Ts
...
>
get
(
std
::
index_sequence
<
Is
...
>
)
const
value_type
get
()
const
{
if
(
m_current
!=
nullptr
)
{
row_handle
rh
{
*
m_category
,
*
m_current
};
return
std
::
tuple
<
Ts
...
>
{
rh
[
m_column_ix
[
Is
]].
template
as
<
Ts
>
()...}
;
return
rh
[
m_column_ix
].
template
as
<
T
>
()
;
}
return
{};
...
...
@@ -196,7 +403,7 @@ class iterator_impl
category_type
*
m_category
=
nullptr
;
row_type
*
m_current
=
nullptr
;
value_type
m_value
;
s
td
::
array
<
size_t
,
N
>
m_column_ix
;
s
ize_t
m_column_ix
;
};
// --------------------------------------------------------------------
...
...
include/cif++/model.hpp
View file @
1769f986
...
...
@@ -270,6 +270,7 @@ class atom
std
::
string
get_auth_seq_id
()
const
{
return
get_property
(
"auth_seq_id"
);
}
std
::
string
get_auth_atom_id
()
const
{
return
get_property
(
"auth_atom_id"
);
}
std
::
string
get_auth_alt_id
()
const
{
return
get_property
(
"auth_alt_id"
);
}
std
::
string
get_auth_comp_id
()
const
{
return
get_property
(
"auth_comp_id"
);
}
std
::
string
get_pdb_ins_code
()
const
{
return
get_property
(
"pdbx_PDB_ins_code"
);
}
bool
is_alternate
()
const
{
return
not
get_label_alt_id
().
empty
();
}
...
...
include/cif++/pdb/
TlsParser
.hpp
→
include/cif++/pdb/
tls
.hpp
View file @
1769f986
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
*
* Copyright (c) 2020 NKI/AVL, Netherlands Cancer Institute
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
...
...
@@ -26,32 +26,30 @@
#pragma once
#include <vector>
#include <string>
#include <tuple>
#include <vector>
#include <cif++.hpp>
namespace
cif
{
extern
const
int
kResidueNrWildcard
,
kNoSeqNum
;
struct
TLSSelection
;
typedef
std
::
unique_ptr
<
TLSSelection
>
TLSSelectionPtr
;
struct
TLSResidue
;
struct
tls_selection
;
struct
tls_residue
;
struct
TLSS
election
struct
tls_s
election
{
virtual
~
TLSS
election
()
{}
virtual
void
CollectResidues
(
cif
::
datablock
&
db
,
std
::
vector
<
TLSResidue
>&
residues
,
std
::
size_t
indentLevel
=
0
)
const
=
0
;
std
::
vector
<
std
::
tuple
<
std
::
string
,
int
,
int
>>
GetRanges
(
cif
::
datablock
&
db
,
bool
pdbNamespace
)
const
;
virtual
~
tls_s
election
()
{}
virtual
void
collect_residues
(
cif
::
datablock
&
db
,
std
::
vector
<
tls_residue
>
&
residues
,
std
::
size_t
indentLevel
=
0
)
const
=
0
;
std
::
vector
<
std
::
tuple
<
std
::
string
,
int
,
int
>>
get_ranges
(
cif
::
datablock
&
db
,
bool
pdbNamespace
)
const
;
};
// Low level: get the selections
TLSSelectionPtr
ParseSelectionDetails
(
const
std
::
string
&
program
,
const
std
::
string
&
selection
);
std
::
unique_ptr
<
tls_selection
>
parse_tls_selection_details
(
const
std
::
string
&
program
,
const
std
::
string
&
selection
);
}
}
// namespace cif
src/category.cpp
View file @
1769f986
...
...
@@ -1679,6 +1679,33 @@ void category::swap_item(size_t column_ix, row_handle &a, row_handle &b)
std
::
swap
(
ra
.
at
(
column_ix
),
rb
.
at
(
column_ix
));
}
void
category
::
sort
(
std
::
function
<
int
(
row_handle
,
row_handle
)
>
f
)
{
if
(
m_head
==
nullptr
)
return
;
std
::
vector
<
row_handle
>
rows
;
for
(
auto
itemRow
=
m_head
;
itemRow
!=
nullptr
;
itemRow
=
itemRow
->
m_next
)
rows
.
emplace_back
(
*
this
,
*
itemRow
);
std
::
stable_sort
(
rows
.
begin
(),
rows
.
end
(),
[
&
f
](
row_handle
ia
,
row_handle
ib
)
{
return
f
(
ia
,
ib
)
<
0
;
});
m_head
=
rows
.
front
().
get_row
();
m_tail
=
rows
.
back
().
get_row
();
auto
r
=
m_head
;
for
(
size_t
i
=
1
;
i
<
rows
.
size
();
++
i
)
r
=
r
->
m_next
=
rows
[
i
].
get_row
();
r
->
m_next
=
nullptr
;
assert
(
r
==
m_tail
);
assert
(
size
()
==
rows
.
size
());
}
void
category
::
reorder_by_index
()
{
if
(
m_index
)
...
...
src/model.cpp
View file @
1769f986
...
...
@@ -1107,7 +1107,7 @@ branch::branch(structure &structure, const std::string &asym_id)
auto
&
branch_scheme
=
db
[
"pdbx_branch_scheme"
];
auto
&
branch_link
=
db
[
"pdbx_entity_branch_link"
];
for
(
const
auto
&
[
entity_id
]
:
struct_asym
.
find
<
std
::
string
>
(
"id"
_key
==
asym_id
,
"entity_id"
))
for
(
const
auto
&
entity_id
:
struct_asym
.
find
<
std
::
string
>
(
"id"
_key
==
asym_id
,
"entity_id"
))
{
for
(
const
auto
&
[
comp_id
,
num
]
:
branch_scheme
.
find
<
std
::
string
,
int
>
(
"asym_id"
_key
==
asym_id
,
"mon_id"
,
"pdb_seq_num"
))
...
...
@@ -1313,7 +1313,7 @@ void structure::load_data()
auto
&
branchScheme
=
m_db
[
"pdbx_branch_scheme"
];
for
(
const
auto
&
[
asym_id
]
:
branchScheme
.
rows
<
std
::
string
>
(
"asym_id"
))
for
(
const
auto
&
asym_id
:
branchScheme
.
rows
<
std
::
string
>
(
"asym_id"
))
{
if
(
m_branches
.
empty
()
or
m_branches
.
back
().
get_asym_id
()
!=
asym_id
)
m_branches
.
emplace_back
(
*
this
,
asym_id
);
...
...
@@ -2523,14 +2523,14 @@ void structure::cleanup_empty_categories()
std
::
optional
<
size_t
>
count
;
if
(
type
==
"polymer"
)
count
=
m_db
[
"
entity_poly
"
].
find
(
"entity_id"
_key
==
id
).
size
();
count
=
m_db
[
"
struct_asym
"
].
find
(
"entity_id"
_key
==
id
).
size
();
else
if
(
type
==
"non-polymer"
or
type
==
"water"
)
count
=
m_db
[
"pdbx_nonpoly_scheme"
].
find
(
"entity_id"
_key
==
id
).
size
();
else
if
(
type
==
"branched"
)
{
// is this correct?
std
::
set
<
std
::
string
>
asym_ids
;
for
(
const
auto
&
[
asym_id
]
:
m_db
[
"pdbx_branch_scheme"
].
find
<
std
::
string
>
(
"entity_id"
_key
==
id
,
"asym_id"
))
for
(
const
auto
&
asym_id
:
m_db
[
"pdbx_branch_scheme"
].
find
<
std
::
string
>
(
"entity_id"
_key
==
id
,
"asym_id"
))
asym_ids
.
insert
(
asym_id
);
count
=
asym_ids
.
size
();
}
...
...
src/pdb/pdb2cif.cpp
View file @
1769f986
...
...
@@ -3006,21 +3006,20 @@ void PDBFileParser::ParseRemark200()
if
(
inRM200
({
"REJECTION CRITERIA (SIGMA(I))"
,
"RESOLUTION RANGE HIGH (A)"
,
"RESOLUTION RANGE LOW (A)"
,
"NUMBER OF UNIQUE REFLECTIONS"
,
"COMPLETENESS FOR RANGE (%)"
,
"<I/SIGMA(I)> FOR THE DATA SET"
,
"R MERGE (I)"
,
"R SYM (I)"
,
"DATA REDUNDANCY"
}))
{
auto
cat
=
getCategory
(
"reflns"
);
if
(
cat
->
empty
())
cat
->
emplace
({});
auto
r
=
cat
->
back
();
r
[
"entry_id"
]
=
mStructureID
;
r
[
"observed_criterion_sigma_I"
]
=
mRemark200
[
"REJECTION CRITERIA (SIGMA(I))"
];
r
[
"d_resolution_high"
]
=
mRemark200
[
"RESOLUTION RANGE HIGH (A)"
];
r
[
"d_resolution_low"
]
=
mRemark200
[
"RESOLUTION RANGE LOW (A)"
];
r
[
"number_obs"
]
=
mRemark200
[
"NUMBER OF UNIQUE REFLECTIONS"
];
r
[
"percent_possible_obs"
]
=
mRemark200
[
"COMPLETENESS FOR RANGE (%)"
];
r
[
"pdbx_netI_over_sigmaI"
]
=
mRemark200
[
"<I/SIGMA(I)> FOR THE DATA SET"
];
r
[
"pdbx_Rmerge_I_obs"
]
=
mRemark200
[
"R MERGE (I)"
];
r
[
"pdbx_Rsym_value"
]
=
mRemark200
[
"R SYM (I)"
];
r
[
"pdbx_redundancy"
]
=
mRemark200
[
"DATA REDUNDANCY"
];
r
[
"pdbx_ordinal"
]
=
1
;
r
[
"pdbx_diffrn_id"
]
=
1
;
cat
->
emplace
({
{
"entry_id"
,
mStructureID
},
{
"observed_criterion_sigma_I"
,
mRemark200
[
"REJECTION CRITERIA (SIGMA(I))"
]
},
{
"d_resolution_high"
,
mRemark200
[
"RESOLUTION RANGE HIGH (A)"
]
},
{
"d_resolution_low"
,
mRemark200
[
"RESOLUTION RANGE LOW (A)"
]
},
{
"number_obs"
,
mRemark200
[
"NUMBER OF UNIQUE REFLECTIONS"
]
},
{
"percent_possible_obs"
,
mRemark200
[
"COMPLETENESS FOR RANGE (%)"
]
},
{
"pdbx_netI_over_sigmaI"
,
mRemark200
[
"<I/SIGMA(I)> FOR THE DATA SET"
]
},
{
"pdbx_Rmerge_I_obs"
,
mRemark200
[
"R MERGE (I)"
]
},
{
"pdbx_Rsym_value"
,
mRemark200
[
"R SYM (I)"
]
},
{
"pdbx_redundancy"
,
mRemark200
[
"DATA REDUNDANCY"
]
},
{
"pdbx_ordinal"
,
1
},
{
"pdbx_diffrn_id"
,
1
}
});
}
if
(
inRM200
({
"HIGHEST RESOLUTION SHELL, RANGE HIGH (A)"
}))
// that one field is mandatory...
...
...
@@ -3987,12 +3986,12 @@ void PDBFileParser::ConstructEntities()
{
seqAlignBeg
=
pdbxPolySeqScheme
.
find1
<
int
>
(
key
(
"pdb_strand_id"
)
==
std
::
string
{
dbref
.
chainID
}
and
key
(
"pdb_seq_num"
)
==
dbref
.
seqBegin
and
key
(
"pdb_ins_code"
)
==
insToStr
(
dbref
.
insertBegin
),
(
key
(
"pdb_ins_code"
)
==
insToStr
(
dbref
.
insertBegin
)
or
key
(
"pdb_ins_code"
)
==
cif
::
null
),
"seq_id"
);
seqAlignEnd
=
pdbxPolySeqScheme
.
find1
<
int
>
(
key
(
"pdb_strand_id"
)
==
std
::
string
{
dbref
.
chainID
}
and
key
(
"pdb_seq_num"
)
==
dbref
.
seqEnd
and
key
(
"pdb_ins_code"
)
==
insToStr
(
dbref
.
insertEnd
),
(
key
(
"pdb_ins_code"
)
==
insToStr
(
dbref
.
insertEnd
)
or
key
(
"pdb_ins_code"
)
==
cif
::
null
),
"seq_id"
);
}
catch
(...)
...
...
@@ -4001,20 +4000,20 @@ void PDBFileParser::ConstructEntities()
getCategory
(
"struct_ref_seq"
)
->
emplace
({
{
"align_id"
,
structRefSeqAlignID
},
{
"ref_id"
,
structRefID
},
{
"pdbx_PDB_id_code"
,
dbref
.
PDBIDCode
},
{
"pdbx_strand_id"
,
std
::
string
{
chain
.
mDbref
.
chainID
}
},
{
"seq_align_beg"
,
seqAlignBeg
},
{
"pdbx_seq_align_beg_ins_code"
,
insToStr
(
dbref
.
insertBegin
)
},
{
"seq_align_end"
,
seqAlignEnd
},
{
"pdbx_seq_align_end_ins_code"
,
insToStr
(
dbref
.
insertEnd
)
},
{
"pdbx_db_accession"
,
dbref
.
dbAccession
},
{
"db_align_beg"
,
dbref
.
dbSeqBegin
},
{
"pdbx_db_align_beg_ins_code"
,
insToStr
(
dbref
.
dbinsBeg
)
},
{
"db_align_end"
,
dbref
.
dbSeqEnd
},
{
"pdbx_db_align_end_ins_code"
,
insToStr
(
dbref
.
dbinsEnd
)
},
{
"pdbx_auth_seq_align_beg"
,
dbref
.
seqBegin
},
{
"pdbx_auth_seq_align_end"
,
dbref
.
seqEnd
}
});
{
"ref_id"
,
structRefID
},
{
"pdbx_PDB_id_code"
,
dbref
.
PDBIDCode
},
{
"pdbx_strand_id"
,
std
::
string
{
chain
.
mDbref
.
chainID
}
},
{
"seq_align_beg"
,
seqAlignBeg
},
{
"pdbx_seq_align_beg_ins_code"
,
insToStr
(
dbref
.
insertBegin
)
},
{
"seq_align_end"
,
seqAlignEnd
},
{
"pdbx_seq_align_end_ins_code"
,
insToStr
(
dbref
.
insertEnd
)
},
{
"pdbx_db_accession"
,
dbref
.
dbAccession
},
{
"db_align_beg"
,
dbref
.
dbSeqBegin
},
{
"pdbx_db_align_beg_ins_code"
,
insToStr
(
dbref
.
dbinsBeg
)
},
{
"db_align_end"
,
dbref
.
dbSeqEnd
},
{
"pdbx_db_align_end_ins_code"
,
insToStr
(
dbref
.
dbinsEnd
)
},
{
"pdbx_auth_seq_align_beg"
,
dbref
.
seqBegin
},
{
"pdbx_auth_seq_align_end"
,
dbref
.
seqEnd
}
});
// write the struct_ref_seq_dif
for
(
auto
&
seqadv
:
mSeqadvs
)
...
...
@@ -5696,6 +5695,8 @@ void PDBFileParser::Parse(std::istream &is, cif::file &result)
{
try
{
mDatablock
.
set_validator
(
result
.
get_validator
());
PreParseInput
(
is
);
mRec
=
mData
;
...
...
@@ -6164,10 +6165,10 @@ void ReadPDBFile(std::istream &pdbFile, cif::file &cifFile)
{
PDBFileParser
p
;
p
.
Parse
(
pdbFile
,
cifFile
);
cifFile
.
load_dictionary
(
"mmcif_pdbx"
);
p
.
Parse
(
pdbFile
,
cifFile
);
if
(
not
cifFile
.
is_valid
()
and
cif
::
VERBOSE
>=
0
)
std
::
cerr
<<
"Resulting mmCIF file is not valid!"
<<
std
::
endl
;
}
...
...
src/pdb/pdb2cif_remark_3.cpp
View file @
1769f986
...
...
@@ -971,6 +971,7 @@ Remark3Parser::Remark3Parser(const std::string &name, const std::string &expMeth
,
mTemplateCount
(
templateLineCount
)
,
mProgramVersion
(
programversion
)
{
mDb
.
set_validator
(
db
.
get_validator
());
}
std
::
string
Remark3Parser
::
nextLine
()
...
...
src/pdb/tls.cpp
0 → 100644
View file @
1769f986
This diff is collapsed.
Click to expand it.
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