Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
openstructure
Commits
d7e5fc61
Commit
d7e5fc61
authored
1 year ago
by
Bienchen
Browse files
Options
Downloads
Patches
Plain Diff
mmCIF writer unitest, entities start at 1
parent
03fe60b8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/io/tests/CMakeLists.txt
+1
-0
1 addition, 0 deletions
modules/io/tests/CMakeLists.txt
modules/io/tests/test_mmcif_writer.cc
+84
-0
84 additions, 0 deletions
modules/io/tests/test_mmcif_writer.cc
with
85 additions
and
0 deletions
modules/io/tests/CMakeLists.txt
+
1
−
0
View file @
d7e5fc61
...
@@ -15,6 +15,7 @@ set(OST_IO_UNIT_TESTS
...
@@ -15,6 +15,7 @@ set(OST_IO_UNIT_TESTS
tests.cc
tests.cc
test_star_parser.cc
test_star_parser.cc
test_mmcif_reader.cc
test_mmcif_reader.cc
test_mmcif_writer.cc
test_mmcif_info.cc
test_mmcif_info.cc
test_io_img.cc
test_io_img.cc
test_exceptions.cc
test_exceptions.cc
...
...
This diff is collapsed.
Click to expand it.
modules/io/tests/test_mmcif_writer.cc
0 → 100644
+
84
−
0
View file @
d7e5fc61
//------------------------------------------------------------------------------
// This file is part of the OpenStructure project <www.openstructure.org>
//
// Copyright (C) 2008-2024 by the OpenStructure authors
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the Free
// Software Foundation; either version 3.0 of the License, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
// details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//------------------------------------------------------------------------------
#define BOOST_TEST_DYN_LINK
#include
<boost/test/unit_test.hpp>
#include
<ost/platform.hh>
#include
<ost/conop/conop.hh>
#include
<ost/mol/mol.hh>
#include
<ost/io/mol/mmcif_writer.hh>
using
namespace
ost
;
using
namespace
ost
::
io
;
BOOST_AUTO_TEST_SUITE
(
io
);
conop
::
CompoundLibPtr
SetDefaultCompoundLib
()
{
// return NULL if not successful, else return newly set default lib
// REQ: OST_ROOT to be set
char
*
ost_root
=
getenv
(
"OST_ROOT"
);
if
(
!
ost_root
)
return
conop
::
CompoundLibPtr
();
SetPrefixPath
(
ost_root
);
String
lib_path
=
GetSharedDataPath
()
+
"/compounds.chemlib"
;
conop
::
CompoundLibPtr
compound_lib
=
conop
::
CompoundLib
::
Load
(
lib_path
);
if
(
compound_lib
)
{
conop
::
Conopology
::
Instance
().
SetDefaultLib
(
compound_lib
);
}
return
compound_lib
;
}
BOOST_AUTO_TEST_CASE
(
mmcif_writer_entity1
)
{
BOOST_TEST_MESSAGE
(
" Running mmcif_writer_entity1 tests..."
);
/*
Make sure molecular entities in mmCIF files written by OST start counting
at ID 1. This is not enforced by the mmCIF format definition, but common
practice.
*/
// Create tiny entity
mol
::
EntityHandle
ent
=
mol
::
CreateEntity
();
mol
::
XCSEditor
edi
=
ent
.
EditXCS
();
mol
::
ChainHandle
ch
=
edi
.
InsertChain
(
"A"
);
mol
::
ResidueHandle
r
=
edi
.
AppendResidue
(
ch
,
"GLY"
);
mol
::
AtomHandle
a
=
edi
.
InsertAtom
(
r
,
"CA"
,
geom
::
Vec3
(
32.0
,
-
128.0
,
-
2.5
),
"C"
);
a
.
SetOccupancy
(
1.0
);
a
.
SetBFactor
(
128.0
);
edi
.
SetChainType
(
ch
,
mol
::
CHAINTYPE_UNKNOWN
);
// Create mmCIF stream
MMCifWriter
writer
;
writer
.
SetStructure
(
ent
,
SetDefaultCompoundLib
(),
false
);
std
::
stringstream
out
;
writer
.
Write
(
"test"
,
out
);
// Check if entity starts with 1, either by reading mmCIF or "grep"
String
s
=
out
.
str
();
BOOST_CHECK_EQUAL
(
s
.
substr
(
0
,
53
),
"data_test
\n
loop_
\n
_entity.id
\n
_entity.type
\n
1 non-polymer"
);
BOOST_TEST_MESSAGE
(
" done."
);
}
BOOST_AUTO_TEST_SUITE_END
();
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment