IMP
2.1.1
The Integrative Modeling Platform
IMP Mainpage
All IMP Modules
Related Pages
Modules
Namespaces
Classes
Files
Examples
Indexes
File List
File Members
mol2.h
Go to the documentation of this file.
1
/**
2
* \file IMP/atom/mol2.h
3
* \brief Functions to read mol2s
4
*
5
* Copyright 2007-2013 IMP Inventors. All rights reserved.
6
*
7
*/
8
9
#ifndef IMPATOM_MOL_2_H
10
#define IMPATOM_MOL_2_H
11
12
#include <IMP/atom/atom_config.h>
13
#include "
Hierarchy.h
"
14
#include "
atom_macros.h
"
15
#include "internal/mol2.h"
16
17
#include <
IMP/kernel/Model.h
>
18
#include <
IMP/kernel/Particle.h
>
19
#include <
IMP/base/file.h
>
20
21
IMPATOM_BEGIN_NAMESPACE
22
23
//! A base class for choosing which Mol2 atoms to read
24
/**
25
*/
26
class
IMPATOMEXPORT
Mol2Selector
:
public
IMP::base::Object
{
27
public
:
28
Mol2Selector
() :
Object
(
"Mol2Selector%1%"
) {}
29
virtual
bool
get_is_selected(
const
std::string& atom_line)
const
= 0;
30
virtual
~
Mol2Selector
();
31
};
32
33
//! Read all atoms
34
class
AllMol2Selector
:
public
Mol2Selector
{
35
public
:
36
IMP_MOL2_SELECTOR
(
AllMol2Selector
,
return
(
true
|| mol2_line.empty()),
37
out <<
""
);
38
};
39
40
//! Defines a selector that will pick only non-hydrogen atoms
41
class
IMPATOMEXPORT
NonHydrogenMol2Selector
:
public
Mol2Selector
{
42
public
:
43
IMP_MOL2_SELECTOR
(
NonHydrogenMol2Selector
,
44
String
atom_type = internal::pick_mol2atom_type(mol2_line);
45
return
(atom_type[0] !=
'H'
), out <<
""
);
46
};
47
48
/** @name Mol2 IO
49
50
\imp can also read and write Mol2 files. As with read_pdb(), selector
51
objects are used to determine which atoms are read.
52
53
The read function produces a hierarchy containing the molecule. The write
54
hierarchy writes all the Residue types in the hierarchy to the file.
55
@{
56
*/
57
//! Create a hierarchy from a Mol2 file.
58
IMPATOMEXPORT
Hierarchy
read_mol2
(
base::TextInput
mol2_file,
59
kernel::Model
* model,
60
Mol2Selector
* mol2sel =
nullptr
);
61
62
//! Write a lignand hierarchy as a mol2 file
63
/** For now, this has to be a hierarchy created by read_mol2()
64
*/
65
IMPATOMEXPORT
void
write_mol2
(
Hierarchy
rhd,
base::TextOutput
file_name);
66
67
/** @} */
68
69
IMPATOM_END_NAMESPACE
70
71
#endif
/* IMPATOM_MOL_2_H */
IMP::atom::AllMol2Selector
Read all atoms.
Definition:
mol2.h:34
IMP::base::TextInput
Definition:
base/file.h:86
IMP_MOL2_SELECTOR
#define IMP_MOL2_SELECTOR(Name, selected, show)
Define the basic things you need for a mol2 selector.
Definition:
atom_macros.h:45
IMP::base::Object::Object
Object()
Hierarchy.h
Decorator for helping deal with a hierarchy of molecules.
IMP::atom::Hierarchy
The standard decorator for manipulating molecular structures.
Definition:
atom/Hierarchy.h:196
IMP::atom::read_mol2
Hierarchy read_mol2(base::TextInput mol2_file, kernel::Model *model, Mol2Selector *mol2sel=nullptr)
Create a hierarchy from a Mol2 file.
IMP::atom::write_mol2
void write_mol2(Hierarchy rhd, base::TextOutput file_name)
Write a lignand hierarchy as a mol2 file.
Model.h
Storage of a model, its restraints, constraints and particles.
IMP::base::Object
Common base class for heavy weight IMP objects.
Definition:
base/declare_Object.h:123
Particle.h
Classes to handle individual model particles.
IMP::atom::NonHydrogenMol2Selector
Defines a selector that will pick only non-hydrogen atoms.
Definition:
mol2.h:41
atom_macros.h
Various important macros for implementing decorators.
IMP::base::TextOutput
Definition:
base/file.h:47
file.h
Handling of file input/output.
IMP::String
std::string String
Basic string value.
Definition:
base/types.h:44
IMP::atom::Mol2Selector
A base class for choosing which Mol2 atoms to read.
Definition:
mol2.h:26
IMP::kernel::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
kernel/declare_Model.h:72