Set up

Load Packages

suppressPackageStartupMessages({
  library(GenomicSuperSignature)
  library(curatedTCGAData)
  library(MultiAssayExperiment)
  library(TCGAutils)
  library(tidyr)
  library(dplyr)
  library(ggplot2)
  library(magick)
  library(wordcloud)
  library(EnrichmentBrowser)
  library(ztable)
  library(magrittr)
  library(ComplexHeatmap)
})

Load TCGA dataset

load("~/Documents/GitHub/GSS/data/TCGA_validationDatasets.rda")
datasets <- TCGA_validationDatasets[1:7]

Load RAVmodel

RAVmodel <- getModel("C2", load=TRUE)
## [1] "downloading"

Select HNSC RNA metadata

hnsc <- curatedTCGAData(diseaseCode = "HNSC", 
                        assays = "RNA*", 
                        version = "2.0.1", 
                        dry.run = FALSE)

hnsc_rna <- getWithColData(hnsc, 
                           "HNSC_RNASeq2Gene-20160128", 
                           mode = "append")

hnsc_meta <- colData(hnsc_rna)

heatmapTable: HNSC

val_hnsc <- validate(datasets$HNSC, RAVmodel)
heatmapTable(val_hnsc, RAVmodel)

val_hnsc_meta <- validate(hnsc_rna, RAVmodel)
heatmapTable(val_hnsc_meta, RAVmodel)

# Subset ## Filter attributes

sparsity_summary <- table(colSums(is.na(hnsc_meta)))
sparsity_summary
## 
##   0   1   2   3   4   5   7   8  10  11  12  13  14  16  23  26  41  50  54  63 
## 235   7   5  23   6  20   2   1   1   1   1   2   1   4   2   3   2   1   1   1 
##  72  73  76  83  86  91 100 115 133 144 147 148 150 151 164 173 175 177 186 191 
##   3   1   1   1   3   5   1   1   2   1   1   1   1   1   1   1   9   1   1   1 
## 192 206 212 216 223 234 241 245 246 250 252 253 256 259 261 263 266 267 269 273 
##   1   1   3   3   3   1   1   1   5   3   1   1   1   2   1   1   1   1   1   1 
## 289 303 308 310 311 312 313 324 325 326 329 330 333 335 341 359 362 363 367 368 
##   2   1   1   2  15  15   1  10   1   2   2   1   1   1   1   1   1   1   3   1 
## 369 371 373 379 380 381 382 384 386 387 389 390 391 397 402 407 410 412 414 416 
##   2   1   1   1   6   2   1   1   1   1   1   1   2   1   1   5   1   1   1   1 
## 420 421 425 426 427 431 433 435 437 440 446 451 452 454 456 457 460 461 462 463 
##   2   4   1   1   3   1   2   1   3   1   1   1   1  60   2   3   1   1   5  24 
## 466 467 469 472 473 474 475 476 477 479 480 481 482 483 485 488 489 490 491 493 
##   1   3   1   1   1   3   2   1   1  17   1   1   2   1   8  41   1   4   2   1 
## 495 502 505 507 508 509 510 512 515 516 517 518 519 520 521 522 523 524 525 526 
##   1   1   1   1   1  17   2   2  23   1   2   4   2   2   2  19   8   2   3   8 
## 527 528 529 530 531 532 533 534 537 538 539 541 542 543 544 545 546 548 549 550 
##   2   1   2  10   1   5   3   3   1   1   3   3   8   3   4   5   2  14   6   4 
## 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 
##  10   8  10   9   7  14  46  10  19  20  44  79  45 100 140   6

Sparsity Plot

# Only select for columns with more than 10% completeness
keep_attr_ind <- which(colSums(!is.na(hnsc_meta)) > round(nrow(hnsc_meta)/10))
meta_sub1 <- hnsc_meta[keep_attr_ind]
meta_sub1 <- subset(meta_sub1, select = -patientID)
# Randomly select for 100 rows
set.seed(1)
random_sample_ind <- sample(1:nrow(meta_sub1), 100)
meta_sub2 <- meta_sub1[random_sample_ind,]
# Check for data types in listData
unique(sapply(hnsc_meta@listData, type))
## [1] "character" "integer"   "double"
charcTb <- meta_sub2[, sapply(meta_sub2, class) == 'character']
numTb <- meta_sub2[, sapply(meta_sub2, class) %in% c('numeric', 'integer')]
# Calculate validation scores
sampleScore <- calculateScore(hnsc_rna, RAVmodel)
# Select for RAVs with a minimum silhouette width of 0.5
val_all <- validate(hnsc_rna, RAVmodel)
validated_ind <- validatedSignatures(val_all, num.out = 30, RAVmodel,
                                     swCutoff = 0.5, indexOnly = TRUE)
# Subset sampleScore to join with MCPcounter
sampleScore_sub <- sampleScore[random_sample_ind, validated_ind] %>% as.data.frame() 

Calculate r-squared value

Numeric variables

# R squared value function
calculateRsq <- function (x, y) stats::cor(x, y, use = "na.or.complete") ^ 2
# Calculate r-squared for numeric attributes
rsq_numAttr_tb <- as.data.frame(matrix(nrow = ncol(numTb), 
                                       ncol = ncol(sampleScore_sub)))

colnames(rsq_numAttr_tb) <- colnames(sampleScore_sub)
rownames(rsq_numAttr_tb) <- colnames(numTb)

for (i in seq_len(ncol(numTb))) {
    for (j in seq_len(ncol(sampleScore_sub))) {
        rsq <- calculateRsq(numTb[,i], sampleScore_sub[,j])
        rsq_numAttr_tb[i, j] <- rsq
    }
}
dim(rsq_numAttr_tb) # 326 features x 12 RAVs
## [1] 330  12
# rsq_numAttr_tb[1:10, 1:10]
max_rav <- apply(rsq_numAttr_tb, 1, max)
max_attr <- which(max_rav > 0.4) # Lower r-squared value cutoff is 0.4
max_rav[max_attr]
##                                        patient.drugs.drug.2.month_of_form_completion 
##                                                                            0.7550794 
##                                patient.radiations.radiation.2.day_of_form_completion 
##                                                                            0.4070505 
## patient.samples.sample.portions.portion.slides.slide.2.percent_monocyte_infiltration 
##                                                                            0.5637815

Features with an r squared value > 0.4

target_rsq <- rsq_numAttr_tb[max_attr,]

heatmapTable

options(ztable.type="html")
z = ztable(target_rsq)
z %>% makeHeatmap(palette="Purples")
  RAV4483 RAV2670 RAV1301 RAV988 RAV987 RAV1002 RAV1125 RAV996 RAV998 RAV999 RAV1001 RAV4113
patient.drugs.drug.2.month_of_form_completion 0.05 0.24 0.27 0.19 0.39 0.06 0.06 0.03 0.76 0.03 0.42 0.37
patient.radiations.radiation.2.day_of_form_completion 0.21 0.00 0.00 0.04 0.00 0.07 0.41 0.00 0.02 0.03 0.12 0.03
patient.samples.sample.portions.portion.slides.slide.2.percent_monocyte_infiltration 0.25 0.06 0.07 0.26 0.02 0.12 0.56 0.43 0.52 0.07 0.12 0.05

Calculate F-Statistic (ANOVA)

Character variables

# Convert to factor data type
factorTb <- meta_sub2[, sapply(meta_sub2, class) == 'character']
factorTb[sapply(factorTb, is.character)] <- lapply(factorTb[sapply(factorTb, is.character)], factor, exclude = NULL)

new_ind <- c()

# Select for factors with at least two possible values
for (i in 1:length(factorTb)) {
  if (nlevels(factorTb[, i]) > 1 & nlevels(factorTb[, i]) < 25) {
    new_ind <- c(new_ind, i)
  }
}

new_factorTb <- factorTb[,new_ind]
# Calculate p-value for factor attributes
aov_factorAttr_tb <- as.data.frame(matrix(nrow = ncol(new_factorTb),
                                          ncol = ncol(sampleScore_sub)))

rownames(aov_factorAttr_tb) <- colnames(new_factorTb)
colnames(aov_factorAttr_tb) <- colnames(sampleScore_sub)

for (i in seq_len(ncol(sampleScore_sub))) {
  for (j in seq_len(ncol(new_factorTb))) {
    if (!is.null(summary(aov(sampleScore_sub[, i] ~ new_factorTb[, j]))[[1]]$`Pr(>F)`[1])) {
      aov_factorAttr_tb[j, i] <- summary(aov(sampleScore_sub[, i] ~ new_factorTb[, j]))[[1]]$`Pr(>F)`[1]
    } else {
      next
    }
  }
}
# Calculate p-value for factor attributes
aov_res <- as.data.frame(matrix(nrow = ncol(new_factorTb),
                                ncol = ncol(sampleScore_sub)))

