Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -152,7 +152,7 @@ _Main split for Hugging Face: JSONL format (see above for statistics)._
|
|
| 152 |
"sci_fields": {},
|
| 153 |
"incl_fields": {}
|
| 154 |
}
|
| 155 |
-
|
| 156 |
|
| 157 |
|
| 158 |
===================================================================================================================
|
|
@@ -163,9 +163,8 @@ The Hugging Face infrastructure will automatically use the efficient Parquet fil
|
|
| 163 |
### Install dependencies (if needed):
|
| 164 |
|
| 165 |
```bash
|
| 166 |
-
pip install datasets
|
| 167 |
-
|
| 168 |
-
|
| 169 |
|
| 170 |
## Load the full dataset (Parquet, recommended)
|
| 171 |
|
|
@@ -175,9 +174,8 @@ pip install datasets```
|
|
| 175 |
ds = load_dataset("SkyWhal3/ClinVar-STXBP1-NLP-Dataset")
|
| 176 |
|
| 177 |
# Access examples
|
| 178 |
-
print(ds["train"][0])
|
| 179 |
-
|
| 180 |
-
|
| 181 |
|
| 182 |
## To force JSONL loading (if you prefer the original format):
|
| 183 |
|
|
@@ -189,8 +187,8 @@ ds = load_dataset(
|
|
| 189 |
data_files="ClinVar-STXBP1-NLP-Dataset.jsonl",
|
| 190 |
split="train"
|
| 191 |
)
|
| 192 |
-
print(ds[0])
|
| 193 |
-
|
| 194 |
|
| 195 |
## Other ways to use the data
|
| 196 |
Load all Parquet shards with pandas
|
|
@@ -202,29 +200,29 @@ import glob
|
|
| 202 |
parquet_files = glob.glob("default/train/*.parquet")
|
| 203 |
df = pd.concat([pd.read_parquet(pq) for pq in parquet_files], ignore_index=True)
|
| 204 |
print(df.shape)
|
| 205 |
-
print(df.head())
|
| 206 |
-
|
| 207 |
|
| 208 |
## Filter for a gene (e.g., STXBP1)
|
| 209 |
|
| 210 |
```df = pd.read_parquet("default/train/0000.parquet")
|
| 211 |
stxbp1_df = df[df["gene"] == "STXBP1"]
|
| 212 |
-
print(stxbp1_df.head())
|
| 213 |
-
|
| 214 |
|
| 215 |
## Randomly sample a subset
|
| 216 |
|
| 217 |
```sample = df.sample(n=5, random_state=42)
|
| 218 |
-
print(sample)
|
| 219 |
-
|
| 220 |
|
| 221 |
## Load with Polars (for high performance)
|
| 222 |
|
| 223 |
```import polars as pl
|
| 224 |
|
| 225 |
df = pl.read_parquet("default/train/0000.parquet")
|
| 226 |
-
print(df.head())
|
| 227 |
-
|
| 228 |
|
| 229 |
## Query with DuckDB (SQL-style)
|
| 230 |
|
|
@@ -232,12 +230,12 @@ print(df.head())```
|
|
| 232 |
|
| 233 |
con = duckdb.connect()
|
| 234 |
df = con.execute("SELECT * FROM 'default/train/0000.parquet' WHERE gene='STXBP1' LIMIT 5").df()
|
| 235 |
-
print(df)
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
```## Streaming mode with 🤗 Datasets
|
| 239 |
|
|
|
|
| 240 |
|
| 241 |
ds = load_dataset("SkyWhal3/ClinVar-STXBP1-NLP-Dataset", split="train", streaming=True)
|
| 242 |
for record in ds.take(5):
|
| 243 |
-
print(record)
|
|
|
|
|
|
| 152 |
"sci_fields": {},
|
| 153 |
"incl_fields": {}
|
| 154 |
}
|
| 155 |
+
```
|
| 156 |
|
| 157 |
|
| 158 |
===================================================================================================================
|
|
|
|
| 163 |
### Install dependencies (if needed):
|
| 164 |
|
| 165 |
```bash
|
| 166 |
+
pip install datasets
|
| 167 |
+
```
|
|
|
|
| 168 |
|
| 169 |
## Load the full dataset (Parquet, recommended)
|
| 170 |
|
|
|
|
| 174 |
ds = load_dataset("SkyWhal3/ClinVar-STXBP1-NLP-Dataset")
|
| 175 |
|
| 176 |
# Access examples
|
| 177 |
+
print(ds["train"][0])
|
| 178 |
+
```
|
|
|
|
| 179 |
|
| 180 |
## To force JSONL loading (if you prefer the original format):
|
| 181 |
|
|
|
|
| 187 |
data_files="ClinVar-STXBP1-NLP-Dataset.jsonl",
|
| 188 |
split="train"
|
| 189 |
)
|
| 190 |
+
print(ds[0])
|
| 191 |
+
```
|
| 192 |
|
| 193 |
## Other ways to use the data
|
| 194 |
Load all Parquet shards with pandas
|
|
|
|
| 200 |
parquet_files = glob.glob("default/train/*.parquet")
|
| 201 |
df = pd.concat([pd.read_parquet(pq) for pq in parquet_files], ignore_index=True)
|
| 202 |
print(df.shape)
|
| 203 |
+
print(df.head())
|
| 204 |
+
```
|
| 205 |
|
| 206 |
## Filter for a gene (e.g., STXBP1)
|
| 207 |
|
| 208 |
```df = pd.read_parquet("default/train/0000.parquet")
|
| 209 |
stxbp1_df = df[df["gene"] == "STXBP1"]
|
| 210 |
+
print(stxbp1_df.head())
|
| 211 |
+
```
|
| 212 |
|
| 213 |
## Randomly sample a subset
|
| 214 |
|
| 215 |
```sample = df.sample(n=5, random_state=42)
|
| 216 |
+
print(sample)
|
| 217 |
+
```
|
| 218 |
|
| 219 |
## Load with Polars (for high performance)
|
| 220 |
|
| 221 |
```import polars as pl
|
| 222 |
|
| 223 |
df = pl.read_parquet("default/train/0000.parquet")
|
| 224 |
+
print(df.head())
|
| 225 |
+
```
|
| 226 |
|
| 227 |
## Query with DuckDB (SQL-style)
|
| 228 |
|
|
|
|
| 230 |
|
| 231 |
con = duckdb.connect()
|
| 232 |
df = con.execute("SELECT * FROM 'default/train/0000.parquet' WHERE gene='STXBP1' LIMIT 5").df()
|
| 233 |
+
print(df)
|
| 234 |
+
```
|
|
|
|
|
|
|
| 235 |
|
| 236 |
+
## Streaming mode with 🤗 Datasets
|
| 237 |
|
| 238 |
ds = load_dataset("SkyWhal3/ClinVar-STXBP1-NLP-Dataset", split="train", streaming=True)
|
| 239 |
for record in ds.take(5):
|
| 240 |
+
print(record)
|
| 241 |
+
```
|