Skip to content

Instantly share code, notes, and snippets.

@monogenea
Last active October 11, 2020 10:20
Show Gist options
  • Save monogenea/ddfa611631a757f281ac095a7745463b to your computer and use it in GitHub Desktop.
Save monogenea/ddfa611631a757f281ac095a7745463b to your computer and use it in GitHub Desktop.
# Remove expression features with > 50% zero-valued expression levels
is_expressed = np.apply_along_axis(lambda x: np.mean(x == 0) < .5, arr=matrix, axis=0)
matrix = matrix[:,is_expressed.tolist()]
# Log2-transform
matrix = np.log2(matrix.to_numpy() + 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment