Skip to content

Instantly share code, notes, and snippets.

View DarwinAwardWinner's full-sized avatar

Ryan C. Thompson DarwinAwardWinner

View GitHub Profile
library(limma)
library(Matrix)
## Create the experimental variables and put them in a data frame
animal <- factor(rep(sprintf("Animal %s", 1:6), each=2))
timep <- factor(c("Pre", "Post"), levels=c("Pre", "Post"))
treat <- factor(c("control", "control", "reagent", "reagent"))
df <- data.frame(animal, timep, treat)
df$replicate <- as.numeric(droplevels(df$animal:df$timep:df$treat))
## Create technical replicates by duplicating each row
library(IRanges)
library(httr)
library(jsonlite)
version <- '0.3'
collapse <- function(...) {
paste(unlist(list(...)), sep=",", collapse=",")
}
Process: trash [55738]
Path: /usr/local/bin/trash
Identifier: trash
Version: ???
Code Type: X86-64 (Native)
Parent Process: bash [46897]
Responsible: iTerm [32951]
User ID: 501
Date/Time: 2014-07-17 15:26:41.087 -0700
@DarwinAwardWinner
DarwinAwardWinner / preloading-input.R
Created July 30, 2014 21:13
Preloading wrappers for FastqStreamer and scanBam
library(ShortRead)
library(parallel)
tsmsg <- function(...) message(format(Sys.time(), "%Y-%m-%d %H:%M:%OS6"), ": ", ...)
## Like readChild but returns NULL when child is finished, and
## automatically unserializes results.
readChildSafe <- function(child) {
res <- parallel:::readChild(child)
if (is.integer(res) || is.null(res)) {
@DarwinAwardWinner
DarwinAwardWinner / crm-via-cr.el
Created August 15, 2014 17:23
An implementation of "completing-read-multiple" by using "completing-read" in a loop. This allows it to use "completing-read-function" for multiple completion as well. For example, if you have "ido-ubiquitous-mode" enabled, you get multiple completion via ido.
(defun my-crm-custom (prompt table &optional predicate require-match initial-input hist def inherit-input-method)
(loop with return-list = nil
with next-value = nil
with def-list = (s-split crm-separator (or def ""))
with def-list-no-empty-string = (remove "" def-list)
with def-text = (when def-list-no-empty-string
(concat "(" (s-join crm-separator def-list) ")"))
;; Need to clear this
with def = nil
;; Save original prompt and construct prompt with defaults
@DarwinAwardWinner
DarwinAwardWinner / callGeneric-dots-bug.R
Last active August 29, 2015 14:05
Wrong variable scope when callGeneric with dots argument is called by a generic that is called from another function
setGeneric("f1", signature=c("a"),
function(..., a) standardGeneric("f1"))
setMethod("f1", c(a="ANY"), function(..., a) list(a=a, ...))
setMethod("f1", c(a="missing"), function(..., a) callGeneric(a=1, ...))
f2 <- function(b,c,d, a) {
if (missing(a))
f1(b=b, c=c, d=d)
else
f1(a=a, b=b, c=c, d=d)
}
@DarwinAwardWinner
DarwinAwardWinner / twiddle-wifi.scpt
Created November 17, 2014 21:56
Script for turning wifi off and on again
--
-- Toggle Airport Power Off and On again
--
if (offset of "On" in (do shell script "networksetup -getairportpower en0")) > 0 then
do shell script "networksetup -setairportpower en0 off"
do shell script "networksetup -setairportpower en0 on"
end if
@DarwinAwardWinner
DarwinAwardWinner / cast-occurrences.txt
Created November 25, 2014 15:42
All 20 occurrences of the word "cast" in the first 6 books of Oz
Sorcerer we have ever known. As it is evident that my people have
advised me wrongly, I will not cast you three people into the dreadful
Garden of the Clinging Vines; but your animals must be driven into the
--
touched they crushed, and our adventurers were indeed thankful to have
escaped being cast among them.
--
"Why, they are driving us toward the Black Pit, into which they
threatened to cast us," replied the kitten. "If I were as big as you
# -*- mode:debian-control -*-
Package: BSgenome.Mfascicularis.NCBI.Macaca_fascicularis_5.0
Title: Full genome sequences for Macaca fascicularis (Macaca_fascicularis_5.0)
Description: Full genome sequences for Macaca fascicularis (Crab-eating Macaque aka Cynomolgus Monkey) as provided by NCBI (Macaca_fascicularis_5.0, 2013-06-12) and stored in Biostrings objects.
Version: 0.1
organism: Macaca fascicularis
species: Crab-eating macaque
provider: NCBI
provider_version: Macaca_fascicularis_5.0
release_date: 2013-06-12
@DarwinAwardWinner
DarwinAwardWinner / featureCounts-hg19-knowngenes.log
Last active August 29, 2015 14:16
featureCounts slow running logs
# featureCounts on exonsBy(TxDb.Hsapiens.UCSC.hg19.knownGene, "gene")
========== _____ _ _ ____ _____ ______ _____
===== / ____| | | | _ \| __ \| ____| /\ | __ \
===== | (___ | | | | |_) | |__) | |__ / \ | | | |
==== \___ \| | | | _ <| _ /| __| / /\ \ | | | |
==== ____) | |__| | |_) | | \ \| |____ / ____ \| |__| |
========== |_____/ \____/|____/|_| \_\______/_/ \_\_____/
Rsubread 1.16.1