This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(IRanges) | |
library(httr) | |
library(jsonlite) | |
version <- '0.3' | |
collapse <- function(...) { | |
paste(unlist(list(...)), sep=",", collapse=",") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#$ -cwd | |
#$ -l jabba,mem_free=10G,h_vmem=2G,h_fsize=1G | |
#$ -N approach1b | |
#$ -pe local 20 | |
#$ -m e | |
echo "**** Job starts ****" | |
date |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(codetools) | |
getNonPackageVars <- function (pos=-1L, envir=as.environment(pos)) { | |
npvarnames <- c() | |
while (TRUE) { | |
if (identical(envir, emptyenv()) || | |
identical(envir, .BaseNamespaceEnv)) { | |
## If we hit the empty env, then we started in a package | |
## namespace, so there are no non-package vars. | |
return(character(0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'cl) | |
(defsubst my-interactive-internal () | |
"Eqivalent of the INTERACTIVE macro in the Emacs C source. | |
This should never be called directly." | |
(and (not executing-kbd-macro) (not noninteractive))) | |
(defun backtrace-from (fun) | |
"Return all backtrace frames, starting with the one for FUN. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun frame-is-last-ns-frame (frame) | |
"Returns t if FRAME is the only NS frame." | |
(and | |
;; Frame is ns frame | |
(eq (framep frame) 'ns) | |
;; No other frames on same terminal | |
(>= 1 (length (filtered-frame-list | |
(lambda (frm) (eq (frame-terminal frm) | |
(frame-terminal frame)))))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/R/gff.R 2012-03-30 15:59:39.000000000 -0700 | |
+++ b/R/gff.R 2012-05-11 17:36:59.208145562 -0700 | |
@@ -286,13 +286,12 @@ | |
lines <- rep(seq_along(attrSplit), elementLengths(attrSplit)) | |
attrs <- sub(" *$", "", sub("^ *", "", unlist(attrSplit))) | |
if (is(file, "GFF3File")) { | |
- attrs <- paste(attrs, "=", sep = "") | |
- tvSplit <- strsplit(attrs, "=", fixed=TRUE) | |
- if (any(elementLengths(tvSplit) != 2)) | |
+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import textwrap | |
def refill_docstring(func, *args, **kwargs): | |
"""Fix the text wrapping in a function's docstring. | |
This can be useful when creating doc strings dynamically. | |
Additional args are options to textwrap.TextWrapper.""" | |
wrapper = textwrap.TextWrapper(*args, **kwargs) | |
# Remove trailing whitespace from all lines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file defines a decorator '@log_to()' that logs every call to a | |
# function, along with the arguments that function was called with. It | |
# takes a logging function, which is any function that accepts a | |
# string and does something with it. A good choice is the debug | |
# function from the logging module. A second decorator '@logdebug' is | |
# provided that uses 'logging.debug' as the logger. | |
from __future__ import print_function | |
from functools import wraps | |
from inspect import getcallargs, getargspec |