def get_samples_panfamilies(families, sample2family2presence):
    """Get the sorted list of all the families present in the samples
    Can be a subset of the pangenome's set of families"""
    panfamilies = set()
    for f in families:
        for s in sample2family2presence:
            if sample2family2presence[s][f]:
                panfamilies.add(f)
                break
    return sorted(panfamilies)