Skip to content

Commit

Permalink
export get_most_inside_radius()
Browse files Browse the repository at this point in the history
  • Loading branch information
jokergoo committed Nov 23, 2020
1 parent a4be0b9 commit b7a3556
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: circlize
Type: Package
Title: Circular Visualization
Version: 0.4.12
Date: 2020-10-18
Date: 2020-11-23
Author: Zuguang Gu
Maintainer: Zuguang Gu <[email protected]>
Depends: R (>= 3.0.0), graphics
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export("get.current.chromosome")
export("get.current.sector.index")
export("get.current.track.index")
export("getI")
export("get_most_inside_radius")
export("highlight.chromosome")
export("highlight.sector")
export("inch_h")
Expand Down
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Changes in version 0.4.12
* `circos.link()`: add a new `inverse` argument to control whether the link
is inversed or not.
* `circos.genomicLabels()`: replace `side` argument with `labels.side`.
* `circos.points()`, `circos.lines()`, `circos.text()` allow argument `x` to be
a two-column matrix.

Changes in version 0.4.11
-----------------------------------------------------------------------
Expand Down
16 changes: 8 additions & 8 deletions R/link.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ circos.link = function(

d = getQuadraticPoints(theta1, theta2, rou1, rou2, h = h, h.ratio = h.ratio, w = w)
nr = nrow(d)
if(directional == 0) {
# if(directional == 0) {
lines(d, col = col, lwd = lwd, lty = lty, lend = "butt")
} else if(directional == 1) {
lines(d[-nr, , drop = FALSE], col = col, lwd = lwd, lty = lty, lend = "butt")
} else if(directional == -1) {
lines(d[-1, , drop = FALSE], col = col, lwd = lwd, lty = lty, lend = "butt")
} else if(directional == 2) {
lines(d[-c(1, nr), , drop = FALSE], col = col, lwd = lwd, lty = lty, lend = "butt")
}
# } else if(directional == 1) {
# lines(d[-nr, , drop = FALSE], col = col, lwd = lwd, lty = lty, lend = "butt")
# } else if(directional == -1) {
# lines(d[-1, , drop = FALSE], col = col, lwd = lwd, lty = lty, lend = "butt")
# } else if(directional == 2) {
# lines(d[-c(1, nr), , drop = FALSE], col = col, lwd = lwd, lty = lty, lend = "butt")
# }

if(nrow(d) > 1) {
if(directional %in% c(1,2)) { # point1 to point2
Expand Down
22 changes: 22 additions & 0 deletions R/low_level.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ circos.points = function(
stop_wrap("'circos.points' can only be used after the plotting region has been created")
}

if(missing(y)) {
if(ncol(x) == 2) {
y = x[, 2]
x = x[, 1]
}
}

len_x = length(x)
len_y = length(y)
if(len_x == 1) x = rep(x, len_y)
Expand Down Expand Up @@ -238,6 +245,13 @@ circos.lines = function(
warning_wrap("`area.baseline` is deprecated, please use `baseline` instead.")
}

if(missing(y)) {
if(ncol(x) == 2) {
y = x[, 2]
x = x[, 1]
}
}

if(length(x) != length(y)) {
stop_wrap("Length of x and y differ.")
}
Expand Down Expand Up @@ -841,6 +855,14 @@ circos.text = function(
font = par("font"),
...) {


if(missing(y)) {
if(ncol(x) == 2) {
y = x[, 2]
x = x[, 1]
}
}

len_x = length(x)
len_y = length(y)
if(len_x == 1) x = rep(x, len_y)
Expand Down
5 changes: 4 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,9 @@ add_transparency = function (col, transparency = 0) {
rgb(t(col2rgb(col)/255), alpha = 1 - transparency)
}

# == title
# Get the inside radius of the most inner track
#
get_most_inside_radius = function() {
tracks = get.all.track.index()
if(length(tracks) == 0) {
Expand Down Expand Up @@ -1137,7 +1140,7 @@ message_wrap = function(...) {

validate_data_frame = function(x) {
if(inherits(x, "data.frame")) {
return(x)
return(as.data.frame(x))
} else if(inherits(x, "GRanges")) {
x = as.data.frame(x)
return(x[, -(4:5), drop = FALSE])
Expand Down
15 changes: 15 additions & 0 deletions man/get_most_inside_radius.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
\name{get_most_inside_radius}
\alias{get_most_inside_radius}
\title{
Get the inside radius of the most inner track
}
\description{
Get the inside radius of the most inner track
}
\usage{
get_most_inside_radius()
}
\examples{
# There is no example
NULL
}

0 comments on commit b7a3556

Please sign in to comment.