MoleculeSelector
MoleculeSelector(self , mol= None )
A helper to create selections for Molecules and AtomArrays.
The selection (self.mask) is not computed or returned until the evaluate_on_array
method is called. Until then methods are stored for later evaluation.
Parameters
mol
Molecule
The molecule object to select from.
None
Attributes
mol
Molecule
The molecule object to select from.
mask
ndarray
or None
Boolean array for the selection on the most recently evaluated array.
pending_selections
list
List of selection operations to be applied once evaluate_on_array
is called.
Methods
atom_name
MoleculeSelector.atom_name(atom_name)
Select atoms by their name.
Parameters
atom_name
str or list of str or tuple of str or ndarray
The atom name(s) to select.
required
Returns
Selector
Returns self for method chaining.
chain_id
MoleculeSelector.chain_id(chain_id)
Select atoms by chain identifier.
Parameters
chain_id
list of str or tuple of str or ndarray
The chain identifier(s) to select.
required
Returns
Selector
Returns self for method chaining.
element
MoleculeSelector.element(element)
Select atoms by element symbol.
Parameters
element
list of str or tuple of str or ndarray
The element symbol(s) to select.
required
Returns
Selector
Returns self for method chaining.
evaluate_on_array
MoleculeSelector.evaluate_on_array(array)
Evaluate this selection on the AtomArray.
Returns
ndarray
Boolean mask array indicating which atoms match the selection criteria.
Notes
All of the selection operations that have been staged for this Selector are evaluated and combined with a logical AND, using the AtomArray as input.
is_amino_acid
MoleculeSelector.is_amino_acid()
Select amino acid residues.
Returns
Selector
Returns self for method chaining.
is_backbone
MoleculeSelector.is_backbone()
Select backbone atoms for peptide and nucleotide.
is_canonical_amino_acid
MoleculeSelector.is_canonical_amino_acid()
Select canonical amino acid residues.
Returns
Selector
Returns self for method chaining.
is_canonical_nucleotide
MoleculeSelector.is_canonical_nucleotide()
Select canonical nucleotide residues.
Returns
Selector
Returns self for method chaining.
is_carbohydrate
MoleculeSelector.is_carbohydrate()
Select carbohydrate residues.
Returns
Selector
Returns self for method chaining.
is_hetero
MoleculeSelector.is_hetero()
Select hetero atoms.
Returns
Selector
Returns self for method chaining.
is_ligand
MoleculeSelector.is_ligand()
Select ligand atoms.
Returns
Selector
Returns self for method chaining.
is_monoatomic_ion
MoleculeSelector.is_monoatomic_ion()
Select monoatomic ions.
Returns
Selector
Returns self for method chaining.
is_nucleotide
MoleculeSelector.is_nucleotide()
Select nucleotide residues.
Returns
Selector
Returns self for method chaining.
is_peptide_backbone
MoleculeSelector.is_peptide_backbone()
Select peptide backbone atoms.
Returns
Selector
Returns self for method chaining.
is_phosphate_backbone
MoleculeSelector.is_phosphate_backbone()
Select phosphate backbone atoms.
Returns
Selector
Returns self for method chaining.
is_polymer
MoleculeSelector.is_polymer()
Select polymer atoms.
Returns
Selector
Returns self for method chaining.
is_solvent
MoleculeSelector.is_solvent()
Select solvent atoms.
Returns
Selector
Returns self for method chaining.
linear_bond_continuity
MoleculeSelector.linear_bond_continuity()
Select atoms with linear bond continuity.
Returns
Selector
Returns self for method chaining.
not_amino_acids
MoleculeSelector.not_amino_acids()
Select non-amino acid residues.
Returns
Selector
Returns self for method chaining.
not_atom_names
MoleculeSelector.not_atom_names(atomname)
Select atoms not matching the specified atom names.
Parameters
atomname
str or list of str
The atom name(s) to exclude.
required
Returns
Selector
Returns self for method chaining.
not_canonical_amino_acids
MoleculeSelector.not_canonical_amino_acids()
Select non-canonical amino acid residues.
Returns
Selector
Returns self for method chaining.
not_canonical_nucleotides
MoleculeSelector.not_canonical_nucleotides()
Select non-canonical nucleotide residues.
Returns
Selector
Returns self for method chaining.
not_carbohydrates
MoleculeSelector.not_carbohydrates()
Select non-carbohydrate residues.
Returns
Selector
Returns self for method chaining.
not_chain_id
MoleculeSelector.not_chain_id(chain_id)
Select atoms not in the specified chains.
Parameters
chain_id
str or list of str
The chain identifier(s) to exclude.
required
Returns
Selector
Returns self for method chaining.
not_element
MoleculeSelector.not_element(element)
Select atoms not matching the specified elements.
Parameters
element
str or list of str
The element symbol(s) to exclude.
required
Returns
Selector
Returns self for method chaining.
not_hetero
MoleculeSelector.not_hetero()
Select non-hetero atoms.
Returns
Selector
Returns self for method chaining.
not_monoatomic_ions
MoleculeSelector.not_monoatomic_ions()
Select non-monoatomic ion atoms.
Returns
Selector
Returns self for method chaining.
not_nucleotides
MoleculeSelector.not_nucleotides()
Select non-nucleotide residues.
Returns
Selector
Returns self for method chaining.
not_peptide_backbone
MoleculeSelector.not_peptide_backbone()
Select non-peptide backbone atoms.
Returns
Selector
Returns self for method chaining.
not_phosphate_backbone
MoleculeSelector.not_phosphate_backbone()
Select non-phosphate backbone atoms.
Returns
Selector
Returns self for method chaining.
not_polymer
MoleculeSelector.not_polymer()
Select non-polymer atoms.
Returns
Selector
Returns self for method chaining.
not_res_id
MoleculeSelector.not_res_id(num)
Select atoms not matching the specified residue IDs.
Parameters
num
int or list of int
The residue ID(s) to exclude.
required
Returns
Selector
Returns self for method chaining.
not_res_name
MoleculeSelector.not_res_name(res_name)
Select atoms not matching the specified residue names.
Parameters
res_name
str or list of str
The residue name(s) to exclude.
required
Returns
Selector
Returns self for method chaining.
not_solvent
MoleculeSelector.not_solvent()
Select non-solvent atoms.
Returns
Selector
Returns self for method chaining.
res_id
MoleculeSelector.res_id(num)
Select atoms by residue ID.
Parameters
num
int or list of int
The residue ID(s) to select.
required
Returns
Selector
Returns self for method chaining.
res_name
MoleculeSelector.res_name(res_name)
Select atoms by residue name.
Parameters
res_name
str or list of str
The residue name(s) to select.
required
Returns
Selector
Returns self for method chaining.
reset
Reset all pending selections and the mask
Returns
self
Selector
Returns self for method chaining
store_selection
MoleculeSelector.store_selection(name)
Evaluate and store the current selection as a named attribute on the Molecule
Parameters
name
str
The name to store the selection under.
required