  Metagenomics provides a powerful new tool set for investigating evolutionary
interactions with the environment. However, an absence of model-based
statistical methods means that researchers are often not able to make full use
of this complex information. We present a Bayesian method for inferring the
phylogenetic relationship among related organisms found within metagenomic
samples. Our approach exploits variation in the frequency of taxa among samples
to simultaneously infer each lineage haplotype, the phylogenetic tree
connecting them, and their frequency within each sample. Applications of the
algorithm to simulated data show that our method can recover a substantial
fraction of the phylogenetic structure even in the presence of strong mixing
among samples. We provide examples of the method applied to data from green
sulfur bacteria recovered from an Antarctic lake, plastids from mixed
Plasmodium falciparum infections, and virulent Neisseria meningitidis samples.
