genome_cluster {tidygenomics} | R Documentation |
Intersect data frames based on chromosome, start and end.
Description
Intersect data frames based on chromosome, start and end.
Usage
genome_cluster(x, by = NULL, max_distance = 0,
cluster_column_name = "cluster_id")
Arguments
x |
A dataframe. |
by |
A character vector with 3 entries which are the chromosome, start and end column.
For example: |
max_distance |
The maximum distance up to which intervals are still considered to be the same cluster. Default: 0. |
cluster_column_name |
A string that is used as the new column name |
Value
The dataframe with the additional column of the cluster
Examples
library(dplyr)
x1 <- data.frame(id = 1:4, bla=letters[1:4],
chromosome = c("chr1", "chr1", "chr2", "chr1"),
start = c(100, 120, 300, 260),
end = c(150, 250, 350, 450))
genome_cluster(x1, by=c("chromosome", "start", "end"))
genome_cluster(x1, by=c("chromosome", "start", "end"), max_distance=10)
[Package tidygenomics version 0.1.2 Index]