[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CTRYNFTM9QAF3KWDYMMJFB":3,"skill-same:01M7CTRYNFTM9QAF3KWDYMMJFB":129},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7CTRYNFTM9QAF3KWDYMMJFB","elastic-net-feature-selection",null,"Use when selecting predictive genes or other molecular features from bulk expression matrices for binary case-vs-control classification with elastic net logistic regression, including coefficient path and cross-validation plots. Trigger keywords: elastic net, glmnet, feature selection, binary classification, lambda.min, lambda.1se. NOT for: survival\u002FCox modeling, multiclass outcomes, single-cell data, or non-expression tables.","mrsonord2240\u002Fopenscience-specialists","mrsonord2240","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F76487430?v=4","01M7CTEM40S43GSJZ9A3YCCXZK","Samuel Nord","01M7CTEM4K69JD1GBYNHVJ9ZP4",2,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: elastic-net-feature-selection\ndescription: \"Use when selecting predictive genes or other molecular features from bulk expression matrices for binary case-vs-control classification with elastic net logistic regression, including coefficient path and cross-validation plots. Trigger keywords: elastic net, glmnet, feature selection, binary classification, lambda.min, lambda.1se. NOT for: survival\u002FCox modeling, multiclass outcomes, single-cell data, or non-expression tables.\"\n---\n\n# Elastic Net Feature Selection\n\n## When to Use\n\n- Use this skill for binary case-vs-control classification on bulk expression matrices.\n- Use it when you need elastic net logistic regression feature selection, coefficient paths, and `cv.glmnet`-based lambda selection.\n- Use custom labels such as `Tumor` and `Normal` only when the group file still contains exactly two outcome levels.\n\n## Out of Scope\n\n- Survival or Cox modeling\n- Multiclass outcomes\n- Single-cell data\n- Non-expression tables\n\nOut-of-scope enforcement:\n\n- If the group file contains any label outside the requested `case_group` and `control_group`, the command stops with `SKILL_INVALID_DATA` instead of silently dropping samples.\n- If either requested class is missing after validation, the command stops with `SKILL_INVALID_DATA`.\n\n## When to Read External Files\n\n| Situation | File to Read | Purpose |\n|-----------|--------------|---------|\n| **Need to understand alpha, lambda choice, or feature-selection behavior** | `references\u002Falgorithm.md` | Elastic net logistic regression, penalty mixing, cross-validation, and coefficient selection assumptions |\n| **Need the authoritative executable entrypoint** | `scripts\u002Fmain.R` | Run: `Rscript scripts\u002Fmain.R --input_file ... --group_file ... --output_dir ...` |\n| **Need parameter examples, smoke-test commands, or recorded local runs** | `references\u002Fcli-guide.md` | Verified CLI examples for normal runs, conservative runs, and test-data runs |\n| **Need bundled sample inputs for a first run or regression test** | `tests\u002Fdata\u002F` | Sample expression matrix, group file, and feature list |\n| **Encounter errors, warnings, or timeout issues** | `references\u002Ftroubleshooting.md` | Common failures, console warning interpretation, and recovery steps |\n\n---\n\n## Usage\n\n```bash\nRscript scripts\u002Fmain.R \\\n  --input_file .\u002Fexpression_matrix.csv \\\n  --group_file .\u002Fgroups.csv \\\n  --feature_file .\u002Fgenes.csv \\\n  --case_group case \\\n  --control_group control \\\n  --alpha auto \\\n  --alpha_grid 0,0.25,0.5,0.75,1 \\\n  --nfolds 5 \\\n  --lambda_choice lambda.min \\\n  --standardize TRUE \\\n  --timeout_seconds 600 \\\n  --output_dir .\u002Foutput\u002F \\\n  --seed 42\n```\n\n---\n\n## Arguments\n\n| Short | Long | Type | Default | Description |\n|-------|------|------|---------|-------------|\n| `-i` | `--input_file` | character | **required** | Expression matrix file (genes as rows, samples as columns) |\n| `-g` | `--group_file` | character | **required** | Group information file with sample and group columns |\n| `-f` | `--feature_file` | character | `NULL` | Optional feature list file; if omitted, all matrix rows are used |\n| `-c` | `--case_group` | character | `case` | Positive class label in the group file |\n| `-d` | `--control_group` | character | `control` | Negative class label in the group file |\n| `-a` | `--alpha` | character | `0.5` | Elastic net mixing parameter: numeric `0`-`1`, or `auto` for CV-based selection |\n|  | `--alpha_grid` | character | `0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1` | Comma-separated alpha candidates evaluated when `alpha=auto` |\n| `-n` | `--nfolds` | integer | `5` | Cross-validation fold count; automatically reduced if a class has fewer samples |\n| `-l` | `--lambda_choice` | character | `lambda.min` | Coefficient extraction rule: `lambda.min` or `lambda.1se` |\n| `-z` | `--standardize` | logical | `TRUE` | Standardize features inside `glmnet` |\n| `-t` | `--timeout_seconds` | integer | `600` | Elapsed timeout limit in seconds |\n| `-o` | `--output_dir` | character | `.\u002Foutput\u002F` | Output directory |\n| `-s` | `--seed` | integer | `42` | Random seed for reproducibility |\n\n---\n\n## Input Format\n\n### Expression Matrix (input_file)\n\nGenes as rows, samples as columns, CSV format with gene IDs in the first column.\n\n```csv\n,Sample01,Sample02,Sample03\nTNMD,0.0349,0.0533,1.3889\nDPM1,4.8627,5.4208,5.6370\n```\n\n### Group File (group_file)\n\nCSV with sample IDs and binary group labels.\n\n```csv\nsample,group\nSample01,case\nSample02,control\nSample03,case\n```\n\n### Feature File (feature_file)\n\nOptional plain text or single-column CSV file with one feature per line.\n\n```csv\nTNMD\nDPM1\nSCYL3\n```\n\n---\n\n## Output Files\n\n| File | Description |\n|------|-------------|\n| `alpha_tuning.csv` | Cross-validated performance summary for each alpha candidate |\n| `model_coefficients.csv` | Coefficients at the selected lambda, including intercept |\n| `selected_features.csv` | Sparse selected features sorted by absolute effect size; written empty when the chosen `alpha` is `0` (ridge) |\n| `feature_matrix.csv` | Sample-by-feature analysis matrix used for model fitting |\n| `coefficient_path.pdf` | Coefficient trajectory plot across lambda values |\n| `cv_curve.pdf` | Cross-validation error curve with `lambda.min` and `lambda.1se` |\n| `session_info.txt` | R session and package version info |\n\n---\n\n## Workflow\n\n### Step 1: Validate Input\n- **WHEN preparing input files for a first run or regression test**, READ: `tests\u002Fdata\u002F`\n- Check file existence\n- Reject empty input files\n- Detect sample and group columns in the group file\n- Reject group files that contain labels outside the requested binary comparison\n- Validate sample matching between expression matrix and group file\n\n### Step 2: Prepare Modeling Matrix\n- Restrict samples to the requested case and control groups\n- Intersect the optional feature list with matrix row names\n- Build a sample-by-feature numeric matrix for `glmnet`\n- Drop zero-variance features before modeling\n\n### Step 3: Run Elastic Net\n- **WHEN deciding between `alpha`, `lambda.min`, and `lambda.1se`**, READ: `references\u002Falgorithm.md`\n- If `alpha=auto`, evaluate the candidate `alpha_grid` with the same cross-validation folds\n- Fit the regularization path with `glmnet`\n- Run `cv.glmnet` to estimate the optimal lambda\n- Extract coefficients at `lambda.min` or `lambda.1se`\n- Apply runtime timeout and capture non-fatal warnings\n\n### Step 4: Export Results\n- **WHEN you need exact invocation patterns or output inspection commands**, READ: `references\u002Fcli-guide.md`\n- Save tuning tables and selected features\n- Generate coefficient path and cross-validation plots\n- Record session information for reproducibility\n\n---\n\n## Methods\n\n### Elastic Net Logistic Regression\nElastic net combines lasso (`L1`) and ridge (`L2`) penalties through `alpha`, enabling sparse feature selection while stabilizing correlated predictors.\n\n### Cross-Validation\n`cv.glmnet` evaluates the lambda path and reports both `lambda.min` and the more conservative `lambda.1se`.\n\n### Automatic Alpha Selection\nWhen `alpha=auto`, the skill reuses the same cross-validation folds across all values in `alpha_grid`, compares the minimum cross-validated error for each candidate, and selects the best alpha before reporting coefficients and lambda-based outputs.\n\nIf the chosen `alpha` is `0`, the model is ridge rather than sparse elastic net. In that case, `selected_features.csv` is written empty to avoid mislabeling dense ridge coefficients as selected features; use `model_coefficients.csv` for coefficient ranking instead.\n\n### Feature Selection Rule\nSelected features are the coefficients whose absolute value exceeds a small numerical tolerance at the chosen lambda, excluding the intercept term.\n\nIf the chosen `alpha` is `0`, the workflow writes an empty `selected_features.csv` because ridge coefficients are dense by design and should not be mislabeled as sparse selected features.\n\n---\n\n## Examples\n\n### Recommended First Run\n```bash\nRscript scripts\u002Fmain.R \\\n  -i expression_matrix.csv \\\n  -g groups.csv \\\n  -f genes.csv \\\n  -a auto \\\n  --alpha_grid 0,0.25,0.5,0.75,1 \\\n  -o output\u002Ffirst_run\n```\n\n### Fixed-Alpha Baseline\n```bash\nRscript scripts\u002Fmain.R \\\n  -i expression_matrix.csv \\\n  -g groups.csv \\\n  -f genes.csv \\\n  -a 0.5 \\\n  -o output\u002Ffixed_alpha\n```\n\n### More Conservative Selection\n```bash\nRscript scripts\u002Fmain.R \\\n  -i expression_matrix.csv \\\n  -g groups.csv \\\n  -l lambda.1se \\\n  -o output\u002Flambda_1se\n```\n\n---\n\n## Error Handling\n\n### Common Errors\n\n| Error | Cause | Solution | Read More |\n|-------|-------|----------|-----------|\n| `SKILL_FILE_NOT_FOUND` | Input file does not exist | Check file path and permissions | `references\u002Ftroubleshooting.md#skill_file_not_found` |\n| `SKILL_EMPTY_DATA` | Input file exists but is empty | Re-export the input file with data rows | `references\u002Ftroubleshooting.md#skill_empty_data` |\n| `SKILL_MISSING_COLUMNS` | Group file lacks sample\u002Fgroup columns | Verify the group file structure | `references\u002Ftroubleshooting.md#skill_missing_columns` |\n| `SKILL_SAMPLE_MISMATCH` | Sample IDs do not overlap between files | Ensure matrix column names match the group file | `references\u002Ftroubleshooting.md#skill_sample_mismatch` |\n| `SKILL_INVALID_PARAMETER` | CLI parameter is invalid | Check allowed values and ranges | `references\u002Ftroubleshooting.md#skill_invalid_parameter` |\n| `SKILL_INVALID_DATA` | Too few samples or usable features remain | Review filtering choices and input data | `references\u002Ftroubleshooting.md#skill_invalid_data` |\n| `SKILL_DEPENDENCY_MISSING` | Required R package is not installed | Install missing packages before rerunning | `references\u002Ftroubleshooting.md#skill_dependency_missing` |\n| `SKILL_PKG_VERSION` | Installed package is too old | Upgrade the required package | `references\u002Ftroubleshooting.md#skill_pkg_version` |\n| `SKILL_TIMEOUT` | Run exceeded the configured time limit | Increase `timeout_seconds` or reduce data size | `references\u002Ftroubleshooting.md#skill_timeout` |\n| `SKILL_RUNTIME_ERROR` | An unexpected runtime or output-write failure occurred | Check output path permissions, free space, and the last console message | `references\u002Ftroubleshooting.md#skill_runtime_error` |\n\n**IF error persists**, READ: `references\u002Ftroubleshooting.md`\n\n---\n\n## Testing\n\n### Test with Sample Data\n\n```bash\n# Check help\nRscript scripts\u002Fmain.R --help\n\n# Run with bundled test data\nRscript scripts\u002Fmain.R \\\n  -i tests\u002Fdata\u002Fexpression_matrix.csv \\\n  -g tests\u002Fdata\u002Fgroups.csv \\\n  -f tests\u002Fdata\u002Fgenes.csv \\\n  -a auto \\\n  --alpha_grid 0,0.5,1 \\\n  -o tests\u002Foutput \\\n  -n 5 \\\n  -t 600\n```\n\n### Validation Commands\n\n```bash\n# Inspect selected features (may be header-only if auto-alpha selects ridge)\ncat tests\u002Foutput\u002Fselected_features.csv\n\n# Check plots exist\nls -la tests\u002Foutput\n```\n\n---\n\n## Implementation Checklist\n\n- [x] CLI parsing with `optparse`\n- [x] `set.seed()` for reproducibility\n- [x] `requireNamespace()` dependency checks\n- [x] Runtime package loading with `library()`\n- [x] Session info recording\n- [x] Timeout control with `setTimeLimit()`\n- [x] Console warning handling\n- [x] Out-of-scope label enforcement\n- [x] `gc()` snapshot reporting\n- [x] File reading instructions in `SKILL.md`\n- [x] Modular script structure\n- [x] Test data provided\n- [x] Error handling with `SKILL_*` codes\n- [x] Scripts in `scripts\u002F` directory\n- [x] References in `references\u002F` directory\n\n---\n\n*Last updated: 2026-04-20 | Version: 1.0.0*\n","# Elastic Net Feature Selection\n\n## When to Use\n\n- Use this skill for binary case-vs-control classification on bulk expression matrices.\n- Use it when you need elastic net logistic regression feature selection, coefficient paths, and `cv.glmnet`-based lambda selection.\n- Use custom labels such as `Tumor` and `Normal` only when the group file still contains exactly two outcome levels.\n\n## Out of Scope\n\n- Survival or Cox modeling\n- Multiclass outcomes\n- Single-cell data\n- Non-expression tables\n\nOut-of-scope enforcement:\n\n- If the group file contains any label outside the requested `case_group` and `control_group`, the command stops with `SKILL_INVALID_DATA` instead of silently dropping samples.\n- If either requested class is missing after validation, the command stops with `SKILL_INVALID_DATA`.\n\n## When to Read External Files\n\n| Situation | File to Read | Purpose |\n|-----------|--------------|---------|\n| **Need to understand alpha, lambda choice, or feature-selection behavior** | `references\u002Falgorithm.md` | Elastic net logistic regression, penalty mixing, cross-validation, and coefficient selection assumptions |\n| **Need the authoritative executable entrypoint** | `scripts\u002Fmain.R` | Run: `Rscript scripts\u002Fmain.R --input_file ... --group_file ... --output_dir ...` |\n| **Need parameter examples, smoke-test commands, or recorded local runs** | `references\u002Fcli-guide.md` | Verified CLI examples for normal runs, conservative runs, and test-data runs |\n| **Need bundled sample inputs for a first run or regression test** | `tests\u002Fdata\u002F` | Sample expression matrix, group file, and feature list |\n| **Encounter errors, warnings, or timeout issues** | `references\u002Ftroubleshooting.md` | Common failures, console warning interpretation, and recovery steps |\n\n---\n\n## Usage\n\n```bash\nRscript scripts\u002Fmain.R \\\n  --input_file .\u002Fexpression_matrix.csv \\\n  --group_file .\u002Fgroups.csv \\\n  --feature_file .\u002Fgenes.csv \\\n  --case_group case \\\n  --control_group control \\\n  --alpha auto \\\n  --alpha_grid 0,0.25,0.5,0.75,1 \\\n  --nfolds 5 \\\n  --lambda_choice lambda.min \\\n  --standardize TRUE \\\n  --timeout_seconds 600 \\\n  --output_dir .\u002Foutput\u002F \\\n  --seed 42\n```\n\n---\n\n## Arguments\n\n| Short | Long | Type | Default | Description |\n|-------|------|------|---------|-------------|\n| `-i` | `--input_file` | character | **required** | Expression matrix file (genes as rows, samples as columns) |\n| `-g` | `--group_file` | character | **required** | Group information file with sample and group columns |\n| `-f` | `--feature_file` | character | `NULL` | Optional feature list file; if omitted, all matrix rows are used |\n| `-c` | `--case_group` | character | `case` | Positive class label in the group file |\n| `-d` | `--control_group` | character | `control` | Negative class label in the group file |\n| `-a` | `--alpha` | character | `0.5` | Elastic net mixing parameter: numeric `0`-`1`, or `auto` for CV-based selection |\n|  | `--alpha_grid` | character | `0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1` | Comma-separated alpha candidates evaluated when `alpha=auto` |\n| `-n` | `--nfolds` | integer | `5` | Cross-validation fold count; automatically reduced if a class has fewer samples |\n| `-l` | `--lambda_choice` | character | `lambda.min` | Coefficient extraction rule: `lambda.min` or `lambda.1se` |\n| `-z` | `--standardize` | logical | `TRUE` | Standardize features inside `glmnet` |\n| `-t` | `--timeout_seconds` | integer | `600` | Elapsed timeout limit in seconds |\n| `-o` | `--output_dir` | character | `.\u002Foutput\u002F` | Output directory |\n| `-s` | `--seed` | integer | `42` | Random seed for reproducibility |\n\n---\n\n## Input Format\n\n### Expression Matrix (input_file)\n\nGenes as rows, samples as columns, CSV format with gene IDs in the first column.\n\n```csv\n,Sample01,Sample02,Sample03\nTNMD,0.0349,0.0533,1.3889\nDPM1,4.8627,5.4208,5.6370\n```\n\n### Group File (group_file)\n\nCSV with sample IDs and binary group labels.\n\n```csv\nsample,group\nSample01,case\nSample02,control\nSample03,case\n```\n\n### Feature File (feature_file)\n\nOptional plain text or single-column CSV file with one feature per line.\n\n```csv\nTNMD\nDPM1\nSCYL3\n```\n\n---\n\n## Output Files\n\n| File | Description |\n|------|-------------|\n| `alpha_tuning.csv` | Cross-validated performance summary for each alpha candidate |\n| `model_coefficients.csv` | Coefficients at the selected lambda, including intercept |\n| `selected_features.csv` | Sparse selected features sorted by absolute effect size; written empty when the chosen `alpha` is `0` (ridge) |\n| `feature_matrix.csv` | Sample-by-feature analysis matrix used for model fitting |\n| `coefficient_path.pdf` | Coefficient trajectory plot across lambda values |\n| `cv_curve.pdf` | Cross-validation error curve with `lambda.min` and `lambda.1se` |\n| `session_info.txt` | R session and package version info |\n\n---\n\n## Workflow\n\n### Step 1: Validate Input\n- **WHEN preparing input files for a first run or regression test**, READ: `tests\u002Fdata\u002F`\n- Check file existence\n- Reject empty input files\n- Detect sample and group columns in the group file\n- Reject group files that contain labels outside the requested binary comparison\n- Validate sample matching between expression matrix and group file\n\n### Step 2: Prepare Modeling Matrix\n- Restrict samples to the requested case and control groups\n- Intersect the optional feature list with matrix row names\n- Build a sample-by-feature numeric matrix for `glmnet`\n- Drop zero-variance features before modeling\n\n### Step 3: Run Elastic Net\n- **WHEN deciding between `alpha`, `lambda.min`, and `lambda.1se`**, READ: `references\u002Falgorithm.md`\n- If `alpha=auto`, evaluate the candidate `alpha_grid` with the same cross-validation folds\n- Fit the regularization path with `glmnet`\n- Run `cv.glmnet` to estimate the optimal lambda\n- Extract coefficients at `lambda.min` or `lambda.1se`\n- Apply runtime timeout and capture non-fatal warnings\n\n### Step 4: Export Results\n- **WHEN you need exact invocation patterns or output inspection commands**, READ: `references\u002Fcli-guide.md`\n- Save tuning tables and selected features\n- Generate coefficient path and cross-validation plots\n- Record session information for reproducibility\n\n---\n\n## Methods\n\n### Elastic Net Logistic Regression\nElastic net combines lasso (`L1`) and ridge (`L2`) penalties through `alpha`, enabling sparse feature selection while stabilizing correlated predictors.\n\n### Cross-Validation\n`cv.glmnet` evaluates the lambda path and reports both `lambda.min` and the more conservative `lambda.1se`.\n\n### Automatic Alpha Selection\nWhen `alpha=auto`, the skill reuses the same cross-validation folds across all values in `alpha_grid`, compares the minimum cross-validated error for each candidate, and selects the best alpha before reporting coefficients and lambda-based outputs.\n\nIf the chosen `alpha` is `0`, the model is ridge rather than sparse elastic net. In that case, `selected_features.csv` is written empty to avoid mislabeling dense ridge coefficients as selected features; use `model_coefficients.csv` for coefficient ranking instead.\n\n### Feature Selection Rule\nSelected features are the coefficients whose absolute value exceeds a small numerical tolerance at the chosen lambda, excluding the intercept term.\n\nIf the chosen `alpha` is `0`, the workflow writes an empty `selected_features.csv` because ridge coefficients are dense by design and should not be mislabeled as sparse selected features.\n\n---\n\n## Examples\n\n### Recommended First Run\n```bash\nRscript scripts\u002Fmain.R \\\n  -i expression_matrix.csv \\\n  -g groups.csv \\\n  -f genes.csv \\\n  -a auto \\\n  --alpha_grid 0,0.25,0.5,0.75,1 \\\n  -o output\u002Ffirst_run\n```\n\n### Fixed-Alpha Baseline\n```bash\nRscript scripts\u002Fmain.R \\\n  -i expression_matrix.csv \\\n  -g groups.csv \\\n  -f genes.csv \\\n  -a 0.5 \\\n  -o output\u002Ffixed_alpha\n```\n\n### More Conservative Selection\n```bash\nRscript scripts\u002Fmain.R \\\n  -i expression_matrix.csv \\\n  -g groups.csv \\\n  -l lambda.1se \\\n  -o output\u002Flambda_1se\n```\n\n---\n\n## Error Handling\n\n### Common Errors\n\n| Error | Cause | Solution | Read More |\n|-------|-------|----------|-----------|\n| `SKILL_FILE_NOT_FOUND` | Input file does not exist | Check file path and permissions | `references\u002Ftroubleshooting.md#skill_file_not_found` |\n| `SKILL_EMPTY_DATA` | Input file exists but is empty | Re-export the input file with data rows | `references\u002Ftroubleshooting.md#skill_empty_data` |\n| `SKILL_MISSING_COLUMNS` | Group file lacks sample\u002Fgroup columns | Verify the group file structure | `references\u002Ftroubleshooting.md#skill_missing_columns` |\n| `SKILL_SAMPLE_MISMATCH` | Sample IDs do not overlap between files | Ensure matrix column names match the group file | `references\u002Ftroubleshooting.md#skill_sample_mismatch` |\n| `SKILL_INVALID_PARAMETER` | CLI parameter is invalid | Check allowed values and ranges | `references\u002Ftroubleshooting.md#skill_invalid_parameter` |\n| `SKILL_INVALID_DATA` | Too few samples or usable features remain | Review filtering choices and input data | `references\u002Ftroubleshooting.md#skill_invalid_data` |\n| `SKILL_DEPENDENCY_MISSING` | Required R package is not installed | Install missing packages before rerunning | `references\u002Ftroubleshooting.md#skill_dependency_missing` |\n| `SKILL_PKG_VERSION` | Installed package is too old | Upgrade the required package | `references\u002Ftroubleshooting.md#skill_pkg_version` |\n| `SKILL_TIMEOUT` | Run exceeded the configured time limit | Increase `timeout_seconds` or reduce data size | `references\u002Ftroubleshooting.md#skill_timeout` |\n| `SKILL_RUNTIME_ERROR` | An unexpected runtime or output-write failure occurred | Check output path permissions, free space, and the last console message | `references\u002Ftroubleshooting.md#skill_runtime_error` |\n\n**IF error persists**, READ: `references\u002Ftroubleshooting.md`\n\n---\n\n## Testing\n\n### Test with Sample Data\n\n```bash\n# Check help\nRscript scripts\u002Fmain.R --help\n\n# Run with bundled test data\nRscript scripts\u002Fmain.R \\\n  -i tests\u002Fdata\u002Fexpression_matrix.csv \\\n  -g tests\u002Fdata\u002Fgroups.csv \\\n  -f tests\u002Fdata\u002Fgenes.csv \\\n  -a auto \\\n  --alpha_grid 0,0.5,1 \\\n  -o tests\u002Foutput \\\n  -n 5 \\\n  -t 600\n```\n\n### Validation Commands\n\n```bash\n# Inspect selected features (may be header-only if auto-alpha selects ridge)\ncat tests\u002Foutput\u002Fselected_features.csv\n\n# Check plots exist\nls -la tests\u002Foutput\n```\n\n---\n\n## Implementation Checklist\n\n- [x] CLI parsing with `optparse`\n- [x] `set.seed()` for reproducibility\n- [x] `requireNamespace()` dependency checks\n- [x] Runtime package loading with `library()`\n- [x] Session info recording\n- [x] Timeout control with `setTimeLimit()`\n- [x] Console warning handling\n- [x] Out-of-scope label enforcement\n- [x] `gc()` snapshot reporting\n- [x] File reading instructions in `SKILL.md`\n- [x] Modular script structure\n- [x] Test data provided\n- [x] Error handling with `SKILL_*` codes\n- [x] Scripts in `scripts\u002F` directory\n- [x] References in `references\u002F` directory\n\n---\n\n*Last updated: 2026-04-20 | Version: 1.0.0*\n",{"name":5,"description":7},"main","e0956dc9606356ab78468936b502e55a365282e2","specialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection",0,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists","https:\u002F\u002Fgithub.com\u002Fmrsonord2240","2026-10-12 03:19:04",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add mrsonord2240\u002Fopenscience-specialists --skill elastic-net-feature-selection",{"tool":37,"command":38},"bunx","bunx skills add mrsonord2240\u002Fopenscience-specialists --skill elastic-net-feature-selection",{"tool":40,"command":41},"pnpm","pnpm dlx skills add mrsonord2240\u002Fopenscience-specialists --skill elastic-net-feature-selection","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002FSKILL.md",true,[45,51,55,59,65,69,73,77,81,85,89,93,99,103,107,113,117,121,125],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"references\u002Falgorithm.md","REFERENCE","参考文档",3583,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Freferences\u002Falgorithm.md",{"path":52,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":53,"sourceHtmlUrl":54},"references\u002Fcli-guide.md",5229,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Freferences\u002Fcli-guide.md",{"path":56,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":57,"sourceHtmlUrl":58},"references\u002Ftroubleshooting.md",4546,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Freferences\u002Ftroubleshooting.md",{"path":60,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":63,"sourceHtmlUrl":64},"scripts\u002Ffunctions.R","SCRIPT","脚本",3772,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Fscripts\u002Ffunctions.R",{"path":66,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":67,"sourceHtmlUrl":68},"scripts\u002Fio.R",3239,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Fscripts\u002Fio.R",{"path":70,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":71,"sourceHtmlUrl":72},"scripts\u002Fmain.R",4429,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Fscripts\u002Fmain.R",{"path":74,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":75,"sourceHtmlUrl":76},"scripts\u002Fmodeling.R",2976,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Fscripts\u002Fmodeling.R",{"path":78,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":79,"sourceHtmlUrl":80},"scripts\u002Foutput.R",2267,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Fscripts\u002Foutput.R",{"path":82,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":83,"sourceHtmlUrl":84},"scripts\u002Frun_analysis.R",2478,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Fscripts\u002Frun_analysis.R",{"path":86,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":87,"sourceHtmlUrl":88},"scripts\u002Futils.R",3542,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Fscripts\u002Futils.R",{"path":90,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":91,"sourceHtmlUrl":92},"scripts\u002Fvalidation.R",2384,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Fscripts\u002Fvalidation.R",{"path":94,"resourceType":95,"resourceTypeDesc":96,"sizeBytes":97,"sourceHtmlUrl":98},"tests\u002Fdata\u002Fexpression_matrix.csv","ASSET","资产文件",2609,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Ftests\u002Fdata\u002Fexpression_matrix.csv",{"path":100,"resourceType":95,"resourceTypeDesc":96,"sizeBytes":101,"sourceHtmlUrl":102},"tests\u002Fdata\u002Fgenes.csv",44,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Ftests\u002Fdata\u002Fgenes.csv",{"path":104,"resourceType":95,"resourceTypeDesc":96,"sizeBytes":105,"sourceHtmlUrl":106},"tests\u002Fdata\u002Fgroups.csv",326,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Ftests\u002Fdata\u002Fgroups.csv",{"path":108,"resourceType":109,"resourceTypeDesc":110,"sizeBytes":111,"sourceHtmlUrl":112},"tests\u002Frun_tests.R","OTHER","其他",771,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Ftests\u002Frun_tests.R",{"path":114,"resourceType":109,"resourceTypeDesc":110,"sizeBytes":115,"sourceHtmlUrl":116},"tests\u002Ftestthat.R",887,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Ftests\u002Ftestthat.R",{"path":118,"resourceType":109,"resourceTypeDesc":110,"sizeBytes":119,"sourceHtmlUrl":120},"tests\u002Ftestthat\u002Fhelper-load-scripts.R",519,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Ftests\u002Ftestthat\u002Fhelper-load-scripts.R",{"path":122,"resourceType":109,"resourceTypeDesc":110,"sizeBytes":123,"sourceHtmlUrl":124},"tests\u002Ftestthat\u002Fsetup.R",249,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Ftests\u002Ftestthat\u002Fsetup.R",{"path":126,"resourceType":109,"resourceTypeDesc":110,"sizeBytes":127,"sourceHtmlUrl":128},"tests\u002Ftestthat\u002Ftest-elastic-net.R",10036,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Fclinical-prediction-model-specialist\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Felastic-net-feature-selection\u002Ftests\u002Ftestthat\u002Ftest-elastic-net.R",[130,137,144,151,158,165],{"skillNo":131,"name":132,"nameZh":6,"description":133,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":134,"categories":135,"keywords":136,"publishedAt":19},"01M7CW36A6QAGWFE2C008M1XPG","bio-workflows-metabolomics-pipeline","Orchestrates the untargeted LC-MS metabolomics pipeline end-to-end (xcms 4.x feature extraction, QC\u002Fdrift\u002Fnormalization, confidence-stratified annotation, permutation-validated statistics, background-aware pathway mapping), naming what each stage decides and where it silently fails. Use when running a full LC-MS metabolomics study from raw mzML to enriched pathways and needing the honest handoffs between stages. Each stage defers to its component skill for parameters and traps; for stable-isotope flux (a separate branch, not this untargeted flow) see metabolomics\u002Fisotope-tracing.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-workflows-metabolomics-pipeline\u002FSKILL.md",[],[],{"skillNo":138,"name":139,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":143,"publishedAt":19},"01M7CW2Y18623NA2S1Y30FRQW1","bio-metabolomics-xcms-preprocessing","Programmatic untargeted LC-MS feature extraction in R with the modern xcms 4.x MsExperiment\u002FXcmsExperiment API, taking raw mzML to a feature table via CentWave peak detection, retention-time alignment, peak-density correspondence, gap-filling, CAMERA redundancy collapse, and built-in QC feature filtering. Use when converting centroided LC-MS runs into a features-by-samples matrix and deciding centWave\u002Fgrouping\u002Falignment parameters. For drift correction and QC\u002FCV filtering execution see metabolomics\u002Fnormalization-qc; for metabolite identification see metabolomics\u002Fmetabolite-annotation; for the MS-DIAL GUI alternative with MS2Dec deconvolution see metabolomics\u002Fmsdial-preprocessing; for downstream statistics see metabolomics\u002Fstatistical-analysis.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-xcms-preprocessing\u002FSKILL.md",[],[],{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":150,"publishedAt":19},"01M7CW2M364HVWPNQEKE2WP4PP","bio-metabolomics-statistical-analysis","Decision-grade statistical analysis for metabolomics intensity tables. Covers transformation and scaling (Pareto vs unit-variance as a hidden hypothesis), unsupervised structure (PCA\u002FHCA for QC), permutation-validated PLS-DA\u002FOPLS-DA (R2 vs Q2, double CV, VIP as heuristic), univariate testing (Welch\u002FMann-Whitney\u002FANOVA\u002FLMM with covariate adjustment), and dependence-aware multiple testing. Use when testing which metabolites differ, building or validating a discriminant model, choosing a scaling, or correcting many correlated tests. For sample-wise normalization\u002Fdrift correction see metabolomics\u002Fnormalization-qc; for ML classifiers and selection-inside-CV leakage see machine-learning\u002Fbiomarker-discovery and machine-learning\u002Fmodel-validation; for pathway interpretation see metabolomics\u002Fpathway-mapping; for design\u002Fpower\u002Fmultiplicity regime see experimental-design\u002Fmultiple-testing.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-statistical-analysis\u002FSKILL.md",[],[],{"skillNo":152,"name":153,"nameZh":6,"description":154,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":157,"publishedAt":19},"01M7CW2BCBF851WYE03Z8XPEDQ","bio-metabolomics-pathway-mapping","Maps metabolomics results to biological pathways via over-representation (ORA), metabolite-set enrichment (MSEA\u002FQEA), mummichog\u002FPSEA on raw m\u002Fz peaks, and network-diffusion enrichment (FELLA), with correct background-set construction and honest interpretive ceilings. Use when interpreting differential metabolites or an untargeted LC-MS feature table in pathway context, choosing ORA vs MSEA vs mummichog vs topology, or setting the reference\u002Fbackground set. For annotation confidence levels feeding ORA see metabolomics\u002Fmetabolite-annotation; for gene-set concepts see pathway-analysis\u002Fgo-enrichment and pathway-analysis\u002Fgsea; for joint gene+metabolite pathways see multi-omics-integration\u002Fmofa-integration.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-pathway-mapping\u002FSKILL.md",[],[],{"skillNo":159,"name":160,"nameZh":6,"description":161,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":162,"categories":163,"keywords":164,"publishedAt":19},"01M7CW21NSZMCPMF7D9CHJM718","bio-metabolomics-normalization-qc","Designs QC, corrects signal drift, removes batch effects, filters features, normalizes samples, and imputes missing values for untargeted LC-MS\u002FGC-MS metabolomics, framing each step as a measurement model that can create or erase biological signal. Use when processing a peak\u002Ffeature table before statistical analysis, choosing a drift-correction or sample-normalization method, deciding QC RSD vs D-ratio filtering, or handling left-censored missing values. The feature table is produced by metabolomics\u002Fxcms-preprocessing or metabolomics\u002Fmsdial-preprocessing; transformation\u002Fscaling for modeling defers to metabolomics\u002Fstatistical-analysis; cross-study design issues link to experimental-design\u002Fbatch-design.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-normalization-qc\u002FSKILL.md",[],[],{"skillNo":166,"name":167,"nameZh":6,"description":168,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":169,"categories":170,"keywords":171,"publishedAt":19},"01M7CW1SWVM0NYHVE6Q7MA3G7R","bio-metabolomics-msdial-preprocessing","Runs the MS-DIAL preprocessing workflow (peak picking, MS2Dec spectral deconvolution, alignment, gap-filling) and imports the alignment-result table into R or Python with honest filtering. Use when preprocessing LC-MS DDA\u002FDIA (SWATH) or GC-MS raw data with MS-DIAL, deciding MS-DIAL vs XCMS, configuring the MSDIALCUI console run, or parsing an MS-DIAL export into a clean feature matrix. For programmatic R peak detection and the feature-table-as-artifact framing see metabolomics\u002Fxcms-preprocessing; for lipid annotation mode see metabolomics\u002Flipidomics; for MSI-level confidence honesty see metabolomics\u002Fmetabolite-annotation; for drift correction and QC see metabolomics\u002Fnormalization-qc.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-msdial-preprocessing\u002FSKILL.md",[],[]]