Commit
·
864370e
1
Parent(s):
2a868cd
update
Browse files
README.md
CHANGED
|
@@ -131,45 +131,119 @@ Exploring cellular heterogeneity, identifying novel cell states, and characteriz
|
|
| 131 |
- Discovering biomarkers or therapeutic targets for sarcopenia and other age-related muscle pathologies.
|
| 132 |
|
| 133 |
### **Machine Learning**
|
| 134 |
-
- **Clustering:** Applying clustering algorithms (e.g., K-Means,
|
| 135 |
- **Classification:** Building models to classify cell types, age groups (e.g., young vs. old), or disease states (if available) using `pca_embeddings.parquet` or `umap_embeddings.parquet` as features and `cell_metadata.parquet` for labels.
|
| 136 |
- **Regression:** Predicting the biological age of a cell or donor based on gene expression or cell type composition.
|
| 137 |
- **Dimensionality Reduction & Visualization:** Using the PCA and UMAP embeddings for generating 2D or 3D plots to visualize complex cell relationships and age-related trends.
|
| 138 |
- **Feature Selection:** Identifying key genes or principal components relevant to muscle aging processes.
|
| 139 |
|
| 140 |
-
|
|
|
|
| 141 |
|
| 142 |
```python
|
| 143 |
import pandas as pd
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
#
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
#
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
df_donor_metadata = None
|
| 163 |
|
| 164 |
|
|
|
|
| 165 |
print("Expression data shape:", df_expression.shape)
|
| 166 |
print("PCA embeddings shape:", df_pca_embeddings.shape)
|
| 167 |
print("UMAP embeddings shape:", df_umap_embeddings.shape)
|
| 168 |
print("Cell metadata shape:", df_cell_metadata.shape)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
if df_donor_metadata is not None:
|
| 170 |
print("Donor metadata shape:", df_donor_metadata.shape)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
```
|
| 172 |
|
|
|
|
|
|
|
|
|
|
| 173 |
## **6. Citation**
|
| 174 |
|
| 175 |
Please ensure you cite the original source of the Human Skeletal Muscle Aging Atlas data. Refer to the project's official website for the most up-to-date citation information for the atlas and its associated publications:
|
|
@@ -182,8 +256,11 @@ If you use the `scanpy` library for any further analysis or preprocessing, pleas
|
|
| 182 |
## **7. Contributions**
|
| 183 |
|
| 184 |
This dataset was processed and prepared by:
|
| 185 |
-
- Venkatachalam
|
| 186 |
-
- Pooja
|
| 187 |
-
- Albert
|
| 188 |
|
| 189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
- Discovering biomarkers or therapeutic targets for sarcopenia and other age-related muscle pathologies.
|
| 132 |
|
| 133 |
### **Machine Learning**
|
| 134 |
+
- **Clustering:** Applying clustering algorithms (e.g., K-Means, Louvain) on `pca_embeddings.parquet` or `umap_embeddings.parquet` to identify distinct cell populations or sub-populations.
|
| 135 |
- **Classification:** Building models to classify cell types, age groups (e.g., young vs. old), or disease states (if available) using `pca_embeddings.parquet` or `umap_embeddings.parquet` as features and `cell_metadata.parquet` for labels.
|
| 136 |
- **Regression:** Predicting the biological age of a cell or donor based on gene expression or cell type composition.
|
| 137 |
- **Dimensionality Reduction & Visualization:** Using the PCA and UMAP embeddings for generating 2D or 3D plots to visualize complex cell relationships and age-related trends.
|
| 138 |
- **Feature Selection:** Identifying key genes or principal components relevant to muscle aging processes.
|
| 139 |
|
| 140 |
+
### **Direct Download and Loading from Hugging Face Hub**
|
| 141 |
+
This dataset is hosted on the Hugging Face Hub, allowing for easy programmatic download and loading of its component files.
|
| 142 |
|
| 143 |
```python
|
| 144 |
import pandas as pd
|
| 145 |
+
from huggingface_hub import hf_hub_download
|
| 146 |
+
import os
|
| 147 |
+
|
| 148 |
+
# Define the Hugging Face repository ID and the local directory for downloads
|
| 149 |
+
HF_REPO_ID = "longevity-db/human-muscle-aging-atlas-snRNAseq" # THIS IS YOUR NEW REPO ID
|
| 150 |
+
LOCAL_DATA_DIR = "downloaded_human_muscle_data"
|
| 151 |
+
|
| 152 |
+
os.makedirs(LOCAL_DATA_DIR, exist_ok=True)
|
| 153 |
+
print(f"Created local download directory: {LOCAL_DATA_DIR}")
|
| 154 |
+
|
| 155 |
+
# List of Parquet files to download (matching what your processing script outputs)
|
| 156 |
+
parquet_files = [
|
| 157 |
+
"expression.parquet",
|
| 158 |
+
"gene_metadata.parquet",
|
| 159 |
+
"cell_metadata.parquet",
|
| 160 |
+
"pca_embeddings.parquet",
|
| 161 |
+
"pca_explained_variance.parquet",
|
| 162 |
+
"umap_embeddings.parquet",
|
| 163 |
+
"highly_variable_gene_metadata.parquet",
|
| 164 |
+
"gene_statistics.parquet",
|
| 165 |
+
"cell_type_proportions_overall.parquet",
|
| 166 |
+
"donor_metadata.parquet"
|
| 167 |
+
# Note: cell_type_proportions_by_{grouping_column}.parquet might have a dynamic name,
|
| 168 |
+
# so users might need to download it separately or infer its name.
|
| 169 |
+
]
|
| 170 |
+
|
| 171 |
+
# Download each file
|
| 172 |
+
downloaded_paths = {}
|
| 173 |
+
for file_name in parquet_files:
|
| 174 |
+
try:
|
| 175 |
+
path = hf_hub_download(repo_id=HF_REPO_ID, filename=file_name, local_dir=LOCAL_DATA_DIR)
|
| 176 |
+
downloaded_paths[file_name] = path
|
| 177 |
+
print(f"Downloaded {file_name} to: {path}")
|
| 178 |
+
except Exception as e:
|
| 179 |
+
print(f"Warning: Could not download {file_name}. It might not be in the repository or its name differs. Error: {e}")
|
| 180 |
+
|
| 181 |
+
# Load core Parquet files into Pandas DataFrames
|
| 182 |
+
df_expression = pd.read_parquet(downloaded_paths["expression.parquet"])
|
| 183 |
+
df_pca_embeddings = pd.read_parquet(downloaded_paths["pca_embeddings.parquet"])
|
| 184 |
+
df_umap_embeddings = pd.read_parquet(downloaded_paths["umap_embeddings.parquet"])
|
| 185 |
+
df_cell_metadata = pd.read_parquet(downloaded_paths["cell_metadata.parquet"])
|
| 186 |
+
df_gene_metadata = pd.read_parquet(downloaded_paths["gene_metadata.parquet"])
|
| 187 |
+
df_pca_explained_variance = pd.read_parquet(downloaded_paths["pca_explained_variance.parquet"])
|
| 188 |
+
df_hvg_metadata = pd.read_parquet(downloaded_paths["highly_variable_gene_metadata.parquet"])
|
| 189 |
+
df_gene_stats = pd.read_parquet(downloaded_paths["gene_statistics.parquet"])
|
| 190 |
+
df_cell_type_proportions_overall = pd.read_parquet(downloaded_paths["cell_type_proportions_overall.parquet"])
|
| 191 |
+
try: # Donor metadata might be skipped if no column found, so use try-except
|
| 192 |
+
df_donor_metadata = pd.read_parquet(downloaded_paths["donor_metadata.parquet"])
|
| 193 |
+
except KeyError:
|
| 194 |
df_donor_metadata = None
|
| 195 |
|
| 196 |
|
| 197 |
+
print("\n--- Data Loaded from Hugging Face Hub ---")
|
| 198 |
print("Expression data shape:", df_expression.shape)
|
| 199 |
print("PCA embeddings shape:", df_pca_embeddings.shape)
|
| 200 |
print("UMAP embeddings shape:", df_umap_embeddings.shape)
|
| 201 |
print("Cell metadata shape:", df_cell_metadata.shape)
|
| 202 |
+
print("Gene metadata shape:", df_gene_metadata.shape)
|
| 203 |
+
print("PCA explained variance shape:", df_pca_explained_variance.shape)
|
| 204 |
+
print("HVG metadata shape:", df_hvg_metadata.shape)
|
| 205 |
+
print("Gene statistics shape:", df_gene_stats.shape)
|
| 206 |
+
print("Overall cell type proportions shape:", df_cell_type_proportions_overall.shape)
|
| 207 |
if df_donor_metadata is not None:
|
| 208 |
print("Donor metadata shape:", df_donor_metadata.shape)
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
# Example: Prepare data for an age prediction model
|
| 212 |
+
# IMPORTANT: You need to inspect `df_cell_metadata.columns` to find the actual age and cell type columns.
|
| 213 |
+
print("\nAvailable columns in cell_metadata.parquet (df_cell_metadata.columns):")
|
| 214 |
+
print(df_cell_metadata.columns.tolist())
|
| 215 |
+
|
| 216 |
+
# --- USER ACTION REQUIRED ---
|
| 217 |
+
# Replace 'your_age_column_name' and 'your_cell_type_column_name'
|
| 218 |
+
# with the actual column names found in your df_cell_metadata.columns output.
|
| 219 |
+
# Common names might be 'age', 'Age_Group', 'Age_in_weeks', 'cell_type_annotation', 'CellType' etc.
|
| 220 |
+
age_column_name = 'Age' # <<<--- UPDATE THIS with the actual age column name found in your data (e.g., 'Age', 'age_group', 'Age_in_months')
|
| 221 |
+
cell_type_column_name = 'cell_type' # <<<--- UPDATE THIS with the actual cell type column name (e.g., 'cell_type_annotation', 'CellType')
|
| 222 |
+
# --- END USER ACTION REQUIRED ---
|
| 223 |
+
|
| 224 |
+
|
| 225 |
+
# Example: Using age for a prediction task
|
| 226 |
+
if age_column_name in df_cell_metadata.columns:
|
| 227 |
+
X_features_age_prediction = df_pca_embeddings # Or df_umap_embeddings, or df_expression (if manageable)
|
| 228 |
+
y_labels_age_prediction = df_cell_metadata[age_column_name]
|
| 229 |
+
print(f"\nPrepared X (features) for age prediction with shape {X_features_age_prediction.shape} and y (labels) with shape {y_labels_age_prediction.shape}")
|
| 230 |
+
else:
|
| 231 |
+
print(f"\nWarning: Column '{age_column_name}' not found in cell metadata for age prediction example. Please check your data.")
|
| 232 |
+
|
| 233 |
+
# Example: Using cell type for a classification task
|
| 234 |
+
if cell_type_column_name in df_cell_metadata.columns:
|
| 235 |
+
X_features_cell_type = df_pca_embeddings # Or df_umap_embeddings, or df_expression
|
| 236 |
+
y_labels_cell_type = df_cell_metadata[cell_type_column_name]
|
| 237 |
+
print(f"Prepared X (features) for cell type classification with shape {X_features_cell_type.shape} and y (labels) with shape {y_labels_cell_type.shape}")
|
| 238 |
+
else:
|
| 239 |
+
print(f"Warning: Column '{cell_type_column_name}' not found in cell metadata for cell type classification example. Please check your data.")
|
| 240 |
+
|
| 241 |
+
# This data can then be split into train/test sets and used to train various ML models.
|
| 242 |
```
|
| 243 |
|
| 244 |
+
|
| 245 |
+
-----
|
| 246 |
+
|
| 247 |
## **6. Citation**
|
| 248 |
|
| 249 |
Please ensure you cite the original source of the Human Skeletal Muscle Aging Atlas data. Refer to the project's official website for the most up-to-date citation information for the atlas and its associated publications:
|
|
|
|
| 256 |
## **7. Contributions**
|
| 257 |
|
| 258 |
This dataset was processed and prepared by:
|
|
|
|
|
|
|
|
|
|
| 259 |
|
| 260 |
+
- Venkatachalam
|
| 261 |
+
- Pooja
|
| 262 |
+
- Albert
|
| 263 |
+
|
| 264 |
+
*Curated on June 15, 2025.*
|
| 265 |
+
|
| 266 |
+
**Hugging Face Repository:** [https://huggingface.co/datasets/longevity-db/human-muscle-aging-atlas-snRNAseq](https://huggingface.co/datasets/longevity-db/human-muscle-aging-atlas-snRNAseq)
|