Skip to contents

This is a basic function for searching for CpGs in the vicinity of a given SNP.

Usage

findCpGsnearSNP(
  snp = stop("'snp' is required!", call. = FALSE),
  cpgs = stop("'cpgs' is required!", call. = FALSE),
  range = 5000,
  verbose = FALSE
)

Arguments

snp

A named list with the SNP's name ("marker"), chromosome no. ("chr") and coordinate ("coord").

cpgs

A list or data.frame containing all CpGs on the chromosome where the SNP is located. Must contain only two elements/columns: one named "id" (unique CpG locus cluster ID, cg#) and one named "coord" (coordinate of CpG locus).

range

An integer specifying the desired maximum number of base pairs between the given SNP and CpGs. The default is 5000. The search for CpGs is restricted to the interval (snp$coord - range, snp$coord + range).

verbose

Whether to print information about the result when available (default: FALSE).

Value

A data.frame with CpGs with columns named: "id", "coord".

Details

Given the position and chromosome number of a SNP, along with the positions of CpGs on the same chromosome, the function will return a data.frame with nearby CpGs (within a given number of base pairs).

**Please note** that you should ensure that every CpG in `cpgs` and the SNP in `snp` are located on the same chromosome.