This replaces the old mapping member by constructing it from self.chain_mapping. This function returns a mapping from
        chain IDs in pdb_name1 to chain IDs in pdb_name2.
183380
def get_representative_chain_mapping(self, representative_id_1, representative_id_2):
        ''''''
        d = {}
        for pdb1_chain_id, matched_chain_list in self.chain_mapping[(representative_id_1, representative_id_2)].iteritems():
            d[pdb1_chain_id] = matched_chain_list.get_related_chains_ids('EC{0}'.format(representative_id_2))
        return d
647385
def replace_keys(d, keymap, force_snake_case):
    
    return {
        to_snake(keymap.get(k, k)) if force_snake_case else keymap.get(k, k):
            v for k, v in d.items()
    }
880490
def put_mapping(self, using=None, **kwargs):
        
        return self._get_connection(using).indices.put_mapping(index=self._name, **kwargs)
429334
function renameKey(obj, prevKey, nextKey) {
  return mapKeys(obj, (_, key) => (key === prevKey ? nextKey : key))
}
261276
def _create_mappings(self):
        ''
        created1 = self._create_tag_mapping()
        created2 = self._create_assoc_mapping()
        return created1 or created2
263837
def get_mapping(self, other):
        
        m = next(self._matcher(other).isomorphisms_iter(), None)
        if m:
            return {v: k for k, v in m.items()}
900037
def hmset(self, name, mapping):
        
        with self.pipe as pipe:
            m_encode = self.memberparse.encode
            mapping = {m_encode(k): self._value_encode(k, v)
                       for k, v in mapping.items()}
            return pipe.hmset(self.redis_key(name), mapping)
581744
def add_chain_ids(self, chains):
        
        chains = ssbio.utils.force_list(chains)

        for c in chains:
            if self.chains.has_id(c):
                log.debug('{}: chain already present'.format(c))
            else:
                chain_prop = ChainProp(ident=c, pdb_parent=self.id)
                self.chains.append(chain_prop)
                log.debug('{}: added to chains list'.format(c))
1102260
function remapLoadRecord(load, mapFunction) {
    load = extend({}, load);
    load.name = mapFunction(load.name, load.name);
    var depMap = {};
    Object.keys(load.depMap).forEach(function(dep) {
      depMap[dep] = mapFunction(load.depMap[dep], dep);
    });
    load.depMap = depMap;
    return load;
  }
522671
def convert_mapping(self, mapping):
        """"""
        if isinstance(mapping, dict):
            return self.convert_items(iteritems(mapping))
        return self.convert_items(mapping)
775046
def replace_wires(wire_map, block=None):
    
    block = working_block(block)
    src_nets, dst_nets = block.net_connections(include_virtual_nodes=False)
    for old_w, new_w in wire_map.items():
        replace_wire_fast(old_w, new_w, new_w, src_nets, dst_nets, block)
699124
def replace_seqres(self, pdb, update_atoms = True):
    """"""
  
    newpdb = PDB()
    inserted_seqres = False
    entries_before_seqres = set(["HEADER", "OBSLTE", "TITLE",  "CAVEAT", "COMPND", "SOURCE", 
                                 "KEYWDS", "EXPDTA", "AUTHOR", "REVDAT", "SPRSDE", "JRNL", 
                                 "REMARK", "DBREF",  "SEQADV"])
  
    mutated_resids = {}
    
    if update_atoms:
      old_seqs = ChainSequences()
      chainresnums = old_seqs.parse_atoms(pdb)
    
      assert self.keys() == old_seqs.keys()
      
      for chain in self.keys():
        assert len(self[chain]) == len(old_seqs[chain])
        for i in xrange(len(self[chain])):
          if self[chain][i] != old_seqs[chain][i]:
            resid = chain + chainresnums[chain][i]
            mutated_resids[resid] = self[chain][i]
    
    for line in pdb.lines:
    
      entry = line[0:6]
      if (not inserted_seqres) and entry not in entries_before_seqres:
        inserted_seqres = True
        newpdb.lines += self.seqres_lines()
      
      if update_atoms and entry == "ATOM  ":
        resid = line[21:27]
        atom = line[12:16].strip()
        if not mutated_resids.has_key(resid):
          newpdb.lines += [line]
        else:
          newpdb.lines += [line[:17] + mutated_resids[resid] + line[20:]]
      elif entry != "SEQRES":
        newpdb.lines += [line]
    
    if update_atoms:
      newpdb.remove_nonbackbone_atoms(mutated_resids.keys())
    
    return newpdb