rownames(aov_res) <- colnames(new_factorTb)
colnames(aov_res) <- colnames(sampleScore_sub)

aov_fvalue <- aov_res
aov_pvalue <- aov_res

for (i in seq_len(ncol(sampleScore_sub))) {
  for (j in seq_len(ncol(new_factorTb))) {
      
      ## ANOVA
      aov <- aov(sampleScore_sub[, i] ~ new_factorTb[, j])
      
      ## F value
      fval <- summary(aov)[[1]]$`F value`[1]
      aov_fvalue[j, i] <- fval
      
      ## P value
      pval <- summary(aov)[[1]]$`Pr(>F)`[1]
      aov_pvalue[j, i] <- pval
  }
}

# for (i in seq_len(ncol(sampleScore_sub))) {
#   for (j in seq_len(ncol(new_factorTb))) {
#     if (!is.null(summary(aov(sampleScore_sub[, i] ~ new_factorTb[, j]))[[1]]$`Pr(>F)`[1])) {
#       aov_factorAttr_tb[j, i] <- summary(aov(sampleScore_sub[, i] ~ new_factorTb[, j]))[[1]]$`Pr(>F)`[1]
#     } else {
#       next
#     }
#   }
# }
# Calculate f-statistics for factor attributes
aov_factorAttr_fstat <- as.data.frame(matrix(nrow = ncol(new_factorTb),
                                          ncol = ncol(sampleScore_sub)))

rownames(aov_factorAttr_fstat) <- colnames(new_factorTb)
colnames(aov_factorAttr_fstat) <- colnames(sampleScore_sub)

for (i in seq_len(ncol(sampleScore_sub))) {
  for (j in seq_len(ncol(new_factorTb))) {
    if (!is.null(summary(aov(sampleScore_sub[, i] ~ new_factorTb[, j]))[[1]]$`F value`[1])) {
      aov_factorAttr_fstat[j, i] <- summary(aov(sampleScore_sub[, i] ~ new_factorTb[, j]))[[1]]$`F value`[1]
    } else {
      next
    }
  }
}
# Select for p-values < 0.05
min_rav <- apply(aov_factorAttr_tb, 1, min)
min_attr <- which(min_rav < 0.05)
head(min_rav[min_attr])
##  pathologic_stage pathology_N_stage pathology_M_stage            gender 
##      0.0027993127      0.0002303823      0.0006177815      0.0015547641 
## radiation_therapy histological_type 
##      0.0025327429      0.0042086842

Features with a p-value < 0.05

target_aov <- aov_factorAttr_tb[min_attr,]

heatmapTable

options(ztable.type="html")
ztable(target_aov) %>%
  makeHeatmap(mycolor=gradientColor(low="snow4", mid="snow2", high="snow")) %>%
  print(caption="ANOVA p-values")
ANOVA p-values
  RAV4483 RAV2670 RAV1301 RAV988 RAV987 RAV1002 RAV1125 RAV996 RAV998 RAV999 RAV1001 RAV4113
