Commit 7a732c5b authored by Dhanaprakash Jambulingam's avatar Dhanaprakash Jambulingam
Browse files

Updated corplot

parents
File added
shiny::runApp('Dropbox/corplot/shinycorplots-master-b122d52470b8c848139a1ae7e5c932b7f82afff3')
install.packages("tidyverse")
library(tidyverse)
library(MASS)
tidyverse_conflicts()
tidyverse_update()
install.packages(c("dplyr", "modelr", "stringr", "tidyr"))
library(tidyverse)
library(MASS)
tidyverse_conflicts()
tidyverse_update()
install.packages(c("dplyr", "stringr", "tidyr"))
install.packages(c("dplyr", "stringr", "tidyr"))
shiny::runApp('Dropbox/corplot/shinycorplots-master-b122d52470b8c848139a1ae7e5c932b7f82afff3')
install.packages('swirl')
library('swirl')
ls()
rm(list=ls())
install_from_swirl("R_Programming")
install_from_swirl("Data_Analysis")
swirl()
5+7
x <- 5+7
x
y <- x-3
y
z <- c(1.1,9, 3.14)
?c
z
c(z,555,z)
z*2+100
sqrt(z-1)
my_sqrt <- sqrt(z-1)
my_sqrt
my_div <- z/my_sqrt
my_div
c(1, 2, 3, 4) + c(0, 10)
c(1, 2, 3, 4) + c(0, 10, 100)
z*2+1000
my_div
shiny::runApp('Dropbox/corplot/shinycorplots-master-b122d52470b8c848139a1ae7e5c932b7f82afff3')
runApp('Dropbox/corplot/shinycorplots-master-b122d52470b8c848139a1ae7e5c932b7f82afff3')
runApp('Dropbox/corplot/shinycorplots-master-b122d52470b8c848139a1ae7e5c932b7f82afff3')
runApp('Dropbox/corplot/shinycorplots-master-b122d52470b8c848139a1ae7e5c932b7f82afff3')
runApp('Dropbox/corplot/shinycorplots-master-b122d52470b8c848139a1ae7e5c932b7f82afff3')
runApp('Dropbox/corplot/shinycorplots-master-b122d52470b8c848139a1ae7e5c932b7f82afff3')
runApp('Dropbox/corplot/shinycorplots-master-b122d52470b8c848139a1ae7e5c932b7f82afff3')
runApp('Dropbox/corplot/shinycorplots-master-b122d52470b8c848139a1ae7e5c932b7f82afff3')
runApp('Dropbox/corplot/shinycorplots-master-b122d52470b8c848139a1ae7e5c932b7f82afff3')
runApp('Dropbox/corplot/shinycorplots-master-b122d52470b8c848139a1ae7e5c932b7f82afff3')
runApp('corplot/shinycorplots-master-b122d52470b8c848139a1ae7e5c932b7f82afff3')
shiny::runApp('LocusExplorer')
runApp('Dropbox/corplot/shinycorplots-master-b122d52470b8c848139a1ae7e5c932b7f82afff3')
install.packages('rsconnect')
install.packages("rsconnect")
library(IRanges)
install.packages("rsconnect")
source("https://bioconductor.org/biocLite.R")
biocLite("IRanges")
library(IRanges)
ir1 <- IRanges(start = c(1,3,5), end = c(3,5,7))
ir1
ir2 <- IRanges(start = c(1,3,5), width = 3)
ir2
all.equal(ir1, ir2)
width(ir2) <- 1
ir2
names(ir1) <- paste("A", 1:3, sep = "")
ir1
names(ir1) <- paste("A", 1:3, sep = "")
ir1
names(ir1)
dim(ir1)
?IRanges
ir3 <- IRanges(start = c(1,3,5), width = 3, names = paste('"A", 1:3, sep =""' ))
ir3
ir3 <- IRanges(start = c(1,3,5), width = 3, names = c(A1,A2,A3))
ir3 <- IRanges(start = c(1,3,5), width = 3, names = c("A1","A2","A3"))
ir3
ir3 <- IRanges(start = c(1,3,5), width = 3, names = (paste('"A", 1:3, sep =""' )))
ir3
browseVignettes("GenomicRanges")
browseVignettes("GenomicRanges")
browseVignettes("IRanges")
shiny::runApp('LocusExplorer')
shiny::runApp('tools/LocusExplorer')
shiny::runApp('LocusExplorer')
runApp('LocusExplorer')
install.packages("LDheatmap")
library("LDheatmap")
library(LDheatmap)
install.packages("snpStats")
source("https://bioconductor.org/biocLite.R")
biocLite("snpStats")
library("LDheatmap")
install.packages("LDheatmap")
library("LDheatmap")
data("CEUData")
data
MyHeatmap <- LDheatmap(CEUSNP, CEUDist, LDmeasure="r", title="Pairwise LD in r^2", add.map=TRUE, SNP.name=c("rs2283092", "rs6979287"), color=grey.colors(20), name="myLDgrob", add.key=TRUE)
MyHeatmap
plot(MyHeatmap)
xy<-data("CEUData")
xy
View("CEUData")
shiny::runApp('LocusExplorer')
library(QCGWAS)
install.packages("QCGWAS")
c
shiny::runApp('LocusExplorer')
runApp('LocusExplorer')
mat = matrix(sample(100, 25), 5)
mat
sample(100,25)
sample(1000,25)
sample(10,25)
sample(10,9)
sample(10,10)
sample(10,11)
mat = matrix(sample(100, 25), 6)
mat = matrix(sample(100, 36), 6)
mat
library(readr)
locus <- read_delim("~/tools/rasp/locus.tsv",
"\t", escape_double = FALSE, trim_ws = TRUE)
View(locus)
library(gap)
options(stringsAsFactors=FALSE)
p <- with(locus,data.frame(SNP=NAME,PVAL))
p
hit <- subset(p,PVAL==min(PVAL,na.rm=TRUE))$SNP
hit
install.packages("NCBI2R")
install.packages("~/Downloads/NCBI2R_1.4.7.tar.gz", repos = NULL, type = "source")
library(NCBI2R)
# LD under build 36
pos <- apply(as.data.frame(p$SNP),1,GetSNPPosHapmap)
library(IRanges)
library(gap)
library(NCBI2R)
GetSNPPosHapMap()
GetSNPPosHapMap("rs2074187")
options(stringsAsFactors=FALSE)
p <- with(locus,data.frame(SNP=NAME,PVAL))
p
hit <- subset(p,PVAL==min(PVAL,na.rm=TRUE))$SNP
pos <- apply(as.data.frame(p$SNP),1,GetSNPPosHapmap)
pos <- apply(as.data.frame(p$SNP),1,GetSNPPosHapMap)
hit <- subset(p,PVAL==min(PVAL,na.rm=TRUE))$SNP
hit
p$SNP
pos <- apply(as.data.frame(p$SNP),2,GetSNPPosHapMap)
pos <- apply(as.data.frame(p$SNP),1,GetSNPPosHapMap)
pos <- apply(as.data.frame(p$SNP),1,GetSNPPosHapmap)
library(IRanges)
library(S4Vectors)
library(gap)
library(NCBI2R)
options(stringsAsFactors=FALSE)
p <- with(locus,data.frame(SNP=NAME,PVAL))
hit <- subset(p,PVAL==min(PVAL,na.rm=TRUE))$SNP
pos <- apply(as.data.frame(p$SNP),1,GetSNPPosHapmap)
pos <- apply(as.data.frame(p$SNP),1,GetSNPPosHapMap)
remove.packages("NCBI2R", lib="~/R/x86_64-pc-linux-gnu-library/3.4")
install.packages("~/Downloads/NCBI2R-1.4.6.tar.gz", repos = NULL, type = "source")
library(NCBI2R)
pos <- apply(as.data.frame(p$SNP),1,GetSNPPosHapMap)
library(NCBI2R)
GetSNPPosHapMap("rs2074187")
GetSNPInfo("rs2074187")
library(readr)
snplist <- read_csv("~/Downloads/snplist.csv",
col_names = FALSE)
View(snplist)
GetSNPInfo(snplist)
snp1<-as.data.frame(snplist)
snp1
GetSNPInfo(snp1)
View(locus)
options(stringsAsFactors=FALSE)
p <- with(locus,data.frame(SNP=NAME,PVAL))
p
hit <- subset(p,PVAL==min(PVAL,na.rm=TRUE))$SNP
require(gap.datasets)
install.packages("gap.datasets")
require(gap.datasets)
library(NCBI2R)
chr_pos <- GetSNPInfo(with(p,SNP))[c("chr","chrpos")]
View(chr_pos)
l <- with(chr_pos,min(as.numeric(chrpos),na.rm=TRUE))
u <- with(chr_pos,max(as.numeric(chrpos),na.rm=TRUE))
LD <- with(chr_pos,GetLDInfo(unique(chr),l,u))
l <- with(chr_pos,min(as.numeric(chrpos),na.rm=TRUE))
l
u <- with(chr_pos,max(as.numeric(chrpos),na.rm=TRUE))
u
LD <- with(chr_pos,GetLDInfo(unique(chr),l,u))
pos <- apply(as.data.frame(p$SNP),1,GetSNPPosHapmap)
pos <- apply(as.data.frame(p$SNP),1,GetSNPPosHapMap)
LD <- with(chr_pos,9,l,u))
LD <- with(chr_pos,9,l,u)
LD
LD <- with(chr_pos,9,21890327,22385640)
LD
hit_LD <- subset(LD,SNPA==hit)
hit
hit_LD <- subset(LD,rs10811661)
LD <- with(chr_pos,unique(9),l,u)
LD
hit_LD <- subset(LD,SNPA==hit)
info <- GetSNPInfo(p$SNP)
info
info <- GetSNPInfo(p$SNP)
haldane <- function(x) 0.5*(1-exp(-2*x))
locus <- with(info, data.frame(CHR=chr,POS=chrpos,NAME=marker,
DIST=(chrpos-min(chrpos))/1000000,
THETA=haldane((chrpos-min(chrpos))/100000000)))
locus
locus1 <- with(info, data.frame(CHR=chr,POS=chrpos,NAME=marker,
DIST=(chrpos-min(chrpos))/1000000,
THETA=haldane((chrpos-min(chrpos))/100000000)))
locus1
locus <- with(info, data.frame(CHR=chr,POS=chrpos,NAME=marker,
DIST=(chrpos-min(chrpos))/1000000,
THETA=haldane((chrpos-min(chrpos))/100000000)))
locus <- merge.data.frame(locus,hit_LD,by.x="NAME",by.y="SNPB",all=TRUE)
locus <- merge.data.frame(locus,p,by.x="NAME",by.y="SNP",all=TRUE)
locus
locus <- subset(locus,!is.na(POS))
ann <- AnnotateSNPList(p$SNP)
shiny::runApp('LocusExplorer')
shiny::runApp('Downloads/correlation_plot-v2dev')
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>corplots</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>de.walware.statet.r.builders.RSupport</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>de.walware.statet.base.StatetNature</nature>
<nature>de.walware.statet.r.RNature</nature>
</natures>
</projectDescription>
This diff is collapsed.
---
title: "CORPLOT - FAQ"
author: "Dhana"
date: "October 03, 2018"
---
#### Q1. What is corplot?
**A:** corplot is an interactive R application developed using the shiny package for plotting correlation heatmaps from gene expression data.
#### Q2: I have Ensembl IDs instead of HGNC symbols will I still be able to use corplot ?
**A:** Yes, corplot can be used for visualizing correlation heatmaps with Ensembl IDs (in place of HGNC symbols). Incase you wish to change it to HGNC symbols, corplot has an inbuilt option to retrieve HGNC symbols for corresponding Ensembl IDs from biomart, you can select this option upon uploading the data and corplot will retireve the missing HGNC symbols for corresponding Ensembl Ids.
#### Q3. Can you explain the tabs in the tool?
**A:** There are 4 mains tabs in the plot,
```
1. DATA TABLE - The data from the uploaded file can be viewed in this file.
2. PLOT DATA - The data to be plotted can be viewed in this file, the number of genes to be plotted can be increased/decreased using the slide bar (Number of Genes With Highest Variance) in DATA TABLE tab.
3. CORRELATION HEATMAP - The heat map is generated and viewed in this tab.
4. CORRELATION MATRIX - The correlation matrix generated can be viewed in this tab.
5. INFO - This tab presents a drop down with two tabs - 'FAQ' and 'ABOUT', from which frequently asked questions and information regarding availability, prerequisite packages and running information can be otained.
```
#### Q4: What is the input file format?
**A:** The required input file for corplot is tab separated, where columns represent gene expression values and are labelled with sample names and the rows are labelled according to gene symbols.
```
inputFormat.tsv:
HGNC_symbol Sample1 Sample2 Sample3
Gene1 7.221534140 3.096289636 0.377739835
Gene2 -1.922776449 0.991096096 3.378650875
Gene3 6.474929692 5.982874941 4.702968285
```
#### Q5: Is there any example data provided?
**A:** Yes, an example data file is provided to try out the tool. You can find the file in `corplot/Data/exampleFIle/` folder.
#### Q6: What do colors in the plot indicate?
**A:** The colors in the plot indicate the level of correlation between two genes. Red means maximum correlation value of +1 whereas blue indicates least correlation value of -1.
#### Q7: Is there a size limit for the expression file?
**A:** The default maximum size limit for files are 5 MB in shiny applications, in corplot the maximum size limit has been modified and set to 40 MB.
#### Q8: The app crashes when clicked on the 'CORRELATION HEATMAP' tab?
**A:** It is difficult to determine the cause of the crash, in this scenario the most probable cause would be error in uploaded expression file format, please refer the input file format explained in question 4. The other causes for the crash could be due to R package dependencies with different versions, in this case it better to re-install packages and clear the environment (in RStudio) and run again.
---
title: "CORPLOT - README"
author: "Dhana"
date: "October 03, 2018"
---
### About CORPLOT
Correlation analysis is a powerful approach to determine the strength of association between two variables. The strength and direction of a correlation is represented in the form of a correlation coefficient ranging from -1 (negative) to +1 (positive). In cases of biological data such as expression data, establishing a clear pattern can be difficult from just looking at the values. The CORPLOT tool has been created to enable researchers to see the results of correlation analysis graphically in the form of an interactive heatmap, which can aid in better understanding of relationships and help identify new patterns.
### Disclaimer
CORPLOT tool is intended for visualization purpose only and should not be used for treating or diagnosing human subjects.
### Availability
The source code and installation instructions are available at ................................
### Required Software
CORPLOT requires additional inhouse R packages in-order to run. The required pacakages can be obtained from this **link**
### Frequently asked questions
Please refer to the **FAQ** here
1. Disclaimer
2. Availability
3. Required software
Launching corplot
1. run using github
2. run as a downloaded zip
Contact details
medseqr
readR
heatmapGen2
PAMhm
coreheat
This diff is collapsed.
library(shiny)
library(shinyBS)
library(shinythemes)
library(knitr)
library(rmarkdown)
navbarPage(
title= div(h4("Correlation Heatmaps",style = "margin-top: 0px;"),
img(src = "ty_logo.png", height = "50px",
style = "position: relative; top: -43px; right: -1000px;")),
windowTitle = "Correlation Heatmaps",
theme = shinytheme("sandstone"),
fluid = TRUE,
tabPanel("Data Table",
shinyjs::useShinyjs(),
sidebarLayout(
sidebarPanel(
fileInput('uploadData', 'Choose Data File'),
actionLink(inputId = "show1", label = "Example file"),
uiOutput('idColSelect'),
uiOutput('columnSelect'),
shinyBS::bsButton('doBiomart', "Get Gene Symbols", style="primary", size="small", type="action"),
#shinyBS::bsButton('toggleBMset', "Advanced Biomart Controls", style="primary", size="extra-small", type="toggle", value=FALSE),
width=2
),
mainPanel(
bsAlert('alert_anchor1'),
uiOutput("inputDT"),
width=10
)
)
),
tabPanel("Plot Data",
sidebarLayout(
sidebarPanel(
tags$div(id='noplotdata', tags$label("No data.")),
radioButtons('chooseSelType', "Selection Criteria", c("By number of genes", "By gene symbol (using pre-selected number of genes)"), "By number of genes"),
uiOutput('nvarUI'),
uiOutput('geneSelUI'),
sliderInput('nSurrGenes', tags$label("Numer of genes surrounding selection", style="font-size: 14px;"), 0, 50, 10, 1),
shinyBS::bsButton('sortPlotData', "Sort Plot Data", style="info", size="small", type="toggle", value=FALSE),
shinyBS::bsButton('toPlot', "Open Heatmap", style="primary", size="small", type="action"),
conditionalPanel("input.toggleBMset", {
tags$html(
textInput('biomHost', "Biomart Host URL", "www.ensembl.org", placeholder="www.ensembl.org"),
textInput('biomFilt', "Biomart Search Filter", "ensembl_gene_id", placeholder="ensembl_gene_id")
)
}),
width=2
),
mainPanel(
bsAlert('alert_anchor2'),
uiOutput("plotDT"),
width=10
)
)
),
tabPanel("Correlation Heatmap",
sidebarLayout(
sidebarPanel(
tags$div(id='nohmdata', tags$label("No data.")),
checkboxInput('addStars', "Add Significance Stars", FALSE),
checkboxInput('addRect4genes', "Highlight Selected Genes", FALSE),
sliderInput('imgSize', tags$label("Image Size (%)", style="font-size: 14px;"), 100, 800, 100, 20),
sliderInput('textSize', "Gene Label Size", 0.1, 3, 0.8, 0.1),
textInput('plotTitle', "Enter Plot Title", "", placeholder="Dissimilarity = 1 - Correlation"),
tags$div(id='downlButID', style="text-align: center; ", downloadButton('downloadPlot', tags$label("Download as PDF", style="font-size: 14px;"))),
tags$br(),
shinyBS::bsButton('toggleAdv', "Show advanced controls", style="primary", size="small", type="toggle", value=FALSE),
conditionalPanel("input.toggleAdv", {
tags$html(
checkboxInput('doClust', "Cluster and Filter Correlations", TRUE),
sliderInput('naFrac', "Allowed Fraction of NAs per Row (%)", 0.1, 1, 0.1, 0.05),
checkboxInput('doCorFilt', "Filter by Correlation Value", FALSE),
conditionalPanel("input.doCorFilt", {
tags$html(
sliderInput('corThr', "Correlation Filter Threshold", -1, 1, 0.5, 0.05),
sliderInput('corMar', "Correlation Filter Margin per Row (%)", 0.001, 1, 0.05, 0.005)
)
}),
checkboxInput('doCutFilt', "Filter by Cutting the Dendrogram", FALSE),
conditionalPanel("input.doCutFilt", {
tags$html(
sliderInput('cutThr', "Threshold for Tree Cutting", 0, 2, 1, 0.1),
sliderInput('cutSize', "Number of Genes on a Tree Branch to be Considered a Cluster", 1, 100, 1, 1)
)
})
)
})
, width=2
),
mainPanel(
bsAlert('alert_anchor3'),
uiOutput('main_plot_ui'),
width=10)
)
),
tabPanel("Correlation Matrix",
tags$div(id='nocmdata', tags$label("No data.")),
uiOutput('cormatUI')
),
navbarMenu("Help",
icon = icon("info"),
tabPanel("FAQ",
h4("Frequently Asked Quesitons"),
hr(),
includeMarkdown("Markdown/FAQ.md")
),
tabPanel("About",
h4("About"),
hr(),
includeMarkdown("Markdown/README.md"))),
id='mainNavbarPage', footer=list(tags$hr(), tags$table(style="width: 100%; ", tags$tbody(tags$tr(tags$th(style="text-align: center; ", tags$label(style="font-family: Verdana; font-size: 12pt; font-weight: normal; color: grey; ", "This app has been created and is maintained by the Institute of Biomedicine, University of Turku."))))))
)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment