Skip to content

Instantly share code, notes, and snippets.

View lgatto's full-sized avatar

Laurent Gatto lgatto

View GitHub Profile
@lgatto
lgatto / csama-open-repro.md
Created July 22, 2019 16:41
Notes for the CSAMA 2019 discussion on open and reproducible research
@lgatto
lgatto / annot_filter.R
Created May 12, 2019 19:05
Generic annotation filter
setClass("CharacterVariableFilter",
contains = "CharacterFilter")
setClass("NumericVariableFilter",
contains = "DoubleFilter")
VariableFilter <- function(field,
value,
condition = "==") {
if (is.numeric(value))
@lgatto
lgatto / gist:6f6facde55ab9e313753b4d92faa021a
Created November 23, 2018 10:34 — forked from ajstewartlang/gist:89dcdf01c4512a213141a16e9243626d
Hacked together code for animated raincloud plots for N=20 and N=500 where no difference exists in underlying populations
#Usimg @micahgallen's nice raincloud plot code
#and fork of benmarwick/geom_flat_violin.R code
devtools::install_github('thomasp85/gganimate')
library(tidyverse)
library(gganimate)
library(RColorBrewer)
library(plyr)
#the following is a fork of benmarwick/geom_flat_violin.R
@lgatto
lgatto / installR.sh
Created October 17, 2018 07:06
R installation script
#!/bin/bash
if [ -z "$1" ]; then
WHICH=patched
else
WHICH=$1
fi
## (1) set up variables
case $WHICH in
@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
@lgatto
lgatto / rnw2rmd.pl
Last active December 18, 2023 05:03
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 / 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 / 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 / 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 / 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]]