R/extractBAckbonePositions.R
extractBackbonePositions.Rd
Extract the positions from output of mdsPlot and used as the 'targetObj' for function create3dGenomicSignals
extractBackbonePositions(v3d_output)
The output of mdsPlot or view3dStructure for k=3.
An GRanges object with positions of x0, x1, y0, y1, z0 and z1.
library(GenomicRanges)
gi_nij <- readRDS(system.file("extdata", "nij.chr6.51120000.53200000.gi.rds",
package = "geomeTriD"))
range_chr6 <- GRanges("chr6", IRanges(51120000, 53200000))
geos <- mdsPlot(gi_nij, range = range_chr6, k = 3, render = "none")
#> Some region are missing from the input gi.
#> initial value 46.625959
#> iter 5 value 18.494050
#> iter 10 value 14.996469
#> iter 15 value 11.509102
#> iter 20 value 9.159639
#> iter 25 value 8.392723
#> iter 30 value 8.060898
#> iter 35 value 7.956958
#> final value 7.939262
#> converged
extractBackbonePositions(geos)
#> GRanges object with 1590 ranges and 6 metadata columns:
#> seqnames ranges strand | x0 x1 y0
#> <Rle> <IRanges> <Rle> | <numeric> <numeric> <numeric>
#> [1] chr6 51120000-51121332 * | 4.69581 4.63840 0.591892
#> [2] chr6 51121333-51122665 * | 4.63840 4.58312 0.660904
#> [3] chr6 51122666-51123999 * | 4.58312 4.52994 0.728016
#> [4] chr6 51124000-51125332 * | 4.52994 4.47881 0.793255
#> [5] chr6 51125333-51126665 * | 4.47881 4.42972 0.856648
#> ... ... ... ... . ... ... ...
#> [1586] chr6 53233334-53234666 * | -4.42611 -4.40511 3.72116
#> [1587] chr6 53234667-53235999 * | -4.40511 -4.38384 3.72535
#> [1588] chr6 53236000-53237333 * | -4.38384 -4.36228 3.72884
#> [1589] chr6 53237334-53238666 * | -4.36228 -4.34045 3.73161
#> [1590] chr6 53238667-53240000 * | -4.34045 -4.31835 3.73364
#> y1 z0 z1
#> <numeric> <numeric> <numeric>
#> [1] 0.660904 0.761382 0.878952
#> [2] 0.728016 0.878952 0.991275
#> [3] 0.793255 0.991275 1.098445
#> [4] 0.856648 1.098445 1.200557
#> [5] 0.918222 1.200557 1.297707
#> ... ... ... ...
#> [1586] 3.72535 0.334537 0.2793011
#> [1587] 3.72884 0.279301 0.2223325
#> [1588] 3.73161 0.222333 0.1636144
#> [1589] 3.73364 0.163614 0.1031305
#> [1590] 3.73492 0.103130 0.0408642
#> -------
#> seqinfo: 1 sequence from an unspecified genome; no seqlengths