def write_projection_file(filename, sample_labels, projections):
    """
    Outputs the coordinates for each projection to a file.

    Parameters
    ----------
    filename : String
        File to write
    sample_labels : list(String) len=Num_Samples
        Labels for each sample
    projections : dict(string, (2 x Num_Samples) numpy.ndarray)
        dictionary mapping the projection type (e.g. "tSNE") to an array containing
        the two-dimensional coordinates for each sample in the projection.

    """
    ff = open(filename, 'w')
    for proj in projections:
        coordinates = projections[proj]
        for i in range(coordinates.shape[1]):
            ff.write(proj + '\t')
            ff.write(sample_labels[i] + '\t')
            ff.write('{:.5f}'.format(coordinates[0, i]) + '\t')
            ff.write('{:.5f}'.format(coordinates[1, i]))
            ff.write('\n')
    ff.close()