pathologic_stage 0.01 0.27 0.27 0.24 0.07 0.48 0.00 0.34 0.54 0.08 0.11 0.16
pathology_N_stage 0.00 0.16 0.12 0.24 0.13 0.02 0.01 0.23 0.11 0.09 0.33 0.23
pathology_M_stage 0.36 0.00 0.00 0.00 0.07 0.83 0.14 0.05 0.04 0.06 0.22 0.22
gender 0.21 0.14 0.14 0.21 0.02 0.14 0.01 0.04 0.26 0.25 0.00 0.83
radiation_therapy 0.00 0.19 0.17 0.02 0.20 0.27 0.01 0.18 0.04 0.16 0.16 0.13
histological_type 0.01 0.35 0.29 0.04 0.63 0.20 0.00 0.14 0.02 0.72 0.78 0.06
patient.alcohol_history_documented 0.19 0.76 0.80 0.19 0.28 0.16 0.04 0.19 0.96 0.26 0.02 0.28
patient.anatomic_neoplasm_subdivision 0.11 0.24 0.28 0.03 0.23 0.48 0.00 0.07 0.64 0.47 0.00 0.54
patient.clinical_cqcf.consent_or_death_status 0.05 0.62 0.58 0.01 0.56 0.55 0.02 0.08 0.08 0.66 0.66 0.89
patient.clinical_cqcf.frozen_specimen_anatomic_site 0.11 0.24 0.28 0.03 0.23 0.48 0.00 0.07 0.64 0.47 0.00 0.54
patient.clinical_cqcf.histological_type 0.01 0.35 0.29 0.04 0.63 0.20 0.00 0.14 0.02 0.72 0.78 0.06
patient.clinical_cqcf.normal_tissue_anatomic_site 0.18 0.80 0.75 0.49 0.73 0.10 0.08 0.13 0.00 0.10 0.34 0.94
patient.clinical_cqcf.normal_tissue_proximity 0.17 0.92 0.96 0.34 0.42 0.20 0.62 0.57 0.03 0.06 0.89 0.82
patient.drugs.drug.2.therapy_ongoing 0.17 0.78 0.75 0.05 0.65 0.33 0.13 0.24 0.35 0.50 0.84 0.51
patient.drugs.drug.measure_of_response 0.03 0.50 0.41 0.00 0.65 0.24 0.08 0.08 0.07 0.95 0.40 0.04
patient.drugs.drug.prescribed_dose_units 0.22 0.04 0.05 0.08 0.08 0.08 0.03 0.03 0.29 0.20 0.10 0.96
patient.drugs.drug.regimen_indication 0.11 0.26 0.26 0.40 0.56 0.33 0.63 0.66 0.54 0.80 0.96 0.03
patient.drugs.drug.therapy_ongoing 0.46 0.63 0.70 0.02 0.13 0.87 0.14 0.12 0.27 0.72 0.45 0.44
patient.drugs.drug.therapy_types.therapy_type 0.46 0.63 0.70 0.02 0.13 0.87 0.14 0.12 0.27 0.72 0.45 0.44
patient.drugs.drug.tx_on_clinical_trial 0.04 0.45 0.37 0.00 0.59 0.25 0.04 0.04 0.07 0.93 0.42 0.06
patient.follow_ups.follow_up.disease_after_curative_tx 0.00 0.20 0.13 0.01 0.89 0.46 0.15 0.21 0.03 0.89 0.84 0.06
patient.follow_ups.follow_up.followup_case_report_form_submission_reason 0.04 0.04 0.03 0.40 0.06 0.95 0.70 0.84 0.53 0.91 0.38 0.19
patient.follow_ups.follow_up.lost_follow_up 0.12 0.00 0.00 0.00 0.09 0.64 0.16 0.01 0.07 0.26 0.38 0.09
patient.follow_ups.follow_up.method_of_curative_tx 0.02 0.35 0.29 0.01 0.56 0.52 0.03 0.29 0.08 0.87 0.81 0.07
patient.follow_ups.follow_up.new_tumor_event_after_initial_treatment 0.34 0.00 0.00 0.02 0.02 0.59 0.71 0.20 0.20 0.16 0.21 0.07
patient.follow_ups.follow_up.new_tumor_events.new_tumor_event.new_neoplasm_event_type 0.08 0.20 0.17 0.03 0.61 0.51 0.02 0.17 0.10 0.98 0.67 0.10
patient.follow_ups.follow_up.new_tumor_events.new_tumor_event_after_initial_treatment 0.00 0.00 0.00 0.00 0.01 0.41 0.02 0.07 0.01 0.63 0.05 0.03
patient.follow_ups.follow_up.radiation_therapy 0.03 0.17 0.19 0.13 0.04 0.18 0.00 0.17 0.12 0.27 0.05 0.37
patient.gender 0.21 0.14 0.14 0.21 0.02 0.14 0.01 0.04 0.26 0.25 0.00 0.83
patient.histological_type 0.01 0.35 0.29 0.04 0.63 0.20 0.00 0.14 0.02 0.72 0.78 0.06
patient.hpv_status_by_p16_testing 0.14 0.81 0.75 0.02 0.79 0.32 0.04 0.08 0.46 0.84 0.58 0.17
patient.icd_10 0.09 0.30 0.30 0.01 0.10 0.58 0.00 0.01 0.47 0.71 0.00 0.68
patient.icd_o_3_histology 0.07 0.02 0.02 0.02 0.13 0.80 0.04 0.22 0.04 0.29 0.40 0.07
patient.icd_o_3_site 0.09 0.30 0.30 0.01 0.10 0.58 0.00 0.01 0.47 0.71 0.00 0.68
patient.laterality 0.08 0.08 0.05 0.02 0.43 0.43 0.15 0.23 0.03 0.67 0.14 0.04
patient.lymphovascular_invasion_present 0.82 0.20 0.19 0.81 0.06 0.31 0.17 0.33 0.04 0.62 0.76 0.94
patient.margin_status 0.02 0.47 0.46 0.04 0.38 0.18 0.00 0.05 0.06 0.22 0.20 0.17
patient.neoplasm_histologic_grade 0.04 0.29 0.25 0.06 0.02 0.53 0.00 0.01 0.10 0.81 0.03 0.34
patient.new_tumor_events.new_tumor_event_after_initial_treatment 0.00 0.00 0.00 0.00 0.01 0.34 0.06 0.23 0.00 0.42 0.07 0.01
patient.perineural_invasion_present 0.19 0.05 0.04 0.14 0.09 0.02 0.20 0.07 0.03 0.21 0.96 0.88
patient.postoperative_rx_tx 0.02 0.00 0.00 0.00 0.00 0.73 0.08 0.13 0.00 0.24 0.03 0.05
patient.primary_lymph_node_presentation_assessment 0.93 0.92 0.89 1.00 0.84 0.03 0.82 0.92 0.52 0.01 0.27 0.57
patient.primary_therapy_outcome_success 0.01 0.00 0.00 0.00 0.12 0.68 0.05 0.25 0.00 0.42 0.28 0.02
patient.radiation_therapy 0.01 0.00 0.00 0.00 0.00 0.65 0.03 0.11 0.00 0.22 0.04 0.01
patient.radiations.radiation.2.anatomic_treatment_site 0.42 0.11 0.11 0.00 0.49 0.61 0.08 0.08 0.28 0.60 0.51 0.58
patient.radiations.radiation.2.measure_of_response 0.40 0.15 0.14 0.01 0.68 0.65 0.14 0.19 0.26 0.65 0.74 0.26
patient.radiations.radiation.2.radiation_treatment_ongoing 0.09 0.06 0.06 0.00 0.71 0.25 0.01 0.01 0.07 0.38 0.46 0.16
patient.radiations.radiation.2.radiation_type 0.23 0.01 0.01 0.00 0.10 0.52 0.04 0.04 0.14 0.21 0.62 0.25
patient.radiations.radiation.2.units 0.15 0.14 0.13 0.00 0.86 0.46 0.05 0.04 0.20 0.65 0.76 0.37
patient.radiations.radiation.anatomic_treatment_site 0.13 0.61 0.63 0.04 0.19 0.71 0.10 0.35 0.09 0.42 0.66 0.36
patient.radiations.radiation.measure_of_response 0.06 0.37 0.31 0.01 0.55 0.69 0.11 0.11 0.06 0.86 0.83 0.02
patient.radiations.radiation.radiation_treatment_ongoing 0.01 0.82 0.96 0.00 0.05 0.64 0.01 0.02 0.01 0.28 0.30 0.02
patient.radiations.radiation.radiation_type 0.01 0.01 0.01 0.00 0.01 0.29 0.15 0.23 0.07 0.45 0.45 0.05
patient.radiations.radiation.regimen_indication 0.81 0.01 0.01 0.32 0.02 0.25 0.93 0.33 0.47 0.41 0.71 0.71
patient.radiations.radiation.units 0.04 0.25 0.22 0.02 0.11 0.69 0.05 0.28 0.05 0.62 0.38 0.14
patient.stage_event.clinical_stage 0.82 0.07 0.08 0.02 0.01 0.80 0.18 0.03 0.31 0.40 0.14 0.70
patient.stage_event.pathologic_stage 0.01 0.27 0.27 0.24 0.07 0.48 0.00 0.34 0.54 0.08 0.11 0.16
patient.stage_event.tnm_categories.pathologic_categories.pathologic_m 0.36 0.00 0.00 0.00 0.07 0.83 0.14 0.05 0.04 0.06 0.22 0.22
patient.stage_event.tnm_categories.pathologic_categories.pathologic_n 0.00 0.16 0.12 0.24 0.13 0.02 0.01 0.23 0.11 0.09 0.33 0.23
patient.tissue_prospective_collection_indicator 0.03 0.37 0.31 0.29 0.68 0.29 0.12 0.66 0.03 0.80 0.66 0.50
patient.tissue_retrospective_collection_indicator 0.03 0.37 0.31 0.29 0.68 0.29 0.12 0.66 0.03 0.80 0.66 0.50
patient.tissue_source_site 0.49 0.00 0.00 0.03 0.02 0.97 0.11 0.48 0.06 0.88 0.19 0.17
patient.vital_status 0.01 0.34 0.29 0.00 1.00 0.23 0.02 0.14 0.02 0.56 0.77 0.14
patient.hpv_test_results.hpv_test_result.hpv_call_1 0.67 0.22 0.24 0.35 0.12 0.10 0.50 0.86 0.84 0.03 0.06 0.08
patient.bcr_canonical_check.bcr_patient_canonical_reasons.bcr_canonical_reason 0.04 0.79 0.67 0.16 1.00 0.75 0.46 0.46 0.00 0.27 0.74 0.53
patient.bcr_canonical_check.bcr_patient_canonical_reasons.bcr_canonical_reason.2 0.01 0.27 0.19 0.04 0.94 0.99 0.38 0.49 0.00 0.35 0.84 0.28
patient.bcr_canonical_check.bcr_patient_canonical_status 0.05 0.54 0.43 0.12 0.91 0.48 0.53 0.55 0.02 0.05 0.64 0.40
patient.biospecimen_cqcf.consent_or_death_status 0.05 0.62 0.58 0.01 0.56 0.55 0.02 0.08 0.08 0.66 0.66 0.89
patient.biospecimen_cqcf.digital_image_submitted 0.02 0.24 0.16 0.09 0.62 0.72 0.44 0.68 0.01 0.58 0.71 0.09
patient.biospecimen_cqcf.ethnicity 0.00 0.00 0.00 0.00 0.06 0.29 0.05 0.09 0.01 0.66 0.34 0.01
patient.biospecimen_cqcf.frozen_specimen_anatomic_site 0.11 0.24 0.28 0.03 0.23 0.48 0.00 0.07 0.64 0.47 0.00 0.54
patient.biospecimen_cqcf.histological_type 0.01 0.35 0.29 0.04 0.63 0.20 0.00 0.14 0.02 0.72 0.78 0.06
patient.biospecimen_cqcf.normal_controls.normal_control.method_of_normal_sample_procurement 0.00 0.00 0.00 0.00 0.00 0.48 0.10 0.16 0.00 0.07 0.01 0.00
patient.biospecimen_cqcf.normal_controls.normal_control.normal_tissue.normal_tissue_anatomic_site 0.05 0.78 0.71 0.11 1.00 0.01 0.01 0.04 0.00 0.04 0.14 0.31
patient.biospecimen_cqcf.race 0.00 0.00 0.00 0.00 0.11 0.28 0.04 0.11 0.01 0.32 0.31 0.04
patient.biospecimen_cqcf.site_of_disease_description 0.02 0.01 0.01 0.01 0.05 0.41 0.00 0.07 0.43 0.54 0.00 0.53
patient.biospecimen_cqcf.submitted_for_lce 0.00 0.00 0.00 0.00 0.00 0.52 0.05 0.10 0.00 0.22 0.07 0.00
patient.biospecimen_cqcf.top_slide_submitted 0.00 0.07 0.03 0.11 0.20 0.82 0.95 0.43 0.02 0.76 0.25 0.01
patient.samples.sample.2.oct_embedded 0.00 0.00 0.00 0.00 0.00 0.41 0.03 0.19 0.00 0.18 0.06 0.00
patient.samples.sample.2.portions.portion.analytes.analyte.2.aliquots.aliquot.is_derived_from_ffpe 0.63 0.03 0.03 0.72 0.02 0.97 0.29 0.50 0.24 0.70 0.04 0.64
patient.samples.sample.2.portions.portion.analytes.analyte.2.aliquots.aliquot.plate_id 0.10 0.00 0.00 0.00 0.12 0.57 0.09 0.10 0.01 0.87 0.57 0.28
patient.samples.sample.2.portions.portion.analytes.analyte.2.dna.pcr_amplification_successful 0.00 0.00 0.00 0.00 0.00 0.40 0.02 0.05 0.00 0.09 0.02 0.00
patient.samples.sample.2.portions.portion.analytes.analyte.2.gel_image_file 0.63 0.03 0.03 0.72 0.02 0.97 0.29 0.50 0.24 0.70 0.04 0.64
patient.samples.sample.2.portions.portion.analytes.analyte.2.is_derived_from_ffpe 0.63 0.03 0.03 0.72 0.02 0.97 0.29 0.50 0.24 0.70 0.04 0.64
patient.samples.sample.2.portions.portion.analytes.analyte.2.protocols.protocol.experimental_protocol_type 0.72 0.03 0.03 0.30 0.05 0.85 0.63 0.32 0.27 0.43 0.16 0.90
patient.samples.sample.2.portions.portion.analytes.analyte.2.spectrophotometer_method 0.00 0.00 0.00 0.00 0.00 0.56 0.00 0.01 0.00 0.07 0.03 0.00
patient.samples.sample.2.portions.portion.analytes.analyte.aliquots.aliquot.2.plate_id 0.09 0.00 0.00 0.00 0.06 0.40 0.07 0.07 0.00 0.77 0.49 0.17
patient.samples.sample.2.portions.portion.analytes.analyte.aliquots.aliquot.3.is_derived_from_ffpe 0.00 0.00 0.00 0.00 0.04 0.03 0.01 0.01 0.01 0.91 0.83 0.01
patient.samples.sample.2.portions.portion.analytes.analyte.aliquots.aliquot.3.plate_id 0.02 0.18 0.11 0.00 0.70 0.20 0.03 0.02 0.09 0.86 0.82 0.13
patient.samples.sample.2.portions.portion.analytes.analyte.aliquots.aliquot.3.plate_row 0.00 0.01 0.01 0.00 0.10 0.22 0.03 0.01 0.11 0.47 0.83 0.26
patient.samples.sample.2.portions.portion.analytes.analyte.aliquots.aliquot.plate_id 0.09 0.00 0.00 0.00 0.06 0.40 0.07 0.07 0.00 0.77 0.49 0.17
patient.samples.sample.2.portions.portion.analytes.analyte.dna.pcr_amplification_successful 0.00 0.00 0.00 0.00 0.00 0.19 0.01 0.08 0.00 0.12 0.02 0.00
patient.samples.sample.2.portions.portion.analytes.analyte.protocols.protocol.experimental_protocol_type 0.00 0.00 0.00 0.00 0.08 0.27 0.02 0.20 0.00 0.33 0.39 0.01
patient.samples.sample.2.portions.portion.analytes.analyte.spectrophotometer_method 0.06 0.01 0.01 0.21 0.02 0.04 0.82 0.93 0.46 0.88 0.23 0.19
patient.samples.sample.3.bcr_sample_barcode 0.00 0.49 0.42 0.28 0.64 0.00 0.33 0.32 0.01 0.03 0.36 0.22
patient.samples.sample.3.bcr_sample_uuid 0.00 0.49 0.42 0.28 0.64 0.00 0.33 0.32 0.01 0.03 0.36 0.22
patient.samples.sample.3.is_ffpe 0.04 0.50 0.39 0.09 0.92 0.49 0.40 0.39 0.01 0.08 0.95 0.29
patient.samples.sample.3.portions.portion.analytes.analyte.2.aliquots.aliquot.2.bcr_aliquot_barcode 0.00 0.41 0.34 0.10 0.49 0.00 0.15 0.08 0.00 0.00 0.08 0.03
patient.samples.sample.3.portions.portion.analytes.analyte.2.aliquots.aliquot.2.bcr_aliquot_uuid 0.00 0.41 0.34 0.10 0.49 0.00 0.15 0.08 0.00 0.00 0.08 0.03
patient.samples.sample.3.portions.portion.analytes.analyte.2.aliquots.aliquot.2.is_derived_from_ffpe 0.00 0.11 0.07 0.01 0.72 0.82 0.10 0.12 0.00 0.21 0.74 0.10
patient.samples.sample.3.portions.portion.analytes.analyte.2.aliquots.aliquot.2.plate_row 0.01 0.27 0.21 0.18 0.28 0.02 0.29 0.17 0.00 0.01 0.18 0.08
patient.samples.sample.3.portions.portion.analytes.analyte.2.aliquots.aliquot.bcr_aliquot_barcode 0.00 0.67 0.61 0.24 0.78 0.00 0.26 0.26 0.00 0.01 0.30 0.15
patient.samples.sample.3.portions.portion.analytes.analyte.2.aliquots.aliquot.bcr_aliquot_uuid 0.00 0.67 0.61 0.24 0.78 0.00 0.26 0.26 0.00 0.01 0.30 0.15
patient.samples.sample.3.portions.portion.analytes.analyte.2.aliquots.aliquot.is_derived_from_ffpe 0.02 0.23 0.17 0.04 0.79 0.72 0.29 0.33 0.00 0.10 0.81 0.21
patient.samples.sample.3.portions.portion.analytes.analyte.2.aliquots.aliquot.plate_id 0.17 0.79 0.75 0.22 0.99 0.61 0.49 0.77 0.01 0.73 0.97 0.89
patient.samples.sample.3.portions.portion.analytes.analyte.2.aliquots.aliquot.plate_row 0.08 0.51 0.44 0.50 0.40 0.13 0.26 0.33 0.00 0.05 0.26 0.17
patient.samples.sample.3.portions.portion.analytes.analyte.2.analyte_type 0.00 0.28 0.20 0.03 0.94 0.63 0.23 0.27 0.00 0.27 0.95 0.26
patient.samples.sample.3.portions.portion.analytes.analyte.2.analyte_type_id 0.00 0.28 0.20 0.03 0.94 0.63 0.23 0.27 0.00 0.27 0.95 0.26
patient.samples.sample.3.portions.portion.analytes.analyte.2.bcr_analyte_barcode 0.00 0.67 0.61 0.24 0.78 0.00 0.26 0.26 0.00 0.01 0.30 0.15
patient.samples.sample.3.portions.portion.analytes.analyte.2.bcr_analyte_uuid 0.00 0.67 0.61 0.24 0.78 0.00 0.26 0.26 0.00 0.01 0.30 0.15
patient.samples.sample.3.portions.portion.analytes.analyte.2.gel_image_file 0.02 0.23 0.17 0.04 0.79 0.72 0.29 0.33 0.00 0.10 0.81 0.21
patient.samples.sample.3.portions.portion.analytes.analyte.2.is_derived_from_ffpe 0.02 0.23 0.17 0.04 0.79 0.72 0.29 0.33 0.00 0.10 0.81 0.21
patient.samples.sample.3.portions.portion.analytes.analyte.2.protocols.protocol.experimental_protocol_type 0.00 0.28 0.20 0.03 0.94 0.63 0.23 0.27 0.00 0.27 0.95 0.26
patient.samples.sample.3.portions.portion.analytes.analyte.2.spectrophotometer_method 0.01 0.38 0.27 0.05 0.97 0.96 0.38 0.50 0.00 0.35 0.94 0.32
patient.samples.sample.3.portions.portion.analytes.analyte.3.aliquots.aliquot.bcr_aliquot_barcode 0.00 0.41 0.34 0.10 0.49 0.00 0.15 0.08 0.00 0.00 0.08 0.03
patient.samples.sample.3.portions.portion.analytes.analyte.3.aliquots.aliquot.bcr_aliquot_uuid 0.00 0.41 0.34 0.10 0.49 0.00 0.15 0.08 0.00 0.00 0.08 0.03
patient.samples.sample.3.portions.portion.analytes.analyte.3.aliquots.aliquot.is_derived_from_ffpe 0.00 0.11 0.07 0.01 0.72 0.82 0.10 0.12 0.00 0.21 0.74 0.10
patient.samples.sample.3.portions.portion.analytes.analyte.3.aliquots.aliquot.plate_id 0.03 0.63 0.55 0.06 1.00 0.28 0.16 0.44 0.00 0.27 0.85 0.15
patient.samples.sample.3.portions.portion.analytes.analyte.3.aliquots.aliquot.plate_row 0.00 0.24 0.20 0.03 0.29 0.00 0.06 0.05 0.00 0.00 0.02 0.36
patient.samples.sample.3.portions.portion.analytes.analyte.3.analyte_type 0.00 0.11 0.07 0.01 0.72 0.82 0.10 0.12 0.00 0.21 0.74 0.10
patient.samples.sample.3.portions.portion.analytes.analyte.3.analyte_type_id 0.00 0.11 0.07 0.01 0.72 0.82 0.10 0.12 0.00 0.21 0.74 0.10
patient.samples.sample.3.portions.portion.analytes.analyte.3.bcr_analyte_barcode 0.00 0.41 0.34 0.10 0.49 0.00 0.15 0.08 0.00 0.00 0.08 0.03
patient.samples.sample.3.portions.portion.analytes.analyte.3.bcr_analyte_uuid 0.00 0.41 0.34 0.10 0.49 0.00 0.15 0.08 0.00 0.00 0.08 0.03
patient.samples.sample.3.portions.portion.analytes.analyte.3.dna.normal_tumor_genotype_match 0.00 0.11 0.07 0.01 0.72 0.82 0.10 0.12 0.00 0.21 0.74 0.10
patient.samples.sample.3.portions.portion.analytes.analyte.3.dna.pcr_amplification_successful 0.00 0.11 0.07 0.01 0.72 0.82 0.10 0.12 0.00 0.21 0.74 0.10
patient.samples.sample.3.portions.portion.analytes.analyte.3.gel_image_file 0.00 0.11 0.07 0.01 0.72 0.82 0.10 0.12 0.00 0.21 0.74 0.10
patient.samples.sample.3.portions.portion.analytes.analyte.3.is_derived_from_ffpe 0.00 0.11 0.07 0.01 0.72 0.82 0.10 0.12 0.00 0.21 0.74 0.10
patient.samples.sample.3.portions.portion.analytes.analyte.3.protocols.protocol.experimental_protocol_type 0.00 0.11 0.07 0.01 0.72 0.82 0.10 0.12 0.00 0.21 0.74 0.10
patient.samples.sample.3.portions.portion.analytes.analyte.3.spectrophotometer_method 0.00 0.11 0.07 0.01 0.72 0.82 0.10 0.12 0.00 0.21 0.74 0.10
patient.samples.sample.3.portions.portion.analytes.analyte.aliquots.aliquot.2.bcr_aliquot_barcode 0.00 0.49 0.42 0.28 0.64 0.00 0.33 0.32 0.01 0.03 0.36 0.22
patient.samples.sample.3.portions.portion.analytes.analyte.aliquots.aliquot.2.bcr_aliquot_uuid 0.00 0.49 0.42 0.28 0.64 0.00 0.33 0.32 0.01 0.03 0.36 0.22
patient.samples.sample.3.portions.portion.analytes.analyte.aliquots.aliquot.2.is_derived_from_ffpe 0.04 0.50 0.39 0.09 0.92 0.49 0.40 0.39 0.01 0.08 0.95 0.29
patient.samples.sample.3.portions.portion.analytes.analyte.aliquots.aliquot.2.plate_id 0.15 0.37 0.31 0.11 0.75 0.31 0.50 0.60 0.02 0.77 0.99 0.82
patient.samples.sample.3.portions.portion.analytes.analyte.aliquots.aliquot.2.plate_row 0.13 0.71 0.67 0.51 0.72 0.09 0.31 0.27 0.02 0.05 0.42 0.58
patient.samples.sample.3.portions.portion.analytes.analyte.aliquots.aliquot.3.bcr_aliquot_barcode 0.00 0.51 0.44 0.16 0.64 0.00 0.31 0.22 0.01 0.00 0.15 0.08
patient.samples.sample.3.portions.portion.analytes.analyte.aliquots.aliquot.3.bcr_aliquot_uuid 0.00 0.51 0.44 0.16 0.64 0.00 0.31 0.22 0.01 0.00 0.15 0.08
patient.samples.sample.3.portions.portion.analytes.analyte.aliquots.aliquot.3.is_derived_from_ffpe 0.01 0.17 0.11 0.02 0.81 0.71 0.40 0.47 0.00 0.17 0.59 0.17
patient.samples.sample.3.portions.portion.analytes.analyte.aliquots.aliquot.3.plate_id 0.02 0.35 0.28 0.02 0.96 0.29 0.48 0.38 0.03 0.31 0.93 0.44
patient.samples.sample.3.portions.portion.analytes.analyte.aliquots.aliquot.3.plate_row 0.01 0.39 0.32 0.08 0.40 0.05 0.06 0.09 0.01 0.04 0.16 0.35
patient.samples.sample.3.portions.portion.analytes.analyte.aliquots.aliquot.bcr_aliquot_barcode 0.00 0.49 0.42 0.28 0.64 0.00 0.33 0.32 0.01 0.03 0.36 0.22
patient.samples.sample.3.portions.portion.analytes.analyte.aliquots.aliquot.bcr_aliquot_uuid 0.00 0.49 0.42 0.28 0.64 0.00 0.33 0.32 0.01 0.03 0.36 0.22
patient.samples.sample.3.portions.portion.analytes.analyte.aliquots.aliquot.is_derived_from_ffpe 0.04 0.50 0.39 0.09 0.92 0.49 0.40 0.39 0.01 0.08 0.95 0.29
patient.samples.sample.3.portions.portion.analytes.analyte.aliquots.aliquot.plate_id 0.15 0.37 0.31 0.11 0.75 0.31 0.50 0.60 0.02 0.77 0.99 0.82
patient.samples.sample.3.portions.portion.analytes.analyte.aliquots.aliquot.plate_row 0.13 0.71 0.67 0.51 0.72 0.09 0.31 0.27 0.02 0.05 0.42 0.58
patient.samples.sample.3.portions.portion.analytes.analyte.analyte_type 0.05 0.19 0.17 0.09 0.53 0.55 0.50 0.62 0.01 0.22 0.66 0.43
patient.samples.sample.3.portions.portion.analytes.analyte.analyte_type_id 0.05 0.19 0.17 0.09 0.53 0.55 0.50 0.62 0.01 0.22 0.66 0.43
patient.samples.sample.3.portions.portion.analytes.analyte.bcr_analyte_barcode 0.00 0.49 0.42 0.28 0.64 0.00 0.33 0.32 0.01 0.03 0.36 0.22
patient.samples.sample.3.portions.portion.analytes.analyte.bcr_analyte_uuid 0.00 0.49 0.42 0.28 0.64 0.00 0.33 0.32 0.01 0.03 0.36 0.22
patient.samples.sample.3.portions.portion.analytes.analyte.dna.normal_tumor_genotype_match 0.02 0.23 0.17 0.04 0.79 0.72 0.29 0.33 0.00 0.10 0.81 0.21
patient.samples.sample.3.portions.portion.analytes.analyte.dna.pcr_amplification_successful 0.01 0.37 0.25 0.04 0.96 0.66 0.29 0.51 0.00 0.26 0.93 0.31
patient.samples.sample.3.portions.portion.analytes.analyte.gel_image_file 0.04 0.50 0.39 0.09 0.92 0.49 0.40 0.39 0.01 0.08 0.95 0.29
patient.samples.sample.3.portions.portion.analytes.analyte.is_derived_from_ffpe 0.04 0.50 0.39 0.09 0.92 0.49 0.40 0.39 0.01 0.08 0.95 0.29
patient.samples.sample.3.portions.portion.analytes.analyte.protocols.protocol.experimental_protocol_type 0.06 0.22 0.21 0.05 0.69 0.70 0.37 0.40 0.02 0.39 0.84 0.52
patient.samples.sample.3.portions.portion.analytes.analyte.spectrophotometer_method 0.09 0.40 0.36 0.20 0.62 0.72 0.62 0.55 0.01 0.18 0.89 0.44
patient.samples.sample.3.portions.portion.bcr_portion_barcode 0.00 0.49 0.42 0.28 0.64 0.00 0.33 0.32 0.01 0.03 0.36 0.22
patient.samples.sample.3.portions.portion.bcr_portion_uuid 0.00 0.49 0.42 0.28 0.64 0.00 0.33 0.32 0.01 0.03 0.36 0.22
patient.samples.sample.3.portions.portion.is_ffpe 0.04 0.50 0.39 0.09 0.92 0.49 0.40 0.39 0.01 0.08 0.95 0.29
patient.samples.sample.3.portions.portion.slides.slide.bcr_slide_barcode 0.00 0.37 0.29 0.22 0.49 0.00 0.28 0.26 0.00 0.01 0.19 0.13
patient.samples.sample.3.portions.portion.slides.slide.bcr_slide_uuid 0.00 0.37 0.29 0.22 0.49 0.00 0.28 0.26 0.00 0.01 0.19 0.13
patient.samples.sample.3.portions.portion.slides.slide.image_file_name 0.00 0.37 0.29 0.22 0.49 0.00 0.28 0.26 0.00 0.01 0.19 0.13
patient.samples.sample.3.portions.portion.slides.slide.is_derived_from_ffpe 0.01 0.30 0.21 0.02 0.97 0.79 0.15 0.19 0.00 0.15 1.00 0.16
patient.samples.sample.3.portions.portion.slides.slide.section_location 0.01 0.30 0.21 0.02 0.97 0.79 0.15 0.19 0.00 0.15 1.00 0.16
patient.samples.sample.3.sample_type 0.03 0.67 0.50 0.09 0.99 0.60 0.40 0.58 0.01 0.22 0.97 0.41
patient.samples.sample.3.vial_number 0.06 0.51 0.48 0.07 0.93 0.73 0.32 0.27 0.05 0.22 1.00 0.45
patient.samples.sample.oct_embedded 0.00 0.00 0.00 0.00 0.00 0.17 0.01 0.03 0.00 0.28 0.06 0.00
patient.samples.sample.portions.portion.analytes.analyte.2.aliquots.aliquot.2.plate_id 0.03 0.00 0.00 0.00 0.05 0.29 0.03 0.02 0.00 0.64 0.39 0.04
patient.samples.sample.portions.portion.analytes.analyte.2.aliquots.aliquot.2.plate_row 0.05 0.97 0.95 0.33 0.84 0.47 0.05 0.20 0.13 0.41 0.32 0.10
patient.samples.sample.portions.portion.analytes.analyte.2.aliquots.aliquot.plate_id 0.03 0.00 0.00 0.00 0.05 0.29 0.03 0.02 0.00 0.64 0.39 0.04
patient.samples.sample.portions.portion.analytes.analyte.2.aliquots.aliquot.plate_row 0.03 0.99 0.98 0.48 0.88 0.49 0.05 0.32 0.19 0.35 0.30 0.13
patient.samples.sample.portions.portion.analytes.analyte.3.aliquots.aliquot.plate_id 0.04 0.00 0.00 0.00 0.07 0.35 0.04 0.03 0.00 0.71 0.47 0.06
patient.samples.sample.portions.portion.analytes.analyte.3.aliquots.aliquot.plate_row 0.23 1.00 0.98 0.83 0.93 0.72 0.93 0.85 0.02 0.70 0.78 0.05
patient.samples.sample.portions.portion.analytes.analyte.3.dna.pcr_amplification_successful 0.00 0.00 0.00 0.00 0.00 0.19 0.01 0.02 0.00 0.04 0.01 0.00
patient.samples.sample.portions.portion.analytes.analyte.3.spectrophotometer_method 0.00 0.00 0.00 0.00 0.00 0.40 0.00 0.00 0.00 0.11 0.02 0.00
patient.samples.sample.portions.portion.analytes.analyte.aliquots.aliquot.2.plate_id 0.03 0.00 0.00 0.00 0.05 0.29 0.03 0.02 0.00 0.64 0.39 0.04
patient.samples.sample.portions.portion.analytes.analyte.aliquots.aliquot.3.plate_id 0.03 0.00 0.00 0.00 0.05 0.29 0.03 0.02 0.00 0.64 0.39 0.04
patient.samples.sample.portions.portion.analytes.analyte.aliquots.aliquot.4.is_derived_from_ffpe 0.00 0.00 0.00 0.00 0.03 0.02 0.01 0.01 0.00 0.98 0.95 0.00
patient.samples.sample.portions.portion.analytes.analyte.aliquots.aliquot.4.plate_id 0.01 0.09 0.05 0.00 0.62 0.15 0.02 0.00 0.01 0.86 0.82 0.05
patient.samples.sample.portions.portion.analytes.analyte.aliquots.aliquot.4.plate_row 0.00 0.01 0.00 0.00 0.13 0.20 0.06 0.01 0.02 0.30 0.76 0.12
patient.samples.sample.portions.portion.analytes.analyte.aliquots.aliquot.plate_id 0.03 0.00 0.00 0.00 0.05 0.29 0.03 0.02 0.00 0.64 0.39 0.04
patient.samples.sample.portions.portion.analytes.analyte.dna.pcr_amplification_successful 0.00 0.00 0.00 0.00 0.00 0.19 0.01 0.08 0.00 0.12 0.02 0.00
patient.samples.sample.portions.portion.analytes.analyte.spectrophotometer_method 0.02 0.01 0.01 0.03 0.05 0.01 0.24 0.26 0.32 0.75 0.56 0.18
patient.samples.sample.portions.portion.slides.slide.2.is_derived_from_ffpe 0.02 0.00 0.00 0.00 0.09 0.39 0.08 0.19 0.06 0.12 0.08 0.04
patient.samples.sample.portions.portion.slides.slide.2.section_location 0.07 0.01 0.01 0.00 0.22 0.56 0.15 0.24 0.18 0.14 0.19 0.12
patient.samples.sample.portions.portion.slides.slide.section_location 0.03 0.00 0.00 0.00 0.13 0.57 0.05 0.11 0.09 0.06 0.07 0.06
patient.samples.sample.portions.shipment_portion.is_ffpe 0.16 0.69 0.64 0.03 0.54 0.29 0.04 0.20 0.73 0.84 0.58 0.24
patient.samples.sample.portions.shipment_portion.plate_id 0.00 0.01 0.00 0.00 0.20 0.28 0.05 0.06 0.00 0.08 0.34 0.05
# Calculate f-statistics for p-values < 0.05
aov_factorAttr_fstat_2 <- as.data.frame(matrix(nrow = ncol(new_factorTb),
                                          ncol = ncol(sampleScore_sub)))

