IMP  2.4.0
The Integrative Modeling Platform
Public Types | Public Member Functions | List of all members
IMP::atom::Selection Class Reference

Select hierarchy particles identified by the biological name. More...

#include <IMP/atom/Selection.h>

+ Inheritance diagram for IMP::atom::Selection:

Detailed Description

Select hierarchy particles identified by the biological name.

Given an atom.Hierarchy (or atom.Hierarchies) this will select a subset of the child particles by the biological name.

For example (in Python)

Selection(hierarchy=h, molecule="myprotein", terminus=Selection.C)
Selection(hierarchy=h, molecule="myprotein", residue_index=133)
Selection(hierarchy=h, molecule="myprotein", residue_indexes=range(133,138))

each get the C-terminus of the protein "myprotein" (assuming the last residue index is 133, and the residues are leaves, containing no atoms). (In C++, use one of the other constructors, then call one or more of the set_* methods.)

Selection objects can be combined using basic set operations (union, intersection, difference, symmetric difference). In Python the equivalent operators (|, &, -, ^ respectively) can be used (the similar in-place |=, &=, -= and ^= operators also work). This requires that all of the objects being combined use the same hierarchy or hierarchies. For example (in Python)

Selection(hierarchy=h, residue_type=IMP.atom.ASP) \
- (Selection(hierarchy=h, atom_type=IMP.atom.AT_CG)
| Selection(hierarchy=h, terminus=Selection.C))

selects all atoms in ASP residues except for CG or at the C-terminus. The resulting Selection makes a copy of the Selections it was combined from, so changing the original Selections does not change that Selection.

Note
Only representational particles are selected - that is, those with x,y,z coordinates. The highest resolution representation that fits is returned. If you want lower resolution, use the resolution parameter to select the desired resolution (pass a very large number to get the coarsest representation).

Definition at line 62 of file Selection.h.

Public Types

enum  Terminus { NONE, C, N }
 

Public Member Functions

 Selection (Hierarchy hierarchy=None, Hierarchies hierarchies=[], Strings molecules=[], Ints residue_indexes=[], Strings chains=[], AtomTypes atom_types=[], ResidueTypes residue_types=[], Strings domains=[], double resolution=0, std::string molecule=None, int residue_index=None, std::string chain=None, AtomType atom_type=None, ResidueType residue_type=None, HierarchyType hierarchy_type=None, Terminus terminus=None, std::string domain=None, core::ParticleType particle_type=None, core::ParticleTypes particle_types=[], int copy_index=-1, Ints copy_indexs=[], int state_index=-1, Ints state_indexes=[])
 
 Selection (Hierarchy h)
 
 Selection (kernel::Particle *h)
 
 Selection (kernel::Model *m, const kernel::ParticleIndexes &pis)
 
 Selection (const Hierarchies &h)
 
 Selection (const kernel::ParticlesTemp &h)
 
Selection create_clone ()
 Make a clone of this Selection. More...
 
Hierarchies get_hierarchies () const
 Return the hierarchies that the Selection was constructed with. More...
 
kernel::ParticleIndexes get_selected_particle_indexes () const
 Get the indexes of the selected particles. More...
 
kernel::ParticlesTemp get_selected_particles () const
 Get the selected particles. More...
 
 operator ParticleIndexes () const
 
 operator ParticlesTemp () const
 
void set_atom_type (AtomType types)
 Select atoms with only the passed type. More...
 
void set_atom_types (AtomTypes types)
 Select atoms whose types are in the list, eg AT_CA. More...
 
void set_chain (char c)
 
void set_chain_id (std::string c)
 Select with the passed chain id. More...
 
void set_chain_ids (Strings chains)
 Select particles in chains with the given ids. More...
 
void set_copy_index (unsigned int copy)
 Select elements with Copy::get_copy_index() that match. More...
 
void set_copy_indexes (Ints copies)
 Select elements with Copy::get_copy_index() that are in the list. More...
 
void set_difference (const Selection &s)
 Select elements that are in this Selection but not the passed one. More...
 
void set_domain (std::string name)
 Select only the single domain with that name. More...
 
void set_domains (Strings names)
 Select domains with the specified names. More...
 
void set_hierarchy_types (Ints types)
 
void set_intersection (const Selection &s)
 Select elements that are in both this Selection and the passed one. More...
 
void set_molecule (std::string mol)
 Select a molecule with the passed name. More...
 
void set_molecules (Strings mols)
 Select based on the molecule name. More...
 
void set_particle_type (core::ParticleType t)
 Select elements that match the core::ParticleType. More...
 
void set_particle_types (core::ParticleTypes t)
 Select elements that match the core::ParticleType. More...
 
void set_residue_index (int i)
 Select only residues with the passed index. More...
 
void set_residue_indexes (Ints indexes)
 Select residues whose indexes are in the passed list. More...
 
void set_residue_type (ResidueType type)
 Select only residues with the passed type. More...
 
void set_residue_types (ResidueTypes types)
 Select residues whose types are in the list. More...
 
void set_resolution (double r)
 Select at a Representation node with a resolution close to r. More...
 
void set_state_index (int state)
 Select State with the passed index. More...
 
void set_state_indexes (Ints states)
 Select State with the passed indexes. More...
 
void set_symmetric_difference (const Selection &s)
 Select elements that are in this Selection or the passed one but not both. More...
 
void set_terminus (Terminus t)
 Select the leaf particles at the N or C terminus. More...
 
