set_atom_channels_by_element
- macromol_voxelize.set_atom_channels_by_element(atoms: DataFrame, channels: List[List[str]], *, drop_missing_atoms: bool = False) DataFrame[source]
Assign atoms to channels based on their element types.
- Parameters:
atoms – A dataframe representing the atoms to voxelize. This function requires a column named element, which must contain element names as strings.
channels –
A list of lists of element names. Each item in the outer list represents a different channel. Each item in one of the inner lists represents an element that should appear in said channel. Each element can appear in any number of channels. Furthermore, the special symbol ‘*’ can be used to represent any element that is not mentioned explicitly.
For example, consider:
[['C'], ['N'], ['O'], ['S', 'SE']]. This indicates that carbon should go in the first channel, nitrogen in the second, oxygen in the third, and both sulfur and selenium in the fourth. (Sulfur is commonly replaced by selenium in crystal structures, to help solve the phasing problem.)drop_missing_atoms – If True, atoms that aren’t assigned to any channel will be silently removed. By default, an error will be raised if any such atoms are present.
- Returns:
The input dataframe, with a channels column added. Each entry in this column will be a list of integers, where each integer identifies a single channel and will be in the range [0,
len(channels) - 1].