order in heatmaps

121 views
Skip to first unread message

Elena Gómez-Díaz

unread,
Jun 13, 2014, 1:21:05 PM6/13/14
to deep...@googlegroups.com
Hello,

I have two questions regarding heatmaps:
1. How can I sort the values in the matrix based on a custom order
2. Is any way to use heatmapper using a custom matrix?
I guess I could use deepTools locally by command line. However I do not which should be the format for that matrix. In galaxy the input for heatmapper is the matrix file generated by computematrix tool. When I downloaded that file that is a bgzip but I couldn't opened it I a don't know how it looks like. Is the heatvalues matrix file generated by computematrix a correct input for heatmapper (even if in galaxy does not accept that file?).

thanks!

Friederike Dündar

unread,
Jun 13, 2014, 2:40:13 PM6/13/14
to Elena Gómez-Díaz, deep...@googlegroups.com
Hi Elena,

I will try to reply to your questions.

1. "custom-sorted" matrix

- the default behaviour of computeMatrix (Galaxy and commandLine) is to not sort the regions that are provided in the BED file
- the heatmapper default, however, is to sort --> thus, if you would like to retain the order of the regions in your original BED file, you need to specify that you do not want to sort (in Galaxy, click on "advanced options", in the command line it's the --sort option)

2. heatmapper with custom matrix

I'm not sure if I understood all aspects of your question, but here's what I can tell you:

- the default output file of computeMatrix is indeed gzipped, i.e. if you indicate .gz at the end of the output file, you should be able to have a look into it on the command line, e.g. via zcat

Here's an example:
```
$ zcat matrix.tab.gx | head -1 # to show the first line of the computeMatrix output

@body:0    nan after end:False    verbose:False    downstream:3500    bin size:10    upstream:1500    scale:1    missing data as zero:True    skip zeros:True    ref point:TSS    min threshold:None    proc number:32    bin avg type:mean    max threshold:None


$ zcat matrix.tab.gx | head -2 | tail # to show the second line as an example for all the other entries

chr2    7108    14204    FBgn0203881    -0.177945456498    +    -0.390000    -0.390000    -0.390000    -0.390000    -0.422727    -0.430000    -0.430000

$ zcat matrix.tab.gx | tail  -1  # to show the last line

#genes
```

As you can see, the matrix has three main parts: header, body and label(s). In the case above I used only one BED file, hence there's only one label ("genes" in this case which is the default)

The header contains the information about how the matrix file was generated.
The body contains the values that are later on shown in color as a heatmap - note that the first 6 columns refer to the entire BED entry, i.e. each region in the BED file is kept exactly as is and the values for the heatmap are added in the columns afterwards. In the above shown example, the heatmap would show the colors for the values -0.39, -0.39, -0.39, -0.39, -0.42, -0.43, -0.43 (in total 7 bins). For a typical application, there are probably many more bins, depending on the size of the bins and the size of the plotted regions. I.e. if each region that you plot is 100 bp long and you choose a bin size of 20, there will be 5 columns with values for the heatmap.

 Regarding your very last question - I guess you mean the optional output file that you can get from heatmapper as well as from computeMatrix using the --outFileNameMatrix option? That matrix is similar to the gzipped one, but not identical which is why it is probably throwing out an error.

In contrast to the above shown entries of the gzipped "proper" matrix, the unzipped one has the following first 3 lines:

```
#genes:2474
#downstream:3500    upstream:1500    body:0    bin size:10
-0.39 -0.39 -0.39 -0.39 -0.423 -0.43 -0.43
```

As you can see, here, the label is at the top (not at the bottom) of the file and the options are also listed in a slightly different format.



I hope this helps. If you cannot get it to work, it would help us to understand what your goal is exactly (i.e. what are your input files and what should the result be).

Good luck!

Friederike


--
You received this message because you are subscribed to the Google Groups "deepTools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to deeptools+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages