mdciao.fragments.assign_fragments

mdciao.fragments.assign_fragments(res_idxs, fragments, raise_on_missing=True)

Assign a parent fragment to each residue in a list of res_idxs

Note

Simply wraps around in_what_N_fragments, first asserting that there’s no intersection between the fragments and then checking whether some residxs are missing

Parameters
  • res_idxs (iterable of ints) – The residue indices

  • fragments (iterable of iterable if ints) – The fragment definitions. It will be checked that these definitions don’t have common residues

  • raise_on_missing (bool, default is True) – Whether to raise an Exception if any residue can’t be found in the fragments

Returns

  • frag_idxs (np.array) – Array with the indices of fragments where each residue of res_isxs appears

  • res_idxs (np.array) – If all residues were found in fragments, then this is a copy of the input array. If some didn’t appear anywhere, but raise_on_missing was False, the missing residues have been deleted