The ihm.reference Python module

Classes for providing extra information about an ihm.Entity

class ihm.reference.Reference[source]

Base class for extra information about an ihm.Entity.

This class is not used directly; instead, use a subclass such as Sequence or UniProtSequence. These objects are then typically passed to the ihm.Entity constructor.

class ihm.reference.Sequence(db_name, db_code, accession, sequence, details=None)[source]

Point to the sequence of an ihm.Entity in a sequence database; convenience subclasses are provided for common sequence databases such as UniProtSequence.

These objects are typically passed to the ihm.Entity constructor.

See also alignments to describe the correspondence between the database and entity sequences.

Parameters:
  • db_name (str) – The name of the database.

  • db_code (str) – The name of the sequence in the database.

  • accession (str) – The database accession.

  • sequence (str) – The complete sequence, as a string of one-letter codes.

  • details (str) – Longer text describing the sequence.

alignments

All alignments between the reference and entity sequences, as Alignment objects. If none are provided, a simple 1:1 alignment is assumed.

class ihm.reference.UniProtSequence(db_code, accession, sequence, details=None)[source]

Point to the sequence of an ihm.Entity in UniProt.

These objects are typically passed to the ihm.Entity constructor.

Parameters:
  • db_code (str) – The UniProt name (e.g. NUP84_YEAST)

  • accession (str) – The UniProt accession (e.g. P52891)

See Sequence for a description of the remaining parameters.

classmethod from_accession(accession)[source]

Create UniProtSequence from just an accession. This is done by querying the UniProt web API, so requires network access.

Parameters:

accession (str) – The UniProt accession (e.g. P52891)

class ihm.reference.Alignment(db_begin=1, db_end=None, entity_begin=1, entity_end=None, seq_dif=[])[source]

A sequence range that aligns between the database and the entity. This describes part of the sequence in the sequence database (Sequence) and in the ihm.Entity. The two ranges must be the same length and have the same primary sequence (any differences must be described with SeqDif objects).

Parameters:
  • db_begin (int) – The first residue in the database sequence that is used (defaults to the entire sequence).

  • db_end (int) – The last residue in the database sequence that is used (or None, the default, to use the entire sequence).

  • entity_begin (int) – The first residue in the Entity sequence that is taken from the reference (defaults to the entire entity sequence).

  • entity_end (int) – The last residue in the Entity sequence that is taken from the reference (or None, the default, to use the entire sequence).

  • seq_dif (Sequence of SeqDif objects.) – Single-point mutations made to the sequence.

class ihm.reference.SeqDif(seq_id, db_monomer, monomer, details=None)[source]

Annotate a sequence difference between a reference and entity sequence. See Alignment.

Parameters:
  • seq_id (int) – The residue index in the entity sequence.

  • db_monomer (ihm.ChemComp) – The monomer type (as a ChemComp object) in the reference sequence.

  • monomer (ihm.ChemComp) – The monomer type (as a ChemComp object) in the entity sequence.

  • details (str) – Descriptive text for the sequence difference.