Background: we are clustering some (~500) ncRNAs based on their secondary structure. 2D structure is computed by RNAfold. Then, we compute a distance matrix of RNA structures by RNAdist and cluster it in R using hclust. We would like to plot the dendrogram in a way where the MFE secondary structures generated as .ps files by RNAfold are plotted as small icons at the tips of the dendrogram, to get a visual impression of the similarity of the various shapes. To my surprise, we were unable to find out how to achieve this in R/ggplot, ETE, or iTol. FigTree does not seem to be able to render leaf images either.
Could someone help us out with a recipe to do this?
You can add jpg images to existing plots, see second answer here: http://stackoverflow.com/questions/9543343/plot-a-jpg-image-using-base-graphics-in-r
However, it is not very convenient, maybe the magic wand in Photoshop would be a better solution?
Thank you. Even if I manage to render a single image, the remaining task is really close to 'magic'. MAybe the question can be further broken down:
I remember that you can manually get coordinates with
locator()
function. But with a dendrogram of 500 it is practically not feasible I think. Then, in theory, you could feed these coordinates in theplot_jpeg()
function.Maybe there are better solutions though...