Chain

class rnamake.chain.Chain(residues=None)[source]

Bases: object

Stored chain information from pdb file. Stores all residues in chain. Implementation is designed to be extremely lightweight. To connect residues into chains it highly adviced that you use connect_residues_into_chains()

Parameters:residues (list of residue.Residue objects) – the residues that are to be included in this chain
Attributes:
residues : List of Residue objects
The list of residues that belong to this chain will always be in 5’ to 3’ order
Examples:
>>> import rnamake.unittests.instances
>>> c = rnamake.unittests.instances.chain()
>>> c.first()
<Residue('G103 chain A')>

>>> c.last()
<Residue('C260 chain A')>

>>> len(c)
157

>>> cs = c.subchain(1, 10)
>>> len(cs)
9

>>> cs.first()
<Residue('A104 chain A')>

>>> cs2 = c.subchain(start_res=c.residues[10], end_res=c.residues[15])
>>> len(cs2)
6

>>> c.to_pdb_str()
ATOM      1 O5'  G   A 103     -26.469 -47.756  84.669  1.00  0.00
ATOM      2 C5'  G   A 103     -25.050 -47.579  84.775  1.00  0.00
ATOM      3 C4'  G   A 103     -24.521 -48.156  86.068  1.00  0.00
ATOM      4 O4'  G   A 103     -24.861 -49.568  86.118  1.00  0.00
ATOM      5 C3'  G   A 103     -23.009 -48.119  86.281  1.00  0.00
ATOM      6 O3'  G   A 103     -22.548 -46.872  86.808  1.00  0.00
ATOM      7 C1'  G   A 103     -23.806 -50.289  86.732  1.00  0.00
ATOM      8 C2'  G   A 103     -22.812 -49.259  87.269  1.00  0.00
.
.
.
copy()[source]

Creates a deepcopy of the this chain object.

Returns:Chain object
first()[source]

returns residue at 5’ end of chain

Returns:first residue in chain
Return type:residue.Residue
Examples:
>>> import rnamake.unittests.instances
>>> c = rnamake.unittests.instances.chain()
>>> c.first()
<Residue('G103 chain A')>
last()[source]

returns 3’ end of chain

subchain(start=None, end=None, start_res=None, end_res=None)[source]

Creates a new chain from a subsection of the residues in the current chain.

Parameters:
  • start (int) – start position in residues object list, default:None
  • end (int) – end position in residues object list, default:None
  • start_res – The 5’ residue of sub chain, default:None
  • end_res – The 3’ resiude of sub chain, default:None
Returns:

Chain object

Examples:
>>> cs = c.subchain(1, 10)
>>> len(cs)
9

>>> cs.first()
<Residue('A104 chain A')>

>>> cs2 = c.subchain(start_res=c.residues[10], end_res=c.residues[15])
>>> len(cs2)
6
to_pdb(fname='chain.pdb', rnum=-1, chain_id='')[source]

Writes a PDB string formmated verision of this Chain object to file

Parameters:
  • fname (str) – filename of output PDB file, default=”chain.pdb”
  • rnum (int) – starting residue number, default: -1
  • chain_id (str) – the chain id of the chain, i.e. “A”, “B” etc
Returns:

None

to_pdb_str(acount=1, return_acount=0, rnum=-1, chain_id='')[source]

creates a PDB string formatted verision of this Chain object.

Parameters:
  • acount (int) – current atom index, default: 1
  • return_acount (int) – final atom index after current atoms, default: 0
  • rnum (int) – starting residue number, default: -1
  • chain_id (str) – the chain id of the chain, i.e. “A”, “B” etc
Returns:

str

to_str()[source]

Stringifes Chain object

Returns:str
rnamake.chain.connect_residues_into_chains(residues)[source]

takes all residues and puts into the correct order in chains checking for physical connection between O5’ and P atoms between residues

Parameters:residues (List of Residue objects) – residue objects that belong in this structure
Returns:List of Chain objects