code: def create_pymol_selection_from_PDB_residue_ids(residue_list):
      '''Elements of residue_list should be strings extracted from PDB lines from position 21-26 inclusive (zero-indexing)
         i.e. the chain letter concatenated by the 5-character (including insertion code) residue ID.'''
      residues_by_chain = {}
      for residue_id in residue_list:
          chain_id = residue_id[0]
          pruned_residue_id = residue_id[1:]
          residues_by_chain[chain_id] = residues_by_chain.get(chain_id, [])
          residues_by_chain[chain_id].append(pruned_residue_id)
  
      str = []
      for chain_id, residue_list in sorted(residues_by_chain.iteritems()):
          str.append('(chain %s and resi %s)' % (chain_id, '+'.join(map(string.strip, sorted(residue_list)))))
      return ' or '.join(strf create_pymol_selection_from_PDB_residue_ids(residue_list):
      '''Elements of residue_list should be strings extracted from PDB lines from position 21-26 inclusive (zero-indexing)
         i.e. the chain letter concatenated by the 5-character (including insertion code) residue ID.'''
      residues_by_chain = {}
      for residue_id in residue_list:
          chain_id = residue_id[0]
          pruned_residue_id = residue_id[1:]
          residues_by_chain[chain_id] = residues_by_chain.get(chain_id, [])
          residues_by_chain[chain_id].append(pruned_residue_id)
  
      str = []
      for chain_id, residue_list in sorted(residues_by_chain.iteritems()):
          str.append('(chain %s and resi %s)' % (chain_id, '+'.join(map(string.strip, sorted(residue_list)))))
      return ' or '.join(str)
docs: Elements of residue_list should be strings extracted from PDB lines from position 21-26 inclusive (zero-indexing)
         i.e. the chain letter concatenated by the 5-character (including insertion code) residue ID.