Creates a unique ID for the `Atom` based on its parents.

        Returns
        -------
        unique_id : (str, str, str)
            (polymer.id, residue.id, atom.id)
437854
def unique_id(self):
        
        chain = self.ampal_parent.ampal_parent.id
        residue = self.ampal_parent.id
        return chain, residue, self.id
190393
def id(self):
        
        return sa.Column(sa.Integer, primary_key=True, autoincrement=True)
475273
def _get_ATOM_sequences(self):
        ''''''

        # Get a list of all residues with ATOM or HETATM records
        atom_sequences = {}
        structural_residue_IDs_set = set() # use a set for a quicker lookup
        ignore_HETATMs = True # todo: fix this if we need to deal with HETATMs

        residue_lines_by_chain = []
        structural_residue_IDs_set = []

        present_chain_ids = {}
        for l in self.structure_lines:
            if len(l) > 21 and l[:3] != 'TER':
                present_chain_ids[l[21]] = present_chain_ids.get(l[21], set())
                present_chain_ids[l[21]].add(l[:6])

        model_index = 0
        residue_lines_by_chain.append([])
        structural_residue_IDs_set.append(set())
        full_code_map = {}
        hetatm_map = {}
        full_atom_map = {}
        for l in self.structure_lines:
            chain_id = None
            if l.startswith("TER   "):
                model_index += 1
                residue_lines_by_chain.append([])
                structural_residue_IDs_set.append(set())
            else:
                residue_id = l[21:27]
                if residue_id not in structural_residue_IDs_set[model_index]:
                    residue_lines_by_chain[model_index].append(l)
                    structural_residue_IDs_set[model_index].add(residue_id)
                if l.startswith('ATOM'):
                    chain_id = l[21]
                    # Only use ATOM records to build the code map as chains can have ligands HETATMs
                    full_code_map[chain_id] = full_code_map.get(chain_id, set())
                    full_code_map[chain_id].add(l[17:20].strip())

                    # Only use ATOM records to build the atom map as CA-only chains can have ligands described in full as HETATMs
                    full_atom_map[chain_id] = full_atom_map.get(chain_id, set())
                    full_atom_map[chain_id].add(l[12:16].strip())
                elif l.startswith('HETATM'):
                    chain_id = l[21]
                    hetatm_map[chain_id] = hetatm_map.get(chain_id, set())
                    hetatm_map[chain_id].add(l[17:20].strip())

        # Get the residues used by the residue lines. These can be used to determine the chain type if the header is missing.
        for chain_id in self.atom_chain_order:
            if full_code_map.get(chain_id):
                # The chains may contain other molecules e.g. MG or HOH so before we decide their type based on residue types alone,
                # we subtract out those non-canonicals
                canonical_molecules = full_code_map[chain_id].intersection(dna_nucleotides.union(rna_nucleotides).union(residue_types_3))

                determined_chain_type = None
                if canonical_molecules.union(dna_nucleotides) == dna_nucleotides:
                    determined_chain_type = 'DNA'
                elif canonical_molecules.union(rna_nucleotides) == rna_nucleotides:
                    determined_chain_type = 'RNA'
                elif len(full_code_map[chain_id]) == 1 and 'UNK' in full_code_map[chain_id]:
                    determined_chain_type = 'Unknown'
                elif canonical_molecules:
                    if len(full_atom_map[chain_id]) == 1 and 'CA' in full_atom_map[chain_id]:
                        determined_chain_type = 'Protein skeleton'
                    else:
                        determined_chain_type = 'Protein'
                else:
                    determined_chain_type = PDB._determine_heterogen_chain_type(canonical_molecules)

                if self.chain_types.get(chain_id):
                    assert(self.chain_types[chain_id] == determined_chain_type)
                else:
                    self.chain_types[chain_id] = determined_chain_type

        line_types_by_chain = []
        chain_ids = []
        for model_index in range(len(residue_lines_by_chain)):
            line_types = set()
            if residue_lines_by_chain[model_index]:
                if missing_chain_ids.get(self.pdb_id):
                    chain_ids.append(missing_chain_ids[self.pdb_id])
                else:
                    chain_ids.append(residue_lines_by_chain[model_index][0][21])
            for l in residue_lines_by_chain[model_index]:
                line_types.add(l[0:6])
            if line_types == set(['ATOM']):
                line_types_by_chain.append('ATOM')
            elif line_types == set(['HETATM']):
                line_types_by_chain.append('HETATM')
            else:
                line_types_by_chain.append('Mixed')

        for x in range(0, len(residue_lines_by_chain)):
            residue_lines = residue_lines_by_chain[x]
            line_types = line_types_by_chain[x]
            if ignore_HETATMs and line_types == 'HETATM':
                continue

            for y in range(len(residue_lines)):
                l = residue_lines[y]
                residue_type = l[17:20].strip()
                if l.startswith("HETATM"):
                    if self.modified_residue_mapping_3.get(residue_type):
                        residue_type = self.modified_residue_mapping_3[residue_type]
                    elif y == (len(residue_lines) - 1):
                        # last residue in the chain
                        if residue_type == 'NH2':
                            residue_type = 'UNK' # fixes a few cases e.g. 1MBG, 1K9Q, 1KA6
                        elif ignore_HETATMs:
                            continue

                    elif ignore_HETATMs:
                        continue

                residue_id = l[21:27]
                chain_id = l[21]
                if missing_chain_ids.get(self.pdb_id):
                    chain_id = missing_chain_ids[self.pdb_id]

                if chain_id in self.chain_types:
                    # This means the pdb had SEQRES and we constructed atom_sequences
                    chain_type = self.chain_types[chain_id]
                else:
                    # Otherwise assume this is protein
                    chain_type = 'Protein'

                atom_sequences[chain_id] = atom_sequences.get(chain_id, Sequence(chain_type))

                residue_type = self.modified_residue_mapping_3.get(residue_type, residue_type)

                short_residue_type = None
                if residue_type == 'UNK':
                    short_residue_type = 'X'
                elif chain_type == 'Unknown':
                    assert(False) # we should not reach here - Unknown chains should only contain UNK records
                elif chain_type == 'Protein' or chain_type == 'Protein skeleton':
                    short_residue_type = residue_type_3to1_map.get(residue_type) or protonated_residue_type_3to1_map.get(residue_type) or non_canonical_amino_acids.get(residue_type)
                elif chain_type == 'DNA':
                    short_residue_type = dna_nucleotides_2to1_map.get(residue_type) or non_canonical_dna.get(residue_type)
                elif chain_type == 'RNA':
                    short_residue_type = non_canonical_rna.get(residue_type) or residue_type

                if not short_residue_type:
                    if l.startswith("ATOM") and l[12:16] == ' OH2' and l[17:20] == 'TIP':
                        continue
                    elif not self.strict:
                        short_residue_type = 'X'
                    else:
                        raise NonCanonicalResidueException("Unrecognized residue type %s in PDB file '%s', residue ID '%s'." % (residue_type, str(self.pdb_id), str(residue_id)))

                #structural_residue_IDs.append((residue_id, short_residue_type))
                # KAB - way to allow for multiresidue noncanonical AA's
                if len(short_residue_type) == 1:
                    atom_sequences[chain_id].add(PDBResidue(residue_id[0], residue_id[1:], short_residue_type, chain_type))
                else:
                    for char in short_residue_type:
                        atom_sequences[chain_id].add(PDBResidue(residue_id[0], residue_id[1:], char, chain_type))

        # Assign 'Ligand' or 'Heterogen' to all HETATM-only chains
        for chain_id in present_chain_ids.keys():
            if chain_id not in self.chain_types:
                assert('ATOM  ' not in present_chain_ids[chain_id])
                self.chain_types[chain_id] = PDB._determine_heterogen_chain_type(hetatm_map.get(chain_id, set()))
        self.atom_sequences = atom_sequences
