As I discussed here, git allows you to commit only some of the changes you made to a given file. If you are working in Emacs you probably already know the wonders of Magit. In order to do the same partial committing of a file you can simply open
magit-status and go to the file you’re interested in. This will highlight the changed parts of the text. With your cursor in the changed block you’d like to commit simply press s and that change will be staged. If this is all you want press c to commit and you’re done!
This morning version 0.9-6 of the DatABEL R package was published on CRAN. This is only a minor update that consists of a few small changes and one bug fix. See the official announcement for more information.
DatABEL is an R package that allows users to access files with large matrices (of several gigabytes or more in size) in a fast and efficient manner. The package is mainly used for genome-wide association analyses using e.g. ProbABEL or OmicABEL.
If you only want to commit some of the changes to a file in a Git repository, use
git add --patch your_changed_file
This will interactively ask you which lines to keep:
$ git add --patch .emacs
diff --git a/.emacs b/.emacs
index d903495..5a0eb9e 100644
@@ -69,9 +69,9 @@
;;; Make better buffer names when opening files with the same name
-(when (autoload 'uniquify "uniquify" "uniquify" t)
+(when (require 'uniquify nil 'noerror)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)
Stage this hunk [y,n,q,a,d,/,K,j,J,g,s,e,?]?
Source and more information on StackOverflow.com.
A quick note to self: I wanted to find out what Subversion version was run on R-forge, which I access via SSH. This is how to do it:
$ ssh firstname.lastname@example.org svnserve --version
svnserve, version 1.6.17 (r1128011)
compiled Nov 20 2011, 01:10:33
Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.apache.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).
The following repository back-end (FS) modules are available:
* fs_base : Module for working with a Berkeley DB repository.
* fs_fs : Module for working with a plain file (FSFS) repository.
Cyrus SASL authentication is available.
It was quite a long time in the making and then a bunch of other stuff came in between, but I finally managed to release v0.4.4 of ProbABEL!
ProbABEL is a toolset for doing fast, memory (RAM) efficient genome-wide regression tests.
This is a bugfix release, but a major one for those who use the Cox proportional hazards regression module. Thanks to some of our users on the GenABEL forum, a serious bug leading to way to many NaN’s in the output was discovered, fixed and tested. This is one of the best examples of community collaboration I have seen in the GenABEL project.
Another bug fixed in this release is one that caused a failed install on MacOS X and FreeBSD. Again a bug reported on the forum by one of our users. Great work!
Uploads to Debian and the Ubuntu PPA are coming ASAP.
Now, let’s get ready for a new feature release, which will include p-value calculation (a long-standing feature request) and major speed-ups (implemented by former colleague Maarten Kooyman). Time to get to work ;-)!
After starting Emacs you end up in the
*scratch* buffer (assuming you’ve disabled the startup message in your
.emacs file). The
*scratch* can be used for writing down notes and some Lisp experiments (since it uses the Emacs Lisp major mode by default).
Now, I’m not very much of a Lisp programmer, but I do use Org-mode a lot. Consequently, I found myself changing the buffer’s major mode to org-mode regularly. And Emacs wouldn’t be Emacs if you couldn’t change this to a default. So, thanks to Bozhidar Batsov over at Emacs Redux, I’ve added the following lines to my Emacs configuration file:
;; Set the default mode of the scratch buffer to Org
(setq initial-major-mode 'org-mode)
;; and change the message accordingly
(setq initial-scratch-message "\
# This buffer is for notes you don't want to save. You can use
# org-mode markup (and all Org's goodness) to organise the notes.
# If you want to create a file, visit that file with C-x C-f,
# then enter the text in that file's own buffer.
Note to self: If relying on implicit
make rules, then the libraries you want to link to need to go into the
LDLIBS variable, not in the
The case at hand: I wanted to do a quick test on how to write gzipped files using the Boost libraries. Because this was a simple example, I also wanted a simple
Makefile to accompany it, meaning I wanted to use implicit rules.
Here’s the example C++ code I used, slightly modified from the Boost example:
namespace io = boost::iostreams;
using namespace std;
ifstream infile("hello.txt", ios_base::in | ios_base::binary);
ofstream outfile("hello.txt.gz", ios_base::out | ios_base::binary);
Makefile looks like this:
LDLIBS=-lboost_iostreams -lboost_system -lstdc++
# Needed because otherwise cc is used, in which case -lstdc++
# must be added to -LDLIBS
$(RM) $(PROGRAM).o $(PROGRAM)
- Note the addition of
-lstdc++ to the
LDLIBS, this is because the implicit rule uses
cc to do the linking. This is no problem for C++ code, as longs as you add the C++ standard library. Alternatively, you can set
CC=g++ as shown in the comment, instead of adding
- Note that somewhere since Boost v1.50 the addition of
-lboost_system is required.
- This was done on a machine with Ubuntu Linux 13.10 installed, Boost version 1.53 (the
I took some time today to configure my R experience. I’m mostly using R from Emacs using ESS (Emacs Speaks Statistics), which means I had to configure some settings there as well.
Previously, my settings only consisted of setting a customised directory in which to install my packages and an alias to start R without asking for saving the histroy when quitting. This I did by setting the following environment variable in my
.zshrc, as well as an alias:
# Set the library path for R
if [ -n "$(/usr/bin/which R 2>/dev/null)" ]; then
alias R="$(/usr/bin/which R) --no-save"
However, Emacs didn’t pick up either of these variables, so high time to fix that. This meant creating two files with the following content:
# Set the default CRAN repository used by install.packages()
options("repos" = c(CRAN = "http://cran-mirror.cs.uu.nl/"))
I added the following to my
.emacs file to start R with the
(setq inferior-R-args "--no-save ")
Additionally I have the following in there to turn on a spelling checker and have line-wraps enabled:
;; Set pdflatex as the default command for Sweave (default: texi2pdf)
(setq ess-swv-pdflatex-commands (quote ("pdflatex"
During the Christmas holidays I released a new version of ProbABEL (v0.4.2). The official release announcement can be found here. ProbABEL is a toolset that allows running GWAS (Genome-Wide Association Studies) in a fast and efficient manner. It implements regression using the linear, logistic or Cox proportional hazards models.
This version is mostly a bug fix release. The most important user-visible change is the fact that the ‘official’ name for the wrapper script that runs a GWAS over a range of chromosomes is now called
probabel instead of
probabel.pl. This change was induced by my attempts to get ProbABEL packaged in the Debian Linux repositories. One of the warnings that occurred during the package creation process was a Lintian warning that said that scripts with ‘language extensions’ are not allowed. There are several reasons for that, but the one I found most compelling was the fact that the user shouldn’t be concerned with the programming/scripting language we used to write it in. Moreover, being ‘agnostic’ in this matter also allows us to write such a script in a different language.
Of course, we have left the original name in place (via a symlink) in order not to disrupt any current pipelines. If the user runs the script with the old name a warning appears, urging him/her to start using the new name and that the old name will be deprecated in the future.
In the mean time, ProbABEL v0.4.1 has been accepted in Debian (unstable) and as of today it is also available in Debian ‘testing’. Lots of thanks to the Debian Med team that helped me a lot in preparing the
.deb package. Note that the package has been split up in
probabel (architecture-dependent files) and
probabel-examples (with architecture independent files: the examples). See the Debian Package Tracking System page for ProbABEL for more details of the package.
From Debian the package has trickled down to Ubuntu as well (Launchpad page here), so it will be available by default in the next Ubuntu release (14.04, a.k.a. Trusty Tahr).
This is a quick example of how to do a fixed meta-analysis using the R package
Rmeta, just so I dont have to look it up again next time:
## Create data frame containing betas and standard errors
df <- data.frame()
df <- rbind(df, c(2., 0.2))
df <- rbind(df, c(2.5, 0.4))
df <- rbind(df, c(2.2, 0.2))
## Add study names
df <- cbind(df, c("study 1", "study 2", "study 3"))
colnames(df) <- c("beta", "se_beta", "name")
## Do the meta-analysis
ms <- meta.summaries(df$beta, df$se_beta, names=df$name)
## Add some colors
mc <- meta.colors(summary="darkgreen", zero="red")
## Make a forest plot
plot(ms, xlab=expression(beta ~ " (mmol/l)"),
ylab="Study", colors=mc, zero=2.6)
The resulting plot looks like this: