We first conducted univariate Cox regression and Kaplan‐Meier (KM) analysis using the survival R package to identify ER stress‐related genes associated with patients’ overall survival (OS) time from TCGA, CGGA (CGGA refers to mRNAseq_325 data unless otherwise specified), CGGA (mRNA‐array) and GSE16011 data sets. Only when the p values of both analysis methods were ≤0.05 were the genes included in the next step. The intersection genes related to OS from the above four data sets were analysed by least absolute shrinkage and selection operator (LASSO) regression, using the glmnet R package in TCGA database, to narrow the range of prognosis‐related genes. Subsequently, the Akaike information criterion (AIC) method of multivariate Cox regression analysis was performed using the survival package to establish an optimal ER stress‐related risk signature based on linear integration of the regression coefficient obtained from the multivariate Cox regression analysis and expression level of the selected ER related genes. The risk score was computed as follows:

where Expi is the expression value of the ER stress‐related genes and Coefi is the corresponding regression coefficient calculated by multivariate Cox regression analysis. TCGA data were used as the training cohort, and CGGA and GSE16011 data were used for the validation cohorts.