Last updated: 2021-02-19

Checks: 6 1

Knit directory: 2021_UoM_Yap_shRNA_nuclei_RNAseq_ATACseq/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20210219) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Using absolute paths to the files within your workflowr project makes it difficult for you and others to run your code on a different machine. Change the absolute path(s) below to the suggested relative path(s) to make your code more reproducible.

absolute relative
/group/card2/Evangelyn_Sim/Collaboration_Kev_UoM/Sequencing_ATAC_RNA/Github/2021_UoM_Yap_shRNA_nuclei_RNAseq_ATACseq/output/YAP_shRNA_D28_Proteomics_results.xls output/YAP_shRNA_D28_Proteomics_results.xls

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 704a4cf. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rproj.user/

Untracked files:
    Untracked:  Mus_musculus.GRCm38.96.fulllength.saf
    Untracked:  header.txt
    Untracked:  mouseATAC*bed.saf
    Untracked:  mouseATAC*bed.saf.pe.mx
    Untracked:  mouseATAC*bed.saf.pe.mx.chr
    Untracked:  mouseATAC*bed.saf.pe.mx.fix
    Untracked:  output/YAP_shRNA_D28_Proteomics_results.xls
    Untracked:  output/edgeR_atac_cov2_LacZvsYap.xls
    Untracked:  output/edgeR_rna_LacZvsYap.xls
    Untracked:  output/logCPM_mrna_fulllen_pe_strrev.mx.fix_filt.csv
    Untracked:  output/mouse2human.txt.sort
    Untracked:  output/mouseATAC_peaks_cov2.bed.saf.pe.mx.fix_filt
    Untracked:  output/mrna_fulllen_pe_strrev.mx.fix_filt
    Untracked:  output/pheno.matrix.txt
    Untracked:  output/pheno.matrix_cov2.txt
    Untracked:  output/sampleinfo.txt

