Other articles


  1. Printing p-values using unicode superscripts in R

    This is a pretty simple one. I wanted to show some nicely formatted p-values on a plot by an external library, but it wasn’t possible to pass anything else than a character vector as labels. So I built this function that formats any p-value using unicode characters. Hopefully it’s of use to others as well:

    pval = function (ps) {
        superscript = c('\u{2070}', '\u{00b9}', '\u{00b2}', '\u{00b3}', '\u{2074}',
                        '\u{2075}', '\u{2076}', '\u{2077}', '\u{2078}', '\u{2079}')
        sapply(ps, function(p) {
            if (is.na(p)) return("")
            if (p < 0 || p > 1) return (sprintf("%.2f", p …
    read more
  2. No, the ESP32-S2 is not faster at floating point operations (and how do you actually speed up division on the ESP32?)

    For my master's thesis I'm working on computational models of the inferior olivary nucleus, a region in the brain involved in motor control and learning. The lab already produced multi-CPU, multi-GPU and multi-FPGA brain simulators, and another student and me thought it would be a cute to add a multi-MCU simulator as well. In this way we would be able to simulate a scalable real time inferior olive networks where rewiring the neural connections is just reconnecting wires in an electrical circuit and an oscilloscope is the main tool to analyze the network behaviour (instead of python scripts) (yes it's …

    read more
  3. Online presenting in front of your slides with a transparent GTK window and OpenCV

    Today I had to give a presentation on my research for a course to improve my presenting skills. I thought it would be nice to recreate an in-person presenting environment, instead of my regular share-slides-and-hear-my-voice-but-don't-see-my-face online presentation. A bit like how Daniel Shiffman presents The Coding Train :).

    In zoom, this is a builtin option. Share desktop as your webcam virtual background. Nice, except they decided not to implement this on linux for some reason (WHY?!). So I decided to build this myself.

    TLDR: If you just want the code: click here

    There are roughly two ways to go about this …

    read more
  4. Automatically send all Matplotlib plots to your phone via telegram-send

    So I'm not actually sure if this is actually a good idea, but at least its a fun one :). For my research I usually run long (>20mins) simulations using quickly written scripts and it would be nice if those scripts automagically notified me when they where ready. Of course there are clean solutions to this problem, but they would probaly involve adding extra code to the scripts (which I would have to remember doing everytime!) or black box methods that would just send a message when a long running python process is done (boring!).

    Instead, everytime when a python script …

    read more
  5. Running SLURM locally on Ubuntu 18.04

    Today I found myself needing to set up a minimal SLURM cluster on my laptop for simple testing purposes. As always, there were some challenges along the way and I had to consult multiple installation guides and stackoverflow questions to make everything fit together. Here is what worked for me.

    Set up munge

    $ sudo apt install munge
    

    Test if it works:

    $ munge -n | unmunge
    STATUS:           Success (0)
    [...]
    

    Set up MariaDB

    From here

    $ sudo apt install mariadb-server
    $ sudo mysql -u root
    create database slurm_acct_db;
    create user 'slurm'@'localhost';
    set password for 'slurm'@'localhost' = password('slurmdbpass');
    grant usage on *.* to 'slurm'@'localhost …
    read more
  6. Aligning a GWAS to a genetic reference with gwas2cojo.py

    Dealing with a gazillion different undocumented notations and conventions for writing down variant information is a common problem in bioinformatics. Different effect/other alleles, variant names, reference genome build, chromosome name conventions or just different column names all prevent easy comparison between genetic variants. gwas2cojo.py is there to automatically convert a GWAS to a certain genetic reference.

    For example, in my bachelor end project I had to convert the UKBioBank CAD GWAS dataset to a format readable by SMR. Our genetic dataset and UKBioBank had different ideas about the allele notation for a given variant. The effect allele and …

    read more
  7. Fast searching in a sorted genetics file & the curse of gzip compression

    As a bioinformatician, how often have you found yourself staring at the screen waiting for grep to find a certain gene or chromosome-basepair location in a gargantuan vcf, bed or gwas file? And then realize you forgot adding a field delimiter to your pattern so your search included way too much results? Thats a problem I have wanted so solve for a long time.

    Luckily, these files are usually sorted, which means we should be able to use a binary search! So thats what I wrote this weekend; a tool you can use to instantly find genomic regions in anything …

    read more
  8. Serving precompressed static sites using NGINX to save disk space

    I had this idea to build my next ~~app~~ website as a completely static site, including all user specific content. So no C# ASP / Flask or React, just static files that get regenerated every so often with a cron job. The main advantage would be an extremely simple server with nearly instant page loads, and a disadvantage would be more disk usage. It definitely needs some form of authentication, so I still would have to write a bit of server code. But for a proof of concept, I tried to get nginx to serve precompressed files from disk, as most …

    read more
  9. Building an UEFI x64 kernel from scratch: A long trip to userspace

    When I just started programming, one of my first major projects was building my own kernel. Of course, I failed misserably. But I learned a lot. Back then, x64 didn't dominate the market and I never even heard about UEFI. Copy pasting code bits from tutorials and forum posts I ended up drawing some things to the screen based on keyboard input. However, I never managed to get to userspace (/userland/CPL 3).

    Things have changed a bit, and I decided to finally write a 'modern' UEFI x64 kernel which is able to get to userspace, and document my progress …

    read more