Difference between revisions of "Minimac2"
|Line 38:||Line 38:|
A good rule of thumb is that minimac2 should take about 1 hour to impute 1,000,000 markers in 1,000 individuals using a reference panel with 1000 haplotypes (>10x faster than [[minimac]]). Performance should scale linearly with respect to all these factors. So, your approximate computing time in hours should be about:
A good rule of thumb is that minimac2 should take about 1 hour to impute 1,000,000 markers in 1,000 individuals using a reference panel with 1000 haplotypes (>10x faster than [[minimac]] ). Performance should scale linearly with respect to all these factors. So, your approximate computing time in hours should be about:
Revision as of 02:07, 16 September 2014
minimac2 is an improved version of Minimac. It is designed to work on phased genotypes and can handle very large reference panels with hundreds or thousands of haplotypes. The name has two parts. The first, "mini", refers to the modest amount of computational resources it requires. The second, "mac", is short hand for MaCH, our widely used algorithm for genotype imputation.
There are several minimac(2) related pages on this wiki. The major ones are:
- Minimac2 - This page, the main minimac2 page.
- Minimac: Tutorial - A short minimac(2) tutorial.
- Minimac: 1000 Genomes Imputation Cookbook - Cookbook instructions for 1000 Genomes Imputation with Minimac(2)
- Minimac Command Reference - Summary of minimac(2) options
- Minimac Diagnostics - Summary of diagnostics for imputation performance generated by minimac(2)
- We are happy to run imputation (and pre-phasing) for you: try our Imputation server
- 1 Download
- 2 Performance
- 3 Getting Started
- 3.1 Estimating Haplotypes for Your Sample
- 3.2 Imputation into Phased Haplotypes
- 3.3 X Chromosome Imputation
- 4 Post-imputation Association Analysis
- 5 Reference
- 6 Questions and Comments
- 7 Related Pages
The current version of minimac2 should be stamped 2014.9.15 - if your version shows a different version number or date stamp when it runs, it is not current.
If you use this version, please be sure to stop by the MaCH download page and fill out the registration form, so that we can let you know when an official release is available and keep you updated with respect to any bug fixes.
Minimac2 comes in two flavours,
minimac2-omp. The latter version uses the OpenMP protocol to support multi-threading, resulting in faster throughput.
BE AWARE: since this version of minimac2 runs in parallel the order of samples in the output files (*dose, *haps,...) will vary between runs. Therefore, e.g. chunks have to be merged by sample id.
Questions and Comments
A good rule of thumb is that minimac2 should take about 1 hour to impute 1,000,000 markers in 1,000 individuals using a reference panel with 1000 haplotypes (>10x faster than minimac 2012.11.16). Performance should scale linearly with respect to all these factors. So, your approximate computing time in hours should be about:
These statistics refer to a single core in a modern Intel CPU core and, although your mileage will vary, most modern CPUs should be no more than a few times faster (or slower) than that.
If you are estimating model parameters at the same time as imputing missing genotypes, you can account for the time needed for parameter estimation with the following formula:
In this updated formula, Nrounds represents the number of iterations used for parameter refinement and Nstates represents the maximum number of reference and target haplotypes considered for each update.
Using minimac2 for genotype imputation involves two steps. First, you will have to estimate haplotypes for your entire sample -- this will be the more computationally demanding step. Once that is done, you will be ready to quickly impute missing genotypes using the reference panel of your choice.
Estimating Haplotypes for Your Sample
For the haplotyping step, you can use MaCH with the --phase command line option or ShapeIT. As input MaCH will need Merlin format pedigree and data files. All markers should be ordered according to their physical position and alleles should be labeled on the forward strand.
Preparing Your Data
Within each file, markers should be stored by chromosome position. Alleles should be stored in the forward strand and can be encoded as 'A', 'C', 'G' or 'T' (there is no need to use numeric identifiers for each allele).
If figuring out position and strand for each marker seems like hard work, don't despair. For you, this should be the hardest bit of the entire process! For the computer, the fun is about to start.
A typical MaCH command line to estimate phased haplotypes might look like this:
mach1 -d sample.dat -p sample.ped --rounds 20 --states 200 --phase --interim 5 --sample 5 --compact
This will request that MaCH estimate haplotypes for your sample, using 20 iterations of its Markov sampler and conditioning each update on up to 200 haplotypes. A summary description of these parameters follows (but for a more complete description, you should go to the MaCH website):
||Data file in Merlin format. Markers should be listed according to their order along the chromosome.|
||Pedigree file in Merlin format. Alleles should be labeled on the forward strand.|
||Number of haplotypes to consider during each update. Increasing this value will typically lead to better haplotypes, but can dramatically increase computing time and memory use. A value of 200 - 400 is typical.|
|| Iterations of the Markov sampler to use for haplotyping. Typically, using 20 - 30 rounds should give good results. To obtain better results, it is usually better to increase the |
||Request that intermediate results should be saved to disk periodically. These will facilitate analyses in case a run doesn't complete.|
||Request that random (but plausible) sets of haplotypes for each individual should be drawn every 5 iterations. This parameter is optional, but for some rare variant analyses, these alternative haplotypes can be very useful.|
||Tell MaCH to estimate phased haplotypes for each individual.|
||Reduce memory use at the cost of approximately doubling runtime. This option is recommended for most GWAS scale datasets and computing platforms.|
Imputation into Phased Haplotypes
Imputing genotypes using minimac2 is an easy and straightforward process: after selecting a set of reference haplotypes, plugging-in the target haplotypes from the previous step and setting the number of rounds to use for the model parameter estimation, imputation should proceed rapidly.
Creating SNP List File
Minimac2 requires a file listing markers in the haplotype file. This file can be easily generated by extracting the second column from the .dat file. In a standard Unix system, a command like this should do:
cut -f 2 -d " " sample.dat > target.snps
A typical minimac2 command line might look like this:
using a VCF reference panel
minimac2 --vcfReference --refHaps ref.vcf.gz --haps target.hap.gz --snps target.snps.gz --rounds 5 --states 200 --prefix results
Note: GWAS SNPs (file --snps target.snps.gz) are by default expected to be in the chr:pos format e.g. 1:1000 and on build37/hg19; otherwise, please set the --rs flag
A detailed description of all minimac2 options is available elsewhere. Here is a brief description of the above parameters:
||List of SNPs in the reference panel|
||Reference haplotypes (e.g. from MaCH download page)|
||This option specifies that the provided --refHaps file is provided in VCF format , no --refSNPs file needed.|
||In combination with --vcfReference, allows to use rs GWAS SNP identifiers|
||SNPs in phased haplotypes. These should largely be a subset of the SNPs in the reference panel.|
||Phased haplotypes where missing genotypes will be imputed.|
||Sample list in ShapeIT format.|
||ShapeIT phased haplotypes where missing genotypes will be imputed.|
||Chromosome for which we will carry out imputation (needed to run ShapeIT with chr:pos identifiers - default setting).|
||Rounds of optimization for model parameters, which describe population recombination rates and per SNP error rates.|
||Maximum number of reference (or target) haplotypes to be examined during parameter optimization.|
||Optionally, a string that is used to help generate output file names.|
Reference haplotypes generated by the 1000 Genomes project and formatted so that they are ready for analysis are available from the MaCH download page.
Imputation quality evaluation
To evaluate imputation quality, Minimac2 hides data for each genotyped SNP in turn and calculates 3 statistics:
- looRSQ - this is the estimated rsq for that SNP (as if SNP weren't typed).
- empR - this is the empirical correlation between true and imputed genotypes for the SNP. If this is negative, the SNP is probably flipped.
- empRSQ - this is the actual R2 value, comparing imputed and true genotypes.
These statistics can be found in the .info file
Additional Sources of Information
If you are especially interested in 1000 Genomes Imputation, then you should look at the Minimac: 1000 Genomes Imputation Cookbook.
X Chromosome Imputation
minimac2 supports the imputation of genotypes on the X chromosome (non-pseudo-autosomal part).
- Split the X chromosome pedigree file by sex.
- For females: follow the same protocol as for autosomes (phase with MaCH and impute with minimac2).
- For males
- Remove the pseudo-autosomal part (for build hg18: chrX:1-2709520 and chrX:154584238-154913754 ; for build hg19 chrX:60001-2699520 and chrX:154931044-155260560)
- Convert the pedigree file into a MaCH haplotype file (missing genotypes should be encoded as: "0" or "." or "N" ) and impute using minimac2 as described above.
- <Example of a male only pedigree file>
- FAM1003 ID1234 0 0 M A/A A/A C/C
- FAM1004 ID5678 0 0 M 0/0 C/0 G/G
- <End of pedigree file>
- Note that, consistent with the Merlin convention, hemizygous males are listed as if they were homozygous.
- <Example of the corresponding haplotype file>
- FAM1003->ID1234 HAPLO1 AAC
- FAM1003->ID1234 HAPLO2 AAC
- FAM1004->ID5678 HAPLO1 0CG
- FAM1004->ID5678 HAPLO2 0CG
- <End of the corresponding haplotype file>
Post-imputation Association Analysis
Please use mach2qtl.
Please use mach2dat. Versions 1.0.18 and above accommodate to minimac output.
If you use minimac or minimac2, please cite:
Howie B, Fuchsberger C, Stephens M, Marchini J, and Abecasis GR. Fast and accurate genotype imputation in genome-wide association studies through pre-phasing. Nature Genetics 2012 
Questions and Comments
If you are looking to learn about small computers made by Apple, Inc., you have come to the wrong page. Try looking at http://www.apple.com/macmini/, instead.
If you are looking for a low calorie version of the Big Mac sandwich, you'll be sad to know the Mini Mac has been discontinued. However, you are not the only one who likes the idea of a Mini Mac and you'll probably find some company on the web .