Thoughts on ‘Whole genome phylogenies reflect the distributions of recombination rates for many bacterial species’

I was happy to see that this paper, which originally appeared as a preprint back in April 2019 (!), was published earlier this month.I thought it was one of the most thought-provoking papers I’ve read recently, so suggested a journal club on the final version (it’s long paper — over 80 pages).

There were some parts that I liked a lot, and some parts I didn’t like, which I wanted to summarise here. Overall, I thought the paper brought an interesting ‘outsider’ approach to the problem of bacterial population genomics, and quantified some issues in new and useful ways. However, I was less keen on the presentation, which to me was overly confrontational, and failed to put the research within a proper modern context. I’ve summarised some of the discussion here, which I note is not meant to be a thorough review, and is subjective.

I think I remember some tweets when the preprint came out along the lines of ‘are we analysing bacterial genomes all wrong?’, to which I think we can safely say the answer is no. So, at the bottom of the page, I outline an alternative analysis approach to that which the authors critique, and show that it is likely to be compatible with their findings.

[here I will use ‘strain’ to mean a cluster of related samples, usually a clade on a tree. In the paper the authors use ‘strain’ to mean a single sample]

Update:  Erik van Nimwegen, the corresponding author on the paper, replied to some of these points. I have copied his replies at the end of the post, and added some final thoughts responding to these.

Liked

  • The ‘outsider’ perspective contributes novel perspective, analysis and plots to a tricky problem.
  • The paper is almost relentlessly quantitative, which is particularly appreciated on a problem which is often discussed fairly qualitatively.
  • I really liked the Poisson + negative bionomial fit to pairwise comparisons to quantify the proportion of recombined regions.
  • Datasets were small, but seemed well-chosen to study the problem. ‘Extremes’ on H. pylori and M. tuberculosis were useful to demonstrate these regimes.
  • The interpretation of whole genome phylogenies as rates of recombination, or population structure between strains, seemed convincing.

Ambivalent

  • The authors spent a while on phylogenetic entropy. This seemed interesting, but ultimately my opinion was that this may not be the right tool to talk about this problem. It took me a long time to follow the concept, and while I do agree that it measures something about these populations, it’s not clear exactly what. I think it is perhaps more important consider whether entropy is the right ‘language’ with which to discuss genome evolution, and would posit that molecular terms are easier to understand, even if they cannot explain every nuance in a single number.
  • I was not sure how much of a dependence n-SNPs would have on sample size, which I don’t think was investigated.
  • The model of core genome evolution with random SNP and recombination accrual seemed a little simple to test the questions at hand.
  • I did not buy the network analysis — the power law fits were not convincing, and lacked explanatory power.

Did not like

  • The three attacked models for whole populations, ‘clonal’, ‘freely recombining’ and ‘clonal + some randomly recombining’, are all straw men. I don’t think many researchers would expect bacterial genomes to evolve in these ways.
  • I think there’s a misunderstanding of how bacterial genomics/phylogenetics is typically performed. In my experience, few people would attempt to construct a whole-species tree and infer clonal ancestry from it. Most people would (and typically should) analyse strains/lineages, which are those clusters below the ~90% clonal threshold identified.
  • Recombination detection is misrepresented: gubbins and clonalframe work within a strain, in which there is a genuine clonal frame. They are not designed to be applied to an entire species’ diversity. Methods such as FastGear, which do attempt to find recombination across a population, weren’t mentioned in the discussion where this criticism was made.
  • Related to both of these points, I think the paper picked on some less good examples of phylogenetic analysis, and ignored the better ones. Previous papers have shown how to partition a population into strains to analyse closely related groups. Complex forward simulations, not assuming exchangeability, including selection and saltational recombination have been shown to give rise to genomes which look very similar to observed data.

So, how should we analyse bacterial populations?

Some analyses such as GWAS are of course valid on the whole population. But for those where we would like to find clusters or analyse clonal ancestry, here is a pipeline that I would suggest, which I think will work in many cases:

  1. Standard quality control steps.
  2. Split the population into strains. I would recommend PopPUNK, but cgMLST also works.
  3. Within each of these strains:
    1. Create an alignment by: mapping reads to a reference or assembly within the strain; or by using ska.
    2. Remove recombination from this alignment with gubbins or ClonalFrameML.
    3. Build a phylogeny with IQTree or RAxML. (Note that if using gubbins, this will have been run as part of the pipeline).
    4. Use fastbaps to find subclusters within your strain.
    5. If you wish, BactDating is a good way to time your tree.
  4. Pangenome analysis with panaroo or PEPPAN.

