-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from dpeerlab/umain
Checkup for segger 🩹 and tutorial notebook - andrew's savior magic
- Loading branch information
Showing
12 changed files
with
1,065 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,4 +166,6 @@ data_* | |
model_* | ||
|
||
*.egg_info | ||
figure* | ||
figure* | ||
|
||
dev* |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from pytorch_lightning import LightningDataModule | ||
from torch_geometric.loader import DataLoader | ||
import os | ||
from pathlib import Path | ||
from segger.data.io import SpatialTranscriptomicsDataset | ||
|
||
|
||
# TODO: Add documentation | ||
class SeggerDataModule(LightningDataModule): | ||
|
||
def __init__( | ||
self, | ||
data_dir: os.PathLike, | ||
batch_size: int = 4, | ||
num_workers: int = 1, | ||
): | ||
super().__init__() | ||
self.data_dir = Path(data_dir) | ||
self.batch_size = batch_size | ||
self.num_workers = num_workers | ||
|
||
# TODO: Add documentation | ||
def setup(self, stage=None): | ||
self.train = SpatialTranscriptomicsDataset( | ||
root=self.data_dir / 'train_tiles' | ||
) | ||
self.test = SpatialTranscriptomicsDataset( | ||
root=self.data_dir / 'test_tiles' | ||
) | ||
self.val = SpatialTranscriptomicsDataset( | ||
root=self.data_dir / 'val_tiles' | ||
) | ||
self.loader_kwargs = dict( | ||
batch_size=self.batch_size, | ||
num_workers=self.num_workers, | ||
pin_memory=True, | ||
) | ||
|
||
# TODO: Add documentation | ||
def train_dataloader(self): | ||
return DataLoader(self.train, shuffle=True, **self.loader_kwargs) | ||
|
||
# TODO: Add documentation | ||
def test_dataloader(self): | ||
return DataLoader(self.test, shuffle=False, **self.loader_kwargs) | ||
|
||
# TODO: Add documentation | ||
def val_dataloader(self): | ||
return DataLoader(self.val, shuffle=False, **self.loader_kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.