46802
def _nodes_slots_to_slots_nodes(self, mapping):
        
        out = {}
        for node in mapping:
            for slot in node['slots']:
                out[str(slot)] = node['id']
        return out
1059492
def replace(self, replacements):
        

        for old_var, new_var in replacements.items():
            old_var_id = id(old_var)
            if old_var_id in self._object_mapping:
                # FIXME: we need to check if old_var still exists in the storage
                old_so = self._object_mapping[old_var_id]  # type: StoredObject
                self._store(old_so.start, new_var, old_so.size, overwrite=True)

        return self
82056
def rename_tables(db, table_mapping, reverse=False):
    
    from django.db import connection
    if reverse:
        table_mapping = [(dst, src) for src, dst in table_mapping]
    table_names = connection.introspection.table_names()
    for source, destination in table_mapping:
        if source in table_names and destination in table_names:
            print(u"    WARNING: not renaming {0} to {1}, because both tables already exist.".format(source, destination))
        elif source in table_names and destination not in table_names:
            print(u"     - renaming {0} to {1}".format(source, destination))
            db.rename_table(source, destination)
996445
def _unstructure_mapping(self, mapping):
        """"""

        # We can reuse the mapping class, so dicts stay dicts and OrderedDicts
        # stay OrderedDicts.
        dispatch = self._unstructure_func.dispatch
        return mapping.__class__(
            (dispatch(k.__class__)(k), dispatch(v.__class__)(v))
            for k, v in mapping.items()
        )
1096227
def _create_sequence_maps(self):
        ''''''

        if self.sifts:
            self.sifts_atom_to_seqres_sequence_maps = self.sifts.atom_to_seqres_sequence_maps
            self.sifts_seqres_to_uniparc_sequence_maps = self.sifts.seqres_to_uniparc_sequence_maps
            self.sifts_atom_to_uniparc_sequence_maps = self.sifts.atom_to_uniparc_sequence_maps
            if self.pdb_id in pdbs_with_do_not_use_SIFTS_for_these_chains:
                for chain_id in self.sifts_atom_to_seqres_sequence_maps.keys() + self.sifts_seqres_to_uniparc_sequence_maps.keys() + self.sifts_atom_to_uniparc_sequence_maps.keys():
                    if (self.pdb_id, chain_id) in do_not_use_SIFTS_for_these_chains:
                        self.sifts_atom_to_seqres_sequence_maps[chain_id] = SequenceMap()
                        self.sifts_seqres_to_uniparc_sequence_maps = SequenceMap()
                        self.sifts_atom_to_uniparc_sequence_maps = SequenceMap()

        if self.pdb_to_rosetta_residue_map_error:
            self.rosetta_to_atom_sequence_maps = {}
            for c in self.atom_sequences.keys():
                self.rosetta_to_atom_sequence_maps[c] = SequenceMap()
        else:
            self.rosetta_to_atom_sequence_maps = self.pdb.rosetta_to_atom_sequence_maps

        # If we removed atoms from the PDB file, we need to remove them from the maps so that our validations hold later on
        self.pdbml_atom_to_seqres_sequence_maps = self.pdbml.atom_to_seqres_sequence_maps
        if self.pdb_id in ROSETTA_HACKS_residues_to_remove:
            for residue_to_remove in ROSETTA_HACKS_residues_to_remove[self.pdb_id]:
                chain_id = residue_to_remove[0]
                self.pdbml_atom_to_seqres_sequence_maps[chain_id].remove(residue_to_remove)
                #if self.sifts:
                #    self.sifts_atom_to_seqres_sequence_maps[chain_id].remove(residue_to_remove)

        if self.pdb_id not in do_not_use_the_sequence_aligner:
            self.clustal_seqres_to_uniparc_sequence_maps = self.PDB_UniParc_SA.seqres_to_uniparc_sequence_maps