Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding different annotations in the hover screen in html #61

Closed
dadush1 opened this issue Sep 11, 2024 · 2 comments
Closed

adding different annotations in the hover screen in html #61

dadush1 opened this issue Sep 11, 2024 · 2 comments
Labels
question Further information is requested

Comments

@dadush1
Copy link

dadush1 commented Sep 11, 2024

Hi moshi4!
First of all thank you for a wonderful tool! its great!
One thing that I couldn't quite understand is how to control which text will be shown when hovering on a gene in html mode.
For example this:
image

this is how I add features to the track, but only "length" and "location" are shown in the box, the label is pasted above the gene, I would like it also to show in the hover box:

# add genes to genome track for cds in cds_list: start, end, strand, name, color, patch_kws, linewidth = cds track.add_feature(start, end, strand, label=name, facecolor = color, patch_kws = patch_kws, labelsize = 7, labelvpos = vposition, labelrotation = labelrotation, linewidth = linewidth)

This is how it looks in my case:
image

Thanks!

@moshi4
Copy link
Owner

moshi4 commented Sep 11, 2024

In pyGenomeViz v1.0.0 or later, tooltip labels can be added freely with the extra_tooltip argument.

Code Example

from pygenomeviz import GenomeViz

gv = GenomeViz()
gv.set_scale_xticks(ymargin=0.5)

track = gv.add_feature_track("tutorial", 1000)
track.add_sublabel()

track.add_feature(50, 200, 1, extra_tooltip=dict(name="gene1", type="CDS"))
track.add_feature(250, 460, -1, fc="blue", extra_tooltip=dict(name="gene2", type="CDS", product="hypothetical"))
track.add_feature(500, 710, 1, fc="lime", extra_tooltip=dict(name="16S rRNA", type="rRNA"))
track.add_feature(750, 960, 1, fc="magenta", lw=1.0)

gv.savefig_html("result.html")

pygenomeviz_extra_tooltip

@dadush1
Copy link
Author

dadush1 commented Sep 11, 2024

Perfect! Moshi thanks a lot!

@dadush1 dadush1 closed this as completed Sep 11, 2024
@moshi4 moshi4 mentioned this issue Sep 14, 2024
@moshi4 moshi4 added the question Further information is requested label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants