本文整理汇总了Python中Bio.PDB.NeighborSearch.search_all方法的典型用法代码示例。如果您正苦于以下问题:Python NeighborSearch.search_all方法的具体用法?Python NeighborSearch.search_all怎么用?Python NeighborSearch.search_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bio.PDB.NeighborSearch
的用法示例。
在下文中一共展示了NeighborSearch.search_all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: calculate_ic
# 需要导入模块: from Bio.PDB import NeighborSearch [as 别名]
# 或者: from Bio.PDB.NeighborSearch import search_all [as 别名]
def calculate_ic(structure, d_cutoff=5.5, selection=None):
"""
Calculates intermolecular contacts in a parsed structure object.
"""
atom_list = list(structure.get_atoms())
ns = NeighborSearch(atom_list)
all_list = ns.search_all(radius=d_cutoff, level='R')
if selection:
_sd = selection_dict
ic_list = [c for c in all_list if (c[0].parent.id in _sd and c[1].parent.id in _sd)
and (_sd[c[0].parent.id] != _sd[c[1].parent.id]) ]
else:
ic_list = [c for c in all_list if c[0].parent.id != c[1].parent.id]
if not ic_list:
raise ValueError('No contacts found for selection')
return ic_list
示例2: exp
# 需要导入模块: from Bio.PDB import NeighborSearch [as 别名]
# 或者: from Bio.PDB.NeighborSearch import search_all [as 别名]
SCALAR_EXPRESSION %s_exp = exp(%s_s*(%s_currentenergy-%s_o))
SCALAR_EXPRESSION %s_k = %s
SCALAR_EXPRESSION %s_sig = (1-%s_k)+(%s_k/(1+%s_exp))
""") %(structure_id, structurefilename, correspondencefilename, resfilename, structure_id, startenergy, structure_id, structure_id, structure_id, s_value, structure_id, structure_id, structure_id, structure_id, structure_id, k_value, structure_id, structure_id, structure_id, structure_id)
fitnessfile.write(outstring)
fitnessstring = fitnessstring + str("*%s_sig") % (structure_id)
nucleosome = structure[0]
atom_list = Selection.unfold_entities(nucleosome, 'A') # A for atoms
neighbor_search = NeighborSearch(atom_list)
contacts_list = neighbor_search.search_all(radius, level = 'R')
repack_residues = []
for contact in contacts_list:
res1 = contact[0]
res2 = contact[1]
res1id = int(res1.get_id()[1])
chain1 = res1.get_parent()
chain1id = chain1.get_id()
res2id = int(res2.get_id()[1])
chain2 = res2.get_parent()
chain2id = chain2.get_id()
res1_in_patch = False
res2_in_patch = False
示例3: _build_interface
# 需要导入模块: from Bio.PDB import NeighborSearch [as 别名]
# 或者: from Bio.PDB.NeighborSearch import search_all [as 别名]
def _build_interface(self, model, id, threshold, rsa_calculation, rsa_threshold, include_waters=False, *chains):
"""
Return the interface of a model
"""
self.threshold=threshold
# Recover chain list from initial unpacking
chain_list = self.chain_list
# Unfold atom list
atom_list = []
for c in model:
if c.id in chain_list:
atom_list.extend(Selection.unfold_entities(c,'A'))
# Using of NeighborSearch class in order to get the list of all residues at least than
# the threshold distance of each others
ns=NeighborSearch(atom_list)
pairs=ns.search_all(threshold, 'R')
if not pairs:
raise ValueError("No atoms found in the interface")
# Selection of residues pairs
# 1. Exclude water contacts
# 2. Filter same-chain contacts
# 3. Filter user-defined chain pairs
uniq_pairs=[]
for pair in pairs:
pair_resnames = (pair[0].resname, pair[1].resname)
pair_chains = (pair[0].parent.id, pair[1].parent.id)
if (not include_waters and 'HOH' in pair_resnames) or (pair_chains[0] == pair_chains[1]):
continue
if not (chains and not (pair_chains in chains)):
uniq_pairs.append(pair)
# Build the Interface
# 1. Iterate over the pair list
# 2. Add residues.
for resA, resB in uniq_pairs:
if resA not in self.interface:
self._add_residue(resA)
if resB not in self.interface:
self._add_residue(resB)
# Accessible surface area calculated for each residue
# if naccess setup on user computer and rsa_calculation
# argument is TRUE
if rsa_calculation and os.system('which naccess') == 0:
rsa_pairs=self._rsa_calculation(model, chain_list, rsa_threshold)
for res in rsa_pairs:
if res not in self.interface:
self._add_residue(res)
self._secondary_structure(model)
#interface=uniq_pairs
self.interface.uniq_pairs=uniq_pairs
示例4: NeighborSearch
# 需要导入模块: from Bio.PDB import NeighborSearch [as 别名]
# 或者: from Bio.PDB.NeighborSearch import search_all [as 别名]
# CONSTRUCT KDTREE
neighborsearch = NeighborSearch(structure_atoms)
logging.info('Constructured NeighborSearch.')
# GET INTERACTIONS
logging.info('Calculating interactions...')
for interaction_level in 'ARC':
if interaction_level in OUTPUTS:
logging.info('Calculating interactions for {}s...'.format(
LEVEL_MAP[interaction_level]))
pairs = neighborsearch.search_all(INTERACTION_THRESHOLD,
level=interaction_level)
logging.info('Search complete for {}s.'.format(
LEVEL_MAP[interaction_level]))
logging.info('Organising interactions for {}s...'.format(
LEVEL_MAP[interaction_level]))
interactions = {}
for entities in pairs:
entity1, entity2 = entities
# NO SELFIES
if (entity1 is entity2) or (entity1 == entity2):