generateMapSnvSel: Generate the filter SNP information file in RDS format

View source: R/process1KG.R

generateMapSnvSelR Documentation

Generate the filter SNP information file in RDS format

Description

The function applies a cut-off filter to the SNP information file to retain only the SNP that have a frequency superior or equal to the specified cut-off in at least one super population. The information about the retained SNPs is saved in a RDS format file. A RDS file containing the indexes of the retained SNP is also created.

Usage

generateMapSnvSel(cutOff = 0.01, fileSNV, fileLSNP, fileFREQ)

Arguments

cutOff

a single numeric value, the cut-off for the frequency in at least one super population. Default: 0.01.

fileSNV

a character string representing the path and file name of the bulk SNP information file from 1KG. The file must be in text format. The file must exist.

fileLSNP

a character string representing the path and file name of the RDS file that will contain the indexes of the retained SNPs. The file extension must be '.rds'.

fileFREQ

a character string representing the path and file name of the RDS file that will contain the filtered SNP information. The file extension must be '.rds'.

Details

The filtered SNP information RDS file (parameter fileFREQ), contains a data.frame with those columns:

  • CHROM a character string representing the chromosome where the SNV is located.

  • POS a character string representing the SNV position on the chromosome.

  • REF a character string representing the reference DNA base for the SNV.

  • ALT a character string representing the alternative DNA base for the SNV.\

  • EAS_AF a character string representing the allele frequency of the EAS super population.

  • AFR_AF a character string representing the allele frequency of the AFR super population.

  • AMR_AF a character string representing the allele frequency of the AMR super population.

  • SAS_AF a character string representing the allele frequency of the SAS super population.

Value

The integer 0 when successful.

Author(s)

Pascal Belleau, Astrid DeschĂȘnes and Alexander Krasnitz

Examples


## Needed package
library(withr)

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

## Demo SNV information file used as input
snvFile <- file.path(data.dir, "matFreqSNV_Demo.txt.bz2")

## Temporary output files
## The first file contains the indexes of the retained SNPs
## The second file contains the filtered SNP information
snpIndexFile <- local_file(file.path(data.dir, "listSNP_TEMP.rds"))
filterSNVFile <- local_file(file.path(data.dir, "mapSNVSel_TEMP.rds"))

## Create a data.frame containing the information of the retained
## samples (samples with existing genotyping files)
generateMapSnvSel(cutOff=0.01, fileSNV=snvFile,
    fileLSNP=snpIndexFile, fileFREQ=filterSNVFile)

## Remove temporary files
deferred_run()


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