proteindf_bridge.atomgroup module

class proteindf_bridge.atomgroup.AtomGroup(*args, **kwargs)[source]

Bases: object

>>> group1 = AtomGroup()
>>> atom1 = Atom(symbol='C')
>>> atom2 = Atom(symbol='H')
>>> atom3 = Atom(symbol='N')
>>> subgrp = AtomGroup()
>>> subgrp.set_atom('C1', atom1)
>>> subgrp.set_atom('H1', atom2)
>>> subgrp.set_atom('N1', atom3)
>>> group1.set_group('grp', subgrp)
>>> group1['grp']['C1'].symbol
'C'
>>> group1.get_number_of_atoms()
0
>>> group1.get_number_of_groups()
1
>>> group1.get_number_of_all_atoms()
3
>>> group1.sum_of_atomic_number()
14.0
>>> group2 = AtomGroup()
>>> atom_with_path1 = Atom(symbol='C')
>>> atom_with_path2 = Atom(symbol='N')
>>> group2.set_atom('/group1/subgroup1/C1', atom_with_path1)
>>> group2.set_atom('/group1/subgroup2/N2', atom_with_path2)
>>> print(group2)
# group key= name=
  # group key=group1 name=   parent=
    # group key=subgroup1 name=     parent=
    C ()        0.000    0.000    0.000,  0.00,    0.000    0.000    0.000 /group1/subgroup1/C1
    # group key=subgroup2 name=     parent=
    N ()        0.000    0.000    0.000,  0.00,    0.000    0.000    0.000 /group1/subgroup2/N2

>>> group2['group1']['subgroup1'].has_atom('C1')
True
add_bond(atom1, atom2, order=1)[source]

Add bond information. order = bond order

assign_charges(charges)[source]
atoms()[source]

Return the list of atoms.

Return type:

Iterator[Tuple[str, Atom]]

box()[source]
center()[source]

return Position value of the center

property charge
static divide_path(path)[source]
erase_atom(key)[source]

remove atom

Deprecated since version use: remove_atom() instead.

erase_group(key)[source]

remove group

Deprecated since version use: remove_group() instead.

Return type:

None

formula()[source]
get_atom(key_or_name)[source]

Return the atom if one matching the given key or name is contained; otherwise return None.

Return type:

Optional[Atom]

get_atom_keys()[source]
Return type:

List[str]

get_atom_kinds()[source]

Return the list of atomic species (symbols).

get_atom_kinds_count()[source]

Return a dict mapping atomic species (symbols) to their counts.

get_atom_list()[source]

Collect the atoms within the subgroups into a list and return it.

get_bond_list(bond_list=None)[source]

Return a list of tuples (‘atom1 path’, ‘atom2 path’, bond order).

get_family(query_path)[source]
get_formula()[source]

Return the molecular formula (composition formula).

get_group(key_or_name)[source]

Return the group if one matching the given key or name is contained; otherwise return None.

Return type:

Optional[AtomGroup]

get_group_list()[source]
Return type:

List[str]

get_number_of_all_atoms()[source]
get_number_of_atoms()[source]
get_number_of_bonds()[source]
get_number_of_groups()[source]
get_path_list()[source]

Return the list of paths of the atoms within the group.

get_raw_data()[source]
get_xyz()[source]

Return the XYZ-format string.

groups()[source]

Return the list of molecular groups.

Return type:

Iterator[Tuple[str, AtomGroup]]

has_atom(key_or_name)[source]

Return True if an atom matching the given key or name is contained; otherwise return False.

has_atomkey(key)[source]

Return True if an atom with the given key is contained; otherwise return False.

has_atomname(name)[source]

Return True if an atom with the given name is contained; otherwise return False.

has_group(key_or_name)[source]

Return True if a group matching the given key or name is contained; otherwise return False.

Return type:

bool

has_groupkey(key)[source]

Return True if a group with the given key is contained; otherwise return False.

Return type:

bool

has_groupname(name)[source]

Return True if a group with the given name is contained; otherwise return False.

Return type:

bool

merge(rhs)[source]

Merge in another molecular group.

property name
property nuclei_charge
property parent
property path
pickup_atoms(key_or_name)[source]

Return the array of atoms whose key or name matches.

property real_nuclei_charge
remove_atom(key)[source]

remove atom

remove_group(key)[source]

remove group

Return type:

None

restructure(reference, range=1e-05)[source]

Rebuild the data structure by referring to the structure of reference.

Useful when building up a flat list of atoms into a PDB-like data structure.

rotate(rotmat)[source]
save_csv(path)[source]
select(selector)[source]

Pass a Selector object as selector to get back the corresponding molecular group.

set_atom(key, value)[source]
Return type:

None

set_by_dict_data(data)[source]
set_group(key, value)[source]
Return type:

None

shift_by(direction)[source]
property sort_atoms
property sort_groups
sum_of_atomic_number()[source]

Return the sum of atomic numbers.

property weight