def setUp(self):
     self.atoms = [
         Atom(type='C', name='a1', component_number=3, x=1.0, y=0.0, z=0.0),
         Atom(type='C', name='a2', component_number=2, x=2.0, y=0.0, z=0.0),
         Atom(type='N', name='b1', component_number=1, x=3.0, y=0.0, z=0.0),
         Atom(type='N', name='c2', component_number=0, x=0.0, y=1.0, z=0.0)
     ]
     self.proxy = AtomProxy(self.atoms)
Beispiel #2
0
    def __init__(self,
                 atoms,
                 pdb=None,
                 model=None,
                 type=None,
                 chain=None,
                 symmetry=None,
                 sequence=None,
                 number=None,
                 index=None,
                 insertion_code=None,
                 polymeric=None,
                 alt_id=None):
        """Create a new Component.

        :atoms: The atoms this component is composed of.
        :pdb: The pdb this is a part of.
        :model: The model number.
        """

        self._atoms = atoms
        self.pdb = pdb
        self.model = model
        self.type = type
        self.chain = chain
        self.symmetry = symmetry
        self.sequence = sequence
        self.number = number
        self.index = index
        self.insertion_code = insertion_code
        self.polymeric = polymeric
        self.alt_id = alt_id
        self.centers = AtomProxy(self._atoms)

        if self.sequence in defs.RNAbaseheavyatoms:
            atoms = defs.RNAbaseheavyatoms[self.sequence]
            self.centers.define('base', atoms)

        if self.sequence in defs.nt_backbone:
            atoms = defs.nt_backbone[self.sequence]
            self.centers.define('nt_backbone', atoms)

        if self.sequence in defs.aa_fg:
            atoms = defs.aa_fg[self.sequence]
            self.centers.define('aa_fg', atoms)

        if self.sequence in defs.aa_backbone:
            atoms = defs.aa_backbone[self.sequence]
            self.centers.define('aa_backbone', atoms)
Beispiel #3
0
    def __init__(self,
                 atoms,
                 pdb=None,
                 model=None,
                 type=None,
                 chain=None,
                 symmetry=None,
                 sequence=None,
                 number=None,
                 index=None,
                 insertion_code=None,
                 polymeric=None,
                 alt_id=None,
                 inferhydrogens=True):
        """Create a new Component.

        :atoms: The atoms this component is composed of.
        :pdb: The pdb this is a part of.
        :model: The model number.
        """

        self._atoms = atoms
        self.pdb = pdb
        self.model = model
        self.type = type
        self.chain = chain
        self.symmetry = symmetry
        self.sequence = sequence
        self.number = number
        self.index = index
        self.insertion_code = insertion_code
        self.polymeric = polymeric
        self.alt_id = alt_id
        self.base_center = None
        self.rotation_matrix = None

        # for bases, calculate and store rotation_matrix
        # calculate and store base_center; especially for modified nt without all heavy atoms
        self.calculate_rotation_matrix()

        # initialize centers so they can be used to infer hydrogens
        self.centers = AtomProxy(self._atoms)

        # add hydrogen atoms to standard bases and amino acids
        if inferhydrogens:
            self.infer_hydrogens()

        # initialize centers again to include hydrogens
        self.centers = AtomProxy(self._atoms)

        # standard and modified bases should have their rotation matrix
        # calculated already, and should have a base center set by that
        # if they don't, there is no sensible way to assign a base center,
        # for example if the structure just has a backbone trace
        if self.base_center is not None:
            self.centers.setcenter('base', self.base_center)

        if self.sequence in defs.nt_sugar:
            atoms = defs.nt_sugar[self.sequence]
            self.centers.define('nt_sugar', atoms)

        if self.sequence in defs.nt_phosphate:
            atoms = defs.nt_phosphate[self.sequence]
            self.centers.define('nt_phosphate', atoms)

        # attempt to add sugar and phosphate centers for all modified nucleotides
        if self.sequence in defs.modified_nucleotides:
            atoms = defs.nt_sugar['A']
            self.centers.define('nt_sugar', atoms)
            atoms = defs.nt_phosphate['A']
            self.centers.define('nt_phosphate', atoms)

        if self.sequence in defs.aa_fg:
            atoms = defs.aa_fg[self.sequence]
            self.centers.define('aa_fg', atoms)

        if self.sequence in defs.aa_backbone:
            atoms = defs.aa_backbone[self.sequence]
            self.centers.define('aa_backbone', atoms)