rownames(aov_factorAttr_fstat_2) <- colnames(new_factorTb)
colnames(aov_factorAttr_fstat_2) <- colnames(sampleScore_sub)

for (i in seq_len(ncol(sampleScore_sub))) {
  
  for (j in seq_len(ncol(new_factorTb))) {
    
    if (!is.null(summary(aov(sampleScore_sub[, i] ~ new_factorTb[, j]))[[1]]$`Pr(>F)`[1])) {
      
      if (!is.null(summary(aov(sampleScore_sub[, i] ~ 
                               new_factorTb[, j]))[[1]]$`F value`[1]) & 
          
          (summary(aov(sampleScore_sub[, i] ~ 
                       new_factorTb[, j]))[[1]]$`Pr(>F)`[1] < 0.05)) {
        
            aov_factorAttr_fstat_2[j, i] <- summary(aov(sampleScore_sub[, i] ~ 
                                                          new_factorTb[, j]))[[1]]$`F value`[1]
      } else {
        next
      }
    } else {
      next
    }
  }
}
batch_ind <- grep("analyte|portion|procurement|aliquot|uuid|barcode", 
                  rownames(aov_factorAttr_fstat_2))
aov_factorAttr_fstat_2_no_batch <- aov_factorAttr_fstat_2[-batch_ind,]

fstat_ind <- c()

for (i in seq_len(nrow(aov_factorAttr_fstat_2_no_batch))) {
  if (sum(is.na(aov_factorAttr_fstat_2_no_batch[i,])) < 11) {
    fstat_ind <- c(fstat_ind, i)
  } else {
    next
  }
}

target_aov_2 <- aov_factorAttr_fstat_2_no_batch[fstat_ind,]

heatmapTable

options(ztable.type="html")
ztable(target_aov_2) %>%
  makeHeatmap(palette = 'Blues') %>%
  print(caption="ANOVA f-stats")
ANOVA f-stats
  RAV4483 RAV2670 RAV1301 RAV988 RAV987 RAV1002 RAV1125 RAV996 RAV998 RAV999 RAV1001 RAV4113
pathologic_stage 3.07 3.93
pathology_N_stage 4.25 2.34 2.80
pathology_M_stage 6.36 6.41 7.98 3.10 3.43
gender 6.03 6.13 4.34 10.60
radiation_therapy 6.36 4.24 4.59 3.23
histological_type 6.48 4.15 8.59 5.46
patient.alcohol_history_documented 3.44 4.06
patient.anatomic_neoplasm_subdivision 2.15 3.31 2.86
patient.clinical_cqcf.consent_or_death_status 8.19 5.78
patient.clinical_cqcf.frozen_specimen_anatomic_site 2.15 3.31 2.86
patient.clinical_cqcf.histological_type 6.48 4.15 8.59 5.46
patient.drugs.drug.measure_of_response 4.59 8.42 4.39
patient.drugs.drug.prescribed_dose_units 2.48 2.63 2.58
patient.drugs.drug.tx_on_clinical_trial 4.47 11.28 4.33 4.41
patient.follow_ups.follow_up.disease_after_curative_tx 8.59 6.69 4.83
patient.follow_ups.follow_up.followup_case_report_form_submission_reason 3.26 3.31 3.58
patient.follow_ups.follow_up.lost_follow_up 6.19 6.48 8.15 5.09
patient.follow_ups.follow_up.method_of_curative_tx 3.45 3.83 3.02
patient.follow_ups.follow_up.new_tumor_event_after_initial_treatment 6.33 6.79 4.08 4.27
patient.follow_ups.follow_up.new_tumor_events.new_tumor_event.new_neoplasm_event_type 3.67 4.01
patient.follow_ups.follow_up.new_tumor_events.new_tumor_event_after_initial_treatment 5.87 9.61 10.39 6.17 5.48 4.06 4.39 3.13 3.58
patient.follow_ups.follow_up.radiation_therapy 3.65 3.21 5.72 3.17
patient.gender 6.03 6.13 4.34 10.60
patient.histological_type 6.48 4.15 8.59 5.46
patient.hpv_status_by_p16_testing 3.88 3.22
patient.icd_10 2.48 3.58 2.47 2.78
patient.icd_o_3_histology 3.55 3.34 3.45 2.94 2.90
patient.icd_o_3_site 2.48 3.58 2.47 2.78
patient.laterality 3.34 3.07 2.81
patient.margin_status 3.33 2.89 5.50
patient.neoplasm_histologic_grade 2.57 2.99 4.74 3.97 2.76
patient.new_tumor_events.new_tumor_event_after_initial_treatment 7.80 12.33 13.57 10.25 5.19 8.58 4.64
patient.perineural_invasion_present 3.38 3.87 3.76
patient.postoperative_rx_tx 3.93 13.71 14.49 11.63 7.75 7.73 3.72 3.12
patient.primary_lymph_node_presentation_assessment 3.76 4.70
patient.primary_therapy_outcome_success 4.84 6.25 6.70 7.61 6.86 3.84
patient.radiation_therapy 5.20 12.81 13.65 12.31 5.83 3.71 7.90 3.29 5.00
patient.radiations.radiation.2.radiation_treatment_ongoing 17.26 6.35 6.65
patient.radiations.radiation.2.radiation_type 4.70 4.81 9.43 3.27 3.46
patient.radiations.radiation.2.units 9.00 3.20 3.33
patient.radiations.radiation.measure_of_response 3.97 3.01
patient.radiations.radiation.radiation_treatment_ongoing 7.69 13.10 4.00 8.05 5.40 6.50 5.25
patient.radiations.radiation.radiation_type 4.39 5.23 5.51 6.47 4.59
patient.radiations.radiation.regimen_indication 3.31 3.44 3.25
patient.radiations.radiation.units 3.37 4.12 3.20 3.16
patient.stage_event.clinical_stage 2.74 3.13 2.61
patient.stage_event.pathologic_stage 3.07 3.93
patient.stage_event.tnm_categories.pathologic_categories.pathologic_m 6.36 6.41 7.98 3.10 3.43
patient.stage_event.tnm_categories.pathologic_categories.pathologic_n 4.25 2.34 2.80
patient.tissue_prospective_collection_indicator 3.75 3.75
patient.tissue_retrospective_collection_indicator 3.75 3.75
patient.tissue_source_site 2.43 2.57 1.85 2.00
patient.vital_status 8.00 8.73 5.38 5.29
patient.bcr_canonical_check.bcr_patient_canonical_reasons.bcr_canonical_reason 2.97 4.73
patient.bcr_canonical_check.bcr_patient_canonical_reasons.bcr_canonical_reason.2 5.58 3.47 7.58
patient.bcr_canonical_check.bcr_patient_canonical_status 3.98 5.32 3.96
patient.biospecimen_cqcf.consent_or_death_status 8.19 5.78
patient.biospecimen_cqcf.digital_image_submitted 6.04 8.05
patient.biospecimen_cqcf.ethnicity 6.50 7.69 8.49 11.33 5.58 5.18
patient.biospecimen_cqcf.frozen_specimen_anatomic_site 2.15 3.31 2.86
patient.biospecimen_cqcf.histological_type 6.48 4.15 8.59 5.46
patient.biospecimen_cqcf.normal_controls.normal_control.normal_tissue.normal_tissue_anatomic_site 2.75 3.77 3.81 2.96 4.60 2.91
patient.biospecimen_cqcf.race 5.99 7.63 8.54 10.78 3.27 5.07 3.24
patient.biospecimen_cqcf.site_of_disease_description 2.19 2.37 2.34 2.68 2.99 3.21
patient.biospecimen_cqcf.submitted_for_lce 9.51 15.23 17.10 13.81 6.47 11.50 7.88
patient.biospecimen_cqcf.top_slide_submitted 9.02 4.64 5.71 6.72
patient.samples.sample.2.oct_embedded 9.12 15.30 16.74 12.74 6.69 3.81 11.10 6.09
patient.samples.sample.3.is_ffpe 4.42 6.36
patient.samples.sample.3.sample_type 3.67 4.68
patient.samples.sample.oct_embedded 9.19 15.58 16.99 14.50 6.38 4.80 3.54 13.63 6.03
heatmap(as.matrix(aov_factorAttr_fstat))

