# Mega2, the Manipulation Environment for Genetic Analysis

Mega2 is a data manipulation software for applied statistical genetics. Mega is an acronym for Manipulation Environment for Genetic Analysis.
The software allows the applied statistical geneticist to convert one's data from several input formats to a large number output formats suitable for analysis by commonly used software packages. In a typical human genetics study, the analyst often needs to use a variety of different software programs to analyze the data, and these programs usually require that the data be formatted to their precise input specifications. Conversion of one's data into these multiple different formats can be tedious, time-consuming, and error-prone. Mega2, by providing validated conversion pipelines, can accelerate the analyses while reducing errors.
Mega2 produces a common intermediate data representation using SQLite3, which enables the data to be accessed by other programs and languages. In particular, the Mega2R R package converts the SQLite3 data into R data frames. Several R functions are provided that illustrate how data can be extracted from the data frames for common R analysis, such as SKAT and pedgene. The key is being able to efficiently extract genotypes corresponding to chosen subsets of markers so as to facilitate gene-based association testing by automating looping over genes in the genome. Another function converts to VCF format and another converts the data to GenABEL format. For more information about the Mega2R package, see here.
Mega2 has been used to facilitate genetic analyses of a wide variety of human traits, including hereditary dystonia, Ehlers-Danlos syndrome, multiple sclerosis, and gliomas. A list of PubMed Central articles citing Mega2 can be seen here.
Mega2, which focusses on data reformatting, should not be confused with the MEGA, Molecular Evolutionary Genetics Analysis program, which focuses on molecular evolution and phylogenetics.

## Input file formats

Mega2 accepts input data in a variety of widely used file formats. These contain, at a minimum, data about the phenotypes, the marker genotypes, any family structures, and map positions of the markers.
| Input format | Description | Links |
| LINKAGE | pre-Makeped or post-Makeped formats | Linkage User Guide (PDF), LINKAGE format |
| Mega2 | simplified/augmented LINKAGE-format | Mega2 format |
| PLINK | ped format or binary bed format | PLINK documentation |
| VCF or BCF | Variant Call Format or Binary Variant Call Format | Variant Call Format (Wikipedia entry), BCF documentation |
| IMPUTE2 | IMPUTE2 GEN and BGEN Formats | IMPUTE2 documentation, GEN format, BGEN format |

## Output file formats

Mega2 supports conversion to the following output formats.
| Output format | Links |
| ASPEX format | ASPEX |
| Allegro format | |
| Beagle format | BEAGLE |
| CRANEFOOT format | CRANEFOOT |
| Eigenstrat format | EIGENSOFT |
| FBAT format | FBAT |
| GeneHunter format | GeneHunter |
| GeneHunter-Plus format | GeneHunter-Plus |
| IQLS/Idcoefs format | IQLS,Idcoefs |
| Linkage format | Linkage User Guide (PDF), LINKAGE format |
| Loki format | Loki |
| MaCH/minimac3 format | MaCH, minimac3 |
| MLBQTL format | MLB-QTL |
| Mega2 annotated format | Mega2 format |
| Mendel format | Mendel |
| Merlin format | Merlin |
| Merlin/SimWalk2-NPL format | Merlin SimWalk2 |
| PANGAEA MORGAN format | MORGAN |
| PAP format | PAP |
| PLINK format (bed, lgen, or ped formats) | PLINK |
| PREST format | PREST |
| PSEQ format | PSEQ |
| Pre-makeped LINKAGE format | Linkage User Guide (PDF), LINKAGE format |
| ROADTRIPS format | ROADTRIPS |
| SAGE format | SAGE, openSAGE |
| SHAPEIT format | SHAPEIT |
| SIMULATE format | SIMULATE |
| SLINK format | FASTSLINK |
| SOLAR format | SOLAR |
| SPLINK format | SPLINK |
| SUP format | SUP |
| SimWalk2 format | SimWalk2 |
| Structure format | Structure |
| VCF format | Variant Call Format (Wikipedia entry) |
| Vintage Mendel format | Vintage Mendel |
| Vitesse format | Vitesse |

## Documentation

The Mega2 documentation is available here in HTML format, and here in PDF format.