Created
February 20, 2015 21:36
-
-
Save gpratt/878eb6626df7228c33f4 to your computer and use it in GitHub Desktop.
go_enrichment_plotter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def plot_go_enrichment(df, filter_value=None, **kwargs): | |
new_index = [] | |
for index, description in izip(df.index, df['GO Term Description']): | |
new_index.append(list(index[:-1]) + [description]) | |
df.index = pd.MultiIndex.from_tuples(new_index) | |
go_matrix = df['Bonferroni-corrected Hypergeometric p-Value'].apply(lambda x: -1 * np.log10(x)) | |
go_matrix = go_matrix.unstack(range(len(go_matrix.index.levels) - 1)) | |
go_matrix = go_matrix.fillna(0) | |
if filter_value is not None: | |
go_matrix = go_matrix[go_matrix.apply(max, axis=1) > filter_value] | |
sns.clustermap(go_matrix, robust=True, **kwargs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment