import sys
sys.path.insert(0, '../')
import dotplot
import dotplot.utils
import pandas as pd
%config InlineBackend.figure_format = 'retina'
term_list = ['GO:0002455', 'GO:0006958', 'GO:0006956', 'GO:0038096','GO:0002673',
'GO:0051251', 'GO:0060333', 'GO:0006910','GO:0002483', 'GO:0002440',
'GO:0009141', 'GO:0009123', 'GO:0006119', 'GO:0009260', 'GO:0015985', 'GO:0015986', 'GO:0006260',
'GO:0044843', 'GO:0061621', 'GO:0061718']
up = pd.read_csv('./example_data/group1.csv', header=0, index_col=0)
down = pd.read_csv('./example_data/group2.csv', header=0, index_col=0)
data = dotplot.utils.merge_clusterprofile_results(dataframes=(up, down), groups=['B6_up', 'B6_down'], term_list=term_list)
new_keys = {'item_key': 'Description','group_key': 'group','sizes_key': 'Count'}
dp = dotplot.DotPlot.parse_from_tidy_data(data, **new_keys)
sct = dp.plot(cmap='Reds', size_factor=10)
new_keys = {'item_key': 'Description','group_key': 'group','sizes_key': 'Count'}
dp = dotplot.DotPlot.parse_from_tidy_data(data, **new_keys)
sct = dp.plot(size_factor=10, cmap='Reds', cluster_row=True)
new_keys = {'item_key': 'Description','group_key': 'group','sizes_key': 'Count','color_key': 'pvalue'}
dp = dotplot.DotPlot.parse_from_tidy_data(data, **new_keys)
sct = dp.plot(size_factor=10, cmap='Reds', cluster_row=True)
dp = dotplot.DotPlot.parse_from_tidy_data(data, **dotplot.utils.DEFAULT_CLUSTERPROFILE_KEYS)
sct = dp.plot(size_factor=10, cmap='Reds', cluster_row=True)