Skip to content

Commit 1e4ec77

Browse files
committed
kplot now uses ggplot2 and plotly
1 parent ed6947a commit 1e4ec77

File tree

3 files changed

+24
-16
lines changed

3 files changed

+24
-16
lines changed

DESCRIPTION

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
Package: intermediate
22
Type: Package
33
Title: eQTl/pQTL Mediation analysis
4-
Version: 0.2-3
4+
Version: 0.2-4
55
Date: 2017-02-03
66
Author: Petr Simecek, Steven Munger, Gary Churchill
77
Maintainer: Petr Simecek <[email protected]>
88
Description: It searches for a mediator M that would explain Q->T relationship
9-
Depends: plotly,
10-
ggplot2,
11-
dplyr,
12-
htmlwidgets,
13-
testthat
9+
Depends: magrittr
10+
Imports: ggplot2,
11+
dplyr,
12+
plotly,
13+
htmlwidgets,
14+
testthat
1415
License: GPL-3
1516
LazyData: TRUE
1617
URL: https://github.com/simecek/intermediate

R/kplot.R

+12-9
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@
1818
#' annotation = Tmem68$annotation,
1919
#' covar = Tmem68$covar,
2020
#' qtl.geno = Tmem68$qtl.geno)
21+
#'
22+
#' theme_set(theme_bw())
2123
#' kplot(med, symbol.col="symbol")
2224
#'
2325
#' # save the plot as HTML page
24-
#' pl <- kplot(med, symbol.col="symbol")
26+
#' gp <- kplot(med, symbol.col="symbol")
27+
#' pl <- ggplotly(gp, tooltip="text")
28+
#' pl
2529
#' tmpdir <- tempdir()
2630
#' htmlwidgets::saveWidget(pl, paste0(tmpdir, "/Tmem68.html"),
2731
#' selfcontained=TRUE)
@@ -35,7 +39,7 @@ kplot <- function(med, symbol.col="symbol", chrlen=mouse.chrlen, ...){
3539

3640
#Check input
3741
stopifnot(c("CHR", "POS","LOD") %in% names(med))
38-
42+
3943
if (!("GMB" %in% names(med)))
4044
med$GMB <- gmb.coordinates(med$CHR, med$POS, chrlen=chrlen)
4145
if (symbol.col %in% names(med)) symbols <- med[,symbol.col] else symbols <- med[,1]
@@ -66,21 +70,20 @@ kplot <- function(med, symbol.col="symbol", chrlen=mouse.chrlen, ...){
6670
return(sort(gmb.breakpoints))
6771
}
6872

69-
chrs <- c(as.character(1:19), "X")
73+
chrs <- c(as.character(1:19), "X", "Y", "M")
74+
chrs <- chrs[chrs %in% unique(med$CHR)]
7075
gene.breaks <- get_chr_breaks(med$CHR, med$GMB)
7176
gene.mid <- get_chr_middle_points(med$CHR, med$GMB)
7277

78+
# to be corrected !!!
7379
line.style <- theme_bw()$panel.grid.major
74-
pl <- ggplot(med, aes(x=GMB, y=LOD, color=color, text=SYMBOL)) +
80+
81+
ggplot(med, aes(x=GMB, y=LOD, color=color, text=SYMBOL)) +
7582
geom_point() +
7683
scale_x_continuous(breaks=gene.mid, labels = chrs, minor_breaks=gene.breaks, expand=c(0,0)) +
77-
theme_bw() +
7884
theme(legend.position="none") +
7985
theme(panel.grid.major.x = element_blank()) +
8086
theme(panel.grid.minor.x = line.style) +
8187
xlab('Position')
82-
83-
84-
ggplotly(pl, tooltip="text")
8588

86-
}
89+
}

man/kplot.Rd

+5-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)