Plotting a heat map of gene activity

Hi everyone,

I am having trouble creating a heat map style plot of gene activity using the HeatMap class. Currently I have read in csv data into a DataFrame and have a DataFrame that goes like

1534 6609

0 -0.5 4

5 -0.1 3.1

10 1 2.6

15 2 1.4

20 2.4 0.8

The very top row that starts with 1534, 6609… are actually the numbers for specific genes, and each column that corresponds to each gene gives a series of values corresponding to activity levels sampled at discrete time points of 0,5,10,15,20… and so forth. As the header column (containing gene labelling numbers) and index row (containing the discrete time points) are non-strings (integers), I proceeded to cast them into string data type so that it would make it possible to plot them as the x - y axes in the heat map. However, even after doing that, and passing the values into HeatMap(), I still get the error of ValueError: expected an element of List(String), got seq with invalid items [1283] . Does anyone know what I might be doing wrong here? Why isn’t it possible for me to pass my DataFrame to HeatMap() as how it was done in the example http://bokeh.pydata.org/en/0.9.3/docs/user_guide/charts.html#heatmap ?

Thank you.

Hi Augustine,

The bokeh.charts API is the newest, and it only stabilized fairly recently, around the 0.10 release. The docs you link are older than that, and refer to a version of the charts API that has been deprecated and removed for some time now. Unfortunately no one has had a chance to add a HeatMap section to the user's guide yet, but there is an example you can study at:

  https://github.com/bokeh/bokeh/blob/master/examples/charts/file/heatmap.py

If you have the time and interest and wanted to write up a HeatMap section in the user's guide, after you start to use it some, that would be extremely appreciated.

Thanks,

Bryan

···

On Jun 2, 2016, at 9:37 PM, Augustine Koh <[email protected]> wrote:

Hi everyone,

I am having trouble creating a heat map style plot of gene activity using the HeatMap class. Currently I have read in csv data into a DataFrame and have a DataFrame that goes like

        1534 6609
0 -0.5 4
5 -0.1 3.1
10 1 2.6
15 2 1.4
20 2.4 0.8
...
...
...
...

The very top row that starts with 1534, 6609... are actually the numbers for specific genes, and each column that corresponds to each gene gives a series of values corresponding to activity levels sampled at discrete time points of 0,5,10,15,20... and so forth. As the header column (containing gene labelling numbers) and index row (containing the discrete time points) are non-strings (integers), I proceeded to cast them into string data type so that it would make it possible to plot them as the x - y axes in the heat map. However, even after doing that, and passing the values into HeatMap(), I still get the error of ValueError: expected an element of List(String), got seq with invalid items [1283] . Does anyone know what I might be doing wrong here? Why isn't it possible for me to pass my DataFrame to HeatMap() as how it was done in the example http://bokeh.pydata.org/en/0.9.3/docs/user_guide/charts.html#heatmap ?

Thank you.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5e277727-78c1-4aea-927c-2933c216e88e%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Bryan,

Thanks for replying to me and sorry for taking this long to get back to you. I was interrupted from work for a while and now am back.

Indeed, I’d be more than happy to contribute a brief write up to add to the documentation once I figure out how to generate a heatmap.

Following on your link, I cloned the repo and tried executing the heatmap.py file in the example directory, but came aross this error:

···

ImportError Traceback (most recent call last)

/home/xxxxxxx/bokeh/examples/charts/file/heatmap.py in ()

  2 

  3 from bokeh.charts import HeatMap, bins, output_file, show

----> 4 from bokeh.layouts import column

  5 from bokeh.palettes import RdYlGn6, RdYlGn9

  6 from bokeh.sampledata.autompg import autompg

ImportError: No module named layouts

``

Am I missing a module in the bokeh repo?

Thank you.

Best,

Augustine

On Friday, June 3, 2016 at 10:51:36 PM UTC-5, Bryan Van de ven wrote:

Hi Augustine,

