Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/aptanet_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"\n",
"- **pairs_to_features**: helper that converts `(aptamer_sequence, protein_sequence)` pairs into feature vectors using k-mer + PSeAAC.\n",
"- **SkorchAptaNet**: a PyTorch MLP wrapped in Skorch for binary classification.\n",
"- **load_pfoa_structure**: helper to load the PFOA molecule structure from PDB file."
"- **load_1gnh_structure**: helper to load the GNH molecule structure from PDB file."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion pyaptamer/data/tests/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# dataset paths relative to pyaptamer root
DATA_PATHS = [
"datasets/data/pfoa.pdb",
"datasets/data/5nu7.pdb",
"datasets/data/1gnh.pdb",
]

Expand Down
27 changes: 17 additions & 10 deletions pyaptamer/datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
"""Contains datasets along with their loaders."""

from pyaptamer.datasets._loaders._aptacom_loader import (
from pyaptamer.datasets._loaders import (
load_1brq,
load_1brq_structure,
load_1gnh,
load_1gnh_structure,
load_5nu7,
load_5nu7_structure,
load_aptacom_full,
load_aptacom_x_y,
load_csv_dataset,
load_from_rcsb,
load_hf_dataset,
)
from pyaptamer.datasets._loaders._csv_loader import load_csv_dataset
from pyaptamer.datasets._loaders._hf_loader import load_hf_dataset
from pyaptamer.datasets._loaders._one_gnh import load_1gnh, load_1gnh_structure
from pyaptamer.datasets._loaders._online_databank import load_from_rcsb
from pyaptamer.datasets._loaders._pfoa import load_pfoa, load_pfoa_structure

__all__ = [
"load_aptacom_full",
"load_aptacom_x_y",
"load_csv_dataset",
"load_hf_dataset",
"load_pfoa",
Copy link
Contributor

Choose a reason for hiding this comment

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

seems like some exports get deleted - why?

"load_pfoa_structure",
"load_from_rcsb",
"mol_loader",
"structure_loader",
"load_1brq",
"load_1brq_structure",
"load_5nu7",
"load_5nu7_structure",
"load_1gnh",
"load_1gnh_structure",
"load_from_rcsb",
"load_csv_dataset",
]
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
__author__ = ["satvshr", "fkiraly"]
__all__ = ["load_pfoa", "load_pfoa_structure"]
__author__ = "satvshr"
__all__ = ["load_1brq", "load_1brq_structure"]

import os


def load_pfoa():
"""Load the PFOA molecule as a MoleculeLoader.
def load_1brq():
"""Load the 1brq molecule as a MoleculeLoader.

Returns
-------
loader : MoleculeLoader
A MoleculeLoader object representing the PFOA molecule.
A MoleculeLoader object representing the 1brq molecule.
"""
from pyaptamer.data.loader import MoleculeLoader

pdb_path = os.path.join(os.path.dirname(__file__), "..", "data", "pfoa.pdb")
pdb_path = os.path.join(os.path.dirname(__file__), "..", "data", "1brq.pdb")

return MoleculeLoader(pdb_path)


def load_pfoa_structure(pdb_path=None):
def load_1brq_structure(pdb_path=None):
"""
Load the PFOA molecule from a PDB file using Biopython.
Load the 1brq molecule from a PDB file using Biopython.

Parameters
----------
pdb_path : str, optional
Path to the PDB file. If not provided, the function uses the default path
located in the '../data/pfoa.pdb' relative to the current file.
located in the '../data/1brq.pdb' relative to the current file.

Returns
-------
structure : Bio.PDB.Structure.Structure
A Biopython Structure object representing the PFOA molecule.
A Biopython Structure object representing the 1BRQ molecule.
"""
from Bio.PDB import PDBParser

pdb_path = os.path.join(os.path.dirname(__file__), "..", "data", "pfoa.pdb")
pdb_path = os.path.join(os.path.dirname(__file__), "..", "data", "1brq.pdb")

parser = PDBParser(QUIET=True)
structure = parser.get_structure("PFOA", pdb_path)
structure = parser.get_structure("1brq", pdb_path)
return structure
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def load_1gnh_structure(pdb_path=None):
Returns
-------
structure : Bio.PDB.Structure.Structure
A Biopython Structure object representing the PFOA molecule.
A Biopython Structure object representing the 1GNH molecule.
"""
from Bio.PDB import PDBParser

Expand Down
43 changes: 43 additions & 0 deletions pyaptamer/datasets/_loaders/_5nu7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
__author__ = "satvshr"
__all__ = ["load_5nu7", "load_5nu7_structure"]

import os


def load_5nu7():
"""Load the 5nu7 molecule as a MoleculeLoader.

Returns
-------
loader : MoleculeLoader
A MoleculeLoader object representing the 5nu7 molecule.
"""
from pyaptamer.data.loader import MoleculeLoader

pdb_path = os.path.join(os.path.dirname(__file__), "..", "data", "5nu7.pdb")

return MoleculeLoader(pdb_path)


def load_5nu7_structure(pdb_path=None):
"""
Load the 5nu7 molecule from a PDB file using Biopython.

Parameters
----------
pdb_path : str, optional
Path to the PDB file. If not provided, the function uses the default path
located in the '../data/5nu7.pdb' relative to the current file.

Returns
-------
structure : Bio.PDB.Structure.Structure
A Biopython Structure object representing the 5NU7 molecule.
"""
from Bio.PDB import PDBParser

pdb_path = os.path.join(os.path.dirname(__file__), "..", "data", "5nu7.pdb")

parser = PDBParser(QUIET=True)
structure = parser.get_structure("5nu7", pdb_path)
return structure
23 changes: 18 additions & 5 deletions pyaptamer/datasets/_loaders/__init__.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
"""Loaders for different data structures."""

from pyaptamer.datasets._loaders._1brq import (
load_1brq,
load_1brq_structure,
)
from pyaptamer.datasets._loaders._1gnh import (
load_1gnh,
load_1gnh_structure,
)
from pyaptamer.datasets._loaders._5nu7 import (
load_5nu7,
load_5nu7_structure,
)
from pyaptamer.datasets._loaders._aptacom_loader import (
load_aptacom_full,
load_aptacom_x_y,
)
from pyaptamer.datasets._loaders._csv_loader import load_csv_dataset
from pyaptamer.datasets._loaders._hf_loader import load_hf_dataset
from pyaptamer.datasets._loaders._one_gnh import load_1gnh_structure
from pyaptamer.datasets._loaders._pfoa import load_pfoa_structure
from pyaptamer.datasets._loaders._online_databank import load_from_rcsb

__all__ = [
"load_pfoa_structure",
"load_1gnh_structure",
"load_aptacom_full",
"load_aptacom_x_y",
"load_csv_dataset",
"load_from_rcsb",
"load_hf_dataset",
"load_pfoa_structure",
"load_1gnh",
"load_1gnh_structure",
"load_1brq",
"load_1brq_structure",
"load_5nu7",
"load_5nu7_structure",
]
Loading