aov_fvalue <- read.csv("aov_fvalue.csv", row.names = 1)
aov_pvalue <- read.csv("aov_pvalue.csv", row.names = 1)

batch_ind <- grep("analyte|portion|procurement|aliquot|uuid|barcode", 
                  rownames(aov_fvalue))

aov_pvalue_no_batch <- aov_pvalue[-batch_ind,]

aov_fvalue_no_batch <- aov_fvalue[-batch_ind,]
ind <- which(apply(aov_pvalue_no_batch, 1, min) <= 0.01)
aov_fvalue_sub <- aov_fvalue_no_batch[ind,] %>% as.data.frame
rownames(aov_fvalue_sub) <- gsub("patient", "", rownames(aov_fvalue_sub))
fvalue1 <- aov_fvalue_sub[1:26,]
fvalue2 <- aov_fvalue_sub[27:54,]
heatmap(as.matrix(fvalue1))

heatmap(as.matrix(fvalue2))

heatmapTable

options(ztable.type="html")
ztable(fvalue1) %>%
  makeHeatmap(palette = 'Blues') %>%
  print(caption="ANOVA f-stats 1")
ANOVA f-stats 1
  RAV4483 RAV2670 RAV1301 RAV988 RAV987 RAV1002 RAV1125 RAV996 RAV998 RAV999 RAV1001 RAV4113
