mdciao.contacts.select_and_report_residue_neighborhood_idxs

mdciao.contacts.select_and_report_residue_neighborhood_idxs(ctc_freqs, res_idxs, fragments, residxs_pairs, top, ctcs_kept=5, restrict_to_resSeq=None, interactive=False, fraction=0.9, verbose=True)

Group residue pairs into neighborhoods using pre-computed contact frequencies

Returns a residue-index keyed dictionary containing the indices of residxs_pairs relevant for this residue.

Can be used interactively to decide on-the-fly which residues to include in the neighborhood..

Parameters
  • ctc_freqs (iterable of floats) – Contact frequencies between 0 and 1

  • res_idxs (list of integers) – list of residue idxs for which one wants to extract the neighborhoods

  • fragments (iterable of integers) – Fragments of the topology defined as list of non-overlapping residue indices

  • residxs_pairs (iterable of integer pairs) – The residue pairs for which the contact frequencies in ctc_freqs were computed.

  • top (Topology) – The topology from which the residues come

  • ctcs_kept (integer or float, default is 5) –

    Control how many contacts to report per residue. There’s two types of behaviour: * If int, it means directly keep these many contacts * if float, it must be in [0,1] and represents a fraction

    of the total number of contacts to keep

  • restrict_to_resSeq (iterable, default is None) – Only cycle through the residues in res_idxs with these resSeq indices.

  • interactive (boolean, default is False) – After reporting each neighborhood up to ctcs_kept, ask the user how many should be kept. Forces :obj:`verbose`=True

  • fraction (float, default is .9) – report how many contacts one needs to keep to arrive at this fraction of the overall contacts.

  • verbose (bool, default is True) – Be verbose

Returns

selection – Dictionary keyed with residue indices and valued with lists of indices for residxs_pairs s.t. for example:

selection[30] = [100,200]

means that for the residue with the index 300, the residxs_pairs on the 100-th and 200-th position, e.g. contain the pairs for its most frequent neighbors, e.g. [30-45] and [30-145]. ctcs_kept controls the length of the output, see also option ‘interactive’) Each i-th list is sorted by descending frequency of the contacts of residue-i and is truncated at freq==0 regardless of ctcs_kept

Return type

dictionary