seanhacks commited on
Commit
a46cebb
·
verified ·
1 Parent(s): 489f1e7

Publish NapistuDataStore:

Browse files
Files changed (1) hide show
  1. README.md +29 -39
README.md CHANGED
@@ -52,7 +52,7 @@ store = NapistuDataStore.from_huggingface(
52
  )
53
 
54
  # Use the store (read-only)
55
- napistu_data = store.load_napistu_data("edge_prediction")
56
  ```
57
 
58
  ### Configure DataConfig
@@ -68,7 +68,7 @@ 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()
@@ -76,48 +76,35 @@ 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
@@ -141,7 +128,7 @@ with tempfile.TemporaryDirectory() as temp_data_dir:
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"),
@@ -149,6 +136,9 @@ with tempfile.TemporaryDirectory() as temp_data_dir:
149
  sbml_dfs_path=sbml_dfs_path,
150
  napistu_graph_path=napistu_graph_path,
151
  )
 
 
 
152
  ```
153
 
154
  ## Note
 
52
  )
53
 
54
  # Use the store (read-only)
55
+ napistu_data = store.load_napistu_data("relation_prediction")
56
  ```
57
 
58
  ### Configure DataConfig
 
68
  store_dir=Path("./local_store"),
69
  hf_repo_id="seanhacks/relation_prediction",
70
  hf_revision="main",
71
+ napistu_data_name="relation_prediction",
72
  )
73
 
74
  # Use with NapistuDataStore.from_config()
 
76
  store = NapistuDataStore.from_config(config)
77
  ```
78
 
79
+ To make the store writable (non-read-only), provide paths to the raw data files:
 
 
 
80
 
81
  ```python
82
+ from napistu_torch.configs import DataConfig
 
 
83
  from pathlib import Path
 
84
 
85
+ # Configure DataConfig to load from HuggingFace Hub and enable artifact creation
86
+ config = DataConfig(
87
+ store_dir=Path("./local_store"),
88
+ hf_repo_id="seanhacks/relation_prediction",
89
+ hf_revision="main",
90
+ sbml_dfs_path=Path("/path/to/sbml_dfs.pkl"),
91
+ napistu_graph_path=Path("/path/to/napistu_graph.pkl"),
92
+ napistu_data_name="relation_prediction",
93
+ )
94
+
95
+ # Use with NapistuDataStore.from_config()
96
+ # This will load from HF and convert to non-read-only automatically
97
+ from napistu_torch.napistu_data_store import NapistuDataStore
98
+ store = NapistuDataStore.from_config(config)
99
+
100
+ # Now you can create new artifacts
101
+ store.ensure_artifacts(["new_artifact_name"])
 
 
 
 
 
 
 
 
 
 
102
  ```
103
 
104
+ ### Load Raw Data from GCS (Optional)
105
+
106
+ If you need to create new artifacts, you can convert this read-only store to a non-read-only store
107
+ by loading the raw data from GCS and passing the paths directly to `from_huggingface`:
108
 
109
  ```python
110
  from napistu_torch.napistu_data_store import NapistuDataStore
 
128
  version="20251218",
129
  )
130
 
131
+ # Load and convert to non-read-only in one step
132
  store = NapistuDataStore.from_huggingface(
133
  repo_id="seanhacks/relation_prediction",
134
  store_dir=Path("./local_store"),
 
136
  sbml_dfs_path=sbml_dfs_path,
137
  napistu_graph_path=napistu_graph_path,
138
  )
139
+
140
+ # Now you can create new artifacts
141
+ store.ensure_artifacts(["new_artifact_name"])
142
  ```
143
 
144
  ## Note