Bio.SCOP.Raf module

ASTRAL RAF (Rapid Access Format) Sequence Maps.

The ASTRAL RAF Sequence Maps record the relationship between the PDB SEQRES records (representing the sequence of the molecule used in an experiment) to the ATOM records (representing the atoms experimentally observed).

This data is derived from the Protein Data Bank CIF files. Known errors in the CIF files are corrected manually, with the original PDB file serving as the final arbiter in case of discrepancies.

Residues are referenced by residue ID. This consists of a the PDB residue sequence number (up to 4 digits) and an optional PDB insertion code (an ascii alphabetic character, a-z, A-Z). e.g. “1”, “10A”, “1010b”, “-1”

See “ASTRAL RAF Sequence Maps”:

Dictionary protein_letters_3to1 provides a mapping from the 3-letter amino acid codes found in PDB files to 1-letter codes. The 3-letter codes include chemically modified residues.


Convert RAF one-letter amino acid codes into IUPAC standard codes.

Letters are uppercased, and “.” (“Unknown”) is converted to “X”.

class Bio.SCOP.Raf.SeqMapIndex(filename)

Bases: dict

An RAF file index.

The RAF file itself is about 50 MB. This index provides rapid, random access of RAF records without having to load the entire file into memory.

The index key is a concatenation of the PDB ID and chain ID. e.g “2drcA”, "155c_". RAF uses an underscore to indicate blank chain IDs.

__init__(self, filename)

Initialize the RAF file index.

  • filename – The file to index

__getitem__(self, key)

Return an item from the indexed file.

getSeqMap(self, residues)

Get the sequence map for a collection of residues.

  • residues – A Residues instance, or a string that can be converted into a Residues instance.

class Bio.SCOP.Raf.SeqMap(line=None)

Bases: object

An ASTRAL RAF (Rapid Access Format) Sequence Map.

This is a list like object; You can find the location of particular residues with index(), slice this SeqMap into fragments, and glue fragments back together with extend().

  • pdbid – The PDB 4 character ID

  • pdb_datestamp – From the PDB file

  • version – The RAF format version. e.g. 0.01

  • flags – RAF flags. (See release notes for more information.)

  • res – A list of Res objects, one for each residue in this sequence map

__init__(self, line=None)

Initialize the class.

index(self, resid, chainid='_')

Return the index of the SeqMap for the given resid and chainid.

__getitem__(self, index)

Extract a single Res object from the SeqMap.

append(self, res)

Append another Res object onto the list of residue mappings.

extend(self, other)

Append another SeqMap onto the end of self.

Both SeqMaps must have the same PDB ID, PDB datestamp and RAF version. The RAF flags are erased if they are inconsistent. This may happen when fragments are taken from different chains.

__iadd__(self, other)

In place addition of SeqMap objects.

__add__(self, other)

Addition of SeqMap objects.

getAtoms(self, pdb_handle, out_handle)

Extract all relevant ATOM and HETATOM records from a PDB file.

The PDB file is scanned for ATOM and HETATOM records. If the chain ID, residue ID (seqNum and iCode), and residue type match a residue in this sequence map, then the record is echoed to the output handle.

This is typically used to find the coordinates of a domain, or other residue subset.

  • pdb_handle – A handle to the relevant PDB file.

  • out_handle – All output is written to this file like object.

class Bio.SCOP.Raf.Res

Bases: object

A single residue mapping from a RAF record.

  • chainid – A single character chain ID.

  • resid – The residue ID.

  • atom – amino acid one-letter code from ATOM records.

  • seqres – amino acid one-letter code from SEQRES records.


Initialize the class.


Iterate over RAF file, giving a SeqMap object for each line.

  • handle – file-like object.