Skip to content

Instantly share code, notes, and snippets.

View wolfganghuber's full-sized avatar
🎯
Focusing

Wolfgang Huber wolfganghuber

🎯
Focusing
View GitHub Profile
@wolfganghuber
wolfganghuber / makeSignatureBackgroundWhite.R
Created July 28, 2021 14:17
Edit the foto of my signature to make it more suitable for use in electronic documents; in particular, make the background white.
library("EBImage")
im = readImage("Senza nome.png")
r = im[,,1]
g = im[,,2]
b = im[,,3]
brg = r+g+b
hist(brg, breaks = 100)
display(brg)
white = brg > 1.5
r[white] = 1
@wolfganghuber
wolfganghuber / Plot_number_pkgs_Bioconductor_vs_time.R
Last active July 28, 2021 14:18
Plot the number of software packages in Bioconductor releases over time
# Code is based on Pete Hickey's and Lori Kern's post in https://support.bioconductor.org/p/109502/
library("rvest")
library("ggplot2")
library("magrittr")
library("dplyr")
bioc_pkgs = read_html("http://bioconductor.org/about/release-announcements")
bioc_pkgs_tbl = html_nodes(bioc_pkgs, "table")[[1]] |> html_table()
@wolfganghuber
wolfganghuber / vishiddenmessage.R
Last active November 10, 2020 16:07
Visualizing the hidden message in Boris Johnson's tweet to Joe Biden of 2020-11-07 using R/EBImage
# BiocManager is available from CRAN and is convenient for installing Bioconductor packages such as EBImage
if (!("EBImage" %in% installed.packages()))
BiocManager::install("EBImage")
library("EBImage")
x = readImage("https://pbs.twimg.com/media/EmPRWjyVoAEBIBI?format=jpg&name=4096x4096", type = "jpeg")
# explore the image
display(x)
@wolfganghuber
wolfganghuber / pdfdecrypt.R
Created February 10, 2019 17:00
Decrypting multiple PDF files using ghostscript and R
indir = "..."
outdir = "..."
passwd = "BLA"
files = dir(path, pattern = "??-*pw.pdf")
for (f in files) {
args = sprintf("-q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sPDFPassword=%s -sOutputFile=%s -c .setpdfwrite -f %s",
passwd,
file.path(outdir, sub("_pw.pdf$", ".pdf", f)),
file.path(indir, f))
@wolfganghuber
wolfganghuber / renjin-demo.Rmd
Last active July 17, 2018 23:45
Demo: speeding up R code with Renjin. For a rendered version, see http://rpubs.com/WolfgangHuber/404211
---
title: "Speeding up 'loopy' R code"
author: "Wolfgang Huber"
output: BiocStyle::html_document
---
```{r global_options, include = FALSE}
```
# Versions of this document
@wolfganghuber
wolfganghuber / Blitz-19400907-latlng.RData
Last active July 2, 2018 09:11 — forked from aoles/bombs.Rmd
Visualization Blitz Bombs on map of London - Fig. 5.2 of Modern Statistics for Modern Biology. By Andrzej Oles. A rendered version is shown here: http://rpubs.com/WolfgangHuber/401178
@wolfganghuber
wolfganghuber / DESeq2-lfc-shrinkage.Rmd
Created July 4, 2017 00:20
Code for Fig.2 in DESeq2 paper, with DESeq2 >= 1.16
---
title: "Code for Fig.2 in DESeq2 paper, with DESeq2 >= 1.16"
author:
- name: Wolfgang Huber
output:
BiocStyle::html_document2
vignette: |
%\VignetteIndexEntry{Vignette Title}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}