PhanstielLab/plotgardener

PlotTranscripts not annotating all the transcripts of a given gene

Opened this issue · 5 comments

NPSDC commented

Hi,
I have been trying to use the poloTranscripts functions to plot all transcripts for a given gene, however I find that names of some transcripts are not shown when they are short. I could not find a parameter to orient such cases. I was wondering if I can get some help from the developers on how to do that. To demonstrate, I am attaching some examples. Let me know if you need more information
unnamed
unnamed-2

Hello!

Yes, there are two main ways that transcript names will not be shown: 1) if they will be cut off at the edge of the plot; and 2) they overlap a "higher priority" transcript label. You cannot force the names to show up, but there are a couple things you could try to adjust to show those labels:

  • Make the fontsize of labels smaller.
  • Slightly extend the region of your plot. For example, in your top plot I would slightly extend chromend, and in your bottom plot, I would slightly extend chromstart. This will add additional plotting space that may allow space for the labels.
  • A less ideal solution: if you absolutely insist on keeping the rest of the plot as-is, you can go back and identify the missing names and label them manually with plotText.

I hope one of these solutions is able to help.

Best,
Nicole

NPSDC commented

Hi Nicole,
Thanks for the quick response. I guess the third one seems the most applicable based from what I have tried so far. Will it be possible to request this as a feature in the future, where perhaps we can annotate all the transcripts on the corner so that we can prevent such cases.

Yes, that is a great suggestion! I will keep this issue open with an "enhancement" tag so we can develop some solutions for including missing transcript labels.

Nicole

Hi @nekramer and @NPSDC, we discussed this issue a bit at Bioc2023 and think a few small changes might provide a workaround.

To get all labels to show despite “priority”, could the spaceWidth parameter be set to 1 to force all transcripts on a separate line?

To solve the issue where labels disappear if the center of the transcript is out of bounds, could we make a code change that plots labels in the center of the in-bounds portion of the transcript/gene?

What are your thoughts @nekramer? Do you see any reasons why this wouldn’t be possible?

Setting the spaceWidth parameter to 1 and forcing all transcripts to be on separate lines is a great suggestion to show all labels despite priority @EricSDavis! The only issue I could see here would be if there wasn't enough height in the plot to show all the transcripts, you might not necessarily prioritize the ones you want to see. This made me realize that we haven't given as much love to plotTranscripts as plotGenes because we don't allow for user-defined priorities here and don't return what all the transcripts are like we do for plotGenes.

I've been thinking about doing an adjustment like the one you suggested to change the "center" of a transcript to the in-bounds portion. I definitely think this could be possible! I think in combination with some kind of user-defined priority, this would be a good way to get around this issue. This way, users can 1) prioritize the transcripts they're interested in if they want to plot them on single lines but have limited height; and 2) prioritize any of these edge-labeled ones that might overlap other text with same-line transcripts and not show up if they're not higher "priority" (our internal use grid.text() with checkOverlaps = TRUE will never allow overlaps, which is why I bring this up).

This is on my radar and in the works, but I just haven't had a chance to implement any new features in a while. Thanks for all the suggestions and help <3

Nicole