Flavor composition and energy spectrum of astrophysical neutrinos