Residue¶
-
class
rnamake.residue.
Bead
(center, btype)[source]¶ Bases:
object
Bead class stores information related to keeping track of steric clashes between residues during building. They are never used outside the Residue class
Parameters: - btype (BeadType) – type of the bead either Phos(Phosphate), Sugar or Base, of the atoms used generate the center
- center (numpy array) – The geometric center of the group of atoms
-
class
rnamake.residue.
BeadType
[source]¶ Bases:
object
BeadType is an ENUM type. This is to specify which center of atoms each bead represents.
Phosphate (0): P, OP1, OP2
Sugar (1): O5’,C5’,C4’,O4’,C3’,O3’,C1’,C2’,O2’
Base (2): All remaining atoms
-
class
rnamake.residue.
Residue
(rtype, name, num, chain_id, i_code='')[source]¶ Bases:
object
Store residue information from pdb file, stores all Atom objects that belong to residue. Implementation is designed to be extremely lightweight.
Parameters: - rtype (residue_type.ResidueType) – residue type, stores information about residue
- name (str) – residue name
- num (int) – residue num
- chain_id (str) – chain identification
- i_code (str) – insertion code, optional argument if not supplied will be set to
Attributes: - atoms : atom.Atom
- holds all atoms that belong to this residue object
- name : str
- name of residue, ex. ADE, GUA etc
- num : int
- residue num
- rtype : residue_type.ResidueType
- Information about residue type each nucleic acid has its own type
- chain_id : str
- chain indentification string, ex. ‘A’ or ‘B’
- i_code: str
- residue insertion code
- uuid : uuid.uuid1
- the unique id to indentify residue
Examples: # generating a new residue >>> rts = residue_type.ResidueTypeSet() >>> rtype = rts.get_rtype_by_resname("ADE") >>> r = Residue(rtype, "ADE", 1, "A") >>> print r.name A #using test residue >>> import rnamake.unittests.instances >>> r = rnamake.unittests.instances.residue() >>> print r.name G >>> a = r.get_atom("C1'") >>> print a.coords [-23.806 -50.289 86.732] >>> r.get_beads() [<Bead(btype='SUGAR', center='-24.027 -48.5001111111 86.368')>, <Bead(btype='BASE', center='-21.2186363636 -52.048 85.1157272727')>] #a fast way of saving coordinate information to file >>> r.to_str() "GUA,G,103,A,,N,N,N,O5' -26.469 -47.756 84.669,C5' -25.05 -47.579 84.775,C4' -24.521 -48.156 86.068,O4' -24.861 -49.568 86.118,C3' -23.009 -48.119 86.281,O3' -22.548 -46.872 86.808,C1' -23.806 -50.289 86.732,C2' -22.812 -49.259 87.269,O2' -23.167 -48.903 88.592,N1 -19.538 -52.485 85.025,C2 -19.717 -51.643 86.097,N2 -18.624 -51.354 86.809,N3 -20.884 -51.124 86.445,C4 -21.881 -51.521 85.623,C5 -21.811 -52.356 84.527,C6 -20.546 -52.91 84.164,O6 -20.273 -53.677 83.228,N7 -23.063 -52.513 83.947,C8 -23.858 -51.786 84.686,N9 -23.21 -51.159 85.722," #get PDB formmated coordinates back out >>> r.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 . . .
-
connected_to
(res, cutoff=3.0)[source]¶ Determine if another residue is connected to this residue, returns 0 if res is not connected to self, returns 1 if connection is going from 5’ to 3’ and returns -1 if connection is going from 3’ to 5’
Parameters: - res (Residue) – another residue
- cutoff (int) – distance to be considered connected, default: 3 Angstroms
Return type: int
-
copy
()[source]¶ performs a deep copy of Residue object
Return type: Residue Examples: >>> import rnamake.unittests.instances >>> r = rnamake.unittests.instances.residue() >>> r_copy = r.copy() >>> r_copy.name G
-
get_atom
(atom_name)[source]¶ get atom object by its name
Parameters: atom_name (str) – name Examples:
>>> r = rnamake.unittests.instances.residue() >>> a = r.get_atom("C1'") >>> print a.coords [-23.806 -50.289 86.732]
-
get_beads
()[source]¶ Generates steric beads required for checking for steric clashes between motifs. Each residues has three beads modeled after the typical three bead models used in coarse grain modeling. The three beads are:
Phosphate: P, OP1, OP2
Sugar : O5’,C5’,C4’,O4’,C3’,O3’,C1’,C2’,O2’
Base : All remaining atoms
if there are for example no phosphate atoms only 2 beads will be returned.
>>> import rnamake.unittests.instances >>> r = rnamake.unittests.instances.residue() >>> r.get_beads() [<Bead(btype='SUGAR', center='-24.027 -48.5001111111 86.368')>, <Bead(btype='BASE', center='-21.2186363636 -52.048 85.1157272727')>]
-
new_uuid
()[source]¶ give residue a new unique indentifier code. There is probably no reason why you should call this unless writing a new, motif structure.
-
setup_atoms
(atoms)[source]¶ put atoms in correct positon in internal atom list, also corrects some named atom names to their correct name
Parameters: atoms (list of Atom objects) – list of atom objects that are to be part of this residue
-
short_name
()[source]¶ gets letter of residue, i.e. A or G etc
Returns: letter for residue Return type: str
-
to_pdb
(fname='residue.pdb')[source]¶ Writes a PDB string formmated verision of this Residue object to file
Parameters: fname (str) – filename of output PDB file, default=”chain.pdb” Returns: None
-
to_pdb_str
(acount=1, return_acount=0, rnum=-1, chain_id='')[source]¶ returns pdb formatted string of residue’s coordinate information
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
Return type: str
Examples: >>> import rnamake.unittests.instances >>> r = rnamake.unittests.instances.residue() >>> r.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 . . .
-
to_str
()[source]¶ stringifes residue object
Returns: stringified residue object >>> import rnamake.unittests.instances >>> r = rnamake.unittests.instances.residue() >>> r.to_str() "GUA,G,103,A,,N,N,N,O5' -26.469 -47.756 84.669,C5' -25.05 -47.579 84.775,C4' -24.521 -48.156 86.068,O4' -24.861 -49.568 86.118,C3' -23.009 -48.119 86.281,O3' -22.548 -46.872 86.808,C1' -23.806 -50.289 86.732,C2' -22.812 -49.259 87.269,O2' -23.167 -48.903 88.592,N1 -19.538 -52.485 85.025,C2 -19.717 -51.643 86.097,N2 -18.624 -51.354 86.809,N3 -20.884 -51.124 86.445,C4 -21.881 -51.521 85.623,C5 -21.811 -52.356 84.527,C6 -20.546 -52.91 84.164,O6 -20.273 -53.677 83.228,N7 -23.063 -52.513 83.947,C8 -23.858 -51.786 84.686,N9 -23.21 -51.159 85.722,"