Difference between revisions of "Minimac"

From Genome Analysis Wiki
Jump to: navigation, search
Line 185: Line 185:
 
### Remove the pseudo-autosomal part (for build hg18: chrX:1-2709520 and chrX:154584238-154913754 ; for build hg19 chrX:1-2709520 and chrX:154584238-154913754 )
 
### Remove the pseudo-autosomal part (for build hg18: chrX:1-2709520 and chrX:154584238-154913754 ; for build hg19 chrX:1-2709520 and chrX:154584238-154913754 )
 
### Convert the pedigree file into a MaCH haplotype file (missing genotypes should be encoded as:  "0" or "." or "N" )
 
### Convert the pedigree file into a MaCH haplotype file (missing genotypes should be encoded as:  "0" or "." or "N" )
 +
 +
  '''<Example of a pedigree file >'''
 +
  FAM1003  ID1234  0  0  M  A/0  A/0  C/0
 +
  FAM1004  ID5678  0  0  M  0/0  C/0  G/0
 +
  ...
 +
  '''<End of pedigree file>'''
 +
 +
 +
  '''<Example of a phased haplotype file>'''
 +
  FAM1003->ID1234 HAPLO1 AAC
 +
  FAM1003->ID1234 HAPLO2 AAC
 +
  FAM1004->ID5678 HAPLO1 0CG
 +
  FAM1004->ID5678 HAPLO2 0CG
 +
  ...
 +
  '''<End of phased haplotype file>'''
 +
 
### Impute using minimac as described above.
 
### Impute using minimac as described above.
  

Revision as of 21:37, 13 December 2010

minimac is a low memory, computationally efficient implementation of the MaCH algorithm for genotype imputation. 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.

Download

A full release of minimac is expected here soon. In the meantime, a binary only Linux version of minimac is available from here for those who are willing to test pre-release software. If you use this beta 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.

Multiprocessor Version

The current version of minimac comes in two flavours, minimac and minimac-omp. The latter version uses the OpenMP protocol to support multi-threading, resulting in faster throughput.

Questions and Comments

Please contact Goncalo Abecasis or Christian Fuchsberger.

Performance

Pre-phasing

For the pre-phasing step the cost for increasing the number of states is quadratically and the cost for additional rounds is linear.

States Cost per round
100 states 3 min
200 states 12 min = (3 min * 2^2)
400 states 48 min = (3 min * 4^2)
500 states 75 min = (3 min * 5^2)
500 states 10 rounds = 75 min * 10 = 750 min

Imputation

A good rule of thumb is that minimac should take about 1 hour to impute 1,000,000 markers in 1,000 individuals using a reference panel with 100 haplotypes. Performance should scale linearly with respect to all these factors. So, your approximate computing time in hours should be about:


E(\mbox{Run Time in Hours}) = N_{markers} * N_{individuals} * N_{haplotypes} * 10^{-11}

These statistics refer to Intel X7460 CPU running at 2.66 GHz using 1 core and your mileage may 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:


E(\mbox{Run Time in Hours}) = N_{markers} * ({N_{individuals} + N_{rounds} * N_{states} * 0.75 }) * N_{haplotypes} * 10^{-11}

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.

Getting Started

Using minimac 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, we current recommend using MaCH with the --phase command line option. 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

To get started, you will need to store your data in Merlin format pedigree and data files, one per chromosome. For details, of the Merlin file format, see the Merlin Tutorial.

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).

We recommend that, if at all possible, you should phase your chromosomes according to NCBI build 37. Future releases of the 1000 Genomes Reference panel and other public sets of reference haplotypes are expected to use this genome build.

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.

NCBI build 36 / NCBI build 37

The 1000G June reference panel is on build 36, future 1000G reference panels will be on build 37. This has also some impact on the pre-phasing: your data must be on the corresponding build, or in other words, all SNPs must be ordered correctly based on the used build. Therefore, if you want to use your pre-phased data to impute into NCBI build 36 and NCBI build 37 reference panels, you have to exclude all SNPs that change order between builds.


Here we will provide exclusions list for various genotyping platforms:


Running MaCH

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):

Parameter Description
-d sample.dat Data file in Merlin format. Markers should be listed according to their order along the chromosome.
-p sample.ped Pedigree file in Merlin format. Alleles should be labeled on the forward strand.
--states 200 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 100 - 400 is typical.
--rounds 20 Iterations of the Markov sampler to use for haplotyping. Typically, using 20 - 100 rounds should give good results. To obtain better results, it is usually better to increase the --states parameter.
--interim 5 Request that intermediate results should be saved to disk periodically. These will facilitate analyses in case a run doesn't complete.
--sample 5 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.
--phase Tell MaCH to estimate phased haplotypes for each individual.
--compact 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 minimac is an easy 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.

Running Minimac

A typical minimac command line might look like this:

 minimac --refHaps ref.hap.gz --refSnps ref.snps.gz --haps target.hap.gz --snps target.snps.gz --rounds 5 --states 200 --prefix results

A detailed description of all minimac options is available elsewhere. Here is a brief description of the above parameters:

Parameter Description
--refSnps ref.snps.gz List of SNPs in the reference panel
--refHaps ref.hap.gz Reference haplotypes (e.g. from MaCH download page)
--snps target.snps.gz SNPs in phased haplotypes. These should largely be a subset of the SNPs in the reference panel.
--haps target.hap.gz Phased haplotypes where missing genotypes will be imputed.
--rounds 5 Rounds of optimization for model parameters, which describe population recombination rates and per SNP error rates.
--states 200 Maximum number of reference (or target) haplotypes to be examined during parameter optimization.
--prefix imputed Optionally, a string that is used to help generate output file names.

Reference Haplotypes

Reference haplotypes generated by the 1000 Genomes project and formatted so that they are ready for analysis are available from the MaCH download page. The most recent set of haplotypes are based on genotype calls from August 2010.

Imputation quality evaluation

Minimac drops each of the genotyped SNPs in turn and then 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

X Chromosome Imputation

minimac supports the imputation of genotypes on the X chromosome (non-pseudo-autosomal part).

  1. Split the X chromosome pedigree file by sex.
    1. For females: follow the same protocol as for autosomes (phase with MaCH and impute with minimac).
    2. For males
      1. Remove the pseudo-autosomal part (for build hg18: chrX:1-2709520 and chrX:154584238-154913754 ; for build hg19 chrX:1-2709520 and chrX:154584238-154913754 )
      2. Convert the pedigree file into a MaCH haplotype file (missing genotypes should be encoded as: "0" or "." or "N" )
 <Example of a pedigree file >
 FAM1003   ID1234  0   0   M   A/0   A/0   C/0
 FAM1004   ID5678  0   0   M   0/0   C/0   G/0
 ...
 <End of pedigree file>


 <Example of a phased haplotype file>
 FAM1003->ID1234 HAPLO1 AAC
 FAM1003->ID1234 HAPLO2 AAC
 FAM1004->ID5678 HAPLO1 0CG
 FAM1004->ID5678 HAPLO2 0CG
 ...
 <End of phased haplotype file>
      1. Impute using minimac as described above.


Related Pages

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 [1].