Hello Laura,
My apologies for the delay in responding.
I was unable to determine the issue on my own and requested that another colleague take a look. He said that his " hunch is that the combination of log2 normalized data and cosine similarity may be what's leading to predicting all samples to be in the same class", but he didn't have a chance to test that out.
Let us know if that helps get you pointed in the right direction.
Best
-Barbara