pathologic_stage 3.07 1.31 1.30 1.38 2.10 0.90 3.93 1.15 0.82 2.06 1.84 1.64
pathology_N_stage 4.25 1.53 1.65 1.32 1.60 2.34 2.80 1.34 1.69 1.80 1.16 1.36
pathology_M_stage 1.02 6.36 6.41 7.98 2.72 0.18 2.03 3.10 3.43 2.85 1.55 1.55
gender 1.57 2.23 2.22 1.58 6.03 2.18 6.13 4.34 1.30 1.35 10.60 0.05
radiation_therapy 6.36 1.71 1.80 4.24 1.64 1.31 4.59 1.76 3.23 1.84 1.85 2.11
histological_type 6.48 0.88 1.13 4.15 0.23 1.66 8.59 2.26 5.46 0.13 0.08 3.56
.anatomic_neoplasm_subdivision 1.64 1.31 1.23 2.15 1.33 0.96 3.31 1.84 0.79 0.97 2.86 0.90
.clinical_cqcf.consent_or_death_status 3.91 0.25 0.31 8.19 0.35 0.36 5.78 3.21 3.10 0.19 0.20 0.02
.clinical_cqcf.frozen_specimen_anatomic_site 1.64 1.31 1.23 2.15 1.33 0.96 3.31 1.84 0.79 0.97 2.86 0.90
.clinical_cqcf.histological_type 6.48 0.88 1.13 4.15 0.23 1.66 8.59 2.26 5.46 0.13 0.08 3.56
.clinical_cqcf.normal_tissue_anatomic_site 1.61 0.41 0.48 0.86 0.51 1.98 2.15 1.83 4.45 2.02 1.14 0.20
.drugs.drug.measure_of_response 4.59 0.45 0.68 8.42 0.21 1.38 3.12 3.09 3.28 0.00 0.73 4.39
.drugs.drug.tx_on_clinical_trial 4.47 0.58 0.82 11.28 0.29 1.36 4.33 4.41 3.38 0.01 0.66 3.54
.follow_ups.follow_up.disease_after_curative_tx 8.59 1.68 2.35 6.69 0.02 0.54 2.07 1.62 4.83 0.02 0.04 3.57
.follow_ups.follow_up.lost_follow_up 2.17 6.19 6.48 8.15 2.46 0.45 1.86 5.09 2.78 1.36 0.99 2.44
.follow_ups.follow_up.new_tumor_event_after_initial_treatment 1.09 6.33 6.79 4.08 4.27 0.53 0.34 1.62 1.63 1.85 1.59 2.80
.follow_ups.follow_up.new_tumor_events.new_tumor_event_after_initial_treatment 5.87 9.61 10.39 6.17 5.48 0.90 4.06 2.80 4.39 0.46 3.13 3.58
.follow_ups.follow_up.radiation_therapy 3.65 1.82 1.66 2.11 3.21 1.72 5.72 1.78 2.13 1.32 3.17 1.01
.gender 1.57 2.23 2.22 1.58 6.03 2.18 6.13 4.34 1.30 1.35 10.60 0.05
.histological_type 6.48 0.88 1.13 4.15 0.23 1.66 8.59 2.26 5.46 0.13 0.08 3.56
.icd_10 1.66 1.19 1.19 2.48 1.61 0.87 3.58 2.47 0.98 0.74 2.78 0.77
.icd_o_3_site 1.66 1.19 1.19 2.48 1.61 0.87 3.58 2.47 0.98 0.74 2.78 0.77
.margin_status 3.33 0.85 0.87 2.89 1.04 1.69 5.50 2.63 2.54 1.50 1.59 1.71
.neoplasm_histologic_grade 2.57 1.26 1.36 2.36 2.99 0.80 4.74 3.97 1.99 0.40 2.76 1.14
.new_tumor_events.new_tumor_event_after_initial_treatment 7.80 12.33 13.57 10.25 5.19 1.09 2.99 1.49 8.58 0.89 2.76 4.64
.postoperative_rx_tx 3.93 13.71 14.49 11.63 7.75 0.31 2.55 2.07 7.73 1.45 3.72 3.12
options(ztable.type="html")
ztable(fvalue2) %>%
  makeHeatmap(palette = 'Blues') %>%
  print(caption="ANOVA f-stats 2")
