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
3e1dc6d2
Commit
3e1dc6d2
authored
13 years ago
by
Bienchen
Browse files
Options
Downloads
Patches
Plain Diff
First changes in MMCifParser
parent
aac17c6c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
modules/io/pymod/export_mmcif_io.cc
+38
-0
38 additions, 0 deletions
modules/io/pymod/export_mmcif_io.cc
modules/io/src/mol/mmcif_reader.cc
+12
-29
12 additions, 29 deletions
modules/io/src/mol/mmcif_reader.cc
modules/io/src/mol/mmcif_reader.hh
+6
-8
6 additions, 8 deletions
modules/io/src/mol/mmcif_reader.hh
with
56 additions
and
37 deletions
modules/io/pymod/export_mmcif_io.cc
0 → 100644
+
38
−
0
View file @
3e1dc6d2
//------------------------------------------------------------------------------
// This file is part of the OpenStructure project <www.openstructure.org>
//
// Copyright (C) 2008-2011 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
//------------------------------------------------------------------------------
#include
<boost/python.hpp>
using
namespace
boost
::
python
;
#include
<ost/io/mol/io_profile.hh>
#include
<ost/io/mol/mmcif_reader.hh>
using
namespace
ost
;
using
namespace
ost
::
io
;
using
namespace
ost
::
mol
;
void
export_mmcif_io
()
{
class_
<
MMCifParser
,
boost
::
noncopyable
>
(
"MMCifParser"
,
init
<
const
String
&
,
EntityHandle
&
,
const
IOProfile
&>
())
.
def
(
"Parse"
,
&
MMCifParser
::
Parse
)
.
def
(
"SetRestrictChains"
,
&
MMCifParser
::
SetRestrictChains
)
.
add_property
(
"restrict_chains"
,
make_function
(
&
MMCifParser
::
GetRestrictChains
,
return_value_policy
<
copy_const_reference
>
()),
&
MMCifParser
::
SetRestrictChains
)
;
}
This diff is collapsed.
Click to expand it.
modules/io/src/mol/mmcif_reader.cc
+
12
−
29
View file @
3e1dc6d2
...
...
@@ -53,7 +53,6 @@ void MMCifParser::Init()
warned_name_mismatch_
=
false
;
category_
=
DONT_KNOW
;
chain_count_
=
0
;
record_type_
=
""
;
atom_count_
=
0
;
residue_count_
=
0
;
auth_chain_id_
=
false
;
...
...
@@ -72,7 +71,6 @@ void MMCifParser::ClearState()
residue_count_
=
0
;
atom_count_
=
0
;
category_
=
DONT_KNOW
;
record_type_
=
""
;
warned_name_mismatch_
=
false
;
}
...
...
@@ -170,11 +168,6 @@ bool MMCifParser::ParseAtomIdent(const std::vector<StringRef>& columns,
StringRef
&
atom_name
,
char
&
alt_loc
)
{
// is checking really neccessary? just by using OnBeginData, enough columns
// should be available!
if
(
!
this
->
EnsureEnoughColumns
(
columns
,
12
))
{
return
false
;
}
// ATOM name
atom_name
=
columns
[
indices_
[
LABEL_ATOM_ID
]];
if
(
profile_
.
calpha_only
)
{
// unit test profile
...
...
@@ -187,12 +180,12 @@ bool MMCifParser::ParseAtomIdent(const std::vector<StringRef>& columns,
chain_name
=
columns
[
indices_
[
AUTH_ASYM_ID
]].
str
();
}
else
{
chain_name
=
columns
[
indices_
[
LABEL_ASYM_ID
]].
str
();
if
(
restrict_chains_
.
size
()
>
0
&&
// unit test
restrict_chains_
.
find
(
chain_name
)
==
String
::
npos
)
{
// unit test
return
false
;
}
}
if
(
restrict_chains_
.
size
()
>
0
&&
// unit test
restrict_chains_
.
find
(
chain_name
)
==
String
::
npos
)
{
// unit test
return
false
;
}
std
::
pair
<
bool
,
int
>
a_num
=
this
->
TryGetInt
(
columns
[
indices_
[
ID
]],
"_atom_site.id"
,
profile_
.
fault_tolerant
);
// unit test
...
...
@@ -236,7 +229,7 @@ void MMCifParser::ParseAndAddAtom(const std::vector<StringRef>& columns)
alt_loc
))
{
return
;
}
Real
occ
,
temp
;
Real
occ
=
1.00
f
,
temp
=
0
;
geom
::
Vec3
apos
;
for
(
int
i
=
CARTN_X
;
i
<=
CARTN_Z
;
++
i
)
{
...
...
@@ -253,14 +246,10 @@ void MMCifParser::ParseAndAddAtom(const std::vector<StringRef>& columns)
if
(
indices_
[
OCCUPANCY
]
!=
-
1
)
{
// unit test
occ
=
this
->
TryGetReal
(
columns
[
indices_
[
OCCUPANCY
]],
"atom_site.occupancy"
);
}
else
{
occ
=
1.00
f
;
}
if
(
indices_
[
B_ISO_OR_EQUIV
]
!=
-
1
)
{
// unit test
temp
=
this
->
TryGetReal
(
columns
[
indices_
[
B_ISO_OR_EQUIV
]],
"atom_site.B_iso_or_equiv"
);
}
else
{
temp
=
0
;
}
// determine element
...
...
@@ -370,20 +359,14 @@ void MMCifParser::ParseAndAddAtom(const std::vector<StringRef>& columns)
ah
=
editor
.
InsertAtom
(
curr_residue_
,
aname
,
apos
,
s_ele
);
++
atom_count_
;
}
if
(
indices_
[
B_ISO_OR_EQUIV
]
!=
-
1
)
{
// unit test
ah
.
SetBFactor
(
temp
);
}
if
(
indices_
[
OCCUPANCY
]
!=
-
1
)
{
// unit test
ah
.
SetOccupancy
(
occ
);
}
ah
.
SetBFactor
(
temp
);
ah
.
SetOccupancy
(
occ
);
// record type
if
(
indices_
[
GROUP_PDB
]
!=
-
1
)
{
record_type_
=
columns
[
indices_
[
GROUP_PDB
]].
str
();
}
else
{
record_type_
=
"ATOM"
;
}
ah
.
SetHetAtom
(
record_type_
[
0
]
==
'H'
);
ah
.
SetHetAtom
(
indices_
[
GROUP_PDB
]
==
-
1
?
false
:
columns
[
indices_
[
GROUP_PDB
]][
0
]
==
'H'
);
}
void
MMCifParser
::
OnDataRow
(
const
StarLoopDesc
&
header
,
...
...
This diff is collapsed.
Click to expand it.
modules/io/src/mol/mmcif_reader.hh
+
6
−
8
View file @
3e1dc6d2
...
...
@@ -29,13 +29,6 @@
namespace
ost
{
namespace
io
{
/// \enum categories of the mmcif format
typedef
enum
{
ATOM_SITE
,
DONT_KNOW
}
MMCifCategory
;
/// \brief reader for the mmcif file format
///
/// \section mmcif_format mmcif format description/ coverage
...
...
@@ -183,6 +176,12 @@ private:
GROUP_PDB
///< record name
}
AtomSiteItems
;
/// \enum categories of the mmcif format
typedef
enum
{
ATOM_SITE
,
DONT_KNOW
}
MMCifCategory
;
// members
MMCifCategory
category_
;
int
indices_
[
MAX_ITEMS_IN_ROW
];
///< map items to values in loops
...
...
@@ -196,7 +195,6 @@ private:
int
residue_count_
;
int
atom_count_
;
bool
warned_name_mismatch_
;
String
record_type_
;
bool
go_on_
;
///< flow control within the parser hooks
//from pdbdreader
//entity als member, fill in ondatarow
...
...
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