Skip to content

Commit

Permalink
Add PyG dataset classes (#71)
Browse files Browse the repository at this point in the history
* Add dataloader classes

* [Bug] rogue unused argument

* Add multiprocessing support

* Fix bare excepts

* Remove bare excepts

* [Logging] update try except imports to use logging

* isort

* lint

* [Dataloader] add base dataloader class

* [Dataloader] add len

* torch geometric dataset

* add init

* remove old dataloaders

* refactor mp constructor

* add rename arg to AF2 download and fix docstring

* add docstrings

* add new dataset classes to namespace

* add transforms and docstrings

* add tests for dataloaders

* add tensor equality util

* update docs

* add dataloader tutorial

* fix dataloader tests

* update testing utils to have optional import for torch equality checks

* fix bare except

* remove torch.testing as it breaks support with previous versions <1.11

* black, isort

* add torch geometric install

* remove pyg from matrix tests

* add skip if pyg not installed

* typo

* add option pyg imports

* set imports to optional

* make torch imports optional in tests

* use pathlib instead of string paths

* use tuple of exception classes

* wrap dataset imports in try/except

* fix to obsolete PDB download

* Fix tests

* fix chain graph return

* add pyg install

* rm pyg, ignore dataloader test

* ignore dataloader tutorial

* fix renaming errors in AF2 download
  • Loading branch information
a-r-j authored Apr 4, 2022
1 parent a958b28 commit d0f872b
Show file tree
Hide file tree
Showing 20 changed files with 1,576 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ jobs:
- name: Run unit tests and generate coverage report
run: pytest .
- name: Test notebook execution
run: pytest --nbval-lax notebooks/ --current-env
run: pytest --nbval-lax notebooks/ --current-env --ignore-glob="notebooks/dataloader_tutorial.ipynb"
1 change: 1 addition & 0 deletions docs/source/datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Summaries
:maxdepth: 2
:glob:

notebooks/dataloader_tutorial.nblink
datasets/pscdb
notebooks/pscdb_processing.nblink
notebooks/pscdb_baselines.nblink
Expand Down
3 changes: 3 additions & 0 deletions docs/source/notebooks/dataloader_tutorial.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"path": "../../../notebooks/dataloader_tutorial.ipynb"
}
7 changes: 6 additions & 1 deletion graphein/grn/features/node_features.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import logging

from graphein.utils.utils import import_message

log = logging.getLogger(__name__)

try:
from bioservices import HGNC, UniProt
except ImportError:
import_message(
message = import_message(
submodule="graphein.grn.features.node_features",
package="bioservices",
conda_channel="bioconda",
pip_install=True,
)
log.warning(message)


def add_sequence_to_nodes(n, d):
Expand Down
10 changes: 10 additions & 0 deletions graphein/ml/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from .conversion import GraphFormatConvertor

try:
from .datasets import (
InMemoryProteinGraphDataset,
ProteinGraphDataset,
ProteinGraphListDataset,
)
except (ImportError, NameError):
pass
5 changes: 5 additions & 0 deletions graphein/ml/datasets/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .torch_geometric_dataset import (
InMemoryProteinGraphDataset,
ProteinGraphDataset,
ProteinGraphListDataset,
)
Loading

0 comments on commit d0f872b

Please sign in to comment.