Introduction to GWASinspector

Comprehensive, efficient and easy to use quality control of genome-wide association study results

2024-05-06

Overview

This vignette introduces the GWASinspector package, its general form and how to run the algorithm on multiple GWAS result files. Check our website for further information and reference data sets.

The manual for this package can also be accessed online from here.


Installation

  1. The easiest way to get GWASinspector is to install it from CRAN:

  2. Alternatively, you can use the installation function and zipped package from our website:


Required files

Allele reference panels

Comparing result files with an standard reference panel is the most important part of the QC process. This reference is used to check the alleles in the datasets and to ensure they are all in the same configuration (same strand, same coded alleles) in the post-QC data.

We have created databases from the most popular refernece panel (e.g. HapMap, 1000G, HRC) which are available from our website. Database files are in SQLite format and can be downloaded as a compressed file.

Some reference panels include more than one population. The target population which should be set as a parameter in the configuration file before running the algorithm.

The header-translation table

The column names used in the input may differ between files (e.g. one file uses EFFECT_ALLELE where another uses CODED_ALLELE). This file is a table of possible column names and their standard translations. A sample file with common names is provided in the package.

A sample file including common terms is provided as part of the package and could be used as a template. The file contains a two-column table, with the left column containing the standard column-names and the right the alternatives.

Configuration file

An INI file is used to configure the parameters for running the algorithm. See the manual for details.

Key-names and section-names should not be edited or renamed. Otherwise the algorithm will not work properly.

A sample file is included in the package which should be used as a template. File paths and QC parameters are set according to comments and examples in the file.


Step-by-step guide to run a QC

This walk-through explains how to run QC on a sample result file.

Step 1: make sure the package is installed correctly

After installation, try loading the package with the following command.

Step 2: check R environment

Local machine and R environment can be explored by running the following function.

Refer to the package dependency list in the manual for detail about mandatory and optional libraries.

Step 3: download the standard allele-frequency reference datasets

Standard allele-frequency reference datasets are available from our website. The database file should be decompressed and copied in the references folder [dir_references parameter of the config file].

This package supports both Rdata and SQLite database files (the later is recommended).

Step 4: get the header-translation table

A copy of this file can be copied to a local folder by running the below command. This is a text file which includes most common variable/header names and can be edited according to user specifications. This file should be copied in the references folder [dir_references parameter of the config file].

The default name of this file is alt_headers.txt.

header_translations field should be edited in the configuration file accordingly if this name is changed by user.

Step 5: get the configuration file

The configuration file is in plain text format and is used for setting the desired parameters for running the algorithm. A template file can be copied to local folder by running the following command.

The default name of this file is config.ini.

Step 6: modify the parameters in the configuration file

Please refer to the configuration file or package manual for full detail of parameters.

Parameters in this file are used for reading input files, analyzing the data and saving the reports. There are multiple lines of comment and information about each parameter (lines that start with # and ; are comments and sample possible parameters, respectively). You should only change the lines that contain a key according to your specific needs.

Step 7: run the QC function

The QC is configured by the configuration (ini) file, which is imported into R through setup_inspector and turned into an object of the Inspector class. To perform the QC, process the object with run_inspector. A quick scan of the results can be performed via result_inspector, but the primary outcome of the QC are the log files and graphs generated by run_inspector. An exhaustive log file indicating the progress and possible warnings is also saved which can be used for localization of any problems during this run.

Example:


Test run

You can run the algorithm on a sample GWAS file which is embedded in the package. Reports are generated and saved in the specified folder.

library(GWASinspector)
demo_inspector('/sample_dir')