本文整理汇总了Python中Bio.PDB.StructureBuilder.StructureBuilder.init_seg方法的典型用法代码示例。如果您正苦于以下问题:Python StructureBuilder.init_seg方法的具体用法?Python StructureBuilder.init_seg怎么用?Python StructureBuilder.init_seg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bio.PDB.StructureBuilder.StructureBuilder
的用法示例。
在下文中一共展示了StructureBuilder.init_seg方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Bio.PDB.StructureBuilder import StructureBuilder [as 别名]
# 或者: from Bio.PDB.StructureBuilder.StructureBuilder import init_seg [as 别名]
class XBGFParser:
def __init__(self, PERMISSIVE=1, structure_builder=None):
if structure_builder != None:
self.structure_builder = structure_builder
else:
self.structure_builder = StructureBuilder()
self.PERMISSIVE = PERMISSIVE
# public interface
def parse(self, id, file):
self.structure_builder.init_structure(id)
if isinstance(file, basestring):
file=open(file)
self.charges = dict()
self.chain_suffix = 0
self._parse(file.readlines())
self.structure = self.structure_builder.get_structure()
return self._process_structure()
# private methods
def _parse(self, lines):
self.structure_builder.init_model(0)
self.structure_builder.init_seg("")
self.current_chain_id = None
self.current_residue_id = None
self.current_resname = None
for i in range(0, len(lines)):
self.line_counter = i + 1
self.structure_builder.set_line_counter(self.line_counter)
line = lines[i]
if line[0:6] == 'ATOM ':
self._update_atom(line)
def _update_chain(self, line):
chain_id = self._extract_chain(line)
if self.current_chain_id != chain_id:
try:
self.structure_builder.init_chain(chain_id)
self.current_chain_id = chain_id
self.current_residue_id = None
self.current_resname = None
except PDBConstructionException, message:
self._handle_PDB_exception(message)
示例2: set_structure
# 需要导入模块: from Bio.PDB.StructureBuilder import StructureBuilder [as 别名]
# 或者: from Bio.PDB.StructureBuilder.StructureBuilder import init_seg [as 别名]
def set_structure(self, pdb_object):
"""Check what object the user is providing and build a structure."""
# This is duplicated from the PDBIO class
if pdb_object.level == "S":
structure = pdb_object
else:
sb = StructureBuilder()
sb.init_structure('pdb')
sb.init_seg(' ')
# Build parts as necessary
if pdb_object.level == "M":
sb.structure.add(pdb_object)
self.structure = sb.structure
else:
sb.init_model(0)
if pdb_object.level == "C":
sb.structure[0].add(pdb_object)
else:
sb.init_chain('A')
if pdb_object.level == "R":
try:
parent_id = pdb_object.parent.id
sb.structure[0]['A'].id = parent_id
except ValueError:
pass
sb.structure[0]['A'].add(pdb_object)
else:
# Atom
sb.init_residue('DUM', ' ', 1, ' ')
try:
parent_id = pdb_object.parent.parent.id
sb.structure[0]['A'].id = parent_id
except ValueError:
pass
sb.structure[0]['A'].child_list[0].add(pdb_object)
# Return structure
structure = sb.structure
self.structure = structure
示例3: set_structure
# 需要导入模块: from Bio.PDB.StructureBuilder import StructureBuilder [as 别名]
# 或者: from Bio.PDB.StructureBuilder.StructureBuilder import init_seg [as 别名]
def set_structure(self, pdb_object):
"""Check what the user is providing and build a structure."""
if pdb_object.level == "S":
structure = pdb_object
else:
sb = StructureBuilder()
sb.init_structure('pdb')
sb.init_seg(' ')
# Build parts as necessary
if pdb_object.level == "M":
sb.structure.add(pdb_object.copy())
self.structure = sb.structure
else:
sb.init_model(0)
if pdb_object.level == "C":
sb.structure[0].add(pdb_object.copy())
else:
sb.init_chain('A')
if pdb_object.level == "R":
try:
parent_id = pdb_object.parent.id
sb.structure[0]['A'].id = parent_id
except Exception:
pass
sb.structure[0]['A'].add(pdb_object.copy())
else:
# Atom
sb.init_residue('DUM', ' ', 1, ' ')
try:
parent_id = pdb_object.parent.parent.id
sb.structure[0]['A'].id = parent_id
except Exception:
pass
sb.structure[0]['A'].child_list[0].add(pdb_object.copy())
# Return structure
structure = sb.structure
self.structure = structure
示例4: set_structure
# 需要导入模块: from Bio.PDB.StructureBuilder import StructureBuilder [as 别名]
# 或者: from Bio.PDB.StructureBuilder.StructureBuilder import init_seg [as 别名]
def set_structure(self, pdb_object):
# Check what the user is providing and build a structure appropriately
if pdb_object.level == "S":
structure = pdb_object
else:
sb = StructureBuilder()
sb.init_structure("pdb")
sb.init_seg(" ")
# Build parts as necessary
if pdb_object.level == "M":
sb.structure.add(pdb_object)
self.structure = sb.structure
else:
sb.init_model(0)
if pdb_object.level == "C":
sb.structure[0].add(pdb_object)
else:
sb.init_chain("A")
if pdb_object.level == "R":
try:
parent_id = pdb_object.parent.id
sb.structure[0]["A"].id = parent_id
except Exception:
pass
sb.structure[0]["A"].add(pdb_object)
else:
# Atom
sb.init_residue("DUM", " ", 1, " ")
try:
parent_id = pdb_object.parent.parent.id
sb.structure[0]["A"].id = parent_id
except Exception:
pass
sb.structure[0]["A"].child_list[0].add(pdb_object)
# Return structure
structure = sb.structure
self.structure = structure
示例5: StructureDecoder
# 需要导入模块: from Bio.PDB.StructureBuilder import StructureBuilder [as 别名]
# 或者: from Bio.PDB.StructureBuilder.StructureBuilder import init_seg [as 别名]
#.........这里部分代码省略.........
: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
:param single_letter_code: the single letter code of the group
:param sequence_index: the index of this group in the sequence defined by the entity
:param secondary_structure_type: the type of secondary structure used
(types are according to DSSP and number to type mappings are defined in the specification)
"""
# MMTF uses a NUL character to indicate a blank insertion code, but
# StructureBuilder expects a space instead.
if insertion_code == "\x00":
insertion_code = " "
self.structure_bulder.init_seg(' ')
self.structure_bulder.init_residue(group_name, self.this_type,
group_number, insertion_code)
def set_model_info(self, model_id, chain_count):
"""Set the information for a model.
:param model_id: the index for the model
:param chain_count: the number of chains in the model
"""
self.structure_bulder.init_model(model_id)
def set_xtal_info(self, space_group, unit_cell):
"""Set the crystallographic information for the structure.
:param space_group: the space group name, e.g. "P 21 21 21"
:param unit_cell: an array of length 6 with the unit cell parameters in order: a, b, c, alpha, beta, gamma
"""
self.structure_bulder.set_symmetry(space_group, unit_cell)
def set_header_info(self, r_free, r_work, resolution, title,
deposition_date, release_date, experimnetal_methods):
"""Sets the header information.
:param r_free: the measured R-Free for the structure
:param r_work: the measure R-Work for the structure
:param resolution: the resolution of the structure
:param title: the title of the structure
:param deposition_date: the deposition date of the structure
:param release_date: the release date of the structure
:param experimnetal_methods: the list of experimental methods in the structure