void set_union (const Selection &s)
 Select elements that are in either this Selection or the passed one. More...
 
void show (std::ostream &out=std::cout) const
 

Constructor & Destructor Documentation

IMP::atom::Selection::Selection ( Hierarchy  hierarchy = None,
Hierarchies  hierarchies = [],
Strings  molecules = [],
Ints  residue_indexes = [],
Strings  chains = [],
AtomTypes  atom_types = [],
ResidueTypes  residue_types = [],
Strings  domains = [],
double  resolution = 0,
std::string  molecule = None,
int  residue_index = None,
std::string  chain = None,
AtomType  atom_type = None,
ResidueType  residue_type = None,
HierarchyType  hierarchy_type = None,
Terminus  terminus = None,
std::string  domain = None,
core::ParticleType  particle_type = None,
core::ParticleTypes  particle_types = [],
int  copy_index = -1,
Ints  copy_indexs = [],
int  state_index = -1,
Ints  state_indexes = [] 
)

When using Python, you have much more control over construction due to the use of keyword arguments. You can provide any subset of the arguments (although one of hierarchy or hierarchies must be provided).

Member Function Documentation

Selection IMP::atom::Selection::create_clone ( )

Make a clone of this Selection.

The clone will initially contain the same predicates as the original, but adding new predicates to either Selection will not affect the other (as opposed to simply copy the Selection object, where both copies share the same list of predicates).

Hierarchies IMP::atom::Selection::get_hierarchies ( ) const

Return the hierarchies that the Selection was constructed with.

kernel::ParticleIndexes IMP::atom::Selection::get_selected_particle_indexes ( ) const

Get the indexes of the selected particles.

kernel::ParticlesTemp IMP::atom::Selection::get_selected_particles ( ) const

Get the selected particles.

void IMP::atom::Selection::set_atom_type ( AtomType  types)

Select atoms with only the passed type.

void IMP::atom::Selection::set_atom_types ( AtomTypes  types)

Select atoms whose types are in the list, eg AT_CA.

void IMP::atom::Selection::set_chain ( char  c)
Deprecated:
As of IMP release 2.2. See the IMP Deprecation Policy for more information about deprecation in IMP. Pass a string

Definition at line 170 of file Selection.h.

+ Here is the call graph for this function:

void IMP::atom::Selection::set_chain_id ( std::string  c)

Select with the passed chain id.

void IMP::atom::Selection::set_chain_ids ( Strings  chains)

Select particles in chains with the given ids.

void IMP::atom::Selection::set_copy_index ( unsigned int  copy)

Select elements with Copy::get_copy_index() that match.

void IMP::atom::Selection::set_copy_indexes ( Ints  copies)

Select elements with Copy::get_copy_index() that are in the list.

void IMP::atom::Selection::set_difference ( const Selection s)

Select elements that are in this Selection but not the passed one.

Note
both Selections must be on the same Hierarchy or Hierarchies
void IMP::atom::Selection::set_domain ( std::string  name)

Select only the single domain with that name.

void IMP::atom::Selection::set_domains ( Strings  names)

Select domains with the specified names.

void IMP::atom::Selection::set_hierarchy_types ( Ints  types)

Select only particles whose type matches the passed type, eg Molecule, Fragment, Residue etc. See GetByType for how to specify the types. Ints are used to make swig happy.

void IMP::atom::Selection::set_intersection ( const Selection s)

Select elements that are in both this Selection and the passed one.

Note
both Selections must be on the same Hierarchy or Hierarchies
void IMP::atom::Selection::set_molecule ( std::string  mol)

Select a molecule with the passed name.

void IMP::atom::Selection::set_molecules ( Strings  mols)

Select based on the molecule name.

void IMP::atom::Selection::set_particle_type ( core::ParticleType  t)

Select elements that match the core::ParticleType.

void IMP::atom::Selection::set_particle_types ( core::ParticleTypes  t)

Select elements that match the core::ParticleType.

void IMP::atom::Selection::set_residue_index ( int  i)

Select only residues with the passed index.

void IMP::atom::Selection::set_residue_indexes ( Ints  indexes)

Select residues whose indexes are in the passed list.

void IMP::atom::Selection::set_residue_type ( ResidueType  type)

Select only residues with the passed type.

void IMP::atom::Selection::set_residue_types ( ResidueTypes  types)

Select residues whose types are in the list.

void IMP::atom::Selection::set_resolution ( double  r)

Select at a Representation node with a resolution close to r.

Definition at line 136 of file Selection.h.

void IMP::atom::Selection::set_state_index ( int  state)

Select State with the passed index.

Definition at line 138 of file Selection.h.

void IMP::atom::Selection::set_state_indexes ( Ints  states)

Select State with the passed indexes.

void IMP::atom::Selection::set_symmetric_difference ( const Selection s)

Select elements that are in this Selection or the passed one but not both.

Note
both Selections must be on the same Hierarchy or Hierarchies
void IMP::atom::Selection::set_terminus ( Terminus  t)

Select the leaf particles at the N or C terminus.

If the leaf particles are atoms, a terminus is simply an N or C atom where its parent is also a terminus particle. Otherwise, a terminus particle is the first (for N) or last (for C) child of its parent.

void IMP::atom::Selection::set_union ( const Selection s)

Select elements that are in either this Selection or the passed one.

Note
both Selections must be on the same Hierarchy or Hierarchies

The documentation for this class was generated from the following file: