Skip to contents

This function generates the hexagonal object.

Usage

hex_binning(data, bin1 = 4, r2, q = 0.1)

Arguments

data

A tibble that contains embedding components.

bin1

Number of bins along the x axis.

r2

The ratio of the ranges of the original embedding components.

q

The buffer amount as proportion of data range.

Value

A object that contains numeric vector that contains binwidths (a1), vertical distance (a2), bins along the x and y axes respectively (bins), numeric vector that contains hexagonal starting point coordinates all hexagonal bin centroids (centroids), hexagonal coordinates of the full grid(hex_poly), embedding components with their corresponding hexagon IDs (data_hb_id), hex bins with their corresponding standardise counts (std_cts), total number of hex bins(tot_bins), number of non-empty hex bins (non_bins) and points within each hexagon (pts_bins).

Examples

scurve_umap_scaled_obj <- s_curve_obj$s_curve_umap_scaled_obj
lim1 <- scurve_umap_scaled_obj$lim1
lim2 <- scurve_umap_scaled_obj$lim2
r2 <- diff(lim2)/diff(lim1)
num_bins_x <- 4
hex_binning(data = s_curve_noise_umap_scaled, bin1 = num_bins_x,
r2 = r2, q = 0.1)
#> $a1
#> [1] 0.3098829
#> 
#> $a2
#> [1] 0.2683664
#> 
#> $bins
#> [1] 4 5
#> 
#> $start_point
#> [1] -0.10000000 -0.08849688
#> 
#> $centroids
#> # A tibble: 20 × 3
#>    hexID     c_x     c_y
#>    <int>   <dbl>   <dbl>
#>  1     1 -0.1    -0.0885
#>  2     2  0.210  -0.0885
#>  3     3  0.520  -0.0885
#>  4     4  0.830  -0.0885
#>  5     5  0.0549  0.180 
#>  6     6  0.365   0.180 
#>  7     7  0.675   0.180 
#>  8     8  0.985   0.180 
#>  9     9 -0.1     0.448 
#> 10    10  0.210   0.448 
#> 11    11  0.520   0.448 
#> 12    12  0.830   0.448 
#> 13    13  0.0549  0.717 
#> 14    14  0.365   0.717 
#> 15    15  0.675   0.717 
#> 16    16  0.985   0.717 
#> 17    17 -0.1     0.985 
#> 18    18  0.210   0.985 
#> 19    19  0.520   0.985 
#> 20    20  0.830   0.985 
#> 
#> $hex_poly
#> # A tibble: 120 × 3
#>    hex_poly_id       x         y
#>          <int>   <dbl>     <dbl>
#>  1           1 -0.1     0.0904  
#>  2           1 -0.255   0.000959
#>  3           1 -0.255  -0.178   
#>  4           1 -0.1    -0.267   
#>  5           1  0.0549 -0.178   
#>  6           1  0.0549  0.000959
#>  7           2  0.210   0.0904  
#>  8           2  0.0549  0.000959
#>  9           2  0.0549 -0.178   
#> 10           2  0.210  -0.267   
#> # ℹ 110 more rows
#> 
#> $data_hb_id
#> # A tibble: 3,750 × 4
#>     emb1   emb2    ID hb_id
#>    <dbl>  <dbl> <int> <int>
#>  1 0.270 0.839      1    14
#>  2 0.788 0.466      2    12
#>  3 0.771 0.319      3    12
#>  4 0.306 0.542      5    10
#>  5 0.549 0.806      6    15
#>  6 0.166 0.259      7     5
#>  7 0.672 0.596      9    15
#>  8 0.735 0.354     10    12
#>  9 0.839 0.467     11    12
#> 10 0.240 0.0903    12     6
#> # ℹ 3,740 more rows
#> 
#> $std_cts
#> # A tibble: 15 × 3
#>    hb_id     n std_counts
#>    <int> <int>      <dbl>
#>  1     2    98     0.179 
#>  2     3    36     0.0659
#>  3     5   132     0.242 
#>  4     6   463     0.848 
#>  5     7   425     0.778 
#>  6     8    77     0.141 
#>  7    10   236     0.432 
#>  8    11   181     0.332 
#>  9    12   545     0.998 
#> 10    13   284     0.520 
#> 11    14   519     0.951 
#> 12    15   546     1     
#> 13    16   130     0.238 
#> 14    18    62     0.114 
#> 15    19    16     0.0293
#> 
#> $tot_bins
#> [1] 20
#> 
#> $non_bins
#> [1] 15
#> 
#> $pts_bins
#> # A tibble: 15 × 2
#>    hb_id pts_list   
#>    <int> <list>     
#>  1     2 <int [98]> 
#>  2     3 <int [36]> 
#>  3     5 <int [132]>
#>  4     6 <int [463]>
#>  5     7 <int [425]>
#>  6     8 <int [77]> 
#>  7    10 <int [236]>
#>  8    11 <int [181]>
#>  9    12 <int [545]>
#> 10    13 <int [284]>
#> 11    14 <int [519]>
#> 12    15 <int [546]>
#> 13    16 <int [130]>
#> 14    18 <int [62]> 
#> 15    19 <int [16]> 
#> 
#> attr(,"class")
#> [1] "hex_bin_obj"