To a new location:

because version control, clean interface, markdown; being down with the cool kids.

Posted in Uncategorized | Leave a comment

We have moved

I am now down with the cool kids and hosting this blog @ github:

Why? Version control and the possibility of writing posts on my favourite editor, Sublime text, without changing my work flow at all.

See you there.

Posted in Uncategorized | Leave a comment

Install bioconductor packages from SVN

Due to some issues with the way DEXseq calculates the log2foldchanges I decided to re-run an analysis with the issue fixed. Since it is not yet in the development branch, an install from svn was needed  – my first!

Firstly the source code was downloaded with:

svn co --username readonly --password readonly DEXSeq

This followed a build to generated a package:

R CMD build --no-build-vignettes DEXSeq

I had issues with the build process, which failed during the vignette build. As I don’t care about it, using --no-build-vignettes bypassed the problem. Then it was a simply matter of starting R and installing the package:

install.packages("DEXSeq_1.12.2.tar.gz", repos=NULL)


Posted in Uncategorized | Leave a comment

virtualenvs or: How I Learned to Stop Worrying and Love not having sudo powers in a server

Well, you might think, there is always pip install --user. Aha! Yes, that works most of the time, but not when some package upgrade (distribute for deepTools) conflicts with globally installed packages.

The solution (for python packages)

Python virtualenvs to the rescue!

These have been around for sometime, but I never felt inclined to dig into it until now (I can also be a bit of a Luddite). Put simply, virtualenvs are reservoirs of custom python and package installations. In practice, one creates a folder where all the packages can be installed, and then simply source it. From that point on, everythying done in python is using whathever is in that folder or virtualenv. Even a copy of the python binary will be there.

One of the major appeals, for me at least, is that no sudo is required for the set-up of the virtualenv or installation of packages. Also, one can have multiple virtualenvs, say for different projects.

For a proper (practical tutorial) see this post by Jamie Mathews.

In the meantime, deepTools just finished compiling and I can now go to work.

Posted in Uncategorized | Leave a comment

Clone all repositories from a user (bitbucket)

Now that I have computer, the next step is to install everything I use on daily basis, and set-up my projects space. This involves cloning all my repositories. I could do this manually one by one, but what is the fun in that?

Solution 1

My rule is that “if there is a way to make some task more efficient programatically, some one else thought of it before, so google it before starting scripting”. So I did, and of course someone else came up with a solution:

#Script to get all repositories under a user from bitbucket
#Usage: [username]
## credit to Harold Soh

curl -u ${1}${1} > repoinfo
for repo_name in `grep \"name\" repoinfo | cut -f4 -d\"`
    hg clone ssh://${1}/$repo_name

This however did not work perfectly for me. When downloading the rep info, the json config comes poorly formatted as a single line. This meant that the line grep \"name\" repoinfo | cut -f4 -d\" was return scm, which obviously is not what one of my repositories.


So I hacked a liitle and came up with a not-very-elegant-but-working-solution to parse the json:

#Script to get all repositories under a user from bitbucket
#Usage: [username]

curl -u ${1}${1} > repoinfo
# curl -u adomingues
# cat repoinfo

for repo_name in `cat repoinfo | sed -r 's/("name": )/\n\1/g' | sed -r 's/"name": "(.*)"/\1/' | sed -e 's/{//' | cut -f1 -d\" | tr '\n' ' '`
    echo "Cloning " $repo_name
    hg clone https://${1}${1}/$repo_name
    echo "---"