The bokeh.charts API is the newest, and it only stabilized fairly recently, around the 0.10 release. The docs you link are older than that, and refer to a version of the charts API that has been deprecated and removed for some time now. Unfortunately no one has had a chance to add a HeatMap section to the user’s guide yet, but there is an example you can study at:

    [https://github.com/bokeh/bokeh/blob/master/examples/charts/file/heatmap.py](https://github.com/bokeh/bokeh/blob/master/examples/charts/file/heatmap.py)

If you have the time and interest and wanted to write up a HeatMap section in the user’s guide, after you start to use it some, that would be extremely appreciated.

Thanks,

Bryan

On Jun 2, 2016, at 9:37 PM, Augustine Koh [email protected] wrote:

Hi everyone,

I am having trouble creating a heat map style plot of gene activity using the HeatMap class. Currently I have read in csv data into a DataFrame and have a DataFrame that goes like

    1534     6609

0 -0.5 4

5 -0.1 3.1

10 1 2.6

15 2 1.4

20 2.4 0.8

The very top row that starts with 1534, 6609… are actually the numbers for specific genes, and each column that corresponds to each gene gives a series of values corresponding to activity levels sampled at discrete time points of 0,5,10,15,20… and so forth. As the header column (containing gene labelling numbers) and index row (containing the discrete time points) are non-strings (integers), I proceeded to cast them into string data type so that it would make it possible to plot them as the x - y axes in the heat map. However, even after doing that, and passing the values into HeatMap(), I still get the error of ValueError: expected an element of List(String), got seq with invalid items [1283] . Does anyone know what I might be doing wrong here? Why isn’t it possible for me to pass my DataFrame to HeatMap() as how it was done in the example http://bokeh.pydata.org/en/0.9.3/docs/user_guide/charts.html#heatmap ?

Thank you.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5e277727-78c1-4aea-927c-2933c216e88e%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

The bokeh.layouts module is new, newer than the last 0.11.1 stable release. My guess is that you have 0.11.1 installed and are looking at code from the master branch in GItHub that is too new for 0.11.1 to run. You could either switch to look at the 0.11.1 tag on GitHub to see only code that is appropriate for that version, or install one of the recent 0.12 release candidates (or wait for the full release next week).

Thanks,

Bryan

···

On Jun 24, 2016, at 7:56 PM, Augustine Koh <[email protected]> wrote:

Hi Bryan,

Thanks for replying to me and sorry for taking this long to get back to you. I was interrupted from work for a while and now am back.

Indeed, I'd be more than happy to contribute a brief write up to add to the documentation once I figure out how to generate a heatmap.

Following on your link, I cloned the repo and tried executing the heatmap.py file in the example directory, but came aross this error:

---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/home/xxxxxxx/bokeh/examples/charts/file/heatmap.py in <module>()
      2
      3 from bokeh.charts import HeatMap, bins, output_file, show
----> 4 from bokeh.layouts import column
      5 from bokeh.palettes import RdYlGn6, RdYlGn9
      6 from bokeh.sampledata.autompg import autompg

ImportError: No module named layouts

Am I missing a module in the bokeh repo?

Thank you.

Best,
Augustine

On Friday, June 3, 2016 at 10:51:36 PM UTC-5, Bryan Van de ven wrote:
Hi Augustine,

The bokeh.charts API is the newest, and it only stabilized fairly recently, around the 0.10 release. The docs you link are older than that, and refer to a version of the charts API that has been deprecated and removed for some time now. Unfortunately no one has had a chance to add a HeatMap section to the user's guide yet, but there is an example you can study at:

        https://github.com/bokeh/bokeh/blob/master/examples/charts/file/heatmap.py

If you have the time and interest and wanted to write up a HeatMap section in the user's guide, after you start to use it some, that would be extremely appreciated.

Thanks,

Bryan

> On Jun 2, 2016, at 9:37 PM, Augustine Koh <[email protected]> wrote:
>
> Hi everyone,
>
> I am having trouble creating a heat map style plot of gene activity using the HeatMap class. Currently I have read in csv data into a DataFrame and have a DataFrame that goes like
>
> 1534 6609
> 0 -0.5 4
> 5 -0.1 3.1
> 10 1 2.6
> 15 2 1.4
> 20 2.4 0.8
> ...
> ...
> ...
> ...
>
> The very top row that starts with 1534, 6609... are actually the numbers for specific genes, and each column that corresponds to each gene gives a series of values corresponding to activity levels sampled at discrete time points of 0,5,10,15,20... and so forth. As the header column (containing gene labelling numbers) and index row (containing the discrete time points) are non-strings (integers), I proceeded to cast them into string data type so that it would make it possible to plot them as the x - y axes in the heat map. However, even after doing that, and passing the values into HeatMap(), I still get the error of ValueError: expected an element of List(String), got seq with invalid items [1283] . Does anyone know what I might be doing wrong here? Why isn't it possible for me to pass my DataFrame to HeatMap() as how it was done in the example http://bokeh.pydata.org/en/0.9.3/docs/user_guide/charts.html#heatmap ?
>
> Thank you.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5e277727-78c1-4aea-927c-2933c216e88e%40continuum.io.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9cc8122d-59f6-4c51-a856-322aec33b040%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Bryan,

Somehow I managed to figure out a workaround in order to create the heatmap I wanted.

Basically I just followed the unemployment example http://bokeh.pydata.org/en/latest/docs/gallery/unemployment.html and reverse engineered the code in order to generate the heat map I needed. I was able to express my data correctly and now I’m just left with the aesthetics of making the color mapping the way I want for my case and so forth.

Now I’m curious, if its possible to already create a heatmap from just rendering rectangular glyphs on a figure, then what would the heatmap charts api provide in terms of creating a heatmap, that I can’t already achieve with glyphs? I would guess that maybe the charts API provides a higher level of abstraction to remove the complexity of glyphs away from the user, and make heatmap generation much easier?

Thank you.

Best,

Augustine

···

On Friday, June 3, 2016 at 10:51:36 PM UTC-5, Bryan Van de ven wrote:

Hi Augustine,

The bokeh.charts API is the newest, and it only stabilized fairly recently, around the 0.10 release. The docs you link are older than that, and refer to a version of the charts API that has been deprecated and removed for some time now. Unfortunately no one has had a chance to add a HeatMap section to the user’s guide yet, but there is an example you can study at:

    [https://github.com/bokeh/bokeh/blob/master/examples/charts/file/heatmap.py](https://github.com/bokeh/bokeh/blob/master/examples/charts/file/heatmap.py)

If you have the time and interest and wanted to write up a HeatMap section in the user’s guide, after you start to use it some, that would be extremely appreciated.

Thanks,

Bryan

On Jun 2, 2016, at 9:37 PM, Augustine Koh [email protected] wrote:

Hi everyone,

I am having trouble creating a heat map style plot of gene activity using the HeatMap class. Currently I have read in csv data into a DataFrame and have a DataFrame that goes like

    1534     6609

0 -0.5 4

5 -0.1 3.1

10 1 2.6

15 2 1.4

20 2.4 0.8

The very top row that starts with 1534, 6609… are actually the numbers for specific genes, and each column that corresponds to each gene gives a series of values corresponding to activity levels sampled at discrete time points of 0,5,10,15,20… and so forth. As the header column (containing gene labelling numbers) and index row (containing the discrete time points) are non-strings (integers), I proceeded to cast them into string data type so that it would make it possible to plot them as the x - y axes in the heat map. However, even after doing that, and passing the values into HeatMap(), I still get the error of ValueError: expected an element of List(String), got seq with invalid items [1283] . Does anyone know what I might be doing wrong here? Why isn’t it possible for me to pass my DataFrame to HeatMap() as how it was done in the example http://bokeh.pydata.org/en/0.9.3/docs/user_guide/charts.html#heatmap ?

Thank you.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/5e277727-78c1-4aea-927c-2933c216e88e%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Now I’m curious, if its possible to already create a heatmap
from just rendering rectangular glyphs on a figure, then what
would the heatmap charts api provide in terms of creating a
heatmap, that I can’t already achieve with glyphs? I would guess
that maybe the charts API provides a higher level of abstraction
to remove the complexity of glyphs away from the user, and make
heatmap generation much easier?

  Correct.

  See: "

The high level bokeh.charts interface provides a fast, convenient
way
to create common statistical charts with a minimum of code."
For more detail the Key Concepts page:

···

http://bokeh.pydata.org/en/latest/docs/user_guide/charts.html

http://bokeh.pydata.org/en/latest/docs/user_guide/concepts.html#interfaces
On 6/24/16 8:22 PM, Augustine Koh
wrote:

Hi Bryan,

      Somehow I managed to figure out a workaround in order to

create the heatmap I wanted.

      Basically I just followed the unemployment

example
and reverse engineered the code in order to generate the heat
map I needed. I was able to express my data correctly and now
I’m just left with the aesthetics of making the color mapping
the way I want for my case and so forth.

      Now I'm curious, if its possible to already create a

heatmap from just rendering rectangular glyphs on a figure,
then what would the heatmap charts api provide in terms of
creating a heatmap, that I can’t already achieve with glyphs?
I would guess that maybe the charts API provides a higher
level of abstraction to remove the complexity of glyphs away
from the user, and make heatmap generation much easier?

Thank you.

Best,

Augustine

      On Friday, June 3, 2016 at 10:51:36 PM UTC-5, Bryan Van de ven

wrote:

        Hi

Augustine,

        The bokeh.charts API is the newest, and it only stabilized

fairly recently, around the 0.10 release. The docs you link
are older than that, and refer to a version of the charts
API that has been deprecated and removed for some time now.
Unfortunately no one has had a chance to add a HeatMap
section to the user’s guide yet, but there is an example you
can study at:

                [https://github.com/bokeh/bokeh/blob/master/examples/charts/file/heatmap.py](https://github.com/bokeh/bokeh/blob/master/examples/charts/file/heatmap.py)




        If you have the time and interest and wanted to write up a

HeatMap section in the user’s guide, after you start to use
it some, that would be extremely appreciated.

        Thanks,




        Bryan




        > On Jun 2, 2016, at 9:37 PM, Augustine Koh <            >

wrote:

Hi everyone,
I am having trouble creating a heat map style plot of
gene activity using the HeatMap class. Currently I have read
in csv data into a DataFrame and have a DataFrame that goes
like

    1534     6609

0 -0.5 4
5 -0.1 3.1
10 1 2.6
15 2 1.4
20 2.4 0.8



The very top row that starts with 1534, 6609… are
actually the numbers for specific genes, and each column
that corresponds to each gene gives a series of values
corresponding to activity levels sampled at discrete time
points of 0,5,10,15,20… and so forth. As the header column
(containing gene labelling numbers) and index row
(containing the discrete time points) are non-strings
(integers), I proceeded to cast them into string data type
so that it would make it possible to plot them as the x - y
axes in the heat map. However, even after doing that, and
passing the values into HeatMap(), I still get the error of
ValueError: expected an element of List(String), got seq
with invalid items [1283] . Does anyone know what I might be
doing wrong here? Why isn’t it possible for me to pass my
DataFrame to HeatMap() as how it was done in the example .

  You received this message because you are subscribed to the Google

Groups “Bokeh Discussion - Public” group.

  To unsubscribe from this group and stop receiving emails from it,

send an email to [email protected].

  To post to this group, send email to [email protected]

  To view this discussion on the web visit [](https://groups.google.com/a/continuum.io/d/msgid/bokeh/fba73720-2273-43ce-992f-01c618926817%40continuum.io?utm_medium=email&utm_source=footer)      .

For more options, visit .


Sarah Bird
Developer, Bokeh

    [
      ![Continuum Analytics](http://docs.continuum.io/_static/img/ContinuumWordmark.png)
    ](http://continuum.io)

http://bokeh.pydata.org/en/latest/docs/gallery/unemployment.html[email protected]

http://bokeh.pydata.org/en/09.3/docs/user_guide/charts. html#heatmap
?

        >

        > Thank you.

        >

        >

        > --

        > You received this message because you are subscribed to

the Google Groups “Bokeh Discussion - Public” group.

        > To unsubscribe from this group and stop receiving

emails from it, send an email to [email protected] .

        > To post to this group, send email to
        .

To view this discussion on the web visit [email protected]
https://groups.google.com/a/continuum.io/d/msgid/bokeh/5e277727-78c1-4aea-927c- 2933c216e88e%40continuum.io.

        > For more options, visit [https://groups.google.com/a/continuum.io/d/optout](https://groups.google.com/a/continuum.io/d/optout)            .

      [https://groups.google.com/a/continuum.io/d/msgid/bokeh/fba73720-2273-43ce-992f-01c618926817%40continuum.io](https://groups.google.com/a/continuum.io/d/msgid/bokeh/fba73720-2273-43ce-992f-01c618926817%40continuum.io)

https://groups.google.com/a/continuum.io/d/optout