Learn R Programming

ApplyPolygenicScore (version 4.0.1)

combine.pgs.bed: Combine PGS BED files

Description

Merge overlapping PGS coordinates in multiple BED files.

Usage

combine.pgs.bed(
  pgs.bed.list,
  add.annotation.data = FALSE,
  annotation.column.index = 4,
  slop = 0
)

Value

A data.frame containing the merged PGS coordinates in BED format with an extra annotation column containing the name of the PGS and data from one additional column optionally selected by the user.

Arguments

pgs.bed.list

A named list of data.frames containing PGS coordinates in BED format.

add.annotation.data

A logical indicating whether an additional annotation data column should be added to the annotation column.

annotation.column.index

An integer indicating the index of the column in the data frames in pgs.bed.list that should be added to the annotation column.

slop

An integer indicating the number of base pairs to add to the BED interval on either side.

Examples

Run this code
bed1 <- data.frame(
    chr = c(1, 2, 3),
    start = c(1, 2, 3),
    end = c(2, 3, 4),
    annotation = c('a', 'b', 'c')
    );
bed2 <- data.frame(
    chr = c(1, 2, 3),
    start = c(1, 20, 30),
    end = c(2, 21, 31),
    annotation = c('d', 'e', 'f')
    );
bed.input <- list(bed1 = bed1, bed2 = bed2);
combine.pgs.bed(bed.input);

Run the code above in your browser using DataLab