sozi presentation image

Svg based presentations with Inkscape and Sozi


Have you ever heard of deck.js, Impress or Reveal ? These are tools that allows one to create nice web-based presentations with plenty of animations. As strange as it may sound, I first looked at these apps because I wanted some smooth drop shadows for the pictures in my own LibreOffice presentations. CSS can be used to get that effect. I tried all the above mentioned libraries and tools and was disappointed by the fact that adding images and graphics seems to be an after-thought. These tools are excellent for text-based presentations but placing vector graphics, like svg, in a particular position and making graphically-rich presentations is not their main domain of use. Users circumvented these limitations by writing extensions, see examples for deck.js here.

Wandering on the web led me to a tool that allows graphic rich presentations to be made with the best open source tool for vector graphics creation: Inkscape. One of the integrated plug-ins, called JessyInk, allows one to use a succesion of layers to create an svg file that, when opened with a web browser, are shown one after the other. JessyInk is an impressive tool, allowing one to annotate ‘live’ the presentation or to show an overview by clever keyboard shortcuts, but I did not like the fact that the original svg had to superpose all the layers. Additionally, the svg file is modified by JessyInk with some elements not being rendered at all in the obtained presentation. Not good.

In search for an alternative, I found Sozi, an application that takes a different approach from JessyInk. It allows something that I did not thought possible – take a poster, done with Inkscape or other svg creator, and make a presentation based on succesive views of different parts of the large image. Everything is integrated in a html/json pair of files that integrate the original svg with JavaScript magic. While the Sozi interface is in need of some ergonomy improvements, the tool is robust enough to allow me to create a 60 slides presentations in an evening, from a large svg file that I already had in Inkscape. A few of the slides  can be viewed on my bitbucket site (although some images lack from the presentation). Scrolling allows zooming in and out of the slides and clicking on the slide number opens a nice menu with all the slide titles, for fast navigation. The first slide, as a screenshot of my current Ubuntu desktop (clicking on the image goes to the presentation page):

sozi presentation image
Sozi presentation, first slide

I would very likely use Sozi and Inkscape for presentations in the future. There are a few things to consider though:

  1. Images inserted in the SVG file are better handled through relative links and should be kept in a directory that is close to the svg file itself. Moving the presentation around becomes possible if the html, json and img folder are moved together.
  2. Sozi does not allow for the moment to easily have several versions of the presentation based on the same svg but this feature might come in the future. It will be also very useful to allow the existence of svgs where text was converted to paths, so that one does not need to carry some exotic fonts around just to be able to show a presentation. If you want to duplicate a presentation, you have to duplicate the html, json and original svg and change their name so that they match each other.
  3. One has to be familiar with Inkscape and its quirks.
  4. Web browsers are not exactly familiar to the idea of presentations, the mouse pointer, for example, insists on showing the title of the web page.
  5. Do not use layers in the original Inkscape presentation. Somehow, Sozi becomes confused and might transform the layers differently, giving a very strange result. Better to use blocked elements, if you want to make a pattern of rectangular regions as template for the graphical elements of the presentation.
  6. Always do a backup of your presentation in PDF – sozi-to-pdf does it gracefully. It is a module that has to be installed separately. It generates a rather large pdf file because it is composed of high quality graphic png. While it is large, it will not depend on locally installed fonts or any additional resources to be displayed as you expect it to be.

Update (April 2017). For the type of presentation I usually do, better distribute the images or drawings in separate svg files. This helps a lot in finding a particular image or result, more difficult with very large SVG files, as those used for a Sozi presentation.


Customize Ubuntu 14.04 on a HP Zbook

A few notes about things I did to be able to work with Linux on a HP Zbook 14 G2. Dual boot was problematic because gparted had difficulties with the M.2 SATA SSD. In the end, Linux lives happily on the HDD and a NTFS partition ensures bidirectional communication with Windows.

Once Ubuntu LTS 14.04 was installed, several changes were needed to adapt the display resolution (920×1080 pixels), adjust battery usage, add some useful utilities and hide or show disk partitions at will:

