filter_space_loci: Filter loci based on their spacing

View source: R/filter_space_loci.R

filter_space_lociR Documentation

Filter loci based on their spacing

Description

A function to space loci based on a particular step size. For each chromosome (contig), starting from the first locus, each subsequent locus is assessed with respect to whether it is further than the step size from the previous locus. If a locus is not >= the step size, it will be skipped, and the next locus evaluated.

Usage

filter_space_loci(
  dat,
  chromCol = "CHROM",
  posCol = "POS",
  locusCol = "LOCUS",
  stepSize
)

Arguments

dat

Data.table: Contains the information on the genomic context of each locus, that is, their position and which chromosome/contig they reside on. You can pass this function a genotype data.table (e.g., as produced from vcf2DT()), because it will subset only the unique chromosome, position, and locus information. Must contain the columns:

  1. The chromosome/contig ID (see param chromCol).

  2. The positional information (see param posCol).

  3. The locus ID (see param locusCol).

chromCol

Character: The column name with the chromosome information. Default = 'CHROM'.

posCol

Character: The column name with the position information. Default = 'POS'.

locusCol

Character: The column name with the locus name information. Default = 'LOCUS'.

stepSize

Integer: the size of steps between loci.

Value

Returns a vector of loci IDs to be kept.


j-a-thia/genomalicious documentation built on Oct. 19, 2024, 7:51 p.m.