code: function _filterResidues(chain, dict) {
    var residues = chain.residues();
    if (dict.rnumRange) {
      residues =
          chain.residuesInRnumRange(dict.rnumRange[0], dict.rnumRange[1]);
    }
    var selResidues = [], i, e;
    if (dict.rindexRange !== undefined) {
      for (i = dict.rindexRange[0],
          e = Math.min(residues.length - 1, dict.rindexRange[1]);
          i <= e; ++i) {
        selResidues.push(residues[i]);
      }
      return selResidues;
    } 
    if (dict.rindices) {
      if (dict.rindices.length !== undefined) {
        selResidues = [];
        for (i = 0; i < dict.rindices.length; ++i) {
          selResidues.push(residues[dict.rindices[i]]);
        }
        return selResidues;
      }
    }
    return residues;
  }
docs: handles all residue predicates that can be done through either index- based lookups, or optimized searches of some sorts.