Skip to content

Commit

Permalink
Merge branch 'issue-#82/replace-libpopt-in-rbcavity' of github.com:CB…
Browse files Browse the repository at this point in the history
…DD/rDock into issue-#82/replace-libpopt-in-rbcavity
  • Loading branch information
ggutierrez-sunbright committed May 3, 2024
2 parents b27c816 + 30e7d51 commit 3a950f7
Show file tree
Hide file tree
Showing 18 changed files with 2,009 additions and 2 deletions.
1 change: 1 addition & 0 deletions rdock-utils/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ sdtether = "rdock_utils.sdtether.main:main"
sdtether_old = "rdock_utils.sdtether_original:main"
sdfilter = "rdock_utils.sdfilter.main:main"
sdmodify = "rdock_utils.sdmodify:main"
sdsort = "rdock_utils.sdsort:main"

[project.urls]
Repository = "https://github.com/CBDD/rDock.git"
Expand Down
8 changes: 8 additions & 0 deletions rdock-utils/rdock_utils/common/SDFParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,11 @@ def read_molecules(file: TextIO) -> Generator[FastSDMol, None, None]:

def read_molecules_from_all_inputs(inputs: Iterable[TextIO]) -> Iterable[FastSDMol]:
return itertools.chain.from_iterable(read_molecules(source) for source in inputs)


def molecules_with_progress_log(molecules: Iterable[FastSDMol], count: int = 1000) -> Iterable[FastSDMol]:
for i, molecule in enumerate(molecules):
if i % count == 0:
logger.info(f"read {i} molecules")

yield molecule
3 changes: 2 additions & 1 deletion rdock-utils/rdock_utils/common/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .files import inputs_generator
from .SDFParser import FastSDMol, read_molecules, read_molecules_from_all_inputs
from .SDFParser import FastSDMol, molecules_with_progress_log, read_molecules, read_molecules_from_all_inputs
from .superpose3d import MolAlignmentData, Superpose3D, update_coordinates
from .types import (
AtomsMapping,
Expand All @@ -19,6 +19,7 @@
"FastSDMol",
"read_molecules",
"read_molecules_from_all_inputs",
"molecules_with_progress_log",
# -- superpose3d --
"update_coordinates",
"MolAlignmentData",
Expand Down
2 changes: 1 addition & 1 deletion rdock-utils/rdock_utils/common/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Generator, TextIO


def inputs_generator(inputs: list[str]) -> Generator[TextIO, None, None]:
def inputs_generator(inputs: list[str] | None) -> Generator[TextIO, None, None]:
if not inputs:
yield sys.stdin
else:
Expand Down
Loading

0 comments on commit 3a950f7

Please sign in to comment.