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
7ffda74e
Unverified
Commit
7ffda74e
authored
Oct 26, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pdb2cif, avoid duplicate key violation on REMARK 350
parent
560f6deb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
18 deletions
+41
-18
include/cif++/category.hpp
+9
-0
src/category.cpp
+1
-1
src/pdb/pdb2cif.cpp
+31
-17
No files found.
include/cif++/category.hpp
View file @
7ffda74e
...
@@ -44,6 +44,15 @@ namespace cif
...
@@ -44,6 +44,15 @@ namespace cif
{
{
// --------------------------------------------------------------------
// --------------------------------------------------------------------
// special exception
class
duplicate_key_error
:
public
std
::
runtime_error
{
public
:
duplicate_key_error
(
const
std
::
string
&
msg
)
:
std
::
runtime_error
(
msg
)
{}
};
// --------------------------------------------------------------------
class
category
class
category
{
{
...
...
src/category.cpp
View file @
7ffda74e
...
@@ -416,7 +416,7 @@ category_index::entry *category_index::insert(entry *h, row *v)
...
@@ -416,7 +416,7 @@ category_index::entry *category_index::insert(entry *h, row *v)
os
<<
col
<<
": "
<<
std
::
quoted
(
rh
[
col
].
text
())
<<
"; "
;
os
<<
col
<<
": "
<<
std
::
quoted
(
rh
[
col
].
text
())
<<
"; "
;
}
}
throw
std
::
runtime
_error
(
"Duplicate Key violation, cat: "
+
m_category
.
name
()
+
" values: "
+
os
.
str
());
throw
duplicate_key
_error
(
"Duplicate Key violation, cat: "
+
m_category
.
name
()
+
" values: "
+
os
.
str
());
}
}
if
(
is_red
(
h
->
m_right
)
and
not
is_red
(
h
->
m_left
))
if
(
is_red
(
h
->
m_right
)
and
not
is_red
(
h
->
m_left
))
...
...
src/pdb/pdb2cif.cpp
View file @
7ffda74e
...
@@ -3248,23 +3248,37 @@ void PDBFileParser::ParseRemark350()
...
@@ -3248,23 +3248,37 @@ void PDBFileParser::ParseRemark350()
values
.
clear
();
values
.
clear
();
}
}
getCategory
(
"pdbx_struct_oper_list"
)
->
emplace
({
std
::
string
type
=
mat
==
std
::
vector
<
double
>
{
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
}
and
vec
==
std
::
vector
<
double
>
{
0
,
0
,
0
}
?
"identity operation"
:
"crystal symmetry operation"
;
{
"id"
,
operID
},
{
"type"
,
mat
==
std
::
vector
<
double
>
{
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
}
and
vec
==
std
::
vector
<
double
>
{
0
,
0
,
0
}
?
"identity operation"
:
"crystal symmetry operation"
},
// if (type == "identity operation")
// { "name", "" },
// {
// { "symmetryOperation", "" },
{
"matrix[1][1]"
,
format
(
"%12.10f"
,
mat
[
0
]).
str
()
},
// }
{
"matrix[1][2]"
,
format
(
"%12.10f"
,
mat
[
1
]).
str
()
},
// else
{
"matrix[1][3]"
,
format
(
"%12.10f"
,
mat
[
2
]).
str
()
},
try
{
"vector[1]"
,
format
(
"%12.10f"
,
vec
[
0
]).
str
()
},
{
{
"matrix[2][1]"
,
format
(
"%12.10f"
,
mat
[
3
]).
str
()
},
getCategory
(
"pdbx_struct_oper_list"
)
->
emplace
({
{
"matrix[2][2]"
,
format
(
"%12.10f"
,
mat
[
4
]).
str
()
},
{
"id"
,
operID
},
{
"matrix[2][3]"
,
format
(
"%12.10f"
,
mat
[
5
]).
str
()
},
{
"type"
,
type
},
{
"vector[2]"
,
format
(
"%12.10f"
,
vec
[
1
]).
str
()
},
// { "name", "" },
{
"matrix[3][1]"
,
format
(
"%12.10f"
,
mat
[
6
]).
str
()
},
// { "symmetryOperation", "" },
{
"matrix[3][2]"
,
format
(
"%12.10f"
,
mat
[
7
]).
str
()
},
{
"matrix[1][1]"
,
format
(
"%12.10f"
,
mat
[
0
]).
str
()
},
{
"matrix[3][3]"
,
format
(
"%12.10f"
,
mat
[
8
]).
str
()
},
{
"matrix[1][2]"
,
format
(
"%12.10f"
,
mat
[
1
]).
str
()
},
{
"vector[3]"
,
format
(
"%12.10f"
,
vec
[
2
]).
str
()
}
});
{
"matrix[1][3]"
,
format
(
"%12.10f"
,
mat
[
2
]).
str
()
},
{
"vector[1]"
,
format
(
"%12.10f"
,
vec
[
0
]).
str
()
},
{
"matrix[2][1]"
,
format
(
"%12.10f"
,
mat
[
3
]).
str
()
},
{
"matrix[2][2]"
,
format
(
"%12.10f"
,
mat
[
4
]).
str
()
},
{
"matrix[2][3]"
,
format
(
"%12.10f"
,
mat
[
5
]).
str
()
},
{
"vector[2]"
,
format
(
"%12.10f"
,
vec
[
1
]).
str
()
},
{
"matrix[3][1]"
,
format
(
"%12.10f"
,
mat
[
6
]).
str
()
},
{
"matrix[3][2]"
,
format
(
"%12.10f"
,
mat
[
7
]).
str
()
},
{
"matrix[3][3]"
,
format
(
"%12.10f"
,
mat
[
8
]).
str
()
},
{
"vector[3]"
,
format
(
"%12.10f"
,
vec
[
2
]).
str
()
}
});
}
catch
(
duplicate_key_error
&
ex
)
{
// so what?
}
mat
.
clear
();
mat
.
clear
();
vec
.
clear
();
vec
.
clear
();
...
...
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