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
ae0e9fbe
Unverified
Commit
ae0e9fbe
authored
Apr 29, 2024
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix cif::item constructor
fix ordering atoms
parent
3484c3dd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
23 deletions
+48
-23
include/cif++/item.hpp
+1
-1
src/model.cpp
+40
-15
src/pdb/reconstruct.cpp
+7
-7
No files found.
include/cif++/item.hpp
View file @
ae0e9fbe
...
...
@@ -378,7 +378,7 @@ struct item_handle
template
<
typename
T
>
item_handle
&
operator
=
(
T
&&
value
)
{
assign_value
(
item
{
""
,
std
::
move
(
value
)
}.
value
());
assign_value
(
item
{
""
,
std
::
forward
<
T
>
(
value
)
}.
value
());
return
*
this
;
}
...
...
src/model.cpp
View file @
ae0e9fbe
...
...
@@ -2886,7 +2886,7 @@ static int compare_numbers(std::string_view a, std::string_view b)
ra
=
selected_charconv
<
double
>::
from_chars
(
a
.
data
(),
a
.
data
()
+
a
.
length
(),
da
);
rb
=
selected_charconv
<
double
>::
from_chars
(
b
.
data
(),
b
.
data
()
+
b
.
length
(),
db
);
if
(
not
(
bool
)
ra
.
ec
and
not
(
bool
)
rb
.
ec
)
if
(
not
(
bool
)
ra
.
ec
and
not
(
bool
)
rb
.
ec
)
{
auto
d
=
da
-
db
;
if
(
std
::
abs
(
d
)
>
std
::
numeric_limits
<
double
>::
epsilon
())
...
...
@@ -2901,7 +2901,7 @@ static int compare_numbers(std::string_view a, std::string_view b)
result
=
1
;
else
result
=
-
1
;
return
result
;
}
...
...
@@ -2910,26 +2910,51 @@ void structure::reorder_atoms()
auto
&
atom_site
=
m_db
[
"atom_site"
];
atom_site
.
sort
([](
row_handle
a
,
row_handle
b
)
{
int
d
;
{
int
d
;
// First by model number
d
=
a
.
get
<
int
>
(
"pdbx_PDB_model_num"
)
-
b
.
get
<
int
>
(
"pdbx_PDB_model_num"
);
if
(
d
==
0
)
d
=
a
.
get
<
std
::
string
>
(
"label_asym_id"
).
compare
(
b
.
get
<
std
::
string
>
(
"label_asym_id"
));
if
(
d
==
0
)
d
=
a
.
get
<
int
>
(
"label_seq_id"
)
-
b
.
get
<
int
>
(
"label_seq_id"
);
if
(
d
==
0
)
d
=
compare_numbers
(
a
.
get
<
std
::
string
>
(
"id"
),
b
.
get
<
std
::
string
>
(
"id"
));
// First by model number
d
=
a
.
get
<
int
>
(
"pdbx_PDB_model_num"
)
-
b
.
get
<
int
>
(
"pdbx_PDB_model_num"
);
if
(
d
==
0
)
d
=
a
.
get
<
std
::
string
>
(
"label_asym_id"
).
compare
(
b
.
get
<
std
::
string
>
(
"label_asym_id"
));
if
(
d
==
0
)
{
auto
na
=
a
.
get
<
std
::
optional
<
int
>>
(
"label_seq_id"
);
auto
nb
=
b
.
get
<
std
::
optional
<
int
>>
(
"label_seq_id"
);
if
(
na
.
has_value
()
and
nb
.
has_value
())
d
=
*
na
-
*
nb
;
else
if
(
na
.
has_value
())
d
=
1
;
else
if
(
nb
.
has_value
())
d
=
-
1
;
}
return
d
;
});
if
(
d
==
0
)
{
auto
na
=
a
.
get
<
std
::
optional
<
int
>>
(
"auth_seq_id"
);
auto
nb
=
b
.
get
<
std
::
optional
<
int
>>
(
"auth_seq_id"
);
if
(
na
.
has_value
()
and
nb
.
has_value
())
d
=
*
na
-
*
nb
;
else
if
(
na
.
has_value
())
d
=
1
;
else
if
(
nb
.
has_value
())
d
=
-
1
;
}
if
(
d
==
0
)
d
=
compare_numbers
(
a
.
get
<
std
::
string
>
(
"id"
),
b
.
get
<
std
::
string
>
(
"id"
));
return
d
;
//
});
// atom_site.set_validator(nullptr, m_db);
// for (int nr = 1; auto r : atom_site)
// r["id"] = nr++;
// atom_site.set_validator(m_db.get_validator(), m_db);
}
...
...
src/pdb/reconstruct.cpp
View file @
ae0e9fbe
...
...
@@ -590,18 +590,18 @@ void checkAtomAnisotropRecords(datablock &db)
row
[
"type_symbol"
]
=
parent
[
"type_symbol"
].
text
();
}
if
(
row
[
"pdbx_auth_alt_id"
].
empty
())
if
(
row
[
"pdbx_auth_alt_id"
].
empty
()
and
not
parent
[
"pdbx_auth_alt_id"
].
empty
()
)
row
[
"pdbx_auth_alt_id"
]
=
parent
[
"pdbx_auth_alt_id"
].
text
();
if
(
row
[
"pdbx_label_seq_id"
].
empty
())
if
(
row
[
"pdbx_label_seq_id"
].
empty
()
and
not
parent
[
"pdbx_label_seq_id"
].
empty
()
)
row
[
"pdbx_label_seq_id"
]
=
parent
[
"label_seq_id"
].
text
();
if
(
row
[
"pdbx_label_asym_id"
].
empty
())
if
(
row
[
"pdbx_label_asym_id"
].
empty
()
and
not
parent
[
"pdbx_label_asym_id"
].
empty
()
)
row
[
"pdbx_label_asym_id"
]
=
parent
[
"label_asym_id"
].
text
();
if
(
row
[
"pdbx_label_atom_id"
].
empty
())
if
(
row
[
"pdbx_label_atom_id"
].
empty
()
and
not
parent
[
"pdbx_label_atom_id"
].
empty
()
)
row
[
"pdbx_label_atom_id"
]
=
parent
[
"label_atom_id"
].
text
();
if
(
row
[
"pdbx_label_comp_id"
].
empty
())
if
(
row
[
"pdbx_label_comp_id"
].
empty
()
and
not
parent
[
"pdbx_label_comp_id"
].
empty
()
)
row
[
"pdbx_label_comp_id"
]
=
parent
[
"label_comp_id"
].
text
();
if
(
row
[
"pdbx_PDB_model_num"
].
empty
())
row
[
"pdbx_PDB_model_num"
]
=
parent
[
"pdbx_PDB_model_num"
].
text
();
// if (row["pdbx_PDB_model_num"].empty() and not parent
["pdbx_PDB_model_num"].empty())
//
row["pdbx_PDB_model_num"] = parent["pdbx_PDB_model_num"].text();
}
if
(
not
to_be_deleted
.
empty
())
...
...
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