157966
function createId (coll) {
  var _ = this
  var idProperty = _.__id()
  if (_.isEmpty(coll)) {
    return 1
  } else {
    var id = _.maxBy(coll, function (doc) {
      return doc[idProperty]
    })[idProperty]

    if (_.isFinite(id)) {
      // Increment integer id
      return ++id
    } else {
      // Generate string id
      return uuid()
    }
  }
}
510575
def get_unique_id(element):
    """"""
    this_id = make_id(element)
    dup = True
    while dup:
        if this_id not in ids:
            dup = False
            ids.append(this_id)
        else:
            this_id = make_id(element)
    return ids[-1]
243116
def generate_id
            if self.id.nil?                
                #
                # Generate the id (incrementing values as required)
                #
                overflow = self.class.__overflow__ ||= self.class.bucket.get("#{self.class.design_document}:#{CLUSTER_ID}:overflow", :quiet => true) # Don't error if not there
                count = self.class.bucket.incr("#{self.class.design_document}:#{CLUSTER_ID}:count", :create => true)     # This models current id count
                if count == 0 || overflow.nil?
                    overflow ||= 0
                    overflow += 1
                    # We shouldn't need to worry about concurrency here due to the size of count
                    # Would require ~18446744073709551615 concurrent writes
                    self.class.bucket.set("#{self.class.design_document}:#{CLUSTER_ID}:overflow", overflow)
                    self.class.__overflow__ = overflow
                end
                
                self.id = self.class.__class_id_generator__.call(overflow, count)
                
                
                #
                # So an existing id would only be present if:
                # => something crashed before incrementing the overflow
                # => this is another request was occurring before the overflow is incremented
                #
                # Basically only the overflow should be able to cause issues, we'll increment the count just to be sure
                # One would hope this code only ever runs under high load during an overflow event
                #
                while self.class.bucket.get(self.id, :quiet => true).present?
                    # Set in-case we are here due to a crash (concurrency is not an issue)
                    # Note we are not incrementing the @__overflow__ variable
                    self.class.bucket.set("#{self.class.design_document}:#{CLUSTER_ID}:overflow", overflow + 1)
                    count = self.class.bucket.incr("#{self.class.design_document}:#{CLUSTER_ID}:count")               # Increment just in case (attempt to avoid infinite loops)
                    
                    # Reset the overflow
                    if self.class.__overflow__ == overflow
                        self.class.__overflow__ = nil
                    end

                    # Generate the new id
                    self.id = self.class.__class_id_generator__.call(overflow + 1, count)
                end
            end
        end
1203943
def p_addr_of_id(p):
    
    entry = SYMBOL_TABLE.access_id(p[2], p.lineno(2))
    if entry is None:
        p[0] = None
        return

    entry.accessed = True
    result = make_unary(p.lineno(1), 'ADDRESS', entry, type_=_TYPE(gl.PTR_TYPE))

    if is_dynamic(entry):
        p[0] = result
    else:
        p[0] = make_constexpr(p.lineno(1), result)
706238
def gen_unique_id():
    
    # Workaround for http://bugs.python.org/issue4607
    if ctypes and _uuid_generate_random:
        buffer = ctypes.create_string_buffer(16)
        _uuid_generate_random(buffer)
        return str(UUID(bytes=buffer.raw))
    return str(uuid4())
513414
def parse_atom_tag_data(self, name, tag_content):
        ''''''
        current_atom_site = self.current_atom_site
        if current_atom_site.IsHETATM:
            # Early out - do not parse HETATM records
            return

        elif name == 'PDBx:atom_site':
            # We have to handle the atom_site close tag here since we jump based on self._BLOCK first in end_element

            #'''Add the residue to the residue map.'''
            self._BLOCK = None
            current_atom_site = self.current_atom_site
            current_atom_site.validate()
            if current_atom_site.IsATOM:
                # Only parse ATOM records
                r, seqres, ResidueAA, Residue3AA = current_atom_site.convert_to_residue(self.modified_residues)
                if r:
                    if not(self.pdb_id in cases_with_ACE_residues_we_can_ignore and Residue3AA == 'ACE'):
                        # skip certain ACE residues
                        full_residue_id = str(r)
                        if self._residues_read.get(full_residue_id):
                            assert(self._residues_read[full_residue_id] == (r.ResidueAA, seqres))
                        else:
                            self._residues_read[full_residue_id] = (r.ResidueAA, seqres)
                            self._residue_map[r.Chain] = self._residue_map.get(r.Chain, {})
                            assert(type(seqres) == int_type)
                            self._residue_map[r.Chain][str(r)] = seqres

        # Record type
        elif name == 'PDBx:group_PDB':
            # ATOM or HETATM
            if tag_content == 'ATOM':
                current_atom_site.IsATOM = True
            elif tag_content == 'HETATM':
                current_atom_site.IsHETATM = True
            else:
                raise Exception("PDBx:group_PDB was expected to be 'ATOM' or 'HETATM'. '%s' read instead." % tag_content)

        # Residue identifier - chain ID, residue ID, insertion code
        elif name == 'PDBx:auth_asym_id':
            assert(not(current_atom_site.PDBChainID))
            current_atom_site.PDBChainID = tag_content
            if not tag_content:
                assert(current_atom_site.PDBChainIDIsNull)
                if self.pdb_id.upper() == '2MBP':
                    current_atom_site.PDBChainID = 'A' # e.g. 2MBP
                else:
                    current_atom_site.PDBChainID = ' '

        elif name == 'PDBx:auth_seq_id':
            assert(not(current_atom_site.ATOMResidueID))
            current_atom_site.ATOMResidueID = int(tag_content)
        elif name == "PDBx:pdbx_PDB_ins_code":
            if current_atom_site.ATOMResidueiCodeIsNull:
                assert(len(tag_content) == 0)
            else:
                assert(current_atom_site.ATOMResidueiCode == ' ')
                current_atom_site.ATOMResidueiCode = tag_content
        elif name == "PDBx:auth_comp_id":
            assert(not(current_atom_site.ATOMResidueAA))
            current_atom_site.ATOMResidueAA = tag_content

        elif name == "PDBx:label_seq_id":
            assert(not(current_atom_site.SEQRESIndex))
            current_atom_site.SEQRESIndex = int(tag_content)
        elif name == "PDBx:label_comp_id":
            assert(not(current_atom_site.ATOMSeqresResidueAA))
            current_atom_site.ATOMSeqresResidueAA = tag_content
