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
43302172
Unverified
Commit
43302172
authored
Apr 21, 2021
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
count molecules
parent
7f23c842
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
include/cif++/Cif++.hpp
+10
-0
src/Structure.cpp
+24
-0
No files found.
include/cif++/Cif++.hpp
View file @
43302172
...
@@ -276,6 +276,16 @@ namespace detail
...
@@ -276,6 +276,16 @@ namespace detail
return
*
this
;
return
*
this
;
}
}
template
<
typename
T
>
ItemReference
&
operator
=
(
const
std
::
optional
<
T
>&
value
)
{
if
(
value
)
this
->
operator
=
(
*
value
);
else
this
->
operator
=
(
"?"
);
return
*
this
;
}
ItemReference
&
operator
=
(
const
std
::
string
&
value
);
ItemReference
&
operator
=
(
const
std
::
string
&
value
);
template
<
typename
...
Ts
>
template
<
typename
...
Ts
>
...
...
src/Structure.cpp
View file @
43302172
...
@@ -2402,6 +2402,30 @@ void Structure::cleanupEmptyCategories()
...
@@ -2402,6 +2402,30 @@ void Structure::cleanupEmptyCategories()
for
(
auto
row
:
empty
)
for
(
auto
row
:
empty
)
category
.
erase
(
row
);
category
.
erase
(
row
);
}
}
// count molecules
for
(
auto
entity
:
entities
)
{
std
::
string
type
,
id
;
cif
::
tie
(
type
,
id
)
=
entity
.
get
(
"type"
,
"id"
);
std
::
optional
<
int
>
count
;
if
(
type
==
"polymer"
)
count
=
db
[
"entity_poly"
].
find
(
"entity_id"
_key
==
id
).
size
();
else
if
(
type
==
"non-polymer"
or
type
==
"water"
)
count
=
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
]
:
db
[
"pdbx_branch_scheme"
].
find
<
std
::
string
>
(
"entity_id"
_key
==
id
,
{
"asym_id"
}))
asym_ids
.
insert
(
asym_id
);
count
=
asym_ids
.
size
();
}
entity
[
"pdbx_number_of_molecules"
]
=
count
;
}
}
}
}
}
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