def _get_ATOM_sequences_2(self):
        '''Creates the ATOM Sequences.'''

        # 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
        for l in self.structure_lines:
            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 ignore_HETATMs:
                    continue

            residue_id = l[21:27]
            if residue_id not in structural_residue_IDs_set:
                chain_id = l[21]
                chain_type = self.chain_types[chain_id]
                atom_sequences[chain_id] = atom_sequences.get(chain_id, Sequence(chain_type))
                residue_type = l[17:20].strip()

                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)
                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
                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))
                atom_sequences[chain_id].add(PDBResidue(residue_id[0], residue_id[1:], short_residue_type, chain_type))
                structural_residue_IDs_set.add(residue_id)

        self.atom_sequences = atom_sequences
def _get_ATOM_sequences_2 ( self ) : atom_sequences = { } structural_residue_IDs_set = set ( ) ignore_HETATMs = True for l in self . structure_lines : 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 ignore_HETATMs : continue residue_id = l [ 21 : 27 ] if residue_id not in structural_residue_IDs_set : chain_id = l [ 21 ] chain_type = self . chain_types [ chain_id ] atom_sequences [ chain_id ] = atom_sequences . get ( chain_id , Sequence ( chain_type ) ) residue_type = l [ 17 : 20 ] . strip ( ) 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 ) 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 ) 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 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 ) ) ) atom_sequences [ chain_id ] . add ( PDBResidue ( residue_id [ 0 ] , residue_id [ 1 : ] , short_residue_type , chain_type ) ) structural_residue_IDs_set . add ( residue_id ) self . atom_sequences = atom_sequences
Creates the ATOM Sequences.