This basically the same script as that of Harold, but with a more complex parsing:
sed -r 's/("name": )/\n\1/g' makes sure that the repo name is not at the start of each line;
sed -r 's/"name": "(.*)"/\1/', removes the string “name” at the beginning of the line;
sed -e 's/{//' removes a funny curly bracktet ar the start of the file;
cut -f1 -d\", separates and keeps the actual repository name;
– `tr ‘\n’ ‘ ‘“ just removes the new line character creating a list of repository names to be looped.

Et voilá! There is probably some less convoluted away of going about it, probably involving regex, but in someone else’s wise words: “if you need regex to solve a problem, you now have 2 problems”.

The only minor inconvenience is that I need to input my password for each repository. There might be a solution for this, but I have not found it yet.

Posted in Uncategorized | Tagged , , | 4 Comments

New shiny toy

Updated on 11.01.2015 to correct spelling mistakes, grammar, and add new information about the speakers.

My new laptop has arrived, and after testing it for a couple of days, I feel that I can post my own impressions of the Dell XPS13 (9333).

Dell XPS13

Those in the Linux world may have heard of it by the code name sputnik. Originally this model was developed by Dell, with an eye on developers, and thus it is one of the very few laptops to be offered with Linux Ubuntu pre-installed.  As a bioinformatician, or genomics data analyst as I call myself (not very catchy), working on a *nix machine is a must. Even though I worked in OSX for a while, it never really impressed me, so when deciding on a laptop for my new job, I had three things on my wish-list:

  1. Linux compatibility, to run all the tools I need;

  2. light, to carry home and show results to colleagues;

  3. somewhat powerful, to test scripts and be “future-proof”;

Some specs

With the above in mind, I got the XP13 with the following specs:

Intel® Core™ i7-4510U  (4M Cache, up to 3.1 GHz)
8 GB Dual-Channel DDR3 with 1.600 MHz
Solid-State-hardrive (SSD) with 512 GB
Intel HD Grafics 4400
1.37 kg

Unfortunately the model with pre-installed Ubuntu was not available in Germany, apparently they are out of stock, so mine came with Windows 8 pre-installed. Obviously the 1st thing I did to replace Windows with a fresh install of Ubuntu 14.04 from a liveUSB. Everything pretty much worked out of the box, which is the new unremarkable normal for modern Linux distros, specially those based on Ubuntu. Of note, the touchscreen  (which I do not care about) works, at least selecting and scrolling. Connecting the wifi was also a doodle. It took me almost more time to disable the annoying Windows features to allow the Linux installation than it did to make the install itself. In less than 1 hour I had the computer ready to work.


Oh boy does it look good! Nice aluminium touch, very elegant. I could compare it to a Macbook Air and it is noticeable smaller, both in width and depth, and prettier for my eyes.


Excellent resolution, bright colours – amazing.  The less fun part is that at 1920×1080 fonts and icons are rather small, but nothing that can’t be fixed.

coil whine

This refers to a wizz sound coming from the keyboard area. In my case it is barely noticeable, and turning of the keyboard back-lighting stops it. I don’t care about this light so it works for me.`Most of the time the noise is barely audible though.


This is something of a problem with Linux laptops. I have installed laptop-mode-tools and, as we speak, it is running at 45-55ºc, with Firefox, Thunderbird, Sublime text, and terminal open. So not an issue for me.

Keyboard and mousepad
The keyboard is responsive, without being too edgy. The mouse pad is rather large, and does not have physically separated buttons, so it I am still adjusting and trying to the right-click. Both feel somewhat roughed, at least in comparison to my Toshiba T230, which is neither a good or bad thing, it just offers more resistance and feedback to the touch. It should be noted that the page-up and -down do not have dedicated buttons, nor does the end/start (so useful to navigate lines of code). However, the use of fn + arrows solves the problem.

Good enough. This is a laptop, not a sound system. Scracth that, after some more testing, the sound is loud and clear. Very decent (for a laptop of course).

battery life
It looks like I can squeeze 5 hours out of it easily, but it is too early to tell.

I also got a Dell dock with it, because let’s face it, 2 USB entries is just low, and I am connected to a server most of the time and prefer to do it over an ethernet connection for stability. From what I tested so far, the sound and display entries of the dock do not work. On the other hand, the USB and the ethernet work.


All in all I am very happy with my new shinny Ubuntu ultrabook. And I stress ultra because coming from a 4 year old laptop (still working well) with less than 2 kg, I cannot entertain the thought of not having a light laptop and the XPS13 is the perfect upgrade to my Toshiba T230.

Posted in Uncategorized | 2 Comments

The “p” problem in R plots, or when a dot is a font in inkscape

My graphics/figure workflow generally involves plotting something in R, saving it as a pdf (+png if writing a report with Rmarkdown), followed by some manual editing with Inkscape. Inkscape is a free, as in speech and beer, vector graphics editor – think of a non-commercial Illustrator – and it has very very useful since most of the time I don’t have access to Illustrator, through a combination of working mostly in Linux and the groups not paying for a license. No matter as Inkscape serves me well, including for personal use.


Back to the science. There is a quick with R plots: by default plots save symbols as fonts dingbats font. This means that when opening a pdf created with R in Inkscape (or Illustrator), points are (correctly) displayed as “p”. Even though this is technically correct, it is a nightmare when editing a figure last minute before a presentation.


Set set the option r useDingbats = FALSE when saving the plot:

dat <- sample(1:1000,100)
pdf("plot.pdf", useDingbats = FALSE)

Or even better, make use of Rprofile for more than witty R quotes, adding to it the line grDevices::pdf.optionspdf.options(useDingbats = FALSE). Like this, you will not have to remember this every time a plot is saved. And if you are like me, this will happen often – both the saving and the forgetting.


Posted in Uncategorized | Tagged , , | Leave a comment