If this looks useful I have written some of these steps as a snakemake pipeline. It’s available here, though is a work-in-progress at the time of writing.

To motivate this pipeline within the context of this paper’s contributions, I would like to present a figure from our PopPUNK paper, showing a ‘within-strain’ boundary in core-accessory distance space:

PopPUNK fits to E. coli
PopPUNK fits to E. coli

You can see (or see figure 4 from the paper if it’s too small) that for all of these fits there is a discontinuous region we divide strains at a divergence of around 0.003. The authors identify a 𝝅-crit of 0.0032 for mostly clonal sites in this species — which aligns nicely. Looking at the rest of these fits, for all species this discontinuous space, and where we divide strains is below 0.014, which is the divergence the authors identify across species.

Thanks to the BEE group, and in particular Sam Horsfield and Nick Croucher for their comments on the paper and this post.

Update: Author reply

Erik van Nimwegen’s reply to some of these points (via twitter)

  • The three attacked models for whole populations, ‘clonal’, ‘freely recombining’ and ‘clonal + some randomly recombining’, are all straw men. I don’t think many researchers would expect bacterial genomes to evolve in these ways.

Yet these models are used in methods such as clonalframe and fitted to the data. If it’s obvious these models are wrong, than it is also wrong to make inferences by fitting them to genomic data.

  • I think there’s a misunderstanding of how bacterial genomics/phylogenetics is typically performed. In my experience, few people would attempt to construct a whole-species tree and infer clonal ancestry from it. Most people would (and typically should) analyse strains/lineages, which are those clusters below the ~90% clonal threshold identified.

For E. coli, clusters with >=90% clonal correspond to genomes that are all less than 0.001 divergence of each other. This would partition our 92 strains into many small clusters (singlets, pairs, triplets), i.e. the ‘phylogroups’ would be broken up into little clusters.

I don’t think it is accurate to say ‘most people’ would refuse to infer clonal ancestry beyond these small clusters. Also note that, even for pairs less than 0.001 diverged, one may have that >90% of the divergence comes from recombined regions. So one would have to be careful to reconstruct the clonal tree even for these tiny groups. I also know that, for our E. coli data, one would simply not have the SNPs to fully resolve the phylogenies of these small clusters.

  • Recombination detection is misrepresented: gubbins and clonalframe work within a strain, in which there is a genuine clonal frame. They are not designed to be applied to an entire species’ diversity. Methods such as FastGear, which do attempt to find recombination across a population, weren’t mentioned in the discussion where this criticism was made.

This is just not true. As we cite, the developers of clonalframe specifically used it to reconstruct a clonal phylogeny of E. coli (Didelot et al, BMC genomics, 2012). The well-known Touchon et al paper also claims a clonal tree for a diverse set of E. coli strains. So I don’t accept we have misrepresented here.

Finally, you propose a pipe-line for analysis. We made our E. coli core genome alignment available and I would be very interested to see what this pipe-line would end up giving.

My reply to these points

I agree with the authors that recombination detection using a method which assumes a clonal tree across a species is generally inappropriate. I also think it’s clear that there are good examples of analysis and less good examples of such analysis in previous literature — I don’t think either myself or Erik are ‘right’ in our view of how analysis is typically done, it’s just our (differing) opinion.

Some of the critiqued papers cited are somewhat older: it’s true that the cited paper from 2012 attempted this analysis, though the original clonalframe was ‘designed mostly to work on MLST data’. The updated version, from 2015, is applied mostly within STs (though there is a whole population analysis of S. aureus at the end). Gubbins, from the same year, was exclusively applied within STs.

My belief is that analysis has moved on, and there are numerous other examples of first partitioning a population into strains before trying to detect recombination.  I further think that the authors (Sakoparnig et al) have made a nice contribution formalising the rationale for these improved approaches.

One final point: the dataset used covers much of E. coli’s diversity in just 92 strains, so it’s not surprising that ‘strains’ would consist of primarily singletons and doubletons in this dataset. Datasets with larger sample sizes will likely work a lot better here. I hope to apply PopPUNK/PopPIPE to the 92 sample dataset analysed here in the future.

Paper summary – Joint sequencing of human and pathogen genomes reveals the genetics of pneumococcal meningitis

This a summary of our paper on a joint pathogen and human GWAS that has just been published in Nature Communications:
https://doi.org/10.1038/s41467-019-09976-3

