metaGE.collect: Collect the results of GWAS data from different files

View source: R/metaGEcollect.R

metaGE.collectR Documentation

Collect the results of GWAS data from different files

Description

This function merges files containing the summary statistics of GWAS in different environments (one file per environment).

Usage

metaGE.collect(
  FileNames,
  VariableNames,
  MinFreq = 0,
  DropDuplicates = TRUE,
  Verbose = FALSE,
  NA.rmv = TRUE
)

Arguments

FileNames

A list containing the file paths to merge (one trait only) or a list of such lists

VariableNames

A named list containing the column names in the original files corresponding to the variables : MARKER, CHR, POS, EFFECT, PVAL (optional: FREQ, ALLELE0, ALLELE1) ; or a list of such lists.

MinFreq

A numeric value allowing to filter markers based on the maf. (optional)

DropDuplicates

A boolean indicating whether duplicate markers should be removed or not. (TRUE by default)

Verbose

A boolean indicating whether progression messages should be printed or not. (FALSE by default)

NA.rmv

A boolean indicating if the NA should be removed or not (TRUE by default)

Details

Each file MUST contain the variables below:

  • MARKER: the marker name

  • CHR: the chromosome

  • POS: the position of the marker

  • EFFECT: the mean effect of the marker

  • PVAL: the pvalue

Each file might contain the variables:

  • FREQ: MAF

  • ALLELE0: Allele coding for allele 0

  • ALLELE1: Allele coding for allele 1

Value

A list with the following elements:

Data A tibble containing all the columns of interest of all the files from FileNames.
RemovedMarkers Same kind of tibble, but containing the markers that have been removed due to unclear allele coding, maf filtering or duplicates dropping.

Examples

require(dplyr)
require(tibble)
require(stringr)
RepData <- system.file("extdata", package = "metaGE")
# Get the complete list of association files
File.list <- list.files(RepData ,full.names = TRUE) %>%
            tibble(Names = .) %>%
            mutate(ShortNames = Names %>%
                  str_remove(pattern = paste0(RepData,"/")) %>%
                  str_remove(pattern = "_DF.txt"))  %>%
            select(ShortNames,Names) %>%
            deframe
###Build the dataset
## First provide the list of variable names
Names.list <- list(MARKER="Marker_Name",
                  CHR="Chromosome",
                  POS="Marker_Position",
                  FREQ="Maf",
                  EFFECT="SNP_Weight",
                  PVAL="Pvalue",
                  ALLELE0="Allele1",
                  ALLELE1="Allele2")

MinFreq <- 0.07

## Now collect
metaData <- metaGE.collect(File.list, Names.list,MinFreq = MinFreq)

metaGE documentation built on April 3, 2025, 8:48 p.m.