Skip to content

Instantly share code, notes, and snippets.

View drakaki's full-sized avatar

Alexandra Drakaki drakaki

View GitHub Profile
@drakaki
drakaki / multibed_intersect.R
Created May 24, 2024 13:31
Script to find intersections across multiple bed files and create an UpSet plot illustrating the number of regions shared between them.
# Script for identifying the number of overlaps between any number of bed files. Given a set of N bed files,
# the script will find all 2-, 3- and 4-way unions (if N=4 for example, it will identify 11 unions), as well as
# the unique coordinates of each bed file.
# Load packages
library(ggplot2)
library(stringi)
library(stringr)
library(valr)
## valr package supports bedtools functions in R