This is the last bit of research from my PhD thesis. Also, this was the first thing I started working on back in 2014 (my first GWAS), and our collaborators have been collecting data since 2006 – so it’s good to see this one out!

Overview

We collected cases from pneumococcal meningitis patients enrolled in a nationwide Dutch cohort. We were also able to match these with bacterial isolates collected in the nationwide reference lab. For both the patients and the bacteria, we then collected population-matched control samples to perform a case-control genome-wide association study (GWAS), plus some other statistical genetics. We accumulated similar data from case-control cohorts in other populations, again in both patients and bacteria, to increase the number of samples, and perform meta-analysis.

This allows us to look for the affect of any genetic variant across the species (without needing a prior hypothesis of an interesting gene), in the natural population (humans not mice, and natural variation not lab strains). I hope this generates some useful hypotheses for further testing in more controlled experiments, for example using isogenic mutants in a relevant model organism.

I think these were our key findings:

    1. Bacterial genetics did not seem to affect disease severity, but was a big factor in whether invasive disease would be caused after carriage.
    2. Pneumococcal serotype is important in determining invasiveness, but other genetic factors are also involved.
    3. We found some candidate genetic factors other than serotype, including some previously implicated proteins, and some new ones.
    4. Human genetics however affected both disease severity and susceptibility, and we found a couple of specific candidate loci.
    5. We performed an interaction (genome-to-genome) analysis, but were limited in power due to small number of samples (N = 460) versus large number of possible interactions (~1010).

If you’re interested in the biological ramifications of any of these points I’d encourage you to have a look through the paper. I was particularly interested by 1) which seems to rule out pathogen genotype as a diagnostic of disease severity, and 2) and 3) which suggest that targeting only serotype is maybe not the optimal way to a) define pneumococci or b) design vaccines which stop invasive disease.

Technical summary

I’ll also try and describe some of the more technical aspects here, which were interesting to me, but ended up being only briefly covered in the paper.

Bacterial GWAS (pGWAS)

