コード例 #1
0
ファイル: metricsasa.py プロジェクト: AspirinCode/moleculekit
    def project(self, mol):
        """ Project molecule.

        Parameters
        ----------
        mol : :class:`Molecule <moleculekit.molecule.Molecule>`
            A :class:`Molecule <moleculekit.molecule.Molecule>` object to project.

        Returns
        -------
        data : np.ndarray
            An array containing the projected data.
        """
        getMolProp = lambda prop: self._getMolProp(mol, prop)
        radii = getMolProp('radii')
        atom_mapping = getMolProp('atom_mapping')
        sel = getMolProp('sel')

        xyz = np.swapaxes(
            np.swapaxes(np.atleast_3d(mol.coords[sel, :, :]), 1, 2), 0, 1)
        xyz = np.array(xyz.copy(), dtype=np.float32) / 10  # converting to nm

        try:
            from mdtraj.geometry._geometry import _sasa as sasa
        except ImportError:
            raise ImportError(
                'To calculate SASA you need to install mdtraj with `conda install mdtraj -c omnia`'
            )

        out = np.zeros((mol.numFrames, atom_mapping.max() + 1),
                       dtype=np.float32)
        sasa(xyz, radii / 10, int(self._numSpherePoints), atom_mapping,
             out)  # Divide radii by 10 for nm
        return out
コード例 #2
0
ファイル: metricsasa.py プロジェクト: prokia/htmd
    def project(self, mol):
        """ Project molecule.

        Parameters
        ----------
        mol : :class:`Molecule <htmd.molecule.molecule.Molecule>`
            A :class:`Molecule <htmd.molecule.molecule.Molecule>` object to project.

        Returns
        -------
        data : np.ndarray
            An array containing the projected data.
        """
        radii, atom_mapping, sel = self._getRadiiMapping(mol)

        xyz = np.swapaxes(
            np.swapaxes(np.atleast_3d(mol.coords[sel, :, :]), 1, 2), 0, 1)
        xyz = np.array(xyz.copy(), dtype=np.float32) / 10  # converting to nm

        from mdtraj.geometry._geometry import _sasa as sasa
        out = np.zeros((mol.numFrames, atom_mapping.max() + 1),
                       dtype=np.float32)
        sasa(xyz, radii / 10, int(self._numSpherePoints), atom_mapping,
             out)  # Divide radii by 10 for nm
        return out
コード例 #3
0
ファイル: metricsasa.py プロジェクト: alejandrovr/htmd
    def project(self, mol):
        """ Project molecule.

        Parameters
        ----------
        mol : :class:`Molecule <htmd.molecule.molecule.Molecule>`
            A :class:`Molecule <htmd.molecule.molecule.Molecule>` object to project.

        Returns
        -------
        data : np.ndarray
            An array containing the projected data.
        """
        radii, atom_mapping, sel = self._getRadiiMapping(mol)

        xyz = np.swapaxes(np.swapaxes(np.atleast_3d(mol.coords[sel, :, :]), 1, 2), 0, 1)
        xyz = np.array(xyz.copy(), dtype=np.float32) / 10  # converting to nm

        from mdtraj.geometry._geometry import _sasa as sasa
        out = np.zeros((mol.numFrames, atom_mapping.max() + 1), dtype=np.float32)
        sasa(xyz, radii / 10, int(self._numSpherePoints), atom_mapping, out)  # Divide radii by 10 for nm
        return out