Coder Social home page Coder Social logo

Comments (2)

satta avatar satta commented on May 30, 2024

You are correct, we use Cairo to render SVG -- unfortunately that is also the reason why I am afraid it is not possible to add such active content to the output using the Cairo API. As far as I remember, it does not include such SVG-specific actions, being independent of the target output format.

I guess this may be possible using an external SVG library in a modification of the sketch tool. The boundary coordinates of the feature boxes in the image as well as metadata for each feature drawn in an image are accessible using the GtImageInfo and GtRecMap classes in the GenomeTools API. See http://genometools.org/libgenometools.html#GtImageInfo. However, I would have to research what library would support adding mouseover or click layers to an existing SVG file. Sounds quite non-trivial though.

I definitely see the usefulness of what you request and would love to include something like that as an optional feature for the SVG output, although my time is quite limited right now. Do you have experience with SVG or SVG editing libraries and could suggest some suitable project I could look into? Or is it enough to add some additional code to the end of the file, which -- as you correctly say -- is rather difficult to read as a human.

from genometools.

danudwary avatar danudwary commented on May 30, 2024

Unfortunately, no I can't say that I have viable suggestions on other libraries. In an older project we scripted SVG generation by hand. As you say, you have the coordinates, and writing an interactive SVG polygon is pretty simple.

You might have a look an example at http://jsfiddle.net/aweQh/
(Forgive the bad HTML formatting. It was a quick paste from a website I used to run.)

File size and generation time would be much more efficient, I believe, as Cairo seems to be adding a tag for each stroke, including converting text labels to drawings. If for whatever reason you couldn't/wouldn't want to render an SVG in this way (ie I'm sure it could break much of what you have here), I believe you could maybe tack this sort of scripting to the end of the generated SVG, putting up some invisible rectangles with the onmouseover (or onclick) events, with useful info pulled from the gff the same way labels are. Maybe? Unfortunately, I'm not a strong enough programmer outside of Perl to easily immediately understand the API, but I may give it a try. Though, as you say, time is always limited. :)

Thanks for the attention and consideration! As I said, AnnotationSketch in particular has already been really useful for us.

from genometools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.