Get gene expression, GSVA analysis

We ahve previously computed GSVA and stored, we just need to get expression data to get clinical variables

Now we can

##now what do we see on a tissue level? 
res<-tab%>%
  spread(key=sex,value=score)%>%
  group_by(pathName)%>%
  mutate(pval=t.test(female,male)$p.value)%>%
  select(pathName,pval)%>%distinct()%>%
  ungroup()%>%
  mutate(correctedP=p.adjust(pval))

sigs.all<-subset(res,correctedP<0.05)
sigs.all
## # A tibble: 3 x 3
##   pathName                                   pval correctedP
##   <fct>                                     <dbl>      <dbl>
## 1 KIM_MYCL1_AMPLIFICATION_TARGETS_DN 0.00000895     0.0268  
## 2 KIM_MYCL1_AMPLIFICATION_TARGETS_UP 0.000000261    0.000783
## 3 RUNNE_GENDER_EFFECT_DN             0.0000000869   0.000261
##now what do we see on a tissue level? 
res.c<-tab%>%
  spread(key=sex,value=score)%>%
  group_by(pathName,tumorType)%>%
  mutate(pval=t.test(female,male)$p.value)%>%
  select(pathName,pval,tumorType)%>%distinct()%>%
  ungroup()%>%
  group_by(tumorType)%>%
  mutate(correctedP=p.adjust(pval))

sigs<-subset(res.c,correctedP<0.05)
sigs
## # A tibble: 27 x 4
## # Groups:   tumorType [2]
##    pathName                        pval tumorType                correctedP
##    <fct>                          <dbl> <chr>                         <dbl>
##  1 BASSO_HAIRY_CELL_LEUKEMI…    4.61e-6 Malignant Peripheral Ne…  0.0137   
##  2 CLIMENT_BREAST_CANCER_CO…    1.23e-6 Malignant Peripheral Ne…  0.00369  
##  3 DISTECHE_ESCAPED_FROM_X_…    1.32e-6 Cutaneous Neurofibroma    0.00396  
##  4 HASLINGER_B_CLL_WITH_11Q…    1.55e-5 Malignant Peripheral Ne…  0.0462   
##  5 IIZUKA_LIVER_CANCER_PROG…    3.82e-6 Malignant Peripheral Ne…  0.0114   
##  6 JAZAERI_BREAST_CANCER_BR…    4.29e-6 Malignant Peripheral Ne…  0.0128   
##  7 KANG_GIST_WITH_PDGFRA_UP     1.97e-6 Malignant Peripheral Ne…  0.00589  
##  8 KEGG_PANTOTHENATE_AND_CO…    1.36e-7 Malignant Peripheral Ne…  0.000408 
##  9 KEGG_TERPENOID_BACKBONE_…    3.93e-9 Malignant Peripheral Ne…  0.0000118
## 10 KORKOLA_YOLK_SAC_TUMOR_UP    7.34e-6 Malignant Peripheral Ne…  0.0219   
## # … with 17 more rows

Now we have a lot of significant pathways.

for(ct in unique(sigs$pathName)){
  sigs.t=subset(sigs,pathName==ct)
  tab.t=subset(tab,pathName%in%sigs.t$pathName)%>%subset(pathName==ct)
   p<-ggplot(tab.t,palette='jco')+geom_boxplot(aes(x=pathName,fill=sex,y=score))+facet_grid(.~tumorType)+ theme(axis.text.x = element_text(angle = 90, hjust = 1))
  print(p)

}

#for(meth in unique(sigs$pathName)){
#  sigs.t=subset(sigs,pathName==meth)
#  for(tu in sigs.t$tumorType){
#  tab.t=subset(tab,tumorType==tu)%>%
#      subset(pathName==meth)
 #  p<-ggplot(tab.t,palette='jco')+geom_boxplot(aes(x=tumorType,fill=sex,y=score))+theme(axis.text.x = element_text(angle = 90, hjust = 1))+scale_y_log10()+ggtitle(paste(meth,'scores'))
#   print(p)
 # }
#}