10 June 2011

An extension for Inkscape processing a sequence from Genbank

Let's create a new extension for inkscape by recycling an old XSLT stylsheet producing a SVG image !

For example, we're going to use this xslt stylsheet: https://github.com/lindenb/xslt-sandbox/blob/master/stylesheets/bio/ncbi/gb2svg.xsl that transforms a Genbank XML INSDSeq to SVG. It is downloaded into the extension directory;

${HOME}/.config/inkscape/extensions/gb2svg.xsl

Now let's tell inkscape about this new extension by defining the following XML file (INX):

${HOME}/.config/inkscape/extensions/gb2svg.inx


<inkscape-extension>
<name>Genbank Input</name>
<id>org.inkscape.input.ncbi.genbank</id>
<input>
<extension>.xml</extension>
<mimetype>text/xml</mimetype>
<filetypename>NCBI Genbank (*.xml)</filetypename>
<filetypetooltip>NCBI Genbank XML</filetypetooltip>
</input>
<xslt>
<file reldir="extensions">gb2svg.xsl</file>
</xslt>
</inkscape-extension>



Now let's test this new extension: download a sequence from Genbank and save it as a XML/INSDSeq file. For example: http://www.ncbi.nlm.nih.gov/nuccore/NM_001200001.1.

Open Inkscape. Do Menu File > Import > and select the file sequence.gbc.xml and the Genbank format.


Press OK. Et voila !!






That's it,

Pierre

No comments: