rstoolbox.components.
Selection
(selection=None)¶Complex management of residue selection from a sequence.
It can be used in any function that accepts the key_residue
parameter.
It accepts both numerical and string data.
Thus, a Selection
can be declared in multiple ways.
In [1]: from rstoolbox.components import Selection
...: # From an array of numbers
...: sn = Selection([3, 4, 5, 13, 14, 15, 21, 25])
...: # From a string representation of numbers
...: ss = Selection("3-5,13-15,21,25")
...: # From a string representation of PDB numbering.
...: sp = Selection("4A-6A,14A-16A,22A,26A")
...:
If a Series
is provided, Selection
will try to
extract the appropiate content.
If regular numbering is provided, it will assume that it refers to direct sequence positions.
Note
Selection
works with sequence positioning; that means that it
expects the first position to be 1, not 0.
If a PDB numbering schema is provided, Selection
will consider that
the shift of the original PDB is already taken into account and will correct accordingly
when applied to the different functons and data containers.
Note
PDB numbering cannot combine selections from multiple chains.
Parameters: | selection (Union[ |
||||
---|---|---|---|---|---|
Raises: |
|
Multiple operations are available for Selection.
In [2]: sele = Selection([3, 4, 5, 13, 14, 15, 21, 25])
...: # Negate selection: will call 'select all except'
...: not_sele = ~sele
...: sele.to_list()
...:
Out[2]: [3, 4, 5, 13, 14, 15, 21, 25]
In [3]: not_sele.to_list(25)