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
4 changes: 2 additions & 2 deletions examples/aptanet_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "pyaptamer-latest",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -995,7 +995,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.11"
"version": "3.12.10"
}
},
"nbformat": 4,
Expand Down
24 changes: 14 additions & 10 deletions pyaptamer/datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
"""Contains datasets along with their loaders."""

from pyaptamer.datasets._loaders._aptacom_loader import (
from pyaptamer.datasets._loaders import (
load_1brq,
load_1gnh,
load_5nu7,
load_aptacom_full,
load_aptacom_x_y,
load_csv_dataset,
load_from_rcsb,
load_hf_dataset,
load_pfoa,
)
from pyaptamer.datasets._loaders._csv_loader import load_csv_dataset
from pyaptamer.datasets._loaders._hf_loader import load_hf_dataset
from pyaptamer.datasets._loaders._hf_to_dataset_loader import load_hf_to_dataset
from pyaptamer.datasets._loaders._li2014 import load_li2014
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",
"load_pfoa_structure",
"load_from_rcsb",
"mol_loader",
"structure_loader",
"load_1brq",
"load_5nu7",
"load_1gnh",
"load_1gnh_structure",
"load_pfoa",
"load_from_rcsb",
"load_csv_dataset",
"load_li2014",
"load_hf_to_dataset",
]
19 changes: 19 additions & 0 deletions pyaptamer/datasets/_loaders/_1brq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
__author__ = "satvshr"
__all__ = ["load_1brq"]

import os


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

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

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

return MoleculeLoader(pdb_path)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__author__ = ["satvshr", "fkiraly"]
__all__ = ["load_1gnh", "load_1gnh_structure"]
__all__ = ["load_1gnh"]

import os

Expand All @@ -19,7 +19,8 @@ def load_1gnh():
return MoleculeLoader(pdb_path)


def load_1gnh_structure(pdb_path=None):
# This function is provided only to test struct_to_aaseq.
def _load_1gnh_structure(pdb_path=None):
Copy link
Collaborator Author

@satvshr satvshr Dec 23, 2025

Choose a reason for hiding this comment

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

Function kept as it is used for testing struct_to_aaseq

Copy link
Collaborator

Choose a reason for hiding this comment

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

I might not be in loop with this one, but Could you confirm we are removing this becuase it's no longer needed because of Moleculeloader but the loader currently doesn't have the struct_to_aaseq function? So we need this to test it?

Copy link
Collaborator

Choose a reason for hiding this comment

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

seems a bit counterintutive, I might not be part of the design discussion or might have simply forgot, but can we use moleculeloader to simply do that and either get rid of this structure way entirely, or keep the structure way, as is , for all the molecules if it is needed?

"""
Load the 1gnh molecule from a PDB file using Biopython.

Expand All @@ -32,7 +33,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
19 changes: 19 additions & 0 deletions pyaptamer/datasets/_loaders/_5nu7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
__author__ = "satvshr"
__all__ = ["load_5nu7"]

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)
15 changes: 9 additions & 6 deletions pyaptamer/datasets/_loaders/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"""Loaders for different data structures."""

from pyaptamer.datasets._loaders._1brq import load_1brq
from pyaptamer.datasets._loaders._1gnh import load_1gnh
from pyaptamer.datasets._loaders._5nu7 import load_5nu7
from pyaptamer.datasets._loaders._aptacom_loader import (
load_aptacom_full,
load_aptacom_x_y,
Expand All @@ -8,19 +11,19 @@
from pyaptamer.datasets._loaders._hf_loader import load_hf_dataset
from pyaptamer.datasets._loaders._hf_to_dataset_loader import load_hf_to_dataset
from pyaptamer.datasets._loaders._li2014 import load_li2014
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
from pyaptamer.datasets._loaders._pfoa import load_pfoa

__all__ = [
"load_pfoa_structure",
"load_1gnh_structure",
"load_aptacom_full",
"load_aptacom_x_y",
"load_csv_dataset",
"load_from_rcsb",
"load_hf_dataset",
"load_hf_to_dataset",
"load_pfoa_structure",
"load_1gnh",
"load_1gnh_structure",
"load_li2014",
"load_1brq",
"load_5nu7",
"load_pfoa",
]
26 changes: 1 addition & 25 deletions pyaptamer/datasets/_loaders/_pfoa.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__author__ = ["satvshr", "fkiraly"]
__all__ = ["load_pfoa", "load_pfoa_structure"]
__all__ = ["load_pfoa"]

import os

Expand All @@ -17,27 +17,3 @@ def load_pfoa():
pdb_path = os.path.join(os.path.dirname(__file__), "..", "data", "pfoa.pdb")

return MoleculeLoader(pdb_path)


def load_pfoa_structure(pdb_path=None):
"""
Load the PFOA 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.

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

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

parser = PDBParser(QUIET=True)
structure = parser.get_structure("PFOA", pdb_path)
return structure
Loading