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
2e8a5294
Unverified
Commit
2e8a5294
authored
May 31, 2023
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update example and README
parent
441e1427
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
9 deletions
+64
-9
README.md
+47
-0
examples/example.cpp
+17
-9
No files found.
README.md
View file @
2e8a5294
...
...
@@ -3,6 +3,53 @@ libcifpp
This library contains code to work with mmCIF and PDB files.
Synopsis
--------
```
c++
// A simple program counting residues with an OXT atom
#include <filesystem>
#include <iostream>
#include <cif++.hpp>
namespace
fs
=
std
::
filesystem
;
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
!=
2
)
exit
(
1
);
cif
::
file
file
=
cif
::
pdb
::
read
(
argv
[
1
]);
if
(
file
.
empty
())
{
std
::
cerr
<<
"Empty file"
<<
std
::
endl
;
exit
(
1
);
}
auto
&
db
=
file
.
front
();
auto
&
atom_site
=
db
[
"atom_site"
];
auto
n
=
atom_site
.
find
(
cif
::
key
(
"label_atom_id"
)
==
"OXT"
).
size
();
std
::
cout
<<
"File contains "
<<
atom_site
.
size
()
<<
" atoms of which "
<<
n
<<
(
n
==
1
?
" is"
:
" are"
)
<<
" OXT"
<<
std
::
endl
<<
"residues with an OXT are:"
<<
std
::
endl
;
for
(
const
auto
&
[
asym
,
comp
,
seqnr
]
:
atom_site
.
find
<
std
::
string
,
std
::
string
,
int
>
(
cif
::
key
(
"label_atom_id"
)
==
"OXT"
,
"label_asym_id"
,
"label_comp_id"
,
"label_seq_id"
))
{
std
::
cout
<<
asym
<<
' '
<<
comp
<<
' '
<<
seqnr
<<
std
::
endl
;
}
return
0
;
}
```
Requirements
------------
...
...
examples/example.cpp
View file @
2e8a5294
#include <iostream>
#include <filesystem>
#include <iostream>
#include <cif++.hpp>
namespace
fs
=
std
::
filesystem
;
int
main
()
int
main
(
int
argc
,
char
*
argv
[]
)
{
cif
::
file
file
;
file
.
load
(
"1cbs.cif.gz"
);
if
(
argc
!=
2
)
exit
(
1
);
auto
&
db
=
file
.
front
();
cif
::
file
file
=
cif
::
pdb
::
read
(
argv
[
1
]);
if
(
file
.
empty
())
{
std
::
cerr
<<
"Empty file"
<<
std
::
endl
;
exit
(
1
);
}
auto
&
db
=
file
.
front
();
auto
&
atom_site
=
db
[
"atom_site"
];
auto
n
=
atom_site
.
find
(
cif
::
key
(
"label_atom_id"
)
==
"OXT"
).
size
();
std
::
cout
<<
"File contains "
<<
atom_site
.
size
()
<<
" atoms of which "
<<
n
<<
(
n
==
1
?
" is"
:
" are"
)
<<
" OXT"
<<
std
::
endl
<<
"residues with an OXT are:"
<<
std
::
endl
;
for
(
const
auto
&
[
asym
,
comp
,
seqnr
]
:
atom_site
.
find
<
std
::
string
,
std
::
string
,
int
>
(
cif
::
key
(
"label_atom_id"
)
==
"OXT"
,
"label_asym_id"
,
"label_comp_id"
,
"label_seq_id"
))
<<
"residues with an OXT are:"
<<
std
::
endl
;
for
(
const
auto
&
[
asym
,
comp
,
seqnr
]
:
atom_site
.
find
<
std
::
string
,
std
::
string
,
int
>
(
cif
::
key
(
"label_atom_id"
)
==
"OXT"
,
"label_asym_id"
,
"label_comp_id"
,
"label_seq_id"
))
{
std
::
cout
<<
asym
<<
' '
<<
comp
<<
' '
<<
seqnr
<<
std
::
endl
;
}
...
...
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