ANOVA f-stats 2
  RAV4483 RAV2670 RAV1301 RAV988 RAV987 RAV1002 RAV1125 RAV996 RAV998 RAV999 RAV1001 RAV4113
.primary_therapy_outcome_success 4.84 6.25 6.70 7.61 2.13 0.38 3.05 1.39 6.86 0.87 1.29 3.84
.radiation_therapy 5.20 12.81 13.65 12.31 5.83 0.43 3.71 2.26 7.90 1.53 3.29 5.00
.radiations.radiation.2.anatomic_treatment_site 0.96 2.09 2.08 5.85 0.81 0.61 2.35 2.35 1.29 0.63 0.78 0.66
.radiations.radiation.2.radiation_treatment_ongoing 2.85 3.49 3.61 17.26 0.14 1.31 6.35 6.65 3.24 0.77 0.56 2.00
.radiations.radiation.2.radiation_type 1.50 4.70 4.81 9.43 2.38 0.65 3.27 3.46 2.04 1.57 0.48 1.39
.radiations.radiation.2.units 1.93 1.97 2.10 9.00 0.15 0.79 3.20 3.33 1.64 0.43 0.28 1.02
.radiations.radiation.measure_of_response 2.40 1.09 1.21 3.97 0.77 0.56 1.95 1.94 2.35 0.32 0.38 3.01
.radiations.radiation.radiation_treatment_ongoing 7.69 0.05 0.00 13.10 4.00 0.22 8.05 5.40 6.50 1.20 1.08 5.25
.radiations.radiation.radiation_type 4.39 5.23 5.51 6.47 4.59 1.27 1.95 1.48 2.79 0.80 0.79 3.09
.stage_event.pathologic_stage 3.07 1.31 1.30 1.38 2.10 0.90 3.93 1.15 0.82 2.06 1.84 1.64
.stage_event.tnm_categories.pathologic_categories.pathologic_m 1.02 6.36 6.41 7.98 2.72 0.18 2.03 3.10 3.43 2.85 1.55 1.55
.stage_event.tnm_categories.pathologic_categories.pathologic_n 4.25 1.53 1.65 1.32 1.60 2.34 2.80 1.34 1.69 1.80 1.16 1.36
.tissue_source_site 0.99 2.43 2.57 1.85 2.00 0.49 1.49 1.00 1.67 0.63 1.32 1.34
.vital_status 8.00 0.93 1.12 8.73 0.00 1.49 5.38 2.19 5.29 0.35 0.09 2.25
.bcr_canonical_check.bcr__canonical_reasons.bcr_canonical_reason 2.97 0.35 0.53 1.76 0.01 0.40 0.86 0.87 4.73 1.34 0.42 0.74
.bcr_canonical_check.bcr__canonical_reasons.bcr_canonical_reason.2 5.58 1.33 1.69 3.47 0.06 0.01 0.98 0.71 7.58 1.05 0.18 1.29
.biospecimen_cqcf.consent_or_death_status 3.91 0.25 0.31 8.19 0.35 0.36 5.78 3.21 3.10 0.19 0.20 0.02
.biospecimen_cqcf.digital_image_submitted 6.04 1.38 2.03 2.88 0.25 0.13 0.61 0.17 8.05 0.31 0.14 2.89
.biospecimen_cqcf.ethnicity 6.50 7.69 8.49 11.33 2.90 1.25 3.02 2.50 5.58 0.42 1.10 5.18
.biospecimen_cqcf.frozen_specimen_anatomic_site 1.64 1.31 1.23 2.15 1.33 0.96 3.31 1.84 0.79 0.97 2.86 0.90
.biospecimen_cqcf.histological_type 6.48 0.88 1.13 4.15 0.23 1.66 8.59 2.26 5.46 0.13 0.08 3.56
.biospecimen_cqcf.normal_controls.normal_control.normal_tissue.normal_tissue_anatomic_site 2.75 0.36 0.47 2.10 0.01 3.77 3.81 2.96 4.60 2.91 1.87 1.21
.biospecimen_cqcf.race 5.99 7.63 8.54 10.78 2.28 1.30 3.27 2.31 5.07 1.15 1.19 3.24
.biospecimen_cqcf.site_of_disease_description 2.19 2.37 2.34 2.68 1.90 1.05 2.99 1.80 1.03 0.91 3.21 0.92
.biospecimen_cqcf.submitted_for_lce 9.51 15.23 17.10 13.81 6.47 0.65 3.08 2.34 11.50 1.55 2.77 7.88
.biospecimen_cqcf.top_slide_submitted 9.02 3.42 4.64 2.65 1.65 0.05 0.00 0.64 5.71 0.10 1.34 6.72
.samples.sample.2.oct_embedded 9.12 15.30 16.74 12.74 6.69 0.90 3.81 1.71 11.10 1.77 2.92 6.09
.samples.sample.oct_embedded 9.19 15.58 16.99 14.50 6.38 1.80 4.80 3.54 13.63 1.29 2.90 6.03

RAV Exploration

ind <- 1959
findStudiesInCluster(RAVmodel, ind, studyTitle = TRUE)
##   studyName PC Variance explained (%)
## 1 SRP064515  1                  21.46
## 2 SRP074274  1                  24.27
## 3 SRP145599  1                  18.84
##                                                                                                                                          title
## 1 Widespread shortening of 3’ untranslated regions and increased exon inclusion characterize the human macrophage response to infection [mRNA]
## 2                               Genetic ancestry and natural selection drive population differences in immune responses to pathogens in humans
## 3                                                                 Type I and II IFN Conditioning of Human Macrophage Gene Expression Responses
subsetEnrichedPathways(RAVmodel, ind, include_nes = TRUE) %>% as.data.frame
##                                 RAV1959.Description RAV1959.NES
## Up_1                 KANG_DOXORUBICIN_RESISTANCE_UP    2.540742
## Up_2          FLORIO_NEOCORTEX_BASAL_RADIAL_GLIA_DN    2.433971
## Up_3    ROSTY_CERVICAL_CANCER_PROLIFERATION_CLUSTER    2.396184
## Up_4                      LEE_EARLY_T_LYMPHOCYTE_UP    2.336575
## Up_5         SOTIRIOU_BREAST_CANCER_GRADE_1_VS_3_UP    2.320476
## Up_6      ZHOU_CELL_CYCLE_GENES_IN_IR_RESPONSE_24HR    2.318389
## Up_7                  CROONQUIST_IL6_DEPRIVATION_DN    2.270095
## Up_8                              KONG_E2F3_TARGETS    2.249932
## Up_9             ZHOU_INFLAMMATORY_RESPONSE_LIVE_DN    2.248880
## Up_10 GRAHAM_NORMAL_QUIESCENT_VS_NORMAL_DIVIDING_DN    2.247802
drawWordcloud(RAVmodel, ind)

ind <- 1001
findStudiesInCluster(RAVmodel, ind, studyTitle = TRUE)
##   studyName PC Variance explained (%)
## 1 SRP024274 16                   1.56
## 2 SRP067922 16                   1.63
##                                                                                              title
## 1 Smoking Dysregulates the Human Airway Basal Cell Transcriptome at COPD-linked Risk Locus 19q13.2
## 2   Role of OSGIN1 in Mediating Smoking-induced Autophagy in the Human Airway Epithelium [RNA-Seq]
subsetEnrichedPathways(RAVmodel, ind, include_nes = TRUE) %>% as.data.frame
##       RAV1001.Description RAV1001.NES
## Up_1                 <NA>          NA
## Up_2                 <NA>          NA
## Up_3                 <NA>          NA
## Up_4                 <NA>          NA
## Up_5                 <NA>          NA
## Up_6                 <NA>          NA
## Up_7                 <NA>          NA
## Up_8                 <NA>          NA
## Up_9                 <NA>          NA
## Up_10                <NA>          NA
drawWordcloud(RAVmodel, ind)
## RAV1001 can be filtered based on GSEA_C2
## Warning in wordcloud::wordcloud(words = all$word, freq = all$freq, scale =
## scale, : Chromosomes, Human, Pair 19 could not be fit on page. It will not be
## plotted.
## Warning in wordcloud::wordcloud(words = all$word, freq = all$freq, scale =
## scale, : Chronic Obstructive Pulmonary Disease could not be fit on page. It
## will not be plotted.