In [1]:
# Load standard libraries
import numpy as np
from pandas import DataFrame
from bokeh.plotting import figure, output_notebook, show, gridplot
from bokeh.models import ColumnDataSource, widgets, CustomJS
from bokeh.models.glyphs import Circle, Square
from bokeh.models import HoverTool

from bokeh.models import ColumnDataSource
from bokeh.models.widgets import DataTable, DateFormatter, TableColumn
from bokeh.io import output_file, show, vform, vplot, hplot

output_notebook()


Loading BokehJS ...

In [2]:
# Load AssocPlots


from assocplots.misc import mock_data_generation

data_m, data_w = mock_data_generation(M=100000, seed=42)
data_m['pval'] /= 500000.*np.exp(-(data_m['pos']-10000.)**2/50000.0) * (data_m['chr']=='4') * np.random.rand(len(data_m)) + 1.

In [3]:
from assocplots.interactive import *

# cut1, cut2, data = data_reduce(data_m, data_w, N=5000)
cut1, cut2, data = data_reduce_fast(data_m, data_w, N=1000)


1990

In [4]:
p1,p2,p3,p4,pq1 = mann_only_interactive(data, cut1, cut2)


['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', 'X']
['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', 'X']
840700
825100
671600
649200
611800
580300
541500
489400
468500
460600
443600
453700
317800
293200
273700
304800
271500
261500
199100
212200
111000
113400
516200
[      0.  840700.  825100.  671600.  649200.  611800.  580300.  541500.
  489400.  468500.  460600.  443600.  453700.  317800.  293200.  273700.
  304800.  271500.  261500.  199100.  212200.  111000.  113400.  516200.]
[       0.   840700.  1665800.  2337400.  2986600.  3598400.  4178700.
  4720200.  5209600.  5678100.  6138700.  6582300.  7036000.  7353800.
  7647000.  7920700.  8225500.  8497000.  8758500.  8957600.  9169800.
  9280800.  9394200.  9910400.]
[       0.   840700.  1665800.  2337400.  2986600.  3598400.  4178700.
  4720200.  5209600.  5678100.  6138700.  6582300.  7036000.  7353800.
  7647000.  7920700.  8225500.  8497000.  8758500.  8957600.  9169800.
  9280800.  9394200.  9910400.]
[  420350.  1253250.  2001600.  2662000.  3292500.  3888550.  4449450.
  4964900.  5443850.  5908400.  6360500.  6809150.  7194900.  7500400.
  7783850.  8073100.  8361250.  8627750.  8858050.  9063700.  9225300.
  9337500.  9652300.]
['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', 'X']
E:\katya\PycharmProjects\assocplots\assocplots\interactive.py:231: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  ts['abspos'][ts['chr'] == chrs[i]] += xtixks_pos[i]
E:\katya\PycharmProjects\assocplots\assocplots\interactive.py:240: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  ts['color'][ts['chr'] == chrs[i]] = '#FA8072'
E:\katya\PycharmProjects\assocplots\assocplots\interactive.py:242: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
  ts['color'][ts['chr'] == chrs[i]] = '#00BFFF'
E:\katya\PycharmProjects\assocplots\assocplots\interactive.py:369: BokehDeprecationWarning: bokeh.io.vform was deprecated in Bokeh 0.12.0; please use bokeh.models.layouts.WidgetBox instead
  p3 = vform(data_table)
C:\Anaconda3\lib\site-packages\bokeh\io.py:613: BokehDeprecationWarning: bokeh.models.layouts.VBoxForm was deprecated in Bokeh 0.12.0; please use bokeh.models.layouts.WidgetBox instead
  return VBoxForm(*children, **kwargs)
E:\katya\PycharmProjects\assocplots\assocplots\interactive.py:372: BokehDeprecationWarning: bokeh.io.vform was deprecated in Bokeh 0.12.0; please use bokeh.models.layouts.WidgetBox instead
  p4 = vform(data_table_filt)
C:\Anaconda3\lib\site-packages\bokeh\io.py:613: BokehDeprecationWarning: bokeh.models.layouts.VBoxForm was deprecated in Bokeh 0.12.0; please use bokeh.models.layouts.WidgetBox instead
  return VBoxForm(*children, **kwargs)

In [5]:
show(p1)
show(p2)
show(hplot(pq1,p4))


C:\Anaconda3\lib\site-packages\ipykernel\__main__.py:3: BokehDeprecationWarning: bokeh.io.hplot was deprecated in Bokeh 0.12.0; please use bokeh.models.layouts.Row instead
  app.launch_new_instance()
Out[5]:

<Bokeh Notebook handle for In[5]>


In [8]:
# from assocplots.htmloutput import *
# write_to_html([p1,p2,pq1,p4], filename='output.hmtl', title='Title')