combine.pgs.bed: Combine PGS BED files

View source: R/convert-pgs-to-bed.R

combine.pgs.bedR Documentation

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
)

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.

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.

Examples

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);

ApplyPolygenicScore documentation built on April 4, 2025, 12:18 a.m.