analysis code used in Ballgown paper