Supervised Distance Matrices: Theory and Applications to Genomics