Skip to content
Snippets Groups Projects
Commit 833a4ad8 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

variable renaming

parent be849e66
No related branches found
No related tags found
No related merge requests found
...@@ -311,11 +311,11 @@ class lDDTScorer: ...@@ -311,11 +311,11 @@ class lDDTScorer:
generic float property of that name generic float property of that name
:type local_lddt_prop: :class:`str` :type local_lddt_prop: :class:`str`
:param local_contact_prop: If set, number of expected contacts as well :param local_contact_prop: If set, number of expected contacts as well
as number of fulfilled contacts will be as number of conserved contacts will be
assigned as generic int property. assigned as generic int property.
Excected contacts will be set as Excected contacts will be set as
<local_contact_prop>_exp, fulfilled contacts <local_contact_prop>_exp, conserved contacts
as <local_contact_prop>_fulfilled. Values as <local_contact_prop>_conserved. Values
are summed over all thresholds. are summed over all thresholds.
:param local_contact_prop: :class:`str` :param local_contact_prop: :class:`str`
:param chain_mapping: Mapping of model chains (key) onto target chains :param chain_mapping: Mapping of model chains (key) onto target chains
...@@ -360,7 +360,7 @@ class lDDTScorer: ...@@ -360,7 +360,7 @@ class lDDTScorer:
Third: numpy matrix of shape Third: numpy matrix of shape
(len(scored_residues), len(thresholds)) (len(scored_residues), len(thresholds))
specifying how many for each threshold are specifying how many for each threshold are
fulfilled. conserved.
:returns: global and per-residue lDDT scores as a tuple - :returns: global and per-residue lDDT scores as a tuple -
first element is global lDDT score and second element first element is global lDDT score and second element
a list of per-residue scores with length len(*model*.residues) a list of per-residue scores with length len(*model*.residues)
...@@ -478,7 +478,7 @@ class lDDTScorer: ...@@ -478,7 +478,7 @@ class lDDTScorer:
per_res_exp = np.asarray([self._GetNExp(res_ref_atom_indices[idx], per_res_exp = np.asarray([self._GetNExp(res_ref_atom_indices[idx],
ref_indices) for idx in range(len(res_indices))], dtype=np.int32) ref_indices) for idx in range(len(res_indices))], dtype=np.int32)
per_res_fulfilled = self._EvalResidues(pos, thresholds, per_res_conserved = self._EvalResidues(pos, thresholds,
res_atom_indices, res_atom_indices,
ref_indices, ref_distances) ref_indices, ref_distances)
...@@ -488,14 +488,14 @@ class lDDTScorer: ...@@ -488,14 +488,14 @@ class lDDTScorer:
per_res_lDDT = [None] * len(model.residues) per_res_lDDT = [None] * len(model.residues)
for idx in range(len(res_indices)): for idx in range(len(res_indices)):
n_exp = n_thresh * per_res_exp[idx] n_exp = n_thresh * per_res_exp[idx]
score = np.sum(per_res_fulfilled[idx,:]) / n_exp score = np.sum(per_res_conserved[idx,:]) / n_exp
per_res_lDDT[res_indices[idx]] = score per_res_lDDT[res_indices[idx]] = score
# do full model score # do full model score
if penalize_extra_chains: if penalize_extra_chains:
n_distances += self._GetExtraModelChainPenalty(model, chain_mapping) n_distances += self._GetExtraModelChainPenalty(model, chain_mapping)
lDDT = np.sum(per_res_fulfilled) / (n_thresh * n_distances) lDDT = np.sum(per_res_conserved) / (n_thresh * n_distances)
# set properties if necessary # set properties if necessary
if local_lddt_prop: if local_lddt_prop:
...@@ -506,14 +506,14 @@ class lDDTScorer: ...@@ -506,14 +506,14 @@ class lDDTScorer:
if local_contact_prop: if local_contact_prop:
residues = model.residues residues = model.residues
exp_prop = local_contact_prop + "_exp" exp_prop = local_contact_prop + "_exp"
fulfilled_prop = local_contact_prop + "_fulfilled" conserved_prop = local_contact_prop + "_conserved"
for idx in res_indices: for idx in res_indices:
residues[idx].SetIntProp(exp_prop, n_thresh * per_res_exp[idx]) residues[idx].SetIntProp(exp_prop, n_thresh * per_res_exp[idx])
residues[idx].SetIntProp(fulfilled_prop, residues[idx].SetIntProp(conserved_prop,
np.sum(per_res_fulfilled[idx,:])) np.sum(per_res_conserved[idx,:]))
if return_dist_test: if return_dist_test:
return lDDT, per_res_lDDT, res_indices, per_res_exp, per_res_fulfilled return lDDT, per_res_lDDT, res_indices, per_res_exp, per_res_conserved
else: else:
return lDDT, per_res_lDDT return lDDT, per_res_lDDT
...@@ -858,12 +858,12 @@ class lDDTScorer: ...@@ -858,12 +858,12 @@ class lDDTScorer:
returns numpy matrix of shape (n_atoms, len(threshold)) returns numpy matrix of shape (n_atoms, len(threshold))
""" """
fulfilled = np.zeros((len(atom_indices), len(thresholds)), conserved = np.zeros((len(atom_indices), len(thresholds)),
dtype=np.int32) dtype=np.int32)
for a_idx, a in enumerate(atom_indices): for a_idx, a in enumerate(atom_indices):
fulfilled[a_idx, :] = self._EvalAtom(pos, a, thresholds, conserved[a_idx, :] = self._EvalAtom(pos, a, thresholds,
ref_indices, ref_distances) ref_indices, ref_distances)
return fulfilled return conserved
def _EvalResidues(self, pos, thresholds, res_atom_indices, ref_indices, def _EvalResidues(self, pos, thresholds, res_atom_indices, ref_indices,
ref_distances): ref_distances):
...@@ -872,12 +872,12 @@ class lDDTScorer: ...@@ -872,12 +872,12 @@ class lDDTScorer:
residues are defined in *res_atom_indices* as lists of atom indices residues are defined in *res_atom_indices* as lists of atom indices
returns numpy matrix of shape (n_residues, len(thresholds)). returns numpy matrix of shape (n_residues, len(thresholds)).
""" """
fulfilled = np.zeros((len(res_atom_indices), len(thresholds)), conserved = np.zeros((len(res_atom_indices), len(thresholds)),
dtype=np.int32) dtype=np.int32)
for rai_idx, rai in enumerate(res_atom_indices): for rai_idx, rai in enumerate(res_atom_indices):
fulfilled[rai_idx,:] = np.sum(self._EvalAtoms(pos, rai, thresholds, conserved[rai_idx,:] = np.sum(self._EvalAtoms(pos, rai, thresholds,
ref_indices, ref_distances), axis=0) ref_indices, ref_distances), axis=0)
return fulfilled return conserved
def _ProcessSequenceSeparation(self): def _ProcessSequenceSeparation(self):
if self.sequence_separation != 0: if self.sequence_separation != 0:
...@@ -914,7 +914,7 @@ class lDDTScorer: ...@@ -914,7 +914,7 @@ class lDDTScorer:
continue # nothing to do continue # nothing to do
# score as is # score as is
sym_one_fulfilled = self._EvalAtoms( sym_one_conserved = self._EvalAtoms(
pos, pos,
atom_indices, atom_indices,
thresholds, thresholds,
...@@ -926,7 +926,7 @@ class lDDTScorer: ...@@ -926,7 +926,7 @@ class lDDTScorer:
for pair in sym: for pair in sym:
pos[[pair[0], pair[1]]] = pos[[pair[1], pair[0]]] pos[[pair[0], pair[1]]] = pos[[pair[1], pair[0]]]
sym_two_fulfilled = self._EvalAtoms( sym_two_conserved = self._EvalAtoms(
pos, pos,
atom_indices, atom_indices,
thresholds, thresholds,
...@@ -934,8 +934,8 @@ class lDDTScorer: ...@@ -934,8 +934,8 @@ class lDDTScorer:
sym_ref_distances, sym_ref_distances,
) )
sym_one_score = np.sum(sym_one_fulfilled) / (len(thresholds) * tot) sym_one_score = np.sum(sym_one_conserved) / (len(thresholds) * tot)
sym_two_score = np.sum(sym_two_fulfilled) / (len(thresholds) * tot) sym_two_score = np.sum(sym_two_conserved) / (len(thresholds) * tot)
if sym_one_score >= sym_two_score: if sym_one_score >= sym_two_score:
# switch back, initial positions were better or equal # switch back, initial positions were better or equal
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment