Browsed by
Author: fischuu

New updates

New updates

After quite some time I decided (once again) to start working on the updates for this webpage. For now, I added information regarding the different Snakemake pipelines I wrote for the most common bioinformatics use cases, have a look here: Pipelines

Lets see how long this flow will go, though.

Creating weighted tables with R / sum of numerics associated to some categorical variable

Creating weighted tables with R / sum of numerics associated to some categorical variable

The normal table command table() calculates the frequency of each element of a vector like this:

R> df <- data.frame(var = c("A", "A", "B", "B", "C", "C", "C"))
R> table(df)
A B C 
2 2 3 

So, it tells us, we have two times A and B and three times C, accordingly.

However, if we have now the situation like this:

df <- data.frame(var = c("A", "A", "B", "B", "C", "C", "C"), value = c(10, 20, 20, 40, 15, 25, 35))

Meaning, we have a categorical variable var and a numeric variable value and for each categorical variable we would like to get the sum over the numerical variable, we can simply use the base-R command aggregate like this

R> aggregate(value ~ var, data = df, FUN = sum)
  var wt
1   A 40
2   B 60
3   C 70

As I often use also the data.table package, here is also a simple solution using this package, assuming we do (respective have a data table from some other source, like fread)

dt <- data.table(df)

Then we can just sume over a column name with respect to another column like this (and assign the value into a new variable tot) :

setDT(dt)[, .(n = sum(value)), var] 
Nice new video release

Nice new video release

Traditionally, it was again rather silent here on my little blog, and instead of having any proper content, I would like to recommend an excellent Band from Sweden, the ‘Viagra Boys’. They released a great music video yesterday!

Couldn’t delete a failed R package installation

Couldn’t delete a failed R package installation

Today I faced a strange thing, while I tried to install an update to one of my R-packages. As usually, I installed the latest version from it like this


But the installation failed, and when I tried to reinstall it, I got this error message:

Installing package into ‘/homeappl/home/<user>/R/x86_64-redhat-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
ERROR: failed to lock directory ‘/homeappl/home/<user>/R/x86_64-redhat-linux-gnu-library/4.1’ for modifying
Try removing ‘/homeappl/home/<user>/R/x86_64-redhat-linux-gnu-library/4.1/00LOCK-GenomicTools’
Warning message:
In i.p(...) :
  installation of package ‘/tmp/Rtmp<...>Lv/file3c36<...>34/GenomicTools_0.2.11.tar.gz’ had non-zero exit status

So, I tried to go in said directory and delete the folder manually and there I received another error:

rm: cannot remove '00LOCK-GenomicTools/GenomicTools/libs/.nfs00000001002e2<...>d': Device or resource busy

I tried this and this, but nothing helped to delete that folder, it kept mocking my that the device is busy. Eventually, it helped just to rename the folder list this

mv 00LOCK-GenomicTools/ 00LOCK-GenomicTools-deleteThis/

It is now still hanging there in the folder, but I was able to reinstall the R-package and now I need to revisit the folder in a few days and check, if the device is still busy or if I can delete it then…

CDU/CSU Durcheinander

CDU/CSU Durcheinander

[D] Ich bin ja nun mal weit davon entfernt ein CDU-Wähler zu sein, aber ich kann nicht anders, als mich darüber zu wundern, was da gerade zwischen Laschet/CDU und Söder/CSU abläuft! Wie kann jemand ohne gravierende Gedächtnisprobleme ernsthaft Söder für kanzlertauglich halten?! Klar, die Abgeordneten stehen hinter ihm, da sie sich evtl bessere Chancen auf einen erneuten Sitz im Bundestag ausrechnen – aber trotzdem, da darf auch Mal hinterfragt werden, mit welchem Preis das kommt!

Falls Söder tatsächlich der Kanzlerkandidat wird hoffe ich inständig, dass viele Bürger kein so schlechtes Gedächtnis haben wie momentan viele CDU Mitglieder!

Man darf hoffen, dass andere Parteien da einen Nutzen draus ziehen können…