Datasets:
Publish NapistuDataStore:
Browse files
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
tags: ['napistu', '
|
| 3 |
library_name: napistu-torch
|
| 4 |
license: mit
|
| 5 |
---
|
|
@@ -8,18 +8,21 @@ license: mit
|
|
| 8 |
|
| 9 |
This dataset contains a complete NapistuDataStore with all artifacts published as a read-only store.
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
## Store Contents
|
| 12 |
|
| 13 |
-
- **NapistuData artifacts**:
|
| 14 |
- **VertexTensor artifacts**: 1
|
| 15 |
- **pandas DataFrame artifacts**: 5
|
| 16 |
-
- **Total artifacts**:
|
| 17 |
|
| 18 |
## Artifacts
|
| 19 |
|
| 20 |
### NapistuData
|
| 21 |
- `relation_prediction`
|
| 22 |
-
- `edge_prediction`
|
| 23 |
|
| 24 |
### VertexTensors
|
| 25 |
- `comprehensive_pathway_memberships`
|
|
@@ -35,27 +38,117 @@ This dataset contains a complete NapistuDataStore with all artifacts published a
|
|
| 35 |
|
| 36 |
### Load from HuggingFace Hub
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
```python
|
| 39 |
-
from huggingface_hub import hf_hub_download
|
| 40 |
from napistu_torch.napistu_data_store import NapistuDataStore
|
|
|
|
|
|
|
|
|
|
| 41 |
import tempfile
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
)
|
| 53 |
|
| 54 |
-
#
|
| 55 |
-
store
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
#
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
```
|
| 60 |
|
| 61 |
## Note
|
|
|
|
| 1 |
---
|
| 2 |
+
tags: ['napistu', 'napistu-torch', 'graph-neural-networks', 'biological-networks', 'pytorch', 'napistu-data-store']
|
| 3 |
library_name: napistu-torch
|
| 4 |
license: mit
|
| 5 |
---
|
|
|
|
| 8 |
|
| 9 |
This dataset contains a complete NapistuDataStore with all artifacts published as a read-only store.
|
| 10 |
|
| 11 |
+
## Source Data
|
| 12 |
+
|
| 13 |
+
This store was created from GCS asset: **human_consensus_no_rxns** (version: **20251218**)
|
| 14 |
+
|
| 15 |
## Store Contents
|
| 16 |
|
| 17 |
+
- **NapistuData artifacts**: 1
|
| 18 |
- **VertexTensor artifacts**: 1
|
| 19 |
- **pandas DataFrame artifacts**: 5
|
| 20 |
+
- **Total artifacts**: 7
|
| 21 |
|
| 22 |
## Artifacts
|
| 23 |
|
| 24 |
### NapistuData
|
| 25 |
- `relation_prediction`
|
|
|
|
| 26 |
|
| 27 |
### VertexTensors
|
| 28 |
- `comprehensive_pathway_memberships`
|
|
|
|
| 38 |
|
| 39 |
### Load from HuggingFace Hub
|
| 40 |
|
| 41 |
+
The easiest way to load this dataset is using the `from_huggingface` class method:
|
| 42 |
+
|
| 43 |
+
```python
|
| 44 |
+
from napistu_torch.napistu_data_store import NapistuDataStore
|
| 45 |
+
from pathlib import Path
|
| 46 |
+
|
| 47 |
+
# Load read-only store from HuggingFace Hub
|
| 48 |
+
store = NapistuDataStore.from_huggingface(
|
| 49 |
+
repo_id="seanhacks/relation_prediction",
|
| 50 |
+
store_dir=Path("./local_store"),
|
| 51 |
+
revision="main"
|
| 52 |
+
)
|
| 53 |
+
|
| 54 |
+
# Use the store (read-only)
|
| 55 |
+
napistu_data = store.load_napistu_data("edge_prediction")
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
### Configure DataConfig
|
| 59 |
+
|
| 60 |
+
You can also use this dataset in your `DataConfig` for PyTorch Lightning experiments:
|
| 61 |
+
|
| 62 |
+
```python
|
| 63 |
+
from napistu_torch.configs import DataConfig
|
| 64 |
+
from pathlib import Path
|
| 65 |
+
|
| 66 |
+
# Configure DataConfig to load from HuggingFace Hub
|
| 67 |
+
config = DataConfig(
|
| 68 |
+
store_dir=Path("./local_store"),
|
| 69 |
+
hf_repo_id="seanhacks/relation_prediction",
|
| 70 |
+
hf_revision="main",
|
| 71 |
+
napistu_data_name="edge_prediction",
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
# Use with NapistuDataStore.from_config()
|
| 75 |
+
from napistu_torch.napistu_data_store import NapistuDataStore
|
| 76 |
+
store = NapistuDataStore.from_config(config)
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
### Load Raw Data from GCS (Optional)
|
| 80 |
+
|
| 81 |
+
If you need to create new artifacts, you can convert this read-only store to a non-read-only store
|
| 82 |
+
by loading the raw data from GCS and enabling artifact creation:
|
| 83 |
+
|
| 84 |
```python
|
|
|
|
| 85 |
from napistu_torch.napistu_data_store import NapistuDataStore
|
| 86 |
+
from napistu.gcs.downloads import load_public_napistu_asset
|
| 87 |
+
from napistu.gcs.constants import GCS_SUBASSET_NAMES
|
| 88 |
+
from pathlib import Path
|
| 89 |
import tempfile
|
| 90 |
+
|
| 91 |
+
# Download raw data from GCS
|
| 92 |
+
with tempfile.TemporaryDirectory() as temp_data_dir:
|
| 93 |
+
sbml_dfs_path = load_public_napistu_asset(
|
| 94 |
+
"human_consensus_no_rxns",
|
| 95 |
+
temp_data_dir,
|
| 96 |
+
subasset=GCS_SUBASSET_NAMES.SBML_DFS,
|
| 97 |
+
version="20251218",
|
| 98 |
+
)
|
| 99 |
+
napistu_graph_path = load_public_napistu_asset(
|
| 100 |
+
"human_consensus_no_rxns",
|
| 101 |
+
temp_data_dir,
|
| 102 |
+
subasset=GCS_SUBASSET_NAMES.NAPISTU_GRAPH,
|
| 103 |
+
version="20251218",
|
| 104 |
+
)
|
| 105 |
+
|
| 106 |
+
# Load store from HuggingFace Hub
|
| 107 |
+
store = NapistuDataStore.from_huggingface(
|
| 108 |
+
repo_id="seanhacks/relation_prediction",
|
| 109 |
+
store_dir=Path("./local_store"),
|
| 110 |
+
revision="main"
|
| 111 |
)
|
| 112 |
|
| 113 |
+
# Convert to non-read-only by enabling artifact creation
|
| 114 |
+
store.enable_artifact_creation(sbml_dfs_path, napistu_graph_path)
|
| 115 |
+
|
| 116 |
+
# Now you can create new artifacts
|
| 117 |
+
store.ensure_artifacts(["new_artifact_name"])
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
Alternatively, you can use `from_huggingface` with paths directly:
|
| 121 |
+
|
| 122 |
+
```python
|
| 123 |
+
from napistu_torch.napistu_data_store import NapistuDataStore
|
| 124 |
+
from napistu.gcs.downloads import load_public_napistu_asset
|
| 125 |
+
from napistu.gcs.constants import GCS_SUBASSET_NAMES
|
| 126 |
+
from pathlib import Path
|
| 127 |
+
import tempfile
|
| 128 |
+
|
| 129 |
+
# Download raw data from GCS
|
| 130 |
+
with tempfile.TemporaryDirectory() as temp_data_dir:
|
| 131 |
+
sbml_dfs_path = load_public_napistu_asset(
|
| 132 |
+
"human_consensus_no_rxns",
|
| 133 |
+
temp_data_dir,
|
| 134 |
+
subasset=GCS_SUBASSET_NAMES.SBML_DFS,
|
| 135 |
+
version="20251218",
|
| 136 |
+
)
|
| 137 |
+
napistu_graph_path = load_public_napistu_asset(
|
| 138 |
+
"human_consensus_no_rxns",
|
| 139 |
+
temp_data_dir,
|
| 140 |
+
subasset=GCS_SUBASSET_NAMES.NAPISTU_GRAPH,
|
| 141 |
+
version="20251218",
|
| 142 |
+
)
|
| 143 |
|
| 144 |
+
# Load and convert in one step
|
| 145 |
+
store = NapistuDataStore.from_huggingface(
|
| 146 |
+
repo_id="seanhacks/relation_prediction",
|
| 147 |
+
store_dir=Path("./local_store"),
|
| 148 |
+
revision="main",
|
| 149 |
+
sbml_dfs_path=sbml_dfs_path,
|
| 150 |
+
napistu_graph_path=napistu_graph_path,
|
| 151 |
+
)
|
| 152 |
```
|
| 153 |
|
| 154 |
## Note
|