molecupy.structures.chains (Residuic structures)

Contains classes for macrostructures made of residues.

class molecupy.structures.chains.ResiduicStructure(*residues)[source]

Base class: AtomicStructure

The base class for all structures which can be described as a set of residues.

Parameters:residues – A sequence of Residue objects in this structure.
residues(include_missing=True)[source]

Returns the residues in this structure as a set.

Parameters:include_missing (str) – If False only residues present in the PDB coordinates will be returned, and not missing ones.
Return type:set
add_residue(residue)[source]

Adds a residue to the structure.

Parameters:residue (Residue) – The residue to add.
remove_residue(residue)[source]

Removes a residue from the structure.

Parameters:residue (Residue) – The residue to remove.
get_residue_by_id(residue_id)[source]

Returns the first residue that matches a given residue ID.

Parameters:residue_id (str) – The residue ID to search by.
Return type:Residue or None
get_residues_by_name(residue_name, include_missing=True)[source]

Returns all the residues of a given name.

Parameters:
  • residue_name (str) – The name to search by.
  • include_missing (str) – If False only residues present in the PDB coordinates will be returned, and not missing ones.
Return type:

set of Residue objects.

get_residue_by_name(residue_name, include_missing=True)[source]

Returns the first residue that matches a given name.

Parameters:
  • residue_name (str) – The name to search by.
  • include_missing (str) – If False only residues present in the PDB coordinates will be returned, and not missing ones.
Return type:

Residue or None

class molecupy.structures.chains.ResiduicSequence(*residues)[source]

Base class: ResiduicStructure

The base class for all structures which can be described as a sequence of residues.

Parameters:residues – A sequence of Residue objects in this structure.
residues(include_missing=True)[source]

Returns the residues in this structure as a list.

Parameters:include_missing (str) – If False only residues present in the PDB coordinates will be returned, and not missing ones.
Return type:list
add_residue(residue)[source]

Adds a residue to the end of this sequence.

Parameters:residue (Residue) – The residue to add.
sequence_string(include_missing=True)[source]

Return the protein sequence of this chain as one letter codes.

Parameters:include_missing (str) – If False only residues present in the PDB coordinates will be returned, and not missing ones.
Rtype str:The protein sequence.
class molecupy.structures.chains.Chain(chain_id, *residues)[source]

Base class: ResiduicSequence

Represents chains - the polymeric units that make up most of PDB structures.

Parameters:
  • chain_id – The chain’s ID.
  • residues – The residues in this chain.
chain_id()[source]

Returns the chain’s ID.

Return type:str
alpha_helices()[source]

Returns the AlphaHelix objects on this chain.

Returns:set of AlphaHelix objects
beta_strands()[source]

Returns the BetsStrand objects on this chain.

Returns:set of BetaStrand objects
model()[source]

Returns the Model that the chain inhabits.

Return type:Model
complex()[source]

Returns the Complex that the chain is a part of.

Return type:Model
get_helix_by_id(helix_id)[source]

Returns the first alpha helix that matches a given helix ID.

Parameters:helix_id (str) – The helix ID to search by.
Return type:AlphaHelix or None
get_strand_by_id(strand_id)[source]

Returns the first beta strand that matches a given strand ID.

Parameters:strand_id (str) – The strand ID to search by.
Return type:BetsStrand or None
class molecupy.structures.chains.BindSite(site_id, *residues)[source]

Base class: ResiduicStructure

Represents binding sites - the residue clusters that mediate ligand binding.

Parameters:
  • site_id – The site’s ID.
  • residues – The residues in this chain.
site_id()[source]

Returns the site’s ID.

Return type:str
ligand(ligand=None)[source]

Returns or sets the site’s SmallMolecule ligand.

Parameters:ligand (SmallMolecule) – If given, the ligand will be set to this.
Return type:SmallMolecule
model()[source]

Returns the Model that the site inhabits.

Return type:Model
continuous_sequence()[source]

If the residues are on the same chain, this will return a continuous sequence that contains all residues in this site, otherwise None.

Return type:ResiduicSequence
class molecupy.structures.chains.AlphaHelix(helix_id, *residues, helix_class=None, comment=None)[source]

Base class: ResiduicSequence

Represents alpha helices.

Parameters:
  • helix_id (str) – The helix’s ID.
  • residues – The residues in this helix.
  • helix_class (str) – The classification of the helix.
  • comment (str) – Any comment associated with this helix.
helix_id()[source]

Returns the helix’s ID.

Return type:str
helix_class(helix_class=None)[source]

Returns or sets the helix’s classification.

Parameters:helix_class (str) – If given, the class will be set to this.
Return type:str
comment(comment=None)[source]

Returns or sets the helix’s comment.

Parameters:comment (str) – If given, the comment will be set to this.
Return type:str
chain()[source]

Returns the chain that this helix is on.

Return type:Chain
class molecupy.structures.chains.BetaStrand(strand_id, sense, *residues)[source]

Base class: ResiduicSequence

Represents beta strands.

Parameters:
  • strand_id (str) – The strand’s ID.
  • residues – The residues in this strand.
  • sense (int) – The sense of the strand with respect to the prior strand.
strand_id()[source]

Returns the strand’s ID.

Return type:str
sense(sense=None)[source]

Returns or sets the strand’s sense with respect to the previous strand.

Parameters:sense (int) – If given, the sense will be set to this.
Return type:int
chain()[source]

Returns the chain that this strand is on.

Return type:Chain