Skip to content

Commit 0032803

Browse files
committed
dfs to matrix, minor roxygen/vignette adjustments
1 parent 306e6e6 commit 0032803

6 files changed

Lines changed: 31 additions & 23 deletions

File tree

R/data.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ NULL
3939

4040
#' BRSpred: BCG Response Subtype Predictor for High-risk Non-Muscle Invasive Bladder Cancer
4141
#'
42-
#' Consensus clustering based molecular predictor for BCG responsiveness in bladder cancer. With these initial classes, a pamr-classifier is constructed for future data. Further, transcriptomics datasets for training and validation are provided along with key clinical variables.
42+
#' Consensus clustering based molecular predictor was first constructed for characterizing BCG responsiveness in bladder cancer. With these initial classes, a pamr-classifier is constructed for future data. Further, transcriptomics datasets for training and validation are provided along with key clinical variables. See the main BRS vignette for further details.
4343
#'
4444
#' @import survminer
4545
#' @import ConsensusClusterPlus

data/CohortA_pre.RData

-1.21 KB
Binary file not shown.

data/CohortB.RData

-1 KB
Binary file not shown.

man/BRSpred.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/ErasmusMC.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/brs.Rmd

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ library(BRSpred)
4444

4545
The package comes with two main dasets:
4646

47-
- Cohort A (training) from Erasmus MC (N=132 total for pre-BCG samples, and additional N=45 for post-BCG samples)
47+
- Cohort A (training) from Erasmus MC (N=132 total for pre-BCG samples, and additional N=44 for post-BCG samples)
4848
- Cohort B (testing) from Erasmus MC (N=151 total)
4949

5050

@@ -106,28 +106,19 @@ survminer::ggsurvplot(fit1,
106106
break.time.by = 24, palette = c("forestgreen", "dodgerblue3", "firebrick"))
107107
```
108108

109-
## Post-BCG samples
110-
111-
```{r}
112-
CohortA_post <- BRSpred::BRS(newx = BRSpred::CohortA_post, scale="together")
113-
```
109+
## Testing set (Cohort B)
114110

115-
One outlier sample was identified previously:
111+
Performing prediction for cohort B, with z-score applied independently to the training samples from cohort A and new data from cohort B:
116112

117113
```{r}
118-
119-
table(vignette_prediction = CohortA_post, paper_prediction = erasmus_clinical[colnames(BRSpred::CohortA_post),"Predicted.subtype"])
120-
114+
CohortB_pred <- BRSpred::BRS(newx = BRSpred::CohortB, scale="independent")
115+
table(CohortB_pred)
121116
```
122117

123-
124-
## Testing set (Cohort B)
125-
126-
Performing prediction for cohort B:
118+
Comparing the predicts produced via ```BRSpred::BRS``` to the original predictions published in de Jong et al:
127119

128120
```{r}
129-
CohortB_pred <- BRSpred::BRS(newx = BRSpred::CohortB, scale="independent")
130-
table(CohortB_pred)
121+
table(vignette_prediction = CohortB_pred, original_prediction = erasmus_clinical[colnames(BRSpred::CohortB),"Predicted.subtype"])
131122
```
132123

133124
Kaplan-Meyer using the predictions for Cohort B:
@@ -147,6 +138,21 @@ survminer::ggsurvplot(fit2,
147138
break.time.by = 24, palette = c("forestgreen", "dodgerblue3", "firebrick"))
148139
```
149140

141+
## Post-BCG samples
142+
143+
We run the BRS-classifier for post-BCG samples while z-scaling the new data matrix together with the training data matrix (pre-BCG samples):
144+
145+
```{r}
146+
CohortA_post_pred <- BRSpred::BRS(newx = BRSpred::CohortA_post, scale="together")
147+
table(CohortA_post_pred)
148+
```
149+
150+
Comparing the predicts produced via ```BRSpred::BRS``` to the original predictions published in de Jong et al:
151+
152+
```{r}
153+
table(vignette_prediction = CohortA_post_pred, original_prediction = erasmus_clinical[colnames(BRSpred::CohortA_post),"Predicted.subtype"])
154+
```
155+
150156
## Heatmaps
151157

152158
We predefine some subsets of genes of interest and plot their expression in both the training and validation cohort:
@@ -169,12 +175,13 @@ genesets <- list(
169175

170176
### Cohort A heatmap
171177

172-
Construct geneset-average expression within samples, based on the trained clustering classes (we order samples based on BRS-classes and inside each class based on progression status):
178+
Construct geneset-average expression within samples for genes that can be found from the data, based on the trained clustering classes (we order samples based on BRS-classes and inside each class based on progression status):
173179
```{r}
174180
suborderA <- rownames(Clinicaldata_A_pre[order(Clinicaldata_A_pre$Erasmus.BRS, Clinicaldata_A_pre$Progression),])
175181
176182
exprsmatA <- do.call("rbind", lapply(genesets, FUN=function(genes){
177-
t(as.matrix(colMeans(CohortA_pre[genes,suborderA], na.rm=TRUE)))
183+
genes <- genes[which(genes %in% rownames(CohortA_pre))]
184+
t(as.matrix(colMeans(CohortA_pre[genes,suborderA,drop=FALSE], na.rm=TRUE)))
178185
}))
179186
rownames(exprsmatA) <- names(genesets)
180187
```
@@ -211,7 +218,8 @@ We first construct geneset-average expression within samples, with ordering base
211218
suborderB <- rownames(Clinicaldata_B[order(Clinicaldata_B$CohortB_predict, Clinicaldata_B$Progression, decreasing = FALSE), ])
212219
213220
exprsmatB <- do.call("rbind", lapply(genesets, FUN=function(genes){
214-
t(as.matrix(colMeans(CohortB[genes,suborderB], na.rm=TRUE)))
221+
genes <- genes[which(genes %in% rownames(CohortB))]
222+
t(as.matrix(colMeans(CohortB[genes,suborderB,drop=FALSE], na.rm=TRUE)))
215223
}))
216224
rownames(exprsmatB) <- names(genesets)
217225
```

0 commit comments

Comments
 (0)