376075
def unique_id
      # check all_data instead of data, as we have to not reuse deleted key
      ids = Set.new(all_data.map { |e| e[:key] })
      id = 1
      loop do
        return id.to_s unless ids.include?(id.to_s)

        id += 1
      end
    end
50496
private static String changeIdForRNA(MonomerNotation monomerNotation) {
		if (monomerNotation instanceof MonomerNotationUnitRNA) {
			StringBuilder changeid = new StringBuilder();

			for (MonomerNotation not : ((MonomerNotationUnitRNA) monomerNotation).getContents()) {
				Monomer monomer = nucleotidesNaturalAnalog.get(not.getUnit().replace("[", "").replace("]", ""));
				String id = monomer.getNaturalAnalog();
				if (monomer.getMonomerType().equals(Monomer.BRANCH_MOMONER_TYPE)) {
					id = "(" + id + ")";
				}
				changeid.append(id);
			}
			return changeid.toString();
		} else {
			Monomer monomer = nucleotidesNaturalAnalog.get(monomerNotation.getUnit().replace("[", "").replace("]", ""));
			String id = monomer.getNaturalAnalog();
			if (monomer.getMonomerType().equals(Monomer.BRANCH_MOMONER_TYPE)) {
				id = "(" + id + ")";
			}
			return id;
		}
	}
1115320
def set(self, document_id):
        
        if not self.abstract:
            raise ImmutableDocumentException()
        self._id = document_id

        return self
295196
def _increment_rigid_ids(self, increment):
        
        for particle in self.particles():
            if particle.rigid_id is not None:
                particle.rigid_id += increment
1119456
def get_parent_id(self):
        ''''''
        parent_id = parsers.get_parent_id(self.__chebi_id)
        return None if math.isnan(parent_id) else 'CHEBI:' + str(parent_id)
566468
def generate_id
      raise "generate_id only makes sense for headers" unless node_type == :header
      generated_id = children_to_s.tr(' ', '_').downcase.gsub(/\W/, '').strip
      num_occurs = (@doc.header_ids[generated_id] += 1)
      generated_id += "_#{num_occurs}" if num_occurs > 1
      generated_id
    end
1004372
def get_parent_id(self, resource, document):
        
        parent_type = self._get_parent_type(resource)
        if parent_type and document:
            return document.get(parent_type.get('field'))

        return None
663168
def from_non_aligned_residue_IDs(Chain, StartResidueID, EndResidueID, Sequence = None):
        ''''''
        return PDBSection(Chain, PDB.ResidueID2String(StartResidueID), PDB.ResidueID2String(EndResidueID), Sequence = Sequence)