#[TCGA Projects](https://portal.gdc.cancer.gov/projects/)

project <- 'TCGA-PAAD'# Pancreas
fc <- 2
pval <- 0.05
# library -------------------------------
library(GDCRNATools)
## Warning: package 'GDCRNATools' was built under R version 3.5.2
## 
## 
## ##############################################################################
## Pathview is an open source software package distributed under GNU General
## Public License version 3 (GPLv3). Details of GPLv3 is available at
## http://www.gnu.org/licenses/gpl-3.0.html. Particullary, users are required to
## formally cite the original Pathview paper (not just mention it) in publications
## or products. For details, do citation("pathview") within R.
## 
## The pathview downloads and uses KEGG data. Non-academic uses may require a KEGG
## license agreement (details at http://www.kegg.jp/kegg/legal.html).
## ##############################################################################
library(tidyverse)
## Warning: package 'ggplot2' was built under R version 3.5.2
## Warning: package 'tibble' was built under R version 3.5.2
## Warning: package 'purrr' was built under R version 3.5.2
## Warning: package 'dplyr' was built under R version 3.5.2
## Warning: package 'stringr' was built under R version 3.5.2
## Warning: package 'forcats' was built under R version 3.5.2
library(here)
## here() starts at /Users/zero/Desktop/pancreas
library(DT)
## Warning: package 'DT' was built under R version 3.5.2
library(fs)
## Warning: package 'fs' was built under R version 3.5.2
fs::dir_create("analysis/data/derived_data", project)
# load data  ----------------------------------------------
load(str_glue("analysis/data/derived_data/{project}/ceRNA_network.RData"))

data_dir = here("analysis/data/raw_data")

rnadir      <-paste(data_dir, project, 'RNAseq', sep='/')
mirdir      <-paste(data_dir, project, 'miRNAs', sep='/')
clinicaldir <- paste(data_dir, project, 'Clinical', sep='/')


# update the metaMatix for suvial analysis ------------------------------------------
metaMatrix.RNA_surv <-
  clinicalDa %>%
  rownames_to_column("patient") %>%
  filter(patient %in%  metaMatrix.RNA$patient) %>%
  left_join(metaMatrix.RNA, . , by = "patient") %>%
  select(-ends_with(".x")) %>%
  set_names(~ str_remove(.x, "\\.y$")) %>%
  mutate(days_to_last_follow_up = as.numeric(days_to_last_follow_up)) %>%
  select(c("patient","sample_type","sample","days_to_death","days_to_last_follow_up"))


# Correlation plot
gdcCorPlot(gene1    = 'ENSG00000251165',
           gene2    = 'ENSG00000091831',
           rna.expr = rnaExpr,
           metadata = metaMatrix.RNA_surv)

shinyCorPlot(gene1    = rownames(deLNC),
             gene2    = rownames(dePC),
             rna.expr = rnaExpr,
             metadata = metaMatrix.RNA)
## Loading required package: shiny
## Warning: package 'shiny' was built under R version 3.5.2
## 
## Attaching package: 'shiny'
## The following objects are masked from 'package:DT':
## 
##     dataTableOutput, renderDataTable
## 
## Listening on http://127.0.0.1:5953

R Markdown

shinyCorPlot(gene1    = rownames(deLNC),
             gene2    = rownames(dePC),
             rna.expr = rnaExpr,
             metadata = metaMatrix.RNA)
## 
## Listening on http://127.0.0.1:3401