<title>Background</title> <p>The identification of molecular markers (mutations) associated with drug resistance in <italic>P. falciparum</italic>, and the ability to detect these markers in the blood of infected people, means that large-scale population surveys can be used to infer the likely efficacy of antimalarial drug treatment regimes [##REF##14506209##2##]. This allows their use in large scale surveillance surveys [##REF##11703843##3##]. These surveys measure, and generally report, the prevalence of the marker i.e. the proportion of patient blood samples in which the marker is detected. This is clinically-useful information (it is related to a patient's probability of failing drug treatment) but it is less appropriate as a public health surveillance tool. It is the frequency of the drug resistant mutation, defined as the proportion of parasite clones in which the marker is present, and the rate at which it is increasing which determines the likely time before a drug becomes ineffective and requires replacement. Prevalence and frequency may differ markedly because several parasites clones often simultaneously co-infect the same patient: for example if patients have three clones (a 'multiplicity of infection' (MOI) of three) the frequency of the mutation among the parasites may be 10% but among patients its prevalence will be almost three times higher ≈ 3 × 10% = 30% because each clone has a chance of bearing the marker (the true value, assuming statistical independence of clones, is actually 1-(1-0.1)^3 = 0.27 = 27%).</p> <p>This has several consequences: (a) Prevalences depend on MOI so, unlike frequency, they are not directly comparable across regions with different epidemiology (Figure ##FIG##0##1##); (b) Prevalences have different dynamics compared to frequency: they increase rapidly in the early spread of resistance but less slowly at later times (Figure ##FIG##0##1##); (c) The selection coefficient driving resistance is a key population genetic measurement but can only be estimated from a time series of frequency data [##REF##15878153##4##].</p> <p>A further drawback of using prevalences is that they do not measure the frequencies with which combinations of alleles, (haplotypes) occur together in the same parasite. It is these haplotype frequencies that most directly measure the probability that a parasite is genetically resistant. For example, mutations in codons 51, 59 and 108 in <italic>dhfr </italic>all affect a parasite's ability to survive treatment with antifolate drugs (reviewed in [##REF##11756042##5##]), and the probability that parasites will survive in a mixed infection depends on whether these mutations are present in the same genome or not. The prevalences of mutations at each codon cannot be directly translated into haplotype frequencies. For example, a patient may be infected by two malaria clones and genotyping reveals the presence of only mutants at position 108 and the presence of both mutant and wildtype at positions 51 and 59; consequently, it is impossible from these data to distinguish whether the clones are (i) mutant at 108 in one clonal haplotype and mutant at 108+51+59 in the other haplotype, or (ii) mutant at 108+51 in one clone haplotype and mutant at 108+59 in the other haplotype. The situation becomes even more complex as MOI increases.</p> <p>Statistical approaches for estimating gene and haplotype frequencies in the presence of uncertainty use Maximum Likelihood methodology and are described in standard population genetic textbooks such as Hartl &amp; Clark [##UREF##1##6##]) and in journal reviews such as Williams &amp; Dye [##REF##15275519##7##]). This approach was used by Hill and Babiker [##UREF##2##8##] to estimate MOI in blood samples from Tanzania. If the MOI is known, then estimation of allele frequencies for resistance markers in malaria is analogous to that of estimating frequencies from phenotype data in a polyploid organism, where the MOI is equivalent to the ploidy. Such estimates have been reported in a study of chloroquine resistance markers in Tanzania [##REF##12798014##9##] and software for carrying out such estimation is available at [##UREF##3##10##].</p> <p>The problem of estimating haplotype frequencies from such ambiguous genetic data is somewhat more complicated. An appropriate method is, once again, to use ML methodology. In essence the ML approach is to initially guess the frequency of haplotypes, measure how consistent these frequencies are with the observed prevalence of combinations of mutations in the blood samples, and continue changing and improving estimated values of haplotype frequencies until they provide the best match to the data. This paper describes a freely-available computer programme that uses these techniques to estimate both allele and/or haplotype frequencies from prevalence data. It has two main advantages over existing methodologies.</p> <p>Firstly, it can simultaneously analyse all the samples in a dataset irrespective of their levels of MOI/ploidy. Haplotypes can be directly observed in samples with only a single infection i.e. where MOI is 1. Samples with MOI of 2 are diploid (the sample contains two haplotypes) and haplotype frequencies could be inferred in this subset of the data using existing software (e.g. [##REF##17980034##11##]) designed to analyse samples from diploid organisms such as humans, mice, drosophila (where, obviously, one haplotype comes from the mother and one from the father). To our knowledge no software exists to infer haplotype frequencies where ploidy (MOI) exceeds 2 and our software is explicitly designed to allow this. Our software therefore allows simultaneous analysis of the entire dataset including samples where MOI exceeds 2.</p> <p>Secondly, existing methods for estimating frequency at a single SNP in malaria samples (e.g. [##UREF##2##8##,##REF##12798014##9##] cited above) assume perfect information of the constituent haplotypes. For example, if a sample contains four haplotypes of type 'A' and 1 of type 'B' then these analyses assume the sample would be correctly genotyped as 'AB'. In practice 'minor genotypes' are often not detected and the sample would be misclassified as type 'A'. This non-detection may be due to the minor clone signal being swamped during PCR amplification and/or because many genotyping protocols state that 'minor signals' (e.g. "genotypes returning a signal less than 20% of the largest peak") be ignored; both situations result in a 'mixed' genotype infection being erroneously recorded as single genotype. Our programme allows this effect to be incorporated into the analysis and again, to the best of knowledge, is unique in this respect.</p> <p>The programme is designed to be flexible and could be used to analyse similar genetic datasets obtained from other organisms whose samples vary in ploidy. Analysis of samples containing multiple genotypes of other infectious agents is the obvious example, but whole organisms which vary in ploidy level could also be analysed using our approach. However the software was specifically designed to analyse malaria in blood samples and herein will only be discussed within this context.</p>
<title>Methods</title> <p>The programme was written in C for ease of portability across PC, Macintosh and UNIX computer operating systems. A comprehensive users' manual accompanies the programme [see Additional File ##SUPPL##0##1##] and gives greater details of the underlying methodology as well as details on how to run the programme, interpret the data, and more general advice on decisions that have to be made is setting up the analysis. The programme (PC version) and manual can be freely downloaded from [##UREF##0##1##] and the basic format of input and output is shown on Figure ##FIG##1##2##.</p> <p>The programme will estimate haplotype frequencies defined by mutations at up to three codons. This limit was dictated by the fact that the complexity of the calculations rises exponentially with the number of codons. For example, analysis of haplotypes defined at 3 codons has to consider 3<sup>3 </sup>= 27 blood-sample phenotypes and estimate 2<sup>3 </sup>= 8 haplotype frequencies, while extending the analysis to haplotypes defined at 5 codons requires considering 3<sup>5 </sup>= 243 blood-sample phenotypes and estimating 2<sup>5 </sup>= 32 haplotype frequencies. A further reason for limiting haplotype definitions to a maximum of three codons is because it is rarely necessary in practice to analyse more than three codons simultaneously. For example, mutations in <italic>dhfr </italic>invariably accumulate in sequence, first at codon 108, then 51 or 59 then at 164 so if analysing the frequency of haplotypes containing the 164 mutation, it can be safely assumed that all haplotypes containing the 164 mutation are also mutant at codon 108 (and probably also mutant at positions 51 at 59), so codon 108 can be omitted from the analysis. Note also that if a haplotype of interest is defined at separate, unlinked genes such as <italic>dhfr </italic>+ <italic>dhps </italic>(e.g. the <italic>dhfr</italic>108+51+59 with <italic>dhps</italic>437+540 'quintuple' mutant haplotype) or <italic>crt76</italic>+<italic>mdr86 </italic>haplotype, it is unnecessary to estimate the frequency of haplotypes defined by both loci: it is invariably sufficient to estimate the haplotypes at each locus separately and then assume linkage equilibrium between the loci (this is discussed in more detail in the programme user notes).</p> <title>Algorithm</title> <p>The programme is initialised internally by generating random haplotype frequency estimates and employs a 'hill climbing' routine to improve these estimates until it arrives at the ML estimate of haplotype frequencies. The estimated frequency of each haplotype is then systematically varied from its ML estimate and its 95% confidence interval (technically, a 95% support interval) is defined by the points at which the Log likelihood falls 2 units below the ML value [##UREF##2##8##].</p> <p>The Log Likelihood appropriate for any given combination of parameter estimates is obtained as follows, using the haplotype and phenotype coding described in Figure ##FIG##1##2##. The programme considers each possible MOI in turn and cycles through all the combinations of the eight haplotypes that can occur within that MOI. For example, if MOI = 5, one possible combination would be 3 haplotypes of type [1][1][1] (i.e. mutant at all codons), 1 haplotypes of type [0][1][1] (i.e. wildtype at codon 1, mutant at codons 2 and 3) and 1 haplotypes of type [1][1][0] (i.e. mutant at codons 1 and 2, wildtype at codon 1). This would result in a blood sample phenotypes of [1][2][1][5] i.e. wildtype and mutants present at codon 1, only mutant at codon 2, wildtype and mutants present at codon 3, with MOI of 5. The probability of getting this combination is obtained from the multinomial distribution i.e.</p> <p></p> <p>where <italic>x</italic>, <italic>y</italic>, <italic>z </italic>are the current estimates for the frequencies of haplotypes [1][1][1], [0][1][1] and [1][1][0] respectively and the multinomial coefficient is</p> <p></p> <p>A running total of probabilities of observing the various blood phenotypes is kept stored in an array prob [<italic>p</italic>] [<italic>q</italic>] [r] [<italic>s</italic>] where the final index, <italic>s</italic>, is MOI. So in the above example the running total kept in prob[1][2][1][5] would be incremented by the solution of Equation 1.</p> <p>This is a very flexible approach because it examines each possible combination of clone haplotypes and works out the resulting phenotype that would be <underline>observed</underline> in the dataset rather than the true phenotype. So if, for example, minority clones are missed during the genotyping this is where the effect is incorporated. In the above example, assume clones present at frequency less than 0.33 in the sample are missed in the genotyping (this value is user-defined) then the 'true' phenotype [1][2][1][5] would actually be observed as [2][2][2][5] because the single clones with wildtype at codons 1 and 3 are below the detection limit of 0.33; consequently the value of prob[2][2][5][5] (rather than [1][2][1][5]) would be incremented by the solution of Equation 1.</p> <title>Testing</title> <p>The programme has been used to estimate one-, two- and three-codon haplotypes on 16 unpublished datasets collected from Papua New Guinea (PNG) and Tanzania; each was subject to 7 separate analyses (spread over 4 loci: <italic>crt</italic>, <italic>mdr</italic>, <italic>dhfr </italic>and <italic>dhps</italic>), making 112 analyses in total. The programme ran smoothly, correctly identified inconsistencies in the data (e.g. identified samples encoded as having mixed mutant/wildtype infections in a single-clone infection) and gave sensible output. More specific and stringent testing was done in three parts.</p> <p>A routine was built into the programme to simulate a dataset of the same type and size being analysed. The routine records exactly how many haplotypes of each type enter into the simulated dataset, ensuring the 'true' haplotype frequencies are known in the simulated dataset. It then invokes the main programme to see how well it estimates these 'true' simulated frequencies and whether the 'true' values fall within the 95% confidence interval. The user can command the programme to do this numerous times (e.g. 1,000) to check the programme accuracy: it prints out 'true' frequency, estimated frequency with 95% confidence intervals (CI) and whether the 'true' frequency falls within the 95% CI. At the end of the process it prints out how often the 'true' frequencies fall within the 95% CI. Obviously if the programme is working well this should happen about 95% of the time, and this was observed to be the case.</p> <p>Single codon haplotype frequencies were available for 32 of the PNG/Tanzania analyses (the 16 datasets each analysed at <italic>crt</italic>76 and <italic>mdr</italic>86). These were obtained using a different algorithm and software (a Bayesian approach using WinBugs [##REF##12798014##9##]). Both our analyses gave the same results. Extending the analysis to 2- and 3-codon haplotypes in MalHaploFreq were consistent with the single codon results in two important respects. Firstly, if there was no genetic variation at the additional codons then only two haplotypes were identified with frequencies identical to the one-locus results (although CI were slight larger). Secondly, if genetic variation was present at the additional codons then summing estimated haplotypes into two classes, corresponding to the single-codon haplotypes, gave identical frequencies.</p> <p>The programme has an option to run the analyses numerous times from different starting frequencies. The starting frequencies used to initialise the program are generated at random and updated and improved to converge on final estimates. There is no guarantee that the programme will always converge on the same set of estimated frequencies, so it is important that the user can test that this is the case.</p>
<title>Results</title> <p>Extensive analyses of simulated datasets revealed that the 95% confidence limits were correctly estimated i.e. that the 'true' frequencies in the simulated datasets fell within the 95% CI in more than 95% of analyses. In fact around 98% to 99% of true frequencies fell within the 95% CI, presumably because the approximation used by maximum likelihood to calculate confidence intervals (i.e. a drop in 2 log likelihood units) is conservative. The 95% CI therefore err on the side of caution by being slightly too wide.</p> <p>The 112 PNG and Tanzanian analyses were each re-analysed from 1000 initial haplotype frequency estimates to check that all 1000 re-analyses converged on the same estimates of haplotype frequency. There was one instance (in a three-codon analysis) where there appeared to be two points of convergence, the analysis converging on a single peak of lower LL in approximate 10% of the runs while the remainder converged on a peak of higher LL in the remaining 90% of cases. The differences in estimated frequencies were large, one estimated haplotype frequency increasing from 0.37 to 0.5 with a corresponding fall from 0.47 to 0.33 in the other main haplotype. Such 'false peaks' are rare in ML analyses but do occur. There is an option built into MalHaploFreq to check convergence from a user-defined number of different starting frequencies and users are strongly recommended to perform this check.</p>
<title>Discussion</title> <p>The programme appears to perform well in estimating haplotype frequencies from both field and simulated datasets. It reads input parameters from a separate file rather than from a graphical interface and an example of an input file is provided on Figure ##FIG##2##3##. The advantage of this strategy is that analyses can be automated into batch files. For example part of a DOS batch file may read as follows:</p> <p>del MHFdatafile.txt</p> <p>del MHFparameters.txt</p> <p>copy VillageAdatafile.txt MHFdatafile.txt</p> <p>copy VillageAparameters.txt MHFparameters.txt</p> <p>MalHaploFreq.exe &gt; VillageAoutput.txt</p> <p>The first two lines delete the default data and input parameter files. The next two lines copy the data for Village A into the default MalHaploFreq datafile (see Figure ##FIG##1##2##) and copy the required parameters for analysing Village A into the default parameter file (Figure ##FIG##2##3##). The final line runs MalHaploFreq.exe and dumps the screen output (using the '&gt;' command) into an appropriately-named output file for future reference. A typical project will require many separate ML analyses, for example, many villages analysed at several loci with 1, 2, or 3 codons being analysed. Each analysis can be included in an automated analysis simply by setting up the data and parameter files required for each analysis and copying, pasting and editing this blocks of 5 lines into a larger DOS batch file.</p> <p>This automation has two large advantages. Firstly, the analyses can be initially run rapidly with low levels of precision primarily to check the analyses proceed correctly and that any inconsistencies in the data identified by the program can be corrected. Contemporary methodology (such as genotyping chips) often produces large amounts of data on different loci and inconsistencies identified in one analysis can alter results obtained in the other; a common experience was to find that MOI was originally encoded as 1, indicating that a single clone was present, but later analysis of other loci revealed some codons to be mixed wildtype+mutant indicating that at least 2 clones must be present. The datasets could then be checked and revised if required (so that MOI &gt; 1) and the automated analysis easily repeated. The second advantage comes after the datasets are cleaned and ready for the definitive analyses. High levels of precision in frequency estimates and CI require considerable computer time, and there are associated computer-intensive checks to be made, particularly checking that the programme convergences on the same solution from numerous starting parameter values (1000 is recommended). The most convenient way of running these analyses is to download them onto a spare computer (typically a laptop) and leave an automated analysis ruining over the required period (for example, it required three weeks to perform and check the 112 PNG and Tanzanian analyses).</p>
<title>Conclusion</title> <p>The use of molecular markers to track the spread of drug resistance and to guide policy requires that the frequency of mutations and haplotypes be calculated rather than their prevalence. An appropriate method to estimate their frequencies from blood sample data is by Maximum Likelihood techniques. This paper describes a flexible, freely downloadable computer program which implements this approach.</p>
<p>This is an Open Access article distributed under the terms of the Creative Commons Attribution License (<ext-link ext-link-type="uri" xlink:href="http://creativecommons.org/licenses/by/2.0"/>), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.</p> <title>Background</title> <p>Molecular markers, particularly those associated with drug resistance, are important surveillance tools that can inform policy choice. People infected with <italic>falciparum </italic>malaria often contain several genetically-distinct clones of the parasite; genotyping the patients' blood reveals whether or not the marker is present (i.e. its prevalence), but does not reveal its frequency. For example a person with four malaria clones may contain both mutant and wildtype forms of a marker but it is not possible to distinguish the relative frequencies of the mutant and wildtypes i.e. 1:3, 2:2 or 3:1.</p> <title>Methods</title> <p>An appropriate method for obtaining frequencies from prevalence data is by Maximum Likelihood analysis. A computer programme has been developed that allows the frequency of markers, and haplotypes defined by up to three codons, to be estimated from blood phenotype data.</p> <title>Results</title> <p>The programme has been fully documented [see Additional File ##SUPPL##0##1##] and provided with a user-friendly interface suitable for large scale analyses. It returns accurate frequencies and 95% confidence intervals from simulated dataset sets and has been extensively tested on field data sets.</p> <title>Conclusion</title> <p>The programme is included [see Additional File ##SUPPL##1##2##] and/or may be freely downloaded from [##UREF##0##1##]. It can then be used to extract molecular marker and haplotype frequencies from their prevalence in human blood samples. This should enhance the use of frequency data to inform antimalarial drug policy choice.</p>
<title>Authors' contributions</title> <p>IH designed the algorithm and wrote the programme. IH and TS tested it against field data and co-wrote the manuscript.</p> <title>Supplementary Material</title>
<title>Acknowledgements</title> <p>We thank Tiago Antao, Marcel Hommel and an anonymous referee for comments on the computer programme and Kefas Mugittu, Jutta Marfurt, Blaise Genton, Ingrid Felger and Hans-Peter Beck for access to unpublished datasets from Tanzania and Papua New Guinea. This work was supported by Bill &amp; Melinda Gates Foundation project #39777 and the Liverpool School of Tropical Medicine.</p>
<fig position="float" id="F1"><label>Figure 1</label><caption><p><bold>How prevalence depends on frequency and multiplicity of infection (MOI)</bold>. The marker has a 10% selective advantage over the wildtype form and its frequency is increasing over time. The corresponding prevalence of the marker is shown over the same time scale assuming each human in the population contains either 2, 3, or 5 malaria clones (MOI = 2,3,5).</p></caption></fig> <fig position="float" id="F2"><label>Figure 2</label><caption><p><bold>Input and output formats for MalHaploFreq</bold>. (A) Input file format. Each line corresponds to a single blood sample. The first three indices are phenotypes at up to three codons where "0" indicates only wildtype is present, "2" mean only mutant are present,"1" means both wildtype and mutations are present. The fourth index is the multiplicity of infection (MOI). Assuming, for example, that <italic>dhfr </italic>is being analysed and that codons 1,2 and 3 represent positions 51, 59 and 108 respectively, then the first sample has only wildtype at position 51, only mutants at positions 59 and 108, and its MOI = 3. The second sample has only wildtype at position 51, has both wildtype and mutant and position 59, only mutant at position 108, and its MOI = 4. And so on throughout the input dataset. Missing data are indicated as '99' in the indices. (B) Output format. The indices represent codon genotypes, the first corresponding to codon 1, the second to codon 2 and the third to codon 3; within these brackets, "0" indicates wiltype and "1" indicates mutant. Assuming, as above, that <italic>dhfr </italic>is being analysed and that codons 1,2 and 3 represent positions 51, 59 and 108 respectively, then a haplotype mutant at only position 108 is encoded [0][0][1] and its estimated frequency is 3% with 95% CI of 1% to 8%. The 'double' mutant haplotype with mutations at positions 59 and 108 is encoded [0][1][1] and its estimated frequency is 86% with 95% CI of 79% to 92%. And so on.</p></caption></fig> <fig position="float" id="F3"><label>Figure 3</label><caption><p><bold>Example parameter file for MalHaploFreq</bold>. Parameters required to run MalHaploFreq are read from an external file 'MHFparameters.txt' in the following format. Descriptions for the parameter values are provided to the right of the arrow and are self-explanatory. The parameter values are to the left of the arrow; for example, the first parameter instructs MalHaploFreq to investigate haplotypes defined at only a single codon.</p></caption></fig>
<disp-formula id="bmcM1"><label>(1)</label><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" id="M1" name="1475-2875-7-130-i1" overflow="scroll"><mml:semantics><mml:mrow><mml:mrow><mml:mo>(</mml:mo><mml:mtable columnalign="left"><mml:mtr><mml:mtd><mml:mn>5</mml:mn></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mn>3</mml:mn><mml:mo>,</mml:mo><mml:mn>1</mml:mn><mml:mo>,</mml:mo><mml:mn>1</mml:mn></mml:mtd></mml:mtr></mml:mtable><mml:mo>)</mml:mo></mml:mrow><mml:msup><mml:mn>3</mml:mn><mml:mi>x</mml:mi></mml:msup><mml:msup><mml:mn>1</mml:mn><mml:mi>y</mml:mi></mml:msup><mml:msup><mml:mn>1</mml:mn><mml:mi>z</mml:mi></mml:msup></mml:mrow></mml:semantics></mml:math></disp-formula> <disp-formula><mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" id="M2" name="1475-2875-7-130-i2" overflow="scroll"><mml:semantics><mml:mrow><mml:mrow><mml:mo>(</mml:mo><mml:mtable columnalign="left"><mml:mtr><mml:mtd><mml:mn>5</mml:mn></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mn>3</mml:mn><mml:mo>,</mml:mo><mml:mn>1</mml:mn><mml:mo>,</mml:mo><mml:mn>1</mml:mn></mml:mtd></mml:mtr></mml:mtable><mml:mo>)</mml:mo></mml:mrow><mml:mo>=</mml:mo><mml:mfrac><mml:mrow><mml:mn>5</mml:mn><mml:mo>!</mml:mo></mml:mrow><mml:mrow><mml:mn>3</mml:mn><mml:mo>!</mml:mo><mml:mtext> </mml:mtext><mml:mn>1</mml:mn><mml:mo>!</mml:mo><mml:mtext> </mml:mtext><mml:mn>1</mml:mn><mml:mo>!</mml:mo></mml:mrow></mml:mfrac></mml:mrow></mml:semantics></mml:math></disp-formula>
<supplementary-material content-type="local-data" id="S1"><caption><title>Additional File 1</title><p>User manual for MalHaploFreq.</p></caption></supplementary-material> <supplementary-material content-type="local-data" id="S2"><caption><title>Additional File 2</title><p>executable programme compiled for use on DOS or windows</p></caption></supplementary-material>
<graphic xlink:href="1475-2875-7-130-1"/> <graphic xlink:href="1475-2875-7-130-2"/> <graphic xlink:href="1475-2875-7-130-3"/>
<media xlink:href="1475-2875-7-130-S1.pdf" mimetype="application" mime-subtype="pdf"><caption><p>Click here for file</p></caption></media> <media xlink:href="1475-2875-7-130-S2.exe" mimetype="application" mime-subtype="x-msdownload"><caption><p>Click here for file</p></caption></media>
[{"surname": ["website"], "given-names": ["MHF"], "year": ["2008"]}, {"surname": ["Hartl", "Clark"], "given-names": ["DL", "AG"], "source": ["Principles of Population Genetics"], "year": ["1997"], "edition": ["3"], "publisher-name": ["Sunderland, Ma, USA, Sinauer Associates"]}, {"surname": ["Hill", "Babiker"], "given-names": ["WG", "HA"], "article-title": ["Estimation of numbers of malaria clones in blood samples"], "source": ["Proc R Soc London Ser B"], "year": ["1995"], "volume": ["262"], "fpage": ["249"], "lpage": ["257"], "pub-id": ["10.1098/rspb.1995.0203"]}, {"surname": ["Institute"], "given-names": ["ST"], "year": ["2008"]}]
Malar J. 2008 Jul 15; 7:130