Use when building a binary classification model from an expression matrix or other omics feature matrix with LASSO logistic regression, cross-validation, and coefficient path visualization. NOT for: multiclass classification, survival/Cox models, or ordinary linear regression.
72
89%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
| Situation | File to Read | Purpose |
|---|---|---|
| Need algorithm details | references/algorithm.md | LASSO objective function, cross-validation, and interpretation |
| Need to run analysis | scripts/main.R | Execute: Rscript scripts/main.R --input_file ... --group_file ... |
| Encounter errors | references/troubleshooting.md | Common errors and solutions |
| Need CLI examples | references/cli-guide.md | Detailed CLI usage examples |
| Need test data | tests/data/ | Sample input files for testing |
| Need workflow implementation details | scripts/run_analysis.R | Inspect orchestration, outputs, and file-writing behavior |
| Need input-validation or error-handling details | scripts/utils.R, scripts/io.R | Inspect validation, parsing, logging, and standardized safeguards |
Rscript scripts/main.R \
--input_file ./expression_matrix.csv \
--group_file ./groups.csv \
--case_group case \
--control_group control \
--output_dir ./output/ \
--nfolds 10 \
--timeout_seconds 1800 \
--seed 42| Short | Long | Type | Default | Description |
|---|---|---|---|---|
-i | --input_file | character | required | Expression matrix file (features as rows, samples as columns) |
-g | --group_file | character | required | Group file with sample and group columns |
-c | --case_group | character | required | Case class label encoded as 1 |
-t | --control_group | character | required | Control class label encoded as 0 |
-f | --feature | character | NULL | Optional feature list file or comma-separated feature names |
-n | --nfolds | integer | 10 | Cross-validation folds: 3, 5, 7, 10 |
--cv_title | character | "" | Optional title for the cross-validation plot | |
--path_title | character | "" | Optional title for the coefficient path plot | |
--timeout_seconds | integer | 1800 | Maximum elapsed runtime in seconds | |
-o | --output_dir | character | ./output/ | Output directory |
-s | --seed | integer | 42 | Random seed for reproducibility |
input_file)Features as rows, samples as columns, CSV or TSV format with feature IDs in the first column.
,Sample01,Sample02,Sample03
TSPAN6,1.8479,1.8318,3.8276
TNMD,0.0349,0.0533,1.3889group_file)CSV or TSV with sample IDs and binary-group labels.
sample,group
Sample01,case
Sample02,control
Sample03,casefeature)One feature per line, or pass a comma-separated feature list directly on the CLI.
TNMD
DPM1
SCYL3| File | Description |
|---|---|
coefficient.csv | All coefficients at lambda.min |
feature_matrix.csv | Sample-level matrix with original group labels and binary event column |
selected_features.txt | Non-zero features at lambda.min excluding the intercept, when available |
missing_features.txt | Requested features not found in the matrix, when applicable |
lasso_lambda_binary_plot.pdf | Cross-validation curve |
lasso_var_binary_plot.pdf | Coefficient path plot |
session_info.txt | R session and package version info |
WHEN checking validation rules or parsing behavior, READ: scripts/utils.R and scripts/io.R
WHEN checking class encoding or feature filtering behavior, READ: scripts/modeling.R
case_group as 1 and control_group as 0WHEN understanding the statistical method or lambda selection, READ: references/algorithm.md
glmnet model with alpha = 1cv.glmnet to select the optimal lambdalambda.minWHEN checking output generation or plot behavior, READ: scripts/run_analysis.R and scripts/plotting.R
output_dirThe model minimizes binomial deviance with an L1 penalty, shrinking weak coefficients to zero and performing embedded feature selection.
cv.glmnet evaluates candidate lambda values across nfolds folds and reports lambda.min and lambda.1se.
Rscript scripts/main.R \
-i ./expression_matrix.csv \
-g ./groups.csv \
-c case \
-t control \
-o ./outputRscript scripts/main.R \
-i ./expression_matrix.csv \
-g ./groups.csv \
-c case \
-t control \
-f ./genes.txt \
-o ./outputRscript scripts/main.R \
-i ./expression_matrix.csv \
-g ./groups.csv \
-c case \
-t control \
-n 5 \
--timeout_seconds 900 \
-s 123 \
-o ./outputRscript scripts/main.R \
-i ./expression_matrix.csv \
-g ./groups.csv \
-c case \
-t control \
--cv_title "LASSO Cross-Validation" \
--path_title "LASSO Coefficient Paths" \
--timeout_seconds 1200 \
-o ./output| Error | Cause | Solution |
|---|---|---|
SKILL_FILE_NOT_FOUND | Input file does not exist | Check file path |
SKILL_EMPTY_FILE | An input file exists but contains no data | Verify the file is not empty |
SKILL_PARSE_ERROR | The input file cannot be parsed as CSV or TSV | Check delimiters, headers, and encoding |
SKILL_FILE_WRITE_ERROR | The output directory cannot be created or written | Check output path and permissions |
SKILL_EMPTY_DATA | The loaded table has no usable rows or columns | Verify that the input file contains valid data |
SKILL_MISSING_COLUMNS | The group file does not provide the required columns | Provide sample and group columns |
SKILL_INVALID_TYPE | A parameter or data field has the wrong type | Ensure numeric fields are numeric and strings are valid |
SKILL_SAMPLE_MISMATCH | Sample IDs differ between matrix and group file | Make names match exactly |
SKILL_INVALID_GROUP | Case/control labels not found in group file | Check --case_group and --control_group |
SKILL_INVALID_DATA | Too few classes, samples, or valid features | Review input structure and feature list |
SKILL_INVALID_PARAMETER | Unsupported nfolds or empty parameter | Use documented argument values |
SKILL_DEPENDENCY_MISSING | Required R package not installed | Install missing CRAN package |
SKILL_TIMEOUT | Analysis exceeded the configured time limit | Reduce feature count or increase --timeout_seconds |
SKILL_MEMORY_ERROR | The runtime environment cannot allocate enough memory | Reduce matrix size or available workload |
SKILL_RUNTIME_ERROR | An unexpected runtime error occurred | Review the exact console error and retry |
IF error persists, READ: references/troubleshooting.md
# Check help
Rscript scripts/main.R --help
# Run with sample data
Rscript scripts/main.R \
-i tests/data/expression_matrix.csv \
-g tests/data/groups.csv \
-c case \
-t control \
-f tests/data/genes.csv \
--timeout_seconds 1800 \
-o tests/output# Check coefficient output
ls -la tests/output/coefficient.csv
# Check plots exist
ls -la tests/output/lasso_lambda_binary_plot.pdf
ls -la tests/output/lasso_var_binary_plot.pdfoptparseset.seed() for reproducibilityrequireNamespace() dependency checks--timeout_secondsscripts/ directoryreferences/ directoryLast updated: 2026-04-17 | Version: 1.0.0
f5ef65b
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.