Skip to content

Instantly share code, notes, and snippets.

Avatar

Laurent Gatto lgatto

View GitHub Profile
@lgatto
lgatto / app.R
Created Mar 6, 2022
DEP::run_app("LFQ")
View app.R
library(dplyr)
library(tibble)
library(SummarizedExperiment)
library(DEP)
library(shiny)
library(shinydashboard)
ui <- shinyUI(
dashboardPage(
dashboardHeader(title = "DEP - LFQ"),
View ggPlotMzDelta.R
ggPlotMzDelta <- function(delta, aaLabels = TRUE) {
stopifnot(require("ggplot2"))
## from PSM::getAminoAcids()
amino_acids <-
structure(list(AA = c("peg", "A", "R", "N", "D", "C", "E", "Q",
"G", "H", "I", "L", "K", "M", "F", "P", "S",
"T", "W", "Y", "V"),
ResidueMass = c(44, 71.03711, 156.10111, 114.04293,
115.02694, 103.00919, 129.04259,
128.05858, 57.02146, 137.05891,
@lgatto
lgatto / mzdeltas.R
Last active Sep 2, 2021
M/Z deltas quality control
View mzdeltas.R
##' @title Compute the MZ deltas
##'
##' @description
##'
##' The M/Z delta plot illustrates the suitability of MS2 spectra for
##' identification by plotting the M/Z differences of the most intense
##' peaks. The resulting histogram should optimally shown outstanding
##' bars at amino acid residu masses. The plots have been described in
##' Foster et al. 2011.
##'
View rprot_ex.R
library(magrittr)
library(ggplot2)
library(rpx)
rpx:::apply_fix_issue_5(FALSE)
## https://www.ebi.ac.uk/pride/archive/projects/PXD022816
## RawBeans: A Simple, Vendor-Independent, Raw-Data Quality-Control
## Tool (10.1021/acs.jproteome.0c00956)
View spur-cor
set.seed(123)
max_corrs <- function(d, n = 60, n_iter = 1000)
replicate(n_iter, {
m <- matrix(rnorm(n * d), ncol = d)
max(cor(m)[-1, 1])
})
r1 <- data.frame(d = 800, r = max_corrs(800))
r2 <- data.frame(d = 6400, r = max_corrs(6400))
r <- rbind(r1, r2)
@lgatto
lgatto / csama-open-repro.md
Created Jul 22, 2019
Notes for the CSAMA 2019 discussion on open and reproducible research
View csama-open-repro.md
@lgatto
lgatto / annot_filter.R
Created May 12, 2019
Generic annotation filter
View annot_filter.R
setClass("CharacterVariableFilter",
contains = "CharacterFilter")
setClass("NumericVariableFilter",
contains = "DoubleFilter")
VariableFilter <- function(field,
value,
condition = "==") {
if (is.numeric(value))
@lgatto
lgatto / gist:6f6facde55ab9e313753b4d92faa021a
Created Nov 23, 2018 — 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
View gist:6f6facde55ab9e313753b4d92faa021a
#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 Oct 17, 2018
R installation script
View installR.sh
#!/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 Dec 8, 2017
All PCs and %age vars
View prcomp.R
pca <- prcomp(exprs(object), scale = TRUE, center = TRUE)
pcadata <- pca$x
vars <- (pca$sdev)^2
vars <- vars / sum(vars) * 100