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
3d79278e
Unverified
Commit
3d79278e
authored
May 04, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'trunk' into develop
parents
5e0b197a
9c4170d9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
11 deletions
+49
-11
changelog
+4
-0
include/cif++/Cif++.hpp
+13
-0
include/cif++/Cif2PDB.hpp
+10
-10
src/Cif++.cpp
+21
-0
src/Cif2PDB.cpp
+0
-0
src/Structure.cpp
+1
-1
No files found.
changelog
View file @
3d79278e
Version
4.1.0
Version
4.1.0
-
Some
interface
changes
for
mmcif
::
Atom
-
Some
interface
changes
for
mmcif
::
Atom
Version
4.0.1
-
Added
a
bunch
of
const
methods
to
Datablock
and
Category
.
-
Changed
PDB
writing
interface
to
accept
Datablock
instead
of
File
.
Version
4.0.0
Version
4.0.0
-
getResidue
in
mmcif
::
Structure
now
requires
both
a
-
getResidue
in
mmcif
::
Structure
now
requires
both
a
sequence
ID
and
an
auth
sequence
ID
.
As
a
result
the
code
was
cleaned
sequence
ID
and
an
auth
sequence
ID
.
As
a
result
the
code
was
cleaned
...
...
include/cif++/Cif++.hpp
View file @
3d79278e
...
@@ -254,8 +254,15 @@ class Datablock
...
@@ -254,8 +254,15 @@ class Datablock
const_iterator
begin
()
const
{
return
mCategories
.
begin
();
}
const_iterator
begin
()
const
{
return
mCategories
.
begin
();
}
const_iterator
end
()
const
{
return
mCategories
.
end
();
}
const_iterator
end
()
const
{
return
mCategories
.
end
();
}
/// \brief Access to the category with name \a name, will create it if it doesn't exist.
Category
&
operator
[](
std
::
string_view
name
);
Category
&
operator
[](
std
::
string_view
name
);
// /// \brief Access to the category with name \a name, will throw if it doesn't exist.
// const Category &operator[](std::string_view name) const;
/// \brief Access to the category with name \a name, will return an empty category if is doesn't exist.
const
Category
&
operator
[](
std
::
string_view
name
)
const
;
std
::
tuple
<
iterator
,
bool
>
emplace
(
std
::
string_view
name
);
std
::
tuple
<
iterator
,
bool
>
emplace
(
std
::
string_view
name
);
bool
isValid
();
bool
isValid
();
...
@@ -285,6 +292,9 @@ class Datablock
...
@@ -285,6 +292,9 @@ class Datablock
std
::
string
mName
;
std
::
string
mName
;
const
Validator
*
mValidator
;
const
Validator
*
mValidator
;
Datablock
*
mNext
;
Datablock
*
mNext
;
// for returning empty categories in the const operator[]
mutable
std
::
unique_ptr
<
Category
>
mNullCategory
;
};
};
// --------------------------------------------------------------------
// --------------------------------------------------------------------
...
@@ -1863,6 +1873,9 @@ class Category
...
@@ -1863,6 +1873,9 @@ class Category
Row
front
()
{
return
Row
(
mHead
);
}
Row
front
()
{
return
Row
(
mHead
);
}
Row
back
()
{
return
Row
(
mTail
);
}
Row
back
()
{
return
Row
(
mTail
);
}
const
Row
front
()
const
{
return
Row
(
mHead
);
}
const
Row
back
()
const
{
return
Row
(
mTail
);
}
Row
operator
[](
Condition
&&
cond
);
Row
operator
[](
Condition
&&
cond
);
const
Row
operator
[](
Condition
&&
cond
)
const
;
const
Row
operator
[](
Condition
&&
cond
)
const
;
...
...
include/cif++/Cif2PDB.hpp
View file @
3d79278e
/*-
/*-
* SPDX-License-Identifier: BSD-2-Clause
* SPDX-License-Identifier: BSD-2-Clause
*
*
* Copyright (c) 2020 NKI/AVL, Netherlands Cancer Institute
* Copyright (c) 2020 NKI/AVL, Netherlands Cancer Institute
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer
* list of conditions and the following disclaimer
* 2. Redistributions in binary form must reproduce the above copyright notice,
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* 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
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
...
@@ -28,12 +28,12 @@
...
@@ -28,12 +28,12 @@
#include "cif++/Cif++.hpp"
#include "cif++/Cif++.hpp"
void
WritePDBFile
(
std
::
ostream
&
pdbFile
,
cif
::
File
&
cifFile
);
void
WritePDBFile
(
std
::
ostream
&
os
,
const
cif
::
Datablock
&
data
);
/// \brief Just the HEADER, COMPND, SOURCE and AUTHOR lines
/// \brief Just the HEADER, COMPND, SOURCE and AUTHOR lines
void
WritePDBHeaderLines
(
std
::
ostream
&
os
,
cif
::
File
&
cifFile
);
void
WritePDBHeaderLines
(
std
::
ostream
&
os
,
const
cif
::
Datablock
&
data
);
std
::
string
GetPDBHEADERLine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBHEADERLine
(
c
onst
cif
::
Datablock
&
data
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBCOMPNDLine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBCOMPNDLine
(
c
onst
cif
::
Datablock
&
data
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBSOURCELine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBSOURCELine
(
c
onst
cif
::
Datablock
&
data
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBAUTHORLine
(
c
if
::
File
&
cifFile
,
std
::
string
::
size_type
truncate_at
=
127
);
std
::
string
GetPDBAUTHORLine
(
c
onst
cif
::
Datablock
&
data
,
std
::
string
::
size_type
truncate_at
=
127
);
src/Cif++.cpp
View file @
3d79278e
...
@@ -409,6 +409,22 @@ Category &Datablock::operator[](std::string_view name)
...
@@ -409,6 +409,22 @@ Category &Datablock::operator[](std::string_view name)
return
*
i
;
return
*
i
;
}
}
const
Category
&
Datablock
::
operator
[](
std
::
string_view
name
)
const
{
using
namespace
std
::
literals
;
auto
result
=
get
(
name
);
if
(
result
==
nullptr
)
// throw std::out_of_range("The category with name " + std::string(name) + " does not exist");
{
std
::
unique_lock
lock
(
mLock
);
if
(
not
mNullCategory
)
mNullCategory
.
reset
(
new
Category
(
const_cast
<
Datablock
&>
(
*
this
),
"<null>"
,
nullptr
));
result
=
mNullCategory
.
get
();
}
return
*
result
;
}
Category
*
Datablock
::
get
(
std
::
string_view
name
)
Category
*
Datablock
::
get
(
std
::
string_view
name
)
{
{
std
::
shared_lock
lock
(
mLock
);
std
::
shared_lock
lock
(
mLock
);
...
@@ -1525,6 +1541,11 @@ void Category::drop(const std::string &field)
...
@@ -1525,6 +1541,11 @@ void Category::drop(const std::string &field)
}
}
}
}
const
Row
Category
::
operator
[](
Condition
&&
cond
)
const
{
return
const_cast
<
Category
*>
(
this
)
->
operator
[](
std
::
forward
<
Condition
>
(
cond
));
}
Row
Category
::
operator
[](
Condition
&&
cond
)
Row
Category
::
operator
[](
Condition
&&
cond
)
{
{
Row
result
;
Row
result
;
...
...
src/Cif2PDB.cpp
View file @
3d79278e
This diff is collapsed.
Click to expand it.
src/Structure.cpp
View file @
3d79278e
...
@@ -1373,7 +1373,7 @@ void File::save(const std::filesystem::path &path)
...
@@ -1373,7 +1373,7 @@ void File::save(const std::filesystem::path &path)
out
.
push
(
outFile
);
out
.
push
(
outFile
);
if
(
file
.
extension
()
==
".pdb"
)
if
(
file
.
extension
()
==
".pdb"
)
WritePDBFile
(
out
,
*
this
);
WritePDBFile
(
out
,
data
()
);
else
else
cif
::
File
::
save
(
out
);
cif
::
File
::
save
(
out
);
}
}
...
...
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