-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vincent Cahais
committed
Mar 28, 2022
1 parent
c810db0
commit 64a0db4
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
title: "dmrplot" | ||
runtime: shiny | ||
output: flexdashboard::flex_dashboard | ||
params: | ||
meth: "waterpipe_Funnorm_2022-01-18.rda" | ||
dmrs: "report_SmokingStatus/Cigarette_2022-03-24.dmrs.csv" | ||
--- | ||
|
||
```{r echo = FALSE, message = FALSE} | ||
#library(data.table) | ||
library(tidyverse) | ||
library(GenomicRanges) | ||
library(ggplot2) | ||
library(reshape2) | ||
library(RColorBrewer) | ||
``` | ||
|
||
|
||
```{r echo = FALSE} | ||
load(params$meth) | ||
dmrs<-read_tsv(params$dmrs) %>% mutate(ID=paste0(seqnames, ":", start, "-", end)) | ||
``` | ||
|
||
Column {.sidebar} | ||
-------------------------------------------------- | ||
|
||
<h4>Parameters</h4> | ||
|
||
```{r echo = FALSE} | ||
selectInput("group", "group", choices = colnames(sampleSheet), selected = 3, multiple = FALSE) | ||
selectInput("dmr", "dmr", choices = dmrs$ID, selected = 1, multiple = FALSE) | ||
``` | ||
|
||
Column | ||
-------------------------------------------------- | ||
|
||
```{r echo = FALSE, message = FALSE} | ||
renderPlot({ | ||
#foo<-table[ grepl(input$gene,table$overlapping.genes), ] | ||
cpgs<-dmrs %>% filter(ID==input$dmr) %>% pull(overlapping.sites) %>% strsplit(",") %>% unlist() | ||
colnames(betas)<-sampleSheet$samples | ||
foo<-betas[cpgs,] %>% data.frame() %>% rownames_to_column("cpg") %>% | ||
gather("samples","betas",1:ncol(betas)+1) %>% | ||
merge(sampleSheet,by="samples") %>% | ||
group_by_at(c(input$group,"cpg")) %>% | ||
filter(!is.na(betas)) %>% | ||
summarise(sd=sd(betas),betas=mean(betas), .groups = "drop") | ||
ggplot(foo, aes(x=cpg, y=betas, ymin=(betas-sd/2), ymax=(betas+sd/2) , group=get(input$group), fill=get(input$group) ) ) + | ||
geom_line() + | ||
geom_point() + | ||
geom_ribbon(alpha=0.5) + | ||
theme(axis.text.x=element_text(angle=50,hjust=1, size=10)) + | ||
labs(fill=input$group) + | ||
ggtitle(input$dmr) | ||
}) | ||
``` |