Skip to content

Commit

Permalink
refactor: Move PyMolecule into separate repo
Browse files Browse the repository at this point in the history
  • Loading branch information
aalexmmaldonado committed Nov 30, 2024
1 parent d72c4f1 commit f814314
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 4,181 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ public

__pycache__
.vscode

# Coverage
.coverage
coverage.xml
report.xml
17 changes: 17 additions & 0 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ readme = "README.md"

[pypi-dependencies]
povme = { path = ".", editable = true }
pymolecule = { git = "https://github.com/durrantlab/pymolecule.git", rev = "main" }


[system-requirements]
linux = "3.10.0"
Expand Down
6 changes: 3 additions & 3 deletions povme/hull.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import numpy as np
import numpy.typing as npt
from loguru import logger
from pymolecule import Molecule
from scipy.spatial.distance import cdist, pdist, squareform

from . import pymolecule
from .io import gzopenfile, numpy_to_pdb, openfile, write_to_file
from .parallel import MultithreadingTaskGeneral

Expand Down Expand Up @@ -394,8 +394,8 @@ def value_func(self, item, results_queue):
# you may need to load it from disk if the user so specified
if config.use_disk_not_memory: # so you need to load it from disk
pym_filename = pdb
pdb = pymolecule.Molecule()
pdb.fileio.load_pym_into(pym_filename)
pdb = Molecule()
pdb.io.load_pym_into(pym_filename)

# remove the points that are far from the points region anyway
min_pts = np.min(pts, 0) - config.distance_cutoff - 1
Expand Down
4 changes: 2 additions & 2 deletions povme/pocket_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import numpy as np
from loguru import logger
from pymolecule import Molecule
from scipy.cluster.vq import kmeans2
from scipy.spatial.distance import cdist

from .config import PocketIDConfig
from .hull import ConvexHull
from .io import openfile, write_pdbs
from .pocket import BoxOfPoints
from .pymolecule import Molecule


class PocketDetector:
Expand Down Expand Up @@ -43,7 +43,7 @@ def run(self, path_pdb: str, output_prefix: str = "") -> None:

logger.info("Step 1. Loading the PDB file " + path_pdb + "...")
molecule = Molecule()
molecule.fileio.load_pdb_into(path_pdb)
molecule.io.load_pdb_into(path_pdb)

# Step 2: Get rid of hydogen atoms. They just slow stuff down.

Expand Down
8 changes: 4 additions & 4 deletions povme/povme.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

import numpy as np
from loguru import logger
from pymolecule import Molecule
from scipy.spatial.distance import cdist

from . import pymolecule
from .config import POVMEConfig
from .hull import MultithreadingCalcVolumeTask
from .io import dx_freq, gzopenfile, numpy_to_pdb, openfile, write_to_file
Expand Down Expand Up @@ -54,8 +54,8 @@ def value_func(self, item, results_queue):

# make the pdb object
str_obj = StringIO(pdb_string)
tmp = pymolecule.Molecule()
tmp.fileio.load_pdb_into_using_file_object(str_obj, False, False, False)
tmp = Molecule()
tmp.io.load_pdb_into_using_file_object(str_obj, False, False, False)

logger.debug("\tFurther processing frame " + str(index))

Expand All @@ -64,7 +64,7 @@ def value_func(self, item, results_queue):
self.results.append((index, tmp))
else: # save to disk, record filename
pym_filename = f"./.povme_tmp/frame_{str(index)}.pym"
tmp.fileio.save_pym(pym_filename, False, False, False, False, False)
tmp.io.save_pym(pym_filename, False, False, False, False, False)
self.results.append((index, pym_filename))


Expand Down
Loading

0 comments on commit f814314

Please sign in to comment.