We tried to get as much as we could out of the whole-genome sequence data here, calling as many genetic features as possible for later use in the association:

  • SNPs, genes and k-mers. As have been used in bacterial GWAS studies before.
  • INDELs. Can be less well called by some methods. Here I just looked for short INDELs which might result in frameshifts.
  • Antigen alleles. Noted in various papers before,(e.g. http://dx.doi.org/10.1073/pnas.1613937114 and http://dx.doi.org/10.1093/infdis/jiw628), these might not get well tagged by the SNPs. I built a new machine-learning classifier for three genes (pspC, pspA, zmpA), but it’s probably quite similar to other methods (and was relatively labour and computationally intensive).
  • Copy number variants (including large deletions).
  • A phase-variable inverting locus (ivr). This requires using the read pair information due to repeats breaking up assembly and mapping.

We then fed these into some association models:

  • SEER/pyseer. Used to try and find individual genetic associations with meningitis. We found the mixed effects model was required to get anything sensible, as phenotype was strongly correlated with genetic background.
  • limix. Used to obtain heritability estimates, including partitioning by genome segment.
  • A hierarchical Bayesian model was used for the ivr, as it contains variation within each sample.

Ultimately, only the use of SNPs, INDELs and k-mers led to significant findings. The former were also useful for the heritability analysis with limix. This was also the first time I tried to include association of rare variation (aggregating through gene and operon burden tests). This seemed to be one of the more successful approaches, perhaps due to lower confounding with background, and I would certainly recommend it to anyone trying a bacterial GWAS in future (and you can easily do it in pyseer!). It definitely benefited from the calling of short INDELs.

One further point is that some of the strongest associations we found were to transposons and BOX elements. While BOX elements have been associated with gene expression and competence, none of the transposons had any obvious biological effect (no cargo, nothing consistently interrupted, as far as we could tell). I am not sure whether these associations are a biological effect which we may have ignored, or if this is an artefact of the association model, where the p-value is elevated by these elements apparently occurring independently multiple times on different genetic backgrounds, with uneven case and control numbers. I’d like to investigate this further at some point.

Human GWAS (hGWAS)

What a pleasure it was to work with human genotypes and GWAS methods! It was really noticeable how smooth this analysis was, and how it got easier over the years we added cohorts. I think the main reasons for this compared to pGWAS are:

  • Many long standing methods and software packages which directly work with your data, no need for format conversion (e.g. plink, bolt-lmm, locuszoom, LDAK).
  • Excellent web-services and databases which help enrich the interpretation of your findings (e.g. the imputation servers, https://www.targetvalidation.org/, GTEx).
  • It’s easier than bacterial GWAS. The well designed genotyping arrays with SNPs that cover most the common variation (after imputation) and lack of strong population structure/fast LD decay definitely made a big difference.

This didn’t make it into the final paper, but I also looked into some models of effect sizes with bayesR, which suggested as well as a few high effect loci (oligogenic), much of the heritability explained is from smaller effect loci (polygenic). So collecting more samples would certainly be useful, though this is hard due to the low incidence.

Have a look at the Data Availability section if you want to use our GWAS summary statistics in any future meta-analysis.

Thanks

It’s been a long time in the works mostly due to the time taken to accumulate all of this data: meningitis is a fairly rare disease, with only about 200 cases each year reported in the Netherlands. As new patients were enrolled and genotypes I ended up repeating the analysis (which got easier each time, as human GWAS methods became more and more impressive and easy to use). We also put a lot of effort into expanding the dataset – we were eventually able to gather three separate cohorts of human genotypes (from the Netherlands, Denmark and the UK Biobank) and two cohorts with bacterial sequences (from the Netherlands and South Africa). Consequently we have a nice long author list, with almost as many affiliations as names. I am particularly grateful to all of these authors who each contributed data, analysis and their time.

Particular thanks to Bart Ferwerda, Philip Kremer and Nicole Wheeler who worked with me on much of the analysis; Thomas Benfield, Anne von Gottberg, Arie van der Ende and Mattijs Brouwer who set up and ran the largest cohorts included; and Jeff Barrett, Stephen Bentley and Diederik van de Beek who supervised the work. Also to the reviewers, who provided lots of useful suggestions for improving the paper (you can see the reviews here).

Paper summary – PopPUNK for bacterial epidemiology

A paper describing our recent method for bacterial epidemiology PopPUNK has just been published in Genome Research, which you can read here:
https://dx.doi.org/10.1101/gr.241455.118

You can install our software by running
conda install poppunk
and that full details and documentation can be found at https://poppunk.readthedocs.io

In this blog post I will attempt to describe some of our key features and findings in a shorter format. Broadly, I think there are three main parts:

  1. Core and accessory distances can be estimated using k-mer distances.
  2. In many species, finding clusters in core-accessory space gives good quality clusters of strains. The core and accessory distances from 1) provide further resolution within clusters of strains.
  3. These clusters can be expanded online as new samples are added, and their names stay consistent between studies.

I’ve also noted some of the work we added in our revision, for those that might have seen the first version as a pre-print on bioRxiv. We added more direct comparisons with phylogenies and cg/wgMLST schemes, showing that PopPUNK was preferable to wg/cgMLST, while still fulfilling the criteria desirable for an epidemiological typing system laid out by Nadon et al.

Core and accessory distances can be estimated using k-mer distances

The importance of accessory genome evolution and divergence has been increasingly recognised over the past few years. To analyse the accessory genome, one typically attempts to find clusters of orthologous genes (COGs) using roary, panX or another similar method. These methods compare all annotated genes to all others, which results in a number of comparisons which increases with the square of the number of sequences. Though efficiencies in these pieces of software keep this computation possible, for larger populations this takes a significant amount of time, especially if reruns are needed due to new samples or poorly chosen clustering thresholds.

For some downstream purposes just extracting the core and accessory distances between pairs of samples is sufficient, as information on individual COGs and annotations is not needed. We wanted to use a k-mer based approach to do this, so that we:

  • wouldn’t be reliant on gene annotations, which differ in quality between species and sample collection, and can be hard to standardise across labs and studies.
  • do not require an alignment step, which takes a long time, and again can be hard to standardise.
  • could take advantage of recent developments in efficient k-mer based software. Specifically, we used mash, which rapidly calculates distances between sequences by taking the lowest scoring subset (a sketch) of k-mers from a sequence assembly.

Noting that longer k-mers are more likely to mismatch between samples due to SNP in a shared (core) region, but that k-mers of all sizes are equally likely to mismatch between samples due to a missing accessory element (longer than the k-mer length), we were able to formulate a relation between mash distances at various k-mer lengths and core and accessory distances. Ultimately, this allows us to calculate core and accessory distances between all sequences in a population tens or hundreds of times faster than from clustering and aligning genes. In a population of 128 Listeria monocytogenes PopPUNK took about ten minutes, whereas a run of roary alone took 31 hrs. We also compared our results to this method in simulations (figure 2 in the paper) and in ten varied species (figure 3 in the paper) and found our faster estimates to be consistent with both our simulations and the real data.

We can then plot the core and accessory distances for all pairwise comparisons of samples, adding density countours where many points overlap. Here is the L. monocytogenes example:

L. monocytogenes distance distribution
Core and accessory distances between every pair of 128 L. monocytogenes samples, with density contours

This distribution is useful for a number of things, particularly clustering – the focus of the rest of the paper – but can also tell us about overall core-accessory evolution, and can be used to pick out samples which have unexpected divergence in either core or accessory content (see supplementary figure 11 for a detailed example of this).

Using core-accessory distances to define sequence clusters (strains)

A good, widely used method to define clusters of closely related sequences in a population is hierBAPS, or the recent upgrade fastbaps (both fit the same model, but the newer version is significantly faster at doing so and can also use a phylogeny to constrain the possible clusters). While this approach has many nice features such as being able to cluster recursively and being able to extract likelihoods for fits and assignments, the following limitations make it challenging to directly apply in all the places where subtyping of a population is useful for epidemiology:

  • Requires a good quality alignment as input (time-consuming).
  • Is difficult to update (every new genome requires a complete refit).
  • Difficult to keep cluster names consistent (different studies and runs will have different cluster IDs, and possibly assignments).
  • Usually forms a bin cluster of outlier sequences (putting all low frequency clusters together, rather than separating them).
  • Can be slow to fit (though perhaps no longer, with the development of fastbaps).

These drawbacks make a species-level definition of subtypes potentially challenging. Additionally, for some species (of particular interest to us was the Streptococcus genus) the solution found by optimising the BAPS likelihood does not provide great quality clusters across the tree, I think due to unmodelled recombination events and many small clusters.

This is what we set out to try and improve with PopPUNK, hoping that our fast estimation of core and accessory distances could be used for this purpose.

By finding clusters that are clearly separated in core-accessory space (using one of two standard machine-learning methods) we are able to determine a cutoff for which distances are within the same strain. Applying this to the same distances as above:

GMM fit to L. monocytogenes
Four component Gaussian mixture model fitted to pairwise distances in L. monocytogenes

The light-blue cluster closest to the origin is the within-strain cluster – distances in this cluster represent comparisons between samples in the same strain. We can then draw links between any pair of samples less than this distance apart. Linked samples form the clusters of strains in a network, the connected components (see figure 5A,B). In the network samples A and B may be greater than the cutoff distance apart, if both are close enough to a third sample C they will be in the same cluster. For most of the species we applied our method to this approach gave good clusters very quickly (table 1, figure 4). For two Streptococcal species where extensive recombination blurred the separation between the components, we needed to apply a final step to adjust the position of the boundary. Optimising properties of the network, avoiding clusters which are straggly and linked by only a few samples connected to many things, and reducing the overall number of links, then gave good results in these species without further extensive computation.

Adding new isolates in to a fitted cluster model – quickly and consistently

We found some very useful advantages to representing the clusters as a network, which solve many of the above issues:

  • Outlier sequences or small groups are correctly placed in their own clusters, rather than being grouped in a bin.
  • New isolates can be added in by calculating distances to samples already in the network (avoiding calculating everything again).
  • Removing fully connected sets of samples (cliques) removes redundancy, and further improves speed/memory/storage.
  • Cluster names are by size, and can be constrained to be the same between studies, or as a database is added to.

This means that you can download a PopPUNK database (usually 10-100Mb) and run using --assign-samples with new assemblies. This will cluster new samples within the context of an existing population, without having to redo/care about the model fit. The databases can be expanded without having to refit the model, or worry about cluster names changing (which is one of the nice features of MLST). We tested this with an emerging E. coli strain not seen in the database at the first time point in a longitudinal series, and PopPUNK was able to track its emergence and expansion (see figure 5D,E).

Comparison with gene-by-gene methods

For the second version of this paper we were asked to add in a more explicit comparison with gene-by-gene methods and phylogenies. My understanding of how MLST and cgMLST/wgMLST schemes are applied in epidemiology is:

  1. Download the MLST allele database, or upload your sample to an online database.
  2. BLAST (or another alignment/matching tool) is used to find the typing genes in the uploaded sample.
  3. These genes are compared to a list of previously seen sequences for that gene (alleles). If they exactly match they are assigned the same identifier, otherwise a new one.
  4. A sequence type (ST) is assigned to each unique combination of alleles in the typed genes.

In step 3, counting any number of changes within a gene as a single change loses some resolution, but has the advantage that it does not overcount recombination events. With a good choice of genes making up the scheme, MLST schemes have been shown to capture population structure very well. It is faster than alignment and modelling with hierBAPS, a single sample can easily be added, and with centralised databases it can also deal with keeping names of clusters (STs) consistent.

However, some drawbacks are:

  • MLST lacks resolution, and throws data from whole genome sequencing away. Extended schemes (using core genes or all genes) improve this, but still ignore intergenic regions and group any number of changes together as a single allele difference.
  • Defining allele databases is difficult and requires continual curation for people to add new alleles, and avoid duplicate genes. There are some impressive efforts to do this (e.g. enterobase, BIGSdb), but these only cover some species.
  • It is unclear how to form clusters from allele assignment. How many changes of allele should be in the same cluster? Common interpretations of a single change is far too specific for extended schemes, and seems to be a convenience-based choice rather than a biological one.

In practice, I found that downloading a cgMLST scheme and applying it to my own data was quite challenging due to how the gene database needed to be formatted, and to make sure all the dependencies worked (thanks to João Carriço and Mickael Silva for helping me with this, and for their chewBBACA software which made the comparison possible). MLST methods and databases have been around for longer, and so this was easier to work with. Defining and maintaining a new scheme for a species which doesn’t have one yet seems like it would be a significant undertaking, though I didn’t try this myself.

To directly compare PopPUNK and these methods, we performed MLST and cgMLST assignment on two different species with good typing schemes (L. monocytogenes and E. coli). We then calculated pairwise distances in terms of the number of allele changes, which gave a gene distance matrix rather than a core and accessory distance matrix. By using these with the PopPUNK network we could find how many allele changes to connect to form similar clusters, and how good projections at various cutoffs are (see supplementary tables 6 and 7). We could make the clusters similar between PopPUNK and (cg)MLST, but only by manually testing many values of the cutoff for number of allele changes.

I don’t have lots of experience using gene-by-gene methods or analysing surveillance datasets, but from these tests I ended up concluding that PopPUNK has the following advantages over gene-by-gene methods:

  • The clusters are likely to be real biological entities based on their separation in core-accessory space. With cgMLST/MLST it is unclear how many allele changes should be chosen as a cutoff, but PopPUNK optimises this.
  • The calculation of core distances allow trees to be drawn within clusters (e.g. with the --microreact option), giving further resolution and relationships within clusters.
  • PopPUNK is faster to run.
  • You don’t need curated database of genes (difficult to format/curate when it exists, more difficult to create when it doesn’t).

So we ended up concluding that PopPUNK also retains the advantages of gene-by-gene approaches, and meets the criteria of Nadon et al for a genomic surveillance scheme.

Challenging species – low diversity

The main place we found PopPUNK’s clusters to be worse than those from RhierBAPS was for populations with limited genetic diversity, for example within an identified strain. The calculation of core and accessory distances will in theory work to any resolution (but one may need to increase the sketch size to the genome length divided by the variants per genome). But if there is no clear within-strain versus between-strain separation in the distances and instead just a cloud of points, the spatial clustering methods are not likely to converge on a good solution. Network-based model refinement is needed in this case, though it is likely to split the strain into many substrains.

One example of this was Neisseria gonorrhoeae, which is essentially a strain of Neisseria meningitidis (which did work using default settings). Using refinement of core distances we did get a reasonable fit, and were able to use this to find accessory elements moving within strains (we also looked at this within a well studied strain of S. pneumoniae). In Mycobacterium tuberculosis diversity was even more limited, so while the core distance based phylogeny PopPUNK produced was consistent with the lineages estimated by the first level of hierBAPS, PopPUNK’s clustering split the population into many more substrains (comparable to spoligotyping).

See the supplementary text S1 and figure S11 for a full discussion of this point.

Recommendations for running PopPUNK

Some tips:

  • The most important part of the model fit is to uniquely select the cluster closest to the origin.
  • If you have high accessory distance points check for contamination in assemblies and remove them.
  • Run using one of the extra output options (e.g. --microreact) and you’ll get a lot more information out, and can make interactive visualisations.

See the quickstart guide for a walkthrough, the tutorial for all details on a more complex example and the troubleshooting for common issues.

Thanks

PopPUNK was the result of a collaboration between many people, but I’d particularly like to thank Nick Croucher who jointly worked on the method, code and paper with me.