12 #include <IMP/atom/atom_config.h>
16 #include "internal/pdb.h"
23 #include <IMP/kernel/internal/utility.h>
24 #include <boost/format.hpp>
26 IMPATOM_BEGIN_NAMESPACE
43 virtual bool get_is_selected(
const std::string &pdb_line)
const = 0;
56 return (internal::atom_alt_loc_indicator(pdb_line) ==
' ' ||
57 internal::atom_alt_loc_indicator(pdb_line) ==
'A');
69 return (NonAlternativePDBSelector::get_is_selected(pdb_line) &&
70 internal::is_ATOM_rec(pdb_line));
82 if (!NonAlternativePDBSelector::get_is_selected(pdb_line))
return false;
83 const std::string type = internal::atom_type(pdb_line);
84 return (type[1] ==
'C' && type[2] ==
'A' && type[3] ==
' ');
96 if (!NonAlternativePDBSelector::get_is_selected(pdb_line))
return false;
97 const std::string type = internal::atom_type(pdb_line);
98 return (type[1] ==
'C' && type[2] ==
'B' && type[3] ==
' ');
110 if (!NonAlternativePDBSelector::get_is_selected(pdb_line))
return false;
111 const std::string type = internal::atom_type(pdb_line);
112 return (type[1] ==
'C' && type[2] ==
' ' && type[3] ==
' ');
124 if (!NonAlternativePDBSelector::get_is_selected(pdb_line))
return false;
125 const std::string type = internal::atom_type(pdb_line);
126 return (type[1] ==
'N' && type[2] ==
' ' && type[3] ==
' ');
137 return (
true || pdb_line.empty());
146 if (!NonAlternativePDBSelector::get_is_selected(pdb_line)) {
149 for (
int i = 0; i < (int)chains_.length(); i++) {
150 if (internal::atom_chain_id(pdb_line) == chains_[i])
return true;
157 std::string name =
"ChainPDBSelector%1%")
171 if (!NonAlternativePDBSelector::get_is_selected(pdb_line)) {
174 const std::string res_name = internal::atom_residue_name(pdb_line);
175 return ((res_name[0] ==
'H' && res_name[1] ==
'O' && res_name[2] ==
'H') ||
176 (res_name[0] ==
'D' && res_name[1] ==
'O' && res_name[2] ==
'D'));
183 bool is_hydrogen(std::string pdb_line)
const;
190 if (!NonAlternativePDBSelector::get_is_selected(pdb_line))
return false;
191 return is_hydrogen(pdb_line);
202 if (!NonAlternativePDBSelector::get_is_selected(pdb_line)) {
205 return (!ws_->get_is_selected(pdb_line) && !hs_->get_is_selected(pdb_line));
224 if (!NonAlternativePDBSelector::get_is_selected(pdb_line)) {
227 return (!ws_->get_is_selected(pdb_line));
244 if (!NonWaterNonHydrogenPDBSelector::get_is_selected(pdb_line))
246 const std::string type = internal::atom_type(pdb_line);
247 return ((type[1] ==
'N' && type[2] ==
' ' && type[3] ==
' ') ||
248 (type[1] ==
'C' && type[2] ==
'A' && type[3] ==
' ') ||
249 (type[1] ==
'C' && type[2] ==
' ' && type[3] ==
' ') ||
250 (type[1] ==
'O' && type[2] ==
' ' && type[3] ==
' '));
262 if (!NonAlternativePDBSelector::get_is_selected(pdb_line))
return false;
263 const std::string type = internal::atom_type(pdb_line);
264 return (type[1] ==
'P' && type[2] ==
' ' && type[3] ==
' ');
281 return a_->get_is_selected(pdb_line) && b_->get_is_selected(pdb_line);
285 :
PDBSelector(
"AndPDBSelector%1%"), a_(a), b_(b) {}
299 return a_->get_is_selected(pdb_line) || b_->get_is_selected(pdb_line);
317 return !a_->get_is_selected(pdb_line);
345 inline PDBSelector *get_default_pdb_selector() {
346 return new NonWaterPDBSelector();
352 IMPATOMEXPORT Hierarchy
354 PDBSelector *selector = get_default_pdb_selector(),
355 bool select_first_model =
true
358 bool no_radii =
false
377 IMPATOMEXPORT
void read_pdb(base::TextInput input,
int model, Hierarchy h);
381 IMPATOMEXPORT Hierarchies
383 PDBSelector *selector = get_default_pdb_selector()
409 IMPATOMEXPORT
void write_pdb(
const Selection &mhd, base::TextOutput out,
410 unsigned int model = 1);
420 base::TextOutput out,
421 unsigned int model = 1);
426 base::TextOutput out);
434 IMPATOMEXPORT std::string get_pdb_string(
436 ResidueType rt = atom::ALA,
char chain =
' ',
int res_index = 1,
437 char res_icode =
' ',
double occpancy = 1.00,
double tempFactor = 0.00,
447 IMPATOMEXPORT std::string get_pdb_conect_record_string(
int,
int);
457 std::string filename_;
463 std::string filename);
467 virtual void do_update(
unsigned int call) IMP_OVERRIDE;
472 IMPATOM_END_NAMESPACE
Select non water and non hydrogen atoms.
bool get_is_selected(const std::string &pdb_line) const
Return true if the line should be processed.
ChainPDBSelector(const std::string &chains, std::string name="ChainPDBSelector%1%")
The chain id can be any character in chains.
Define the elements used in IMP.
Hierarchies read_multimodel_pdb(base::TextInput input, kernel::Model *model, PDBSelector *selector=get_default_pdb_selector())
void write_pdb(const Selection &mhd, base::TextOutput out, unsigned int model=1)
bool get_is_selected(const std::string &pdb_line) const
Return true if the line should be processed.
bool get_is_selected(const std::string &pdb_line) const
Return true if the line should be processed.
Select all backbone (N,CA,C,O) ATOM records.
Select all non-water ATOM and HETATMrecords.
virtual void do_update(unsigned int)
Select all P (= phosphate) ATOM records.
Select atoms which are selected by both selectors.
A smart pointer to a ref-counted Object that is a class memeber.
bool get_is_selected(const std::string &pdb_line) const
Return true if the line should be processed.
Shared optimizer state that is invoked upon commitment of new coordinates.
Select all N ATOM records.
void write_multimodel_pdb(const Hierarchies &mhd, base::TextOutput out)
virtual ModelObjectsTemp do_get_inputs() const
bool get_is_selected(const std::string &pdb_line) const
Return true if the line should be processed.
bool get_is_selected(const std::string &pdb_line) const
Return true if the line should be processed.
Select all C (not CA or CB) ATOM records.
bool get_is_selected(const std::string &pdb_line) const
Return true if the line should be processed.
Decorator for helping deal with a hierarchy of molecules.
bool get_is_selected(const std::string &pdb_line) const
Return true if the line should be processed.
Select all CB ATOM records.
Select all ATOM and HETATM records which are not alternatives.
Select all non-alternative ATOM records.
bool get_is_selected(const std::string &pdb_line) const
Return true if the line should be processed.
bool get_is_selected(const std::string &pdb_line) const
Return true if the line should be processed.
Object(std::string name)
Construct an object with the given name.
void write_pdb_of_c_alphas(const Selection &mhd, base::TextOutput out, unsigned int model=1)
Write a hierarchy to a pdb as C_alpha atoms.
bool get_is_selected(const std::string &pdb_line) const
Return true if the line should be processed.
bool get_is_selected(const std::string &pdb_line) const
Return true if the line should be processed.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
bool get_is_selected(const std::string &pdb_line) const
Return true if the line should be processed.
Storage of a model, its restraints, constraints and particles.
Common base class for heavy weight IMP objects.
Classes to handle individual model particles.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
Defines a selector that will pick every ATOM and HETATM record.
Various important macros for implementing decorators.
Select atoms which not selected by a given selector.
bool get_is_selected(const std::string &pdb_line) const
Return true if the line should be processed.
Select all non-water non-alternative ATOM and HETATM records.
Select atoms which are selected by either selector.
bool get_is_selected(const std::string &pdb_line) const
Return true if the line should be processed.
bool get_is_selected(const std::string &pdb_line) const
Return true if the line should be processed.
Handling of file input/output.
bool get_is_selected(const std::string &pdb_line) const
Return true if the line should be processed.
Select all hydrogen ATOM and HETATM records.
Select all CA ATOM records.
void read_pdb(base::TextInput input, int model, Hierarchy h)
Element
The various elements currently supported/known.
Select which atoms to read from a PDB file.
A set of useful functionality on IMP::atom::Hierarchy decorators.
Select all ATOM and HETATMrecords with the given chain ids.
Class for storing model, its restraints, constraints, and particles.