Systematically identifying the collective variables describing phase transformations in flexible materials