genome_cluster: Intersect data frames based on chromosome, start and end.

Description Usage Arguments Value Examples

View source: R/cluster.R

Description

Intersect data frames based on chromosome, start and end.

Usage

1
2
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: by=c("chr", "start", "end")

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

1
2
3
4
5
6
7
8
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)

Artjom-Metro/tidygenomics documentation built on April 16, 2021, 1:47 p.m.