AbstractMotivationMetagenomic samples have high spatiotemporal variability. Hence, it is useful to summarize and characterize the microbial makeup of a given environment in a way that is biologically reasonable and interpretable. The UniFrac metric has been a robust and widely used metric for measuring the variability between metagenomic samples. We propose that the characterization of metagenomic environments can be improved by finding the average, a.k.a. the barycenter, among the samples with respect to the UniFrac distance. However, it is possible that such a UniFrac-average includes negative entries, making it no longer a valid representation of a metagenomic community.ResultsTo overcome this intrinsic issue, we propose a special version of the UniFrac metric, termedL2UniFrac, which inherits the phylogenetic nature of the traditional UniFrac and with respect to which one can easily compute the average, producing biologically meaningful environment-specific “representative samples.” We demonstrate the usefulness of such representative samples as well as the extended usage ofL2UniFrac in efficient clustering of metagenomic samples, and provide mathematical characterizations and proofs to the desired properties ofL2UniFrac.Availability and implementationA prototype implementation is provided athttps://github.com/KoslickiLab/L2-UniFrac.git. All figures, data, and analysis can be reproduced athttps://github.com/KoslickiLab/L2-UniFrac-Paper