Skip to content

Instantly share code, notes, and snippets.

@aaronwolen
aaronwolen / circos-legend.R
Last active September 4, 2019 19:38
R hack to create legends for Circos heatmaps by parsing the log file
# Parse logs from circos -debug_group legend to generate heatmap legends
#
# circos_legend(
# logfile = "logs/circos.log",
# outdir = "figures/legends",
# width = 4,
# height = 1,
# horizontal = TRUE
# )
#
@aaronwolen
aaronwolen / plot-iranges.R
Created July 3, 2019 14:46
Simple plotting method for R IRanges and GRanges objects
# IRanges plot
# by Aaron Wolen (2016)
plot.GRanges <- function(x, ...) plot(GenomicRanges::ranges(x))
plot.IRanges <-
function(x,
xlim = NULL,
ylim = NULL,
height = 0.8,
@aaronwolen
aaronwolen / corrgram_plot.R
Created May 2, 2019 17:57
Customized corrgram function
# Pairs points panel ------------------------------------------------------
panel_points <- function(x, y, corr = NULL, fit.line = F, ...) {
if(!is.null(corr)) {
return()
}
plot.xy(xy.coords(x, y), type = "p", ...)
box(col = "lightgray")
if(fit.line) {
@aaronwolen
aaronwolen / pca-plot.r
Last active October 4, 2019 15:32
PCA plot
# Plot two PCA components with optional coloring
plot_pca <- function(x, pcs, annotation,
size = 4, alpha = 0.8, legend.position = c(1, 0)) {
suppressPackageStartupMessages(require(ggplot2))
require(scales)
# check pcs
if (missing(pcs)) pcs <- paste0("PC", 1:2)
stopifnot(length(pcs) == 2)
@aaronwolen
aaronwolen / osfr_demo.R
Created December 27, 2018 15:53
osfr demo
# devtools::install_github("aaronwolen/osfr")
library(osfr2)
library(stringr)
# retrieve a user
user <- osf_retrieve_user("alh38")
user
# this is an osf_tbl_user
class(user)
@aaronwolen
aaronwolen / dply-rstudio-server.sh
Last active October 17, 2017 18:24
Deploy RStudio Server on dply.co
#!/bin/bash
# TODO: Install readr
# Skip post-install configuration steps
export DEBIAN_FRONTEND=noninteractive;
# Update
apt-get update;
apt-get -y upgrade;
@aaronwolen
aaronwolen / s4s-alspac-join.r
Created August 14, 2017 19:18
Joining GWAS data tables
alspac <- alspac %>%
mutate(allele_key = if_else(
A1 < A2,
paste0(A1, A2),
paste0(A2, A1)
))
s4s <- s4s %>%
mutate(allele_key = if_else(
alleleA < alleleB,
@aaronwolen
aaronwolen / # ghc - 2017-01-19_09-45-03.txt
Created January 19, 2017 14:52
ghc on "Red Hat Enterprise Linux Server release 6.8 (Santiago)" - Homebrew build logs
Homebrew build logs for ghc on "Red Hat Enterprise Linux Server release 6.8 (Santiago)"
Build date: 2017-01-19 09:45:03
@aaronwolen
aaronwolen / mimager-error.log
Created January 13, 2017 15:51
travis error log for mimager
R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Jan 24 19:29:59 raspberrypi systemd[1]: Started Node.js HomeKit Server.
Jan 24 19:30:00 raspberrypi homebridge[13396]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
Jan 24 19:30:00 raspberrypi node[13396]: *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
Jan 24 19:30:00 raspberrypi node[13396]: *** WARNING *** Please fix your application to use the native API of Avahi!
Jan 24 19:30:00 raspberrypi node[13396]: *** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node>
Jan 24 19:30:00 raspberrypi node[13396]: *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
Jan 24 19:30:00 raspberrypi node[13396]: *** WARNING *** Please fix your application to use the native API of Avahi!
Jan 24 19:30:00 raspberrypi node[13396]: *** WARNING *** For more information see <http://0pointer.de/avahi-c