pachterlab / sleuth

Differential analysis of RNA-Seq
http://pachterlab.github.io/sleuth
GNU General Public License v3.0
305 stars 95 forks source link

Order of labels_row in plot_transcript_heatmap #207

Open bruvellu opened 5 years ago

bruvellu commented 5 years ago

Hello,

I wanted to replace the transcript IDs for gene names in the heatmap generated by plot_transcript_heatmap. However, if I use the pheatmap argument labels_row as below, the gene names do not match the IDs. The rows are reordered by the heatmap function before the labels are applied.

plot_transcript_heatmap(
  so,
  transcripts = head(table, n = 10)$target_id,
  labels_row = table$gene_name[0:10]
  )

I have used this approach to control row ordering when calling pheatmap directly. What would be the best way to replace IDs by names within plot_transcript_heatmap?

Thanks

warrenmcg commented 5 years ago

Hi @nelas,

I think you've uncovered a bug. Because of how the count/TPM data is pulled from the sleuth object, the order of the input data matrix to pheatmap is not guaranteed to be the same as the order of the transcripts given to plot_transcript_heatmap. I will add a line of code to make sure it is guaranteed, and then your strategy should work.