本文整理汇总了Python中Bio.PDB.StructureBuilder.StructureBuilder.init_atom方法的典型用法代码示例。如果您正苦于以下问题:Python StructureBuilder.init_atom方法的具体用法?Python StructureBuilder.init_atom怎么用?Python StructureBuilder.init_atom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bio.PDB.StructureBuilder.StructureBuilder
的用法示例。
在下文中一共展示了StructureBuilder.init_atom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: StructureDecoder
# 需要导入模块: from Bio.PDB.StructureBuilder import StructureBuilder [as 别名]
# 或者: from Bio.PDB.StructureBuilder.StructureBuilder import init_atom [as 别名]
class StructureDecoder(object):
"""Class to pass the data from mmtf-python into a Biopython data structure."""
def __init__(self):
"""Initialize the class."""
self.this_type = ""
def init_structure(self, total_num_bonds, total_num_atoms,
total_num_groups, total_num_chains, total_num_models,
structure_id):
"""Initialize the structure object.
:param total_num_bonds: the number of bonds in the structure
:param total_num_atoms: the number of atoms in the structure
:param total_num_groups: the number of groups in the structure
:param total_num_chains: the number of chains in the structure
:param total_num_models: the number of models in the structure
:param structure_id: the id of the structure (e.g. PDB id)
"""
self.structure_bulder = StructureBuilder()
self.structure_bulder.init_structure(structure_id=structure_id)
self.chain_index_to_type_map = {}
self.chain_index_to_seq_map = {}
self.chain_index_to_description_map = {}
self.chain_counter = 0
def set_atom_info(self, atom_name, serial_number, alternative_location_id,
x, y, z, occupancy, temperature_factor, element, charge):
"""Create an atom object an set the information.
:param atom_name: the atom name, e.g. CA for this atom
:param serial_number: the serial id of the atom (e.g. 1)
:param alternative_location_id: the alternative location id for the atom, if present
:param x: the x coordiante of the atom
:param y: the y coordinate of the atom
:param z: the z coordinate of the atom
:param occupancy: the occupancy of the atom
:param temperature_factor: the temperature factor of the atom
:param element: the element of the atom, e.g. C for carbon. According to IUPAC. Calcium is Ca
:param charge: the formal atomic charge of the atom
"""
# MMTF uses "\x00" (the NUL character) to indicate to altloc, so convert
# that to the space required by StructureBuilder
if alternative_location_id == "\x00":
alternative_location_id = " "
# Atom_name is in twice - the full_name is with spaces
self.structure_bulder.init_atom(str(atom_name), [x, y, z],
temperature_factor, occupancy,
alternative_location_id, str(atom_name),
serial_number=serial_number,
element=str(element).upper())
def set_chain_info(self, chain_id, chain_name, num_groups):
"""Set the chain information.
:param chain_id: the asym chain id from mmCIF
:param chain_name: the auth chain id from mmCIF
:param num_groups: the number of groups this chain has
"""
# A Bradley - chose to use chain_name (auth_id) as it complies
# with current Biopython. Chain_id might be better.
self.structure_bulder.init_chain(chain_id=chain_name)
if self.chain_index_to_type_map[self.chain_counter] == "polymer":
self.this_type = " "
elif self.chain_index_to_type_map[self.chain_counter] == "non-polymer":
self.this_type = "H"
elif self.chain_index_to_type_map[self.chain_counter] == "water":
self.this_type = "W"
self.chain_counter += 1
def set_entity_info(self, chain_indices, sequence, description, entity_type):
"""Set the entity level information for the structure.
:param chain_indices: the indices of the chains for this entity
:param sequence: the one letter code sequence for this entity
:param description: the description for this entity
:param entity_type: the entity type (polymer,non-polymer,water)
"""
for chain_ind in chain_indices:
self.chain_index_to_type_map[chain_ind] = entity_type
self.chain_index_to_seq_map[chain_ind] = sequence
self.chain_index_to_description_map[chain_ind] = description
def set_group_info(self, group_name, group_number, insertion_code,
group_type, atom_count, bond_count, single_letter_code,
sequence_index, secondary_structure_type):
"""Set the information for a group
:param group_name: the name of this group, e.g. LYS
:param group_number: the residue number of this group
:param insertion_code: the insertion code for this group
:param group_type: a string indicating the type of group (as found in the chemcomp dictionary.
Empty string if none available.
:param atom_count: the number of atoms in the group
:param bond_count: the number of unique bonds in the group
#.........这里部分代码省略.........