Unstaged changes:
    Modified:   README.md

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/06.Proteomic_GSEA.Rmd) and HTML (docs/06.Proteomic_GSEA.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 704a4cf evangelynsim 2021-02-19 wflow_publish(c(“analysis/01.RNAseq_primary_analysis.Rmd”, “analysis/02.RNAseq_QC_and_CPM.Rmd”,

Introduction

Obtain Proteomics differential analysis outcome: YAP shRNA D28 Proteomics results_ES.txt

Used libraries and functions

  • java/1.8.0_66
  • parallel
library(ggplot2)
library(grid)
library(gridExtra)
library(cowplot)

********************************************************
Note: As of version 1.0.0, cowplot does not change the
  default ggplot2 theme anymore. To recover the previous
  behavior, execute:
  theme_set(theme_cowplot())
********************************************************
library(ggpubr)

Attaching package: 'ggpubr'
The following object is masked from 'package:cowplot':

    get_legend
library(dplyr)

Attaching package: 'dplyr'
The following object is masked from 'package:gridExtra':

    combine
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

Read files

name = read.delim("/group/card2/Evangelyn_Sim/Collaboration_Kev_UoM/Sequencing_ATAC_RNA/20190531_RNA_run1/seqaln/rename/mrna_fulllen_pe_strrev.mx.chr", header = T, sep = "\t")
name$Gene.names = gsub(".*_","",name$Geneid)
name = name[,c(1,7)]

prote = read.delim("/group/card2/Evangelyn_Sim/Collaboration_Kev_UoM/Sequencing_ATAC_RNA/20190530_ATAC_run1/R/1.1kbpTSS/8.intersectwithproteomic/YAP shRNA D28 Proteomics results_ES.txt", header = T, sep = "\t")

mg = merge(prote, name, by = "Gene.names")
mg = mg[,c(21,2:20)]

write.table(mg, file = "/group/card2/Evangelyn_Sim/Collaboration_Kev_UoM/Sequencing_ATAC_RNA/Github/2021_UoM_Yap_shRNA_nuclei_RNAseq_ATACseq/output/YAP_shRNA_D28_Proteomics_results.xls", col.names = T, row.names = F, sep = "\t")

Rank Genes and change mouse gene name to human homolog

Following generated edgeR spreadsheet, use the logFC and p.Value to generate a rank score using the following scripts.

rnkgenM2H.sh

  #!/bin/bash

  #Specify the input file
  XLS=$1
  #Specify the gene ID column
  ID=$2
  #Specify the fold change value column
  FC=$3
  #Specify the raw p-value column
  P=$4
  #Specify ortholog maping
  ORTH=$5


  RNK=${XLS}.rnk
  HUM=${RNK}.hum.rnk

  sed 1d $XLS | tr -d '"' \
  | awk -v I=$ID -v F=$FC -v P=$P '{FS="\t"} {print $I, $F, $P}' \
  | awk '$2!="NA" && $3!="NA"' \
  | awk '{s=1} $2<0{s=-1} {print $1"\t"s*-1*log($3)/log(10)}' \
  | sort -k2gr | sed 's/inf$/330/'> $RNK

  sed 's/_/\t/' $RNK \
  | sort -k 1b,1 \
  | join -1 2 -2 1 $ORTH - \
  | awk '{OFS="\t"} {print $0,$5*$5}' \
  | sort -k6gr \
  | awk '!arr[$4]++' \
  | awk '{OFS="\t"} !arr[$3]++ {print $3,$5}' \
  | sort -k2gr > $HUM

Run rnkgenM2H.sh to generate .rnk files

  #!/bin/bash
  for XLS in *xls ; do
     ./rnkgen.sh $XLS 1 5 6 mouse2human.txt.sort 1 2 3 ;
  done

Run GSEA using ranked genes

Subject the generated .rnk files along with .gmt file sand run the following scripts to perform gene set enrichment analysis.

Download gmt files from GSEA webpage http://www.gsea-msigdb.org/gsea/login.jsp;jsessionid=C4D3892651A8792A331D7B32E9D2269C

rungsea.sh

  #!/bin/bash

  run_gsea(){
  RNK=$1
  GMT=$2
  echo /group/card2/Evangelyn_Sim/NGS/app/gsea-3.0.jar $RNK $GMT
  java -Xmx4096m -cp /group/card2/Evangelyn_Sim/NGS/app/gsea-3.0.jar xtools.gsea.GseaPreranked  \
  -gmx $GMT -collapse false -mode Max_probe \
  -norm meandiv -nperm 1000 -rnk $RNK -scoring_scheme classic \
  -rpt_label ${RNK}.${GMT} -include_only_symbols true -make_sets true \
  -plot_top_x 20 -rnd_seed timestamp -set_max 5000 -set_min 10 -zip_report false \
  -out . -gui false
  }
  export -f run_gsea

  parallel -j5 run_gsea ::: *rnk ::: *gmt

Parse GSEA outcome

#!/bin/bash
echo 'GeneSetName   GeneSetSize ES  NES p-val   FDR FWER' > header.txt

for GSEADIR in `ls | grep GseaPreranked | grep -v xls$` ; do
  awk '{FS="\t"} {OFS="\t"} $8<0.05 {print $1,$4,$5,$6,$7,$8,$9} ' $GSEADIR/gsea_report_for_na_*xls \
  | cat header.txt - > $GSEADIR.xls
done

Plot GSEA result

files = list.files(path = "/group/card2/Evangelyn_Sim/Collaboration_Kev_UoM/Sequencing_ATAC_RNA/20190530_ATAC_run1/R/1.1kbpTSS/10.proteomic_gsea", pattern = ".*go.xls$", full.names = T)
mx = lapply(files, read.delim, header=T)


for(l in 1:length(mx)){
  
  mx[[l]]$GeneSetName = gsub("GO_", "", mx[[l]]$GeneSetName)
  
  mxRU= mx[[l]]
  mxRU= mxRU[order(mxRU$NES, decreasing = T), ]
  mxRU= mxRU[c(1:5),]
  mxRU$colour = "blue"
  
  mxRD= mx[[l]]
  mxRD= mxRD[order(mxRD$NES), ]
  mxRD= mxRD[c(1:5),]
  mxRD$colour = "red"
  
  ES_all = rbind(mxRU, mxRD)
  
}
par(las =2)
par(mar=c(3,55,5,2))
  
fig = barplot(rev(ES_all$NES), 
                horiz = T, 
                col = ES_all$colour, 
                names.arg = rev(ES_all$GeneSetName) , 
                cex.axis = 1.5, cex.names = 1.25)


sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS:   /hpc/software/installed/R/3.6.1/lib64/R/lib/libRblas.so
LAPACK: /hpc/software/installed/R/3.6.1/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] dplyr_1.0.2     ggpubr_0.4.0    cowplot_1.0.0   gridExtra_2.3  
[5] ggplot2_3.3.2   workflowr_1.6.2

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.0  xfun_0.18         purrr_0.3.4       haven_2.3.1      
 [5] carData_3.0-4     colorspace_1.4-1  vctrs_0.3.2       generics_0.1.0   
 [9] htmltools_0.5.0   yaml_2.2.1        rlang_0.4.7       later_1.1.0.1    
[13] pillar_1.4.6      foreign_0.8-71    glue_1.4.2        withr_2.3.0      
[17] readxl_1.3.1      lifecycle_0.2.0   stringr_1.4.0     cellranger_1.1.0 
[21] munsell_0.5.0     ggsignif_0.6.0    gtable_0.3.0      zip_2.1.1        
[25] evaluate_0.14     knitr_1.30        rio_0.5.16        forcats_0.5.0    
[29] httpuv_1.5.4      curl_4.3          highr_0.8         broom_0.7.0      
[33] Rcpp_1.0.5        promises_1.1.1    scales_1.1.1      backports_1.1.10 
[37] abind_1.4-5       fs_1.5.0          hms_0.5.3         digest_0.6.27    
[41] openxlsx_4.2.3    stringi_1.5.3     rstatix_0.6.0     rprojroot_1.3-2  
[45] tools_3.6.1       magrittr_1.5      tibble_3.0.3      crayon_1.3.4     
[49] whisker_0.4       tidyr_1.1.2       car_3.0-10        pkgconfig_2.0.3  
[53] ellipsis_0.3.1    data.table_1.13.2 rmarkdown_2.5     rstudioapi_0.11  
[57] R6_2.5.0          git2r_0.27.1      compiler_3.6.1