identifyRelative: Identify genetically unrelated patients in GDS 1KG file

View source: R/process1KG.R

identifyRelativeR Documentation

Identify genetically unrelated patients in GDS 1KG file

Description

The function identify patients that are genetically related in the 1KG file. It generates a first RDS file with the list of unrelated patient. It also generates a second RDS file with the kinship coefficient between the patients.

Usage

identifyRelative(gds, maf = 0.05, thresh = 2^(-11/2), fileIBD, filePart)

Arguments

gds

an object of class SNPRelate::SNPGDSFileClass, a SNP GDS file.

maf

a single numeric representing the threshold for the minor allele frequency. Only the SNPs with ">= maf" will be used. Default: 0.05.

thresh

a single numeric representing the threshold value used to decide if a pair of individuals is ancestrally divergent. Default: 2^(-11/2).

fileIBD

a character string representing the path and file name of the RDS file that will be created. The RDS file will contain the kinship coefficient between the patients. The extension of the file must be '.rds'.

filePart

a character string representing the path and file name of the RDS file that will be created. The RDS file will contain the information about the 1KG patients that are unrelated. The file will contains two lists: the list of related samples, called rels and the list of unrelated samples, called unrels. The extension of the file must be '.rds'.

Value

NULL invisibly.

Author(s)

Pascal Belleau, Astrid DeschĂȘnes and Alexander Krasnitz

Examples


## Needed packages
library(withr)
library(gdsfmt)

## Path to the demo pedigree file is located in this package
data.dir <- system.file("extdata", package="RAIDS")

## Open existing 1K GDS file
GDS_file <- file.path(data.dir, "1KG_Demo.gds")
gdsFile <- snpgdsOpen(GDS_file)

## Temporary output files
## The first RDS file will contain the list of unrelated patients
## The second RDS file will contain the kinship information between patients
patientTmpFile <- local_file(file.path(data.dir,
    "unrelatedPatients_TEMP.rds"))
ibdTmpFile <- local_file(file.path(data.dir,"ibd_TEMP.rds"))

## Identify unrelated patients in 1KG GDS file
identifyRelative(gds=gdsFile, maf=0.05, thresh=2^(-11/2),
    fileIBD=ibdTmpFile, filePart=patientTmpFile)

## Close 1K GDS file
closefn.gds(gdsFile)

## Remove temporary files
deferred_run()



belleau/aicsPaper documentation built on Aug. 4, 2022, 1:12 a.m.