Skip to content

Instantly share code, notes, and snippets.

View lgatto's full-sized avatar

Laurent Gatto lgatto

View GitHub Profile
@lgatto
lgatto / SC-ICS-announcement.md
Created March 27, 2016 18:55
SC ICS announcement

An R-based instructor training sponsored by the R consortium

The R consortium Infrastructure Steering Committee awards have been officially announced and we are happy to confirm that our proposal to organise an R-based instructor training was successful.

We will organise an in-person instructor training that will focus on R. While the content of the training will not change as such,

@lgatto
lgatto / console.log
Created April 26, 2016 08:20
ImpactStory console log
unreachable code after return statement ti.js:828:12
unreachable code after return statement ti.js:1834:24
unreachable code after return statement ti.js:828:12
person is loading! Object { $id: 1, $$childTail: Object, $$childHead: Object, $$prevSibling: null, $$nextSibling: null, $$watchers: Array[2], $parent: null, $$phase: "$digest", $root: Object, $$destroyed: false, 12 more… } ti.js:923:21
Person Service getting from server: 0000-0002-1520-2268 ti.js:1579:13
Auto-adding the missing md-mode='indeterminate' to the ProgressCircular element angular.min.js:107:210
The resource at "https://www.google-analytics.com/analytics.js" was blocked because tracking protection is enabled.[Learn More] 0000-0002-1520-2268
The resource at "https://widget.intercom.io/widget/z93rnxrs" was blocked because tracking protection is enabled.[Learn More] 0000-0002-1520-2268
retrieved the person Object { _full_name: "Laurent Gatto", _id: "l3twu5batt", affiliation_name: "University of Cambridge", affiliation_role_title: "Senior Researc
@lgatto
lgatto / updateRdevel.sh
Created May 12, 2016 13:58
R installation scripts
#!/bin/bash
## getting the latest R-devel src
rtgz=R-devel.tar.bz2
rsrc=R-devel
rm $rtgz
wget ftp://ftp.stat.math.ethz.ch/Software/R/$rtgz
rm -rf $rsrc
## installation
@lgatto
lgatto / makeFoIs.R
Last active September 1, 2016 16:09
BHC projections on PCA plot
f <- "clusteringlopit/dunkley/hc_labels_observations_a.txt"
library("pRolocdata")
library("pRoloc")
data(dunkley2006)
makeFoIs <- function(fn, obj) {
x <- readLines(fn)[-1] ## first is 'x'
i <- grep("---", x)
@lgatto
lgatto / analyse_fprint.R
Last active September 5, 2016 14:37
Comparing fingerprints
## Run https://gist.github.com/lgatto/1875f858f4af543990ce3dc84825d9ee
fls <- dir(pattern = "rda")
fps <- lapply(fls, readRDS)
names(fps) <- fls
fps <- lapply(fps, "[[", 1)
.ref <- 3
ref <- fps[[.ref]]
@lgatto
lgatto / subtract_distance.R
Created September 6, 2016 08:38
Comparing images by subtracting pixels
library("EBImage")
resize_to_smallest <- function(x, y) {
dx <- dim(x)
dy <- dim(y)
w <- min(dx[1], dy[1])
h <- min(dx[2], dy[2])
list(x = EBImage::resize(x, w, h),
y = EBImage::resize(y, w, h))
}
@lgatto
lgatto / bib.bib
Last active December 24, 2016 11:22
BiocStyle_issue_22
@Article{foo,
author = {Foo, Bar},
title = {Just a references},
journal = {Journal of references},
year = {2016}
}
@lgatto
lgatto / make_sticker.R
Created March 8, 2017 21:04
Create a Bioc-sticker.
##' This function can be used to create a hexagonal sticker following
##' the guidelines described in the BioC-sticker sticker
##' repository. The function requires the following packages: ggplot2,
##' ggforce, ggtree, showtext and grid, if lattice objects are used.
##'
##' @title Create a BioC sticker.
##' @param x The package logo. Can either be a ggplot, lattice or grob
##' object.
##' @param package Package name, to be used as label on the
##' sticker. Default is "MyPackage".
@lgatto
lgatto / rnw2rmd.pl
Last active November 4, 2024 21:57
Convert Rnw to Rmd
#!/usr/bin/perl
## Based on convert.txt by Mike Love
## https://gist.github.com/mikelove/5618f935ace6e389d3fbac03224860cd
## The script ignores labels and references, un-numbered sections
## (section*), quotes and probably a couple of more. It won't deal
## with the pre-amble, bibliography and document tags either. Still
## useful, though.
@lgatto
lgatto / prcomp.R
Last active December 8, 2017 16:53
All PCs and %age vars
pca <- prcomp(exprs(object), scale = TRUE, center = TRUE)
pcadata <- pca$x
vars <- (pca$sdev)^2
vars <- vars / sum(vars) * 100