1. Make fonts larger on high dpi screen for the grub menu (from
sudo grub-mkfont --output=/boot/grub/fonts/DejaVuSansMono24.pf2 --size=24 /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf

Add the following lines to the grub configuration file (can be edited with “sudo gedit /etc/default/grub”):
## More readable font on high dpi screen, generated with
## sudo grub-mkfont --output=/boot/grub/fonts/DejaVuSansMono24.pf2 \
## --size=24 /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf

Update grub to take into account the new configuration:
sudo update-grub

2. Install LibreOffice 5:
sudo add-apt-repository ppa:libreoffice/libreoffice-5-0
sudo apt-get update
sudo apt-get dist-upgrade

3. Install a very capable FTP client (lftp) and an alternative file manager (Double Commander):
sudo apt-get install lftp
sudo add-apt-repository ppa:alexx2000/doublecmd
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install doublecmd-gtk

4. Install exFAT support
sudo apt-get install exfat-fuse exfat-utils

5. Command line information on battery usage:

upower -i /org/freedesktop/UPower/devices/battery_BAT0

Get information on battery usage (11.5 W average):
sudo apt-get install powerstat
powerstat -d 1

Test if hibernate works; no it does not work well, forget about it.
sudo pm-hibernate

6. Optimize energy consumption with tlp:

Install tlp from ppa (will be included in the main repository for further versions of ubuntu)
sudo apt-add-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get install tlp

Configure TLP:
cd /etc/default/
cp tlp ~/tlpconfig.backup
sudo gedit tlp
# modify SATA option, from
# modify SATA_LINKPWR_ON_BAT=min_power to max_performance

7. Hide windows partitions from XFCE and Unity and automount partitions:
cd /etc/udev/rules.d/
sudo gedit 99-hide-disks.rules
# use the right names for the disks or their identifiers
# at reboot the sda1 and sdb2 partitions will not be visible any more
# inactivate fast boot option in Windows, otherwise shared disks are unmountable in Linux

# Automatically mount removable partitions
# First, get the identifier of the partition with "mount" -> /dev/sda3
# Get the uiid:
ls -al /dev/disk/by-uuid/
# lrwxrwxrwx 1 root root 10 mars 2 08:31 someuiid...
# Add to startup items:
/usr/bin/udisksctl mount --block-device /dev/disk/by-uuid/someuiid

8. Packages required to install R on Ubuntu:
# Various packages required for installation of R parts, if packages complain about missing libraries:
sudo apt-get install libxml2-dev
sudo apt-get install libssl-dev
sudo apt-get install libcurl4-gnutls-dev

9. Display customization and other tricks:

Change dpi settings in the “Displays” preference > scale 1.38
Install Unsettings to change Unity settings
sudo add-apt-repository ppa:diesch/testing
sudo apt-get update
sudo apt-get install unsettings

Change the brown color of selected item to something else (blue)
sudo apt-get install gtk-theme-config

Make text and other things larger on high dpi for Firefox
Write: *about:config* in the address bar
Then change the layout.css.devPixelsPerPx value to 1.4 (user set string)
The same can be done for Thunderbird (Preferences > Advanced > Edit config)


VirtualBox Linux shared folders how-to

Switching from Ubuntu/Debian to Manjaro/Arch linux as VirtualBox guest operating systems has consequences.

First, Manjaro/Arch already has the virtualbox guest extensions pre-installed, which is very convenient. These extensions allow running the virtual machine full screen with adjusted resolution and mounting shared folders with the host OS.

Second, an additional manipulation is required for Ubuntu to make shared folders accesible (as described here):

Question: I configured a shared folder between the Windows host and Ubuntu guest. The folder mounts at start up but its empty. It also has a padlock sign.

Answer: You, as a user, were not added to the vboxsf group, to which the mounted share folder belongs. To allow access to the shared folders permanently, in a Terminal window on the new Ubuntu:

sudo usermod -G vboxsf -a username

where you replace username with your own user name. This command appends the user “username” to the vboxsf group, which is the owner of the shared folders (found in /media/ on the Ubuntu box). You won’t need to run a script at startup once you own the mounted shared folder.

On Manjaro/Arch Linux (with LXDE), the mount does not happen automagically. I created a ‘shared’ folder in my user home directory. Next, I mounted the shared folder using the virtualbox mount command:

sudo mount.vboxsf temporary /home/myusername/shared

EDIT: the command allows some read access but no write access. To have access in both directions as a user follow the instructions detailed in a superuser answer:

sudo mount.vboxsf -o gid=1000,uid=1000,rw temporary /home/myusername/shared

I wrote this blog post as a reminder for myself and in the hope that it could be useful for someone else (even if I already wrote some of this information in a previous blog post)

Column order and decimal point changes with awk and sed

Recently, I’ve been confronted with a simple problem that I usually solve in a spreadsheet application. In a text file, change the order of columns and shift from “,” to “.” as a decimal point separator. However, since I had many similarly formatted text files and did want to speed up the conversion, I searched for tools that could help me do theses simple tasks without too much hassle. Welcome awk, a programming language and tool for text processing and sed, a line-by-line editor, both available by default in MacOS X and Linux. As usual, stackexchange answers and question were extremely useful to quickly find a solution.

While I was awking happily around, I became aware of a problem that I did not expect – it uses line feed characters (LF) as line terminator and if the file comes from Window, it has carriage return (CR) and LF at the end of lines. Thus, the first step needed to get a clean file, was to remove those annoying CR (well visible in the following screenshot, on Geany, a fantastic text editor):


This can be done with the following awk command that removes CR characters while leaving LF in the file:

awk '{ sub(/\r$/,""); print }' infile.txt >outfile.txt

The result is, as expected:


Now, we can proceed with the following step, which is a change in column order. What I needed was to move 4th column in second position. Awk comes to the rescue here as well:

awk -F\t '{print $1,$4,$2,$3}' OFS=$'\t' infile.txt > outfile.txt

The result looks good, no more CRs and the order of columns is fine:


Finally, the numeric values that used “,” as decimal separator were not correctly interpreted by the clustering program. However, changing all the commas to dots was not very nice, because column 2 now contains useful text commas. Sed provided a very simple command to do that:

sed 's/\([0-9]\)\,\([0-9]\)/\1.\2/g' < infile.txt > outfile.txt

To understand how sed does its thing, one must be familiar with regular expressions.

In the end, the file looks exactly as I wanted it to be:


There is no need to keep intermediate files and these commands can be chained using the “|” pipe operator. Alternatively, they can be put together in a small shell script.

Any alternatives to LaTeX for collaborative manuscript writing in science ?

In a world in which we read mostly on screens and in which unprintable data like videos or high resolution images are part of published papers, it makes sense to think of new ways of producing, sharing and reading research results. Finding ways to easily collaborate with co-workers and to be able to keep a manuscript in a shareable and flexible format is an ongoing quest (see for example, datacite).

When trying to see what online tools allow to write manuscripts in a collaborative way, I was very much impressed by Overleaf‘s interface and gave it a try for a real manuscript writing. While some of my colleagues had no problem in working with the system, it is still a little odd that, for example, including citations requires uploading a file in the .bib format. Some ‘infinite compiling’ errors scared one of my collaborators and were perceived as a lack of robustness of the system. Adding references and cross-references remains quite involved and one needs some time spent in LaTeX innards to be able to get to a nice end result.

Lens Writer screenshot
An image of Lens Writer in action. Installing the package from github and launching a local server is very simple.

This post was motivated by my recent enthusiasm when reading about a JavaScript library called Substance that serves as a basis for several projects, including one that is designed to allow easy writing and sharing of scientific data:  Lens Writer. The philosophy of this way of writing a scientific report is, from my very limited understanding of it, that everything revolves around web-based technologies, running with JavaScript. An early version of the editor, working with Node.js, provides a play ground for those curious to test its capabilities. Definitely a project that will be very interesting to follow and see its evolution!

LabKey – manage shared lists of reagents, oligos, strains

LabKey is a very friendly system for lab scale, or larger, sharing of common data. In our own hands, LabKey replaced a series of spreadsheets giving a much better way to edit and view things; mostly lists of reagents. The software can be obtained from:

Nelson EK, Piehler B, Eckels J, Rauch A, Bellew M, Hussey P, Ramsay S, Nathe C, Lum K, Krouse K, Stearns D, Connolly B, Skillman T, Igra M. LabKey Server: An open source platform for scientific data integration, analysis and collaboration. BMC Bioinformatics 2011 Mar 9; 12(1): 71.

LabKey works on on an Apache tomcat java server and it’s mostly Java on server side with some JavaScript enhanced pages on the user side. A working relational database server is also required. Not perfect but better than shared Excel files.

The installation we use is on a Windows machine with VirtualBox on which a Ubuntu 12.04 is installed. Installation was not painless but I followed the steps detailed in the python file: I had some problems with showing the Apache server to the outside world from within the virtual machine. A short description of how to install a Ubuntu machine on a Mac is here:

I just found a few notes on steps taken to configure a working LabKey on Linux (Ubuntu). These are useful especially if you are doing the install in a VirtualBox machine:

sudo apt-get install build-essential 
#installs compilers
>sudo usermod -G vboxsf -a yourusername 
#adds a user to the group -vboxsf to allow sharing of a folder
#install the server and database system (adjust numbers to actual versions)
>sudo apt-get install sendmail tomcat6 postgresql xvfb graphviz r-base
>cd /usr/local/
>sudo cp -R ~/Downloads/jre1.7.0_21 ./
>sudo ln -s /usr/local/jre1.7.0_21/ /usr/local/java
#configure the database user
>sudo -s -u postgres
>createuser -P
>sudo service tomcat6 stop
#help labkey user get access to the configuration in the tomcat server folder
>sudo chown -R tomcat6:tomcat6 labkey/
#make logs position a little bit easier to find.
>sudo ln -s /var/log/tomcat6/ /usr/share/tomcat6/logs

I’ve updated the LabKey server to the latest version (14.2, as of July 2014). While I thought it would be easy, I ended up by upgrading:
– Java (to 1.7 OpenJDK and Sun – I don’t really know which one is used – the system reports Oracle but the tomcat7 user has apparently a mind on its own),

– PostgreSQL (to 9.3 from 9.1 and kept the database safe using a script from postgres-contrib, pg_update, and indications from this blog post). The update failed if launched from the home directory. Worked if started from the /var directory because the script wants to write a log file and needs write permissions.
– Tomcat from 6 to 7 (relatively painless). Works very nicely as a service and can be stopped started at will with >sudo tomcat7 start (or stop or restart).
With the update, I changed also the way I remotely backup the data from the labkey database. Getting json files is good, but a pg_dump is much better. The only problem was that I did not know how to talk to the database – two configuration files needed to be changed to allow remote connection (postgresql.conf and pg_hba.config, as explained here.) In addition, another port forwarding needs to be added to the VirtualBox configuration.
The new LabKey version is improved compared to the older one. I feel more confident now about upgrading the thing.

ApE, a plasmid editor, installation on Linux (Debian)

UPDATE 2017-06: The easiest way to have a running ApE under Linux, which became critical for me after switching permanently to Linux at work, is to recover a Mac App bundle from the author’s web site:

After unzipping to a local folder, just launch the application (in my case):

wish /home/username/thefolder/ApeMac/

Tcl/Tk need to be installed to have the wish command available.

You can even alter the preferences of your file manager to open .ape files by using the same command followed by “%F” (on Ubuntu 17.04, MATE, Caja file manager).

UPDATE 2018-04: For portability among Linux installations, the `AppMain.tcl` can be packed with the `tclkit`, making it a single executable file (Starkit, for StandAlone Runtime). It takes about five minutes to follow the instructions from the tcl/tk wiki. It needs the sdx (Starkit Developer eXtension) application and a tclkit.

The first command creates a compressed folder containing the script and the associated tclkit resources. The second command unzips the folder, which allows the third command to create the runnable application file.

tclkit sdx.kit qwrap example.tcl
tclkit sdx.kit unwrap example.kit
tclkit sdx.kit wrap example -runtime tclkitcopy

OLDER CONTENT – safe to ignore follows:

ApE is the most useful DNA editor I know of. Although installation on Windows and Mac OS X is easy through pre-packaged binaries, Linux installation may be a little bit more complex. Don’t be discouraged – nice people, with the help from the ApE author himself, discovered all that is there to know about how to do it properly. Some useful information comes from the Ape wiki:

Information from about how to install Ape on Linux (you might get some error results from wget, standard browser pointing to the address should work better):

# download latest windows version/package
 # download & setup tclkit (
 >gunzip tclkit-linux-x86.gz 

 #make the binary executable:
 >chmod +x tclkit-linux-x86
 # download SDX (Starkit Developer eXtension)
 # unwrap & run ApE
 ./tclkit-linux-x86 sdx.kit unwrap ApE.exe
 ./tclkit-linux-x86 ApE.vfs/main.tcl

A recent version of the Tclkit can be recovered from:

Two i386 libraries were required for ApE  to work on a Debian install (wheezy, 7.7, 64 bit version):

>su - root
>apt-get install libxss1:i386
>apt-get install libxft2:i386

The old Ape version for Linux works with base Tcl/Tk, but lacks some of the nice features of the ApE 2 series.
Newer versions require some extensions from the tclkit.

Don’t forget to chmod +x the tclkit binary

Proof that it works:

ApE screen shot
ApE screen shot

🙂    🙂


EDIT: The 2.0.7 version is in fact available and works directly with wish. Once unzipped, just ‘cd’ to the ‘ApE Linux’ directory and from there > wish AppMain.tcl  . This even works under Mac OS X Mavericks with Tcl/Tk 8.5.9!