Skip to content

Instantly share code, notes, and snippets.

View yannabraham's full-sized avatar

Yann Abraham yannabraham

  • Janssen Pharmaceutical Companies of Johnson & Johnson
  • Beerse (BE)
View GitHub Profile
@yannabraham
yannabraham / complex_summary_w_tapply.R
Created August 2, 2016 12:49
Using tapply to return multiple values as an array
data(warpbreaks)
my.summary <- function(vals) {
return(c(avg=mean(vals),sd=sd(vals)))
}
sum.warpbreaks <- with(warpbreaks,tapply(breaks,list(tension,wool),my.summary))
sum.warpbreaks <- array(unlist(sum.warpbreaks),
dim=c(length(sum.warpbreaks[1,1][[1]]),dim(sum.warpbreaks)),
@yannabraham
yannabraham / cdlist_parser.R
Last active September 2, 2016 15:02
This script parses the (very useful but broken) list of CD markers and associated genes from Uniprot found at http://www.uniprot.org/docs/cdlist.txt
library(stringr)
screwed <- readLines(con='http://www.uniprot.org/docs/cdlist.txt')
screwed <- screwed[76:521]
parser <- c(0,8,21,29,37,55,1000000L) # use fixed length parsing
screwed <- lapply(screwed,function(scr) {
sapply(seq(length(parser)-1),function(i) str_trim(substr(scr,parser[i]+1,parser[i+1])))
}
@yannabraham
yannabraham / andrews.R
Last active May 29, 2018 14:56
Plotting Andrews curves using dplyr and ggplot2
## https://en.wikipedia.org/wiki/Andrews_plot
library(dplyr)
library(ggplot2)
do.andrews <- function(x,breaks=30) {
require(reshape2)
t <- seq(-pi, pi, pi/breaks)
m<-nrow(x)
n<-ncol(x)
@yannabraham
yannabraham / beanplots.R
Created July 16, 2012 09:31
ggplot2 BeanPlots
## reproduce the figures from http://www.jstatsoft.org/v28/c01/paper using ggplot2
library(ggplot2)
## parameters
set.seed(2710)
## Figure 1
d <- rnorm(50)
@yannabraham
yannabraham / inverted_fan_plots.R
Created October 30, 2019 16:00
Classically one can use fan plots to visualize the full profile of a given population over a set of conditions, but if you are interested in the effect of treatment on a given channel, you can `pivot` or `invert` the fan plot and visualize the effect of treatment over all populations
library(ggplot2)
library(dplyr)
library(tidyr)
library(cytofan)
library(bodenmiller)
## let's prepare some data:
cur.mat <- cbind(rbind(refPhenoMat,untreatedPhenoMat),
rbind(refFuncMat,untreatedFuncMat))
cur.annot <- bind_rows(refAnnots %>%
@yannabraham
yannabraham / cytometry_fan.R
Last active October 30, 2019 16:06
Fan plots are an attractive method to visualize trends in complex data such as those generated in Flow and Mass Cytometry experiments. Using ggplot2, one can easily treillis the different conditions to observe trends in the data.
## build a fan plot from scratch using dplyr & ggplot2 for visualization of Flow data
## after an original idea by Guy J. Abel
## http://gjabel.wordpress.com/category/r/fanplot/
## libraries
library(flowCore)
library(reshape2)
library(dplyr)
library(ggplot2)
library(RColorBrewer)
@yannabraham
yannabraham / FontLineGenomicsTalk.R
Last active June 29, 2021 08:16
The source code to my presentation "Embracing complexity: From discrete analysis to multivariate visualizations" (2021-06-24 - Front Line Genomics)
#
# Author: ABRAHYA1
###############################################################################
rm(list=ls())
graphics.off()
## libraries
library(ggplot2)
library(Radviz)
@yannabraham
yannabraham / README.md
Created October 21, 2021 10:20
Cytobank2Freeviz
@yannabraham
yannabraham / 20211105_NextGenOmicsTalk.Rmd
Last active November 20, 2021 09:31
NextGenOMICSLondonTalk
---
title: "NextGen OMICS 2021 - The Polyfunctionality Challenge"
author: "Yann Abraham"
date: "2021-11-05"
params:
fold.lim:
label: the limit applied to absolute fold change
value: 1
input: numeric
sig.lim:
@yannabraham
yannabraham / 20220110_AI4Health_WinterSchool_Poster.Rmd
Last active December 14, 2021 17:07
The source code supporting my poster for the Winter School of AI for Health (2022-01-10)
---
title: "AI for Health Winter School Poster"
author: "Yann Abraham"
date: "2022-01-10"
params:
fold.lim:
label: the limit applied to absolute fold change
value: 1
input: numeric
sig.lim: