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
49dc7335
Unverified
Commit
49dc7335
authored
Jan 25, 2022
by
Maarten L. Hekkelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create non poly from described atoms
parent
755bd78f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
134 additions
and
6 deletions
+134
-6
cmake/VersionString.cmake
+77
-0
include/cif++/Structure.hpp
+8
-0
src/Structure.cpp
+49
-1
src/revision.hpp.in
+0
-5
No files found.
cmake/VersionString.cmake
0 → 100644
View file @
49dc7335
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c) 2021 NKI/AVL, Netherlands Cancer Institute
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# 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
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cmake_minimum_required
(
VERSION 3.15
)
# Create a revision file, containing the current git version info, if any
function
(
write_version_header
)
include
(
GetGitRevisionDescription
)
if
(
NOT
(
GIT-NOTFOUND OR HEAD-HASH-NOTFOUND
))
git_describe_working_tree
(
BUILD_VERSION_STRING --match=build --dirty
)
if
(
BUILD_VERSION_STRING MATCHES
"build-([0-9]+)-g([0-9a-f]+)(-dirty)?"
)
set
(
BUILD_GIT_TAGREF
"
${
CMAKE_MATCH_2
}
"
)
if
(
CMAKE_MATCH_3
)
set
(
BUILD_VERSION_STRING
"
${
CMAKE_MATCH_1
}
*"
)
else
()
set
(
BUILD_VERSION_STRING
"
${
CMAKE_MATCH_1
}
"
)
endif
()
endif
()
else
()
set
(
BUILD_VERSION_STRING
"no git info available"
)
endif
()
include_directories
(
${
CMAKE_BINARY_DIR
}
PRIVATE
)
string
(
TIMESTAMP BUILD_DATE_TIME
"%Y-%m-%dT%H:%M:%SZ"
UTC
)
if
(
ARGC GREATER 0
)
set
(
VAR_PREFIX
"
${
ARGV0
}
"
)
endif
()
file
(
WRITE
"
${
CMAKE_BINARY_DIR
}
/revision.hpp.in"
[[// Generated revision file
#pragma once
#include <ostream>
const char k@VAR_PREFIX@ProjectName[] = "@PROJECT_NAME@";
const char k@VAR_PREFIX@VersionNumber[] = "@PROJECT_VERSION@";
const char k@VAR_PREFIX@VersionGitTag[] = "@BUILD_GIT_TAGREF@";
const char k@VAR_PREFIX@BuildInfo[] = "@BUILD_VERSION_STRING@";
const char k@VAR_PREFIX@BuildDate[] = "@BUILD_DATE_TIME@";
inline void write_version_string(std::ostream &os, bool verbose)
{
os << k@VAR_PREFIX@ProjectName << " version " << k@VAR_PREFIX@VersionNumber << std::endl;
if (verbose)
{
os << "build: " << k@VAR_PREFIX@BuildInfo << ' ' << k@VAR_PREFIX@BuildDate << std::endl;
if (k@VAR_PREFIX@VersionGitTag[0] != 0)
os << "git tag: " << k@VAR_PREFIX@VersionGitTag << std::endl;
}
}
]]
)
configure_file
(
"
${
CMAKE_BINARY_DIR
}
/revision.hpp.in"
"
${
CMAKE_BINARY_DIR
}
/revision.hpp"
@ONLY
)
endfunction
()
include/cif++/Structure.hpp
View file @
49dc7335
...
...
@@ -605,6 +605,14 @@ class Structure
/// \return The newly create asym ID
std
::
string
createNonpoly
(
const
std
::
string
&
entity_id
,
const
std
::
vector
<
mmcif
::
Atom
>
&
atoms
);
/// \brief Create a new NonPolymer struct_asym with atoms constructed from info in \a atom_info, returns asym_id.
/// This method creates new atom records filled with info from the info.
///
/// \param entity_id The entity ID of the new nonpoly
/// \param atoms The array of sets of cif::item data containing the data for the atoms.
/// \return The newly create asym ID
std
::
string
createNonpoly
(
const
std
::
string
&
entity_id
,
std
::
vector
<
std
::
vector
<
cif
::
Item
>>
&
atom_info
);
/// \brief To sort the atoms in order of model > asym-id > res-id > atom-id
/// Will asssign new atom_id's to all atoms. Be carefull
void
sortAtoms
();
...
...
src/Structure.cpp
View file @
49dc7335
...
...
@@ -2088,7 +2088,8 @@ std::string Structure::createNonpoly(const std::string &entity_id, const std::ve
{
auto
atom_id
=
atom_site
.
getUniqueID
(
""
);
auto
&&
[
row
,
inserted
]
=
atom_site
.
emplace
({{
"group_PDB"
,
atom
.
get_property
<
std
::
string
>
(
"group_PDB"
)},
auto
&&
[
row
,
inserted
]
=
atom_site
.
emplace
({
{
"group_PDB"
,
atom
.
get_property
<
std
::
string
>
(
"group_PDB"
)},
{
"id"
,
atom_id
},
{
"type_symbol"
,
atom
.
get_property
<
std
::
string
>
(
"type_symbol"
)},
{
"label_atom_id"
,
atom
.
get_property
<
std
::
string
>
(
"label_atom_id"
)},
...
...
@@ -2117,6 +2118,53 @@ std::string Structure::createNonpoly(const std::string &entity_id, const std::ve
return
asym_id
;
}
std
::
string
Structure
::
createNonpoly
(
const
std
::
string
&
entity_id
,
std
::
vector
<
std
::
vector
<
cif
::
Item
>>
&
atom_info
)
{
using
namespace
cif
::
literals
;
cif
::
Datablock
&
db
=
*
mFile
.
impl
().
mDb
;
auto
&
struct_asym
=
db
[
"struct_asym"
];
std
::
string
asym_id
=
struct_asym
.
getUniqueID
();
struct_asym
.
emplace
({{
"id"
,
asym_id
},
{
"pdbx_blank_PDB_chainid_flag"
,
"N"
},
{
"pdbx_modified"
,
"N"
},
{
"entity_id"
,
entity_id
},
{
"details"
,
"?"
}});
std
::
string
comp_id
=
db
[
"pdbx_entity_nonpoly"
].
find1
<
std
::
string
>
(
"entity_id"
_key
==
entity_id
,
"comp_id"
);
auto
&
atom_site
=
db
[
"atom_site"
];
auto
&
res
=
mNonPolymers
.
emplace_back
(
*
this
,
comp_id
,
asym_id
);
for
(
auto
&
atom
:
atom_info
)
{
auto
atom_id
=
atom_site
.
getUniqueID
(
""
);
atom
.
insert
(
atom
.
end
(),
{
{
"group_PDB"
,
"HETATM"
},
{
"id"
,
atom_id
},
{
"label_comp_id"
,
comp_id
},
{
"label_asym_id"
,
asym_id
},
{
"label_seq_id"
,
""
},
{
"label_entity_id"
,
entity_id
},
{
"auth_comp_id"
,
comp_id
},
{
"auth_asym_id"
,
asym_id
},
{
"auth_seq_id"
,
""
},
{
"pdbx_PDB_model_num"
,
1
},
{
"label_alt_id"
,
""
}
});
auto
&&
[
row
,
inserted
]
=
atom_site
.
emplace
(
atom
.
begin
(),
atom
.
end
());
auto
&
newAtom
=
mAtoms
.
emplace_back
(
std
::
make_shared
<
Atom
::
AtomImpl
>
(
db
,
atom_id
,
row
));
res
.
addAtom
(
newAtom
);
}
return
asym_id
;
}
void
Structure
::
cleanupEmptyCategories
()
{
using
namespace
cif
::
literals
;
...
...
src/revision.hpp.in
deleted
100644 → 0
View file @
755bd78f
const char kRevision[] = R"(
lib@PROJECT_NAME@-version: @PROJECT_VERSION@
@BUILD_VERSION_STRING@
Date: @BUILD_DATE_TIME@
)";
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