This repository contains a trained elastic net model for estimating prostate tumor purity from proteomic abundance data.
The model was trained from CPTAC prostate proteomics using xCell tumor epithelial percentage as the training target. The final deployed object keeps only the elastic net model, its preprocessing parameters, calibration object, selected features, and feature weights.
-
inst/extdata/final_elastic_net_proteomic_deconvolution_model.rds
Cleaned final elastic net model object. -
data/final_elastic_net_feature_weights_clean.csv
Final elastic net feature weights. Positive weights increase predicted tumor purity; negative weights decrease predicted tumor purity. -
R/predict_purity.R
Helper functions for loading the model and predicting tumor purity. -
examples/predict_new_samples.R
Minimal example script for applying the model to a new proteomic matrix.
The input proteomic matrix should be a table with:
- one row per protein
- an
Indexcolumn matching the model feature IDs - one numeric column per sample
Example:
| Index | sample_1 | sample_2 | sample_3 |
|---|---|---|---|
| ENSP00000354587 | 0.12 | -0.31 | 0.44 |
| ENSP00000269305 | -0.08 | 0.22 | -0.17 |
The model expects log2 abundance or log-ratio style data. By default, each feature is median-centered within the new cohort before prediction.
Clone the repository:
git clone https://github.com/jinyangye119/Prodecov.git
cd ProdecovInstall required R packages:
install.packages(c("glmnet", "Matrix", "readr"))You can either source the helper script directly:
source("R/predict_purity.R")or install the folder as a small local R package:
install.packages("devtools")
devtools::install(".")Load the model:
source("R/predict_purity.R")
model <- load_protein_deconvolution_model(
"inst/extdata/final_elastic_net_proteomic_deconvolution_model.rds"
)Read a new protein matrix:
library(readr)
new_data <- read_tsv("path/to/new_protein_matrix.tsv", show_col_types = FALSE)Predict tumor purity:
predictions <- predict_protein_purity(
new_data = new_data,
model = model,
index_col = "Index",
median_center = TRUE,
calibrate = TRUE
)
predictionsThe output contains:
sample_id: sample name from the input matrix columnpredicted_purity_raw: raw elastic net prediction, clipped to 0-1predicted_purity_calibrated: calibrated prediction, clipped to 0-1n_model_features: number of model featuresn_matched_features: number of model features found in the new datamissing_feature_fraction: fraction of model features missing from the new data
Save predictions:
write_csv(predictions, "predicted_tumor_purity.csv")- Use
predicted_purity_calibratedas the main prediction. - If many model features are missing, interpret predictions cautiously.
- For external cohorts, keep
median_center = TRUEunless you have a specific reason not to.