Learn R Programming

qgg (version 1.1.6)

ldscore: Compute LD (Linkage Disequilibrium) Scores for a Given Chromosome.

Description

This function calculates LD scores for the specified chromosome(s) based on genotypic data provided in `Glist`. The LD score quantifies the amount of Linkage Disequilibrium at a given SNP.

Usage

ldscore(
  Glist = NULL,
  chr = NULL,
  onebased = TRUE,
  nbytes = 4,
  cm = NULL,
  kb = NULL
)

Value

A list containing computed LD scores for each chromosome in the input.

Arguments

Glist

A list structure with genotypic data stored, including positions (`pos`), map information (`map`), rsids for LD calculation (`rsidsLD`), and LD file locations (`ldfiles`).

chr

A single chromosome or a vector of chromosomes for which LD scores need to be computed. Default is NULL, implying all chromosomes in `Glist` will be used.

onebased

Logical, if `TRUE`, the indexing of positions and other genomic information is 1-based. Default is `TRUE`.

nbytes

The size (in bytes) of each numeric value to read from the binary LD files. Default is 4.

cm

The threshold in centiMorgans for filtering LD values. Default is NULL.

kb

The threshold in kilobases for filtering LD values. Default is NULL. If specified, it will be converted to base pairs internally.

Details

The function computes the LD scores for each SNP by reading LD values from binary files stored in `Glist$ldfiles`. It can filter SNPs based on physical distance (`kb`) or genetic map distance (`cm`). If both `cm` and `kb` are NULL, all LD values are used in computation.