posTransform.text: Genomic position transformation function specifically for...

Description Usage Arguments Details Examples

Description

Genomic position transformation function specifically for text

Usage

1
2
3
4
posTransform.text(region, y, labels, cex = 1, font = par("font"),
    sector.index = get.cell.meta.data("sector.index"),
    track.index = get.cell.meta.data("track.index"), padding = 0,
    extend = 0, ...)

Arguments

region

Genomic positions at a single chromosome. It is a data frame with two columns which are start position and end position.

y

positions of texts

labels

text labels

cex

text size

font

text font style

sector.index

sector index

track.index

track index

padding

padding of text

extend

extend to allow labels to be put in an region which is wider than the current chromosome. The value should be a proportion value and the length is either one or two.

...

other arguments

Details

This position transformation function is designed specifically for text. Under the transformation, texts will be as close as possible to the original positions.

Examples

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
## Not run: 

op = par(no.readonly = TRUE)

set.seed(123458)

par(mfrow = c(2, 2))

bed = generateRandomBed(nr = 400, fun = function(k) rep("text", k))
bed = bed[-(9:13), ]
##########################################
circos.par("start.degree" = 90, canvas.xlim = c(0, 1), canvas.ylim = c(0, 1), 
    gap.degree = 270, cell.padding = c(0, 0, 0, 0), track.margin = c(0.005, 0.005))
circos.initializeWithIdeogram(plotType = c("axis"), chromosome.index = "chr1")
circos.genomicTrackPlotRegion(bed, ylim = c(0, 1), 
    panel.fun = function(region, value, ...) {
        circos.genomicText(region, value, y = 0, labels.column = 1, 
            facing = "clockwise", adj = c(0, 0.5),
            posTransform = posTransform.text, cex = 0.8, niceFacing = F)
}, track.height = 0.1, bg.border = NA)
i_track = get.cell.meta.data("track.index")

circos.genomicPosTransformLines(bed, 
    posTransform = function(region, value) 
        posTransform.text(region, y = 0, labels = value[[1]], 
            cex = 0.8, track.index = i_track),
    direction = "outside"
)

circos.genomicTrackPlotRegion(bed, ylim = c(0, 1), 
    panel.fun = function(region, value, ...) {
        circos.points( (region[[1]] + region[[2]])/2, rep(0.5, nrow(region)), pch = 16)
}, track.height = 0.02, bg.border = NA)

circos.clear()

text(0, 0.05, "posTransform.text\ndirection = 'outside'", adj = c(0, 0))

############################################
circos.par("start.degree" = 90, canvas.xlim = c(0, 1), canvas.ylim = c(0, 1), 
    gap.degree = 270, cell.padding = c(0, 0, 0, 0), track.margin = c(0.005, 0.005))
circos.initializeWithIdeogram(plotType = c("axis"), chromosome.index = "chr1")
circos.genomicTrackPlotRegion(bed, ylim = c(0, 1), 
    panel.fun = function(region, value, ...) {
        circos.genomicText(region, value, y = 0, labels.column = 1, 
            facing = "clockwise", adj = c(0, 0.5),
            posTransform = posTransform.default, cex = 0.8, niceFacing = F)
}, track.height = 0.1, bg.border = NA)
i_track = get.cell.meta.data("track.index")

circos.genomicPosTransformLines(bed, posTransform = posTransform.default, 
    direction = "outside")

circos.genomicTrackPlotRegion(bed, ylim = c(0, 1), 
    panel.fun = function(region, value, ...) {
        circos.points( (region[[1]] + region[[2]])/2, rep(0.5, nrow(region)), pch = 16)
}, track.height = 0.02, bg.border = NA)

circos.clear()
text(0, 0.05, "posTransform.default\ndirection = 'outside'", adj = c(0, 0))

##############################################################################
circos.par("start.degree" = 90, canvas.xlim = c(0, 1), canvas.ylim = c(0, 1), 
    gap.degree = 270, cell.padding = c(0, 0, 0, 0), track.margin = c(0.005, 0.005))
circos.initializeWithIdeogram(plotType = c("axis"), chromosome.index = "chr1")
circos.par(cell.padding = c(0, 0, 0, 0))
circos.genomicTrackPlotRegion(bed, ylim = c(0, 1), 
    panel.fun = function(region, value, ...) {
        circos.points( (region[[1]] + region[[2]])/2, rep(0.5, nrow(region)), pch = 16)
}, track.height = 0.02, bg.border = NA)

circos.genomicTrackPlotRegion(bed, ylim = c(0, 1), track.height = 0.1, bg.border = NA)
i_track = get.cell.meta.data("track.index")

circos.genomicTrackPlotRegion(bed, ylim = c(0, 1), 
    panel.fun = function(region, value, ...) {
        circos.genomicText(region, value, y = 1, labels.column = 1, 
            facing = "clockwise", adj = c(1, 0.5),
            posTransform = posTransform.text, cex = 0.8, niceFacing = F)
}, track.height = 0.1, bg.border = NA)

circos.genomicPosTransformLines(bed, 
    posTransform = function(region, value) 
        posTransform.text(region, y = 1, labels = value[[1]], 
            cex = 0.8, track.index = i_track+1),
    direction = "inside", track.index = i_track
)
circos.clear()
text(0, 0.05, "posTransform.text\ndirection = 'inside'", adj = c(0, 0))

##############################################################################
circos.par("start.degree" = 90, canvas.xlim = c(0, 1), canvas.ylim = c(0, 1), 
    gap.degree = 270, cell.padding = c(0, 0, 0, 0), track.margin = c(0.005, 0.005))
circos.initializeWithIdeogram(plotType = c("axis"), chromosome.index = "chr1")
circos.par(cell.padding = c(0, 0, 0, 0))
circos.genomicTrackPlotRegion(bed, ylim = c(0, 1), 
    panel.fun = function(region, value, ...) {
        circos.points( (region[[1]] + region[[2]])/2, rep(0.5, nrow(region)), pch = 16)
}, track.height = 0.02, bg.border = NA)

circos.genomicTrackPlotRegion(bed, ylim = c(0, 1), track.height = 0.1, bg.border = NA)
i_track = get.cell.meta.data("track.index")

circos.genomicTrackPlotRegion(bed, ylim = c(0, 1), 
    panel.fun = function(region, value, ...) {
        circos.genomicText(region, value, y = 1, labels.column = 1, facing = "clockwise", 
            adj = c(1, 0.5), posTransform = posTransform.text, cex = 0.8, 
            niceFacing = F, padding = 0.2)
}, track.height = 0.1, bg.border = NA)


circos.genomicPosTransformLines(bed, 
    posTransform = function(region, value) 
        posTransform.text(region, y = 1, labels = value[[1]], 
            cex = 0.8, track.index = i_track+1, padding = 0.2),
    direction = "inside", track.index = i_track
)
circos.clear()
text(0, 0.05, "posTransform.text\ndirection = 'inside'\npadding = 0.2", adj = c(0, 0))

par(op)


## End(Not run)

eilslabs/circlize documentation built on May 16, 2019, 1:23 a.m.