Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data transfer #18

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
12 changes: 12 additions & 0 deletions pyscreener/docking/data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from dataclasses import dataclass
from os import read
from pathlib import Path
from typing import Optional, Tuple, Union
from openbabel import pybel

from pyscreener.exceptions import InvalidResultError, NotSimulatedError
from pyscreener.utils import ScoreMode
Expand Down Expand Up @@ -38,6 +40,9 @@ class CalculationData:
result : Optional[Mapping]
the result of the docking calculation. None if the calculation has not
been performed yet.
input_file_bytes : None
the file bytes for distributed computing. None if there is
no file being sent.

Parmeters
---------
Expand All @@ -53,6 +58,7 @@ class CalculationData:
prepared_ligand : Optional[Union[str, Path]], default=None
prepared_receptor : Optional[Union[str, Path]], default=None
result : Optional[Result], default=None
input_file_bytes : Optional[bytes], default = None
"""

smi: str
Expand All @@ -68,11 +74,17 @@ class CalculationData:
score_mode: ScoreMode = ScoreMode.BEST
k: int = 1
result: Optional[Result] = None
input_file_bytes: Optional[bytes] = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is bytes the correct type here?


def __post_init__(self):
self.in_path = Path(self.in_path)
self.out_path = Path(self.out_path)

if self.input_file is not None:
with open(self.input_file, 'rb') as f:
self.input_file_bytes = f.read()


@property
def score(self) -> Optional[float]:
"""the docking score of this calculation
Expand Down
Loading