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

Add LinkGraph to replace ObjectLink and LinkCollection #252

Merged
merged 14 commits into from
Jun 10, 2024
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies = [
"httpx",
"jsonschema",
"numpy",
"networkx",
"pandas",
"pyteomics",
"rich",
Expand Down
1 change: 0 additions & 1 deletion src/nplinker/nplinker.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from .metabolomics import Spectrum
from .pickler import save_pickled_data
from .scoring.abc import ScoringBase
from .scoring.link_collection import LinkCollection
from .scoring.metcalf_scoring import MetcalfScoring
from .scoring.np_class_scoring import NPClassScoring
from .scoring.rosetta_scoring import RosettaScoring
Expand Down
13 changes: 10 additions & 3 deletions src/nplinker/scoring/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
from .abc import ScoringBase
from .link_collection import LinkCollection
from .link_graph import LinkGraph
from .metcalf_scoring import MetcalfScoring
from .object_link import ObjectLink
from .score import Score
from .scoring_method import ScoringMethod


__all__ = ["LinkCollection", "MetcalfScoring", "ScoringBase", "ObjectLink"]
__all__ = [
"LinkGraph",
"MetcalfScoring",
"Score",
"ScoringBase",
"ScoringMethod",
]
16 changes: 10 additions & 6 deletions src/nplinker/scoring/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@


if TYPE_CHECKING:
from nplinker import NPLinker
from . import LinkCollection
from nplinker.nplinker import NPLinker
from .link_graph import LinkGraph

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -36,15 +36,19 @@ def setup(cls, npl: NPLinker):
"""Setup class level attributes."""

@abstractmethod
def get_links(self, *objects, link_collection: LinkCollection) -> LinkCollection:
def get_links(
self,
*objects,
**parameters,
) -> LinkGraph:
"""Get links information for the given objects.

Args:
objects: A set of objects.
link_collection: The LinkCollection object.
objects: A list of objects to get links for.
parameters: The parameters used for scoring.

Returns:
The LinkCollection object.
The LinkGraph object.
"""

@abstractmethod
Expand Down
192 changes: 0 additions & 192 deletions src/nplinker/scoring/link_collection.py

This file was deleted.

Loading
Loading