setClass('Seq', representation(data = 'character', id = 'character'),
validity = function (object) is_dna(object@data))
print_fasta = function (object) {
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 | |
set -x | |
USAGE() { | |
cat << EOF | |
Usage: ${0##*/} <-i ident.p12> [-p password] <-m profile.mobileprovision> [-a com.example.app] [-n NewName] [-I Info.plist] | |
-i ident.p12 The signing identity file. | |
-p password The password of signing identity file. | |
-m profile.mobileprovision Signing provision profile | |
-a com.example.app Override CFBundleIdentifier |
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
# Consider the following setup: | |
# | |
# root | |
# + a | |
# | + Makefile | |
# | + ..some other files.. | |
# + b | |
# + Makefile | |
# + ..some other files.. | |
# |
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
importCpp <- function(infile, output_dir="lib", rebuild=FALSE){ | |
output_dir = ifelse(is.null(output_dir), ".", output_dir) | |
dir.create(output_dir, recursive=T, showWarnings=FALSE) | |
outfile = file.path(output_dir, paste0(infile, ".R")) | |
if (!file.exists(outfile) || file.info(infile)$mtime > file.info(outfile)$mtime || rebuild){ | |
Rcpp::sourceCpp(infile, rebuild=rebuild) | |
context = .Call("sourceCppContext", PACKAGE = "Rcpp", | |
normalizePath(infile, winslash = "/"), code=NULL, 0L, .Platform) | |
scriptfile = file.path(context$buildDirectory, context$rSourceFilename) |
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
#!/usr/bin/env bash | |
# Inspired by <http://blog.melski.net/2010/11/30/makefile-hacks-print-the-value-of-any-variable/> | |
usage() { | |
echo >&2 "Usage: $0 [-f makefile] variables..." | |
echo >&2 | |
echo >&2 "Optional arguments:" | |
echo >&2 " -f makefile: path to the makefile" | |
echo >&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
# Example makefile with some dummy rules | |
.PHONY: all | |
## Make ALL the things; this includes: building the target, testing it, and | |
## deploying to server. | |
all: test deploy | |
.PHONY: build | |
# No documentation; target will be omitted from help display | |
build: |
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
accession2url <- function(x) { | |
prefix <- "ftp://ftp.sra.ebi.ac.uk/vol1/fastq" | |
dir1 <- paste0("/",substr(x,1,6)) | |
dir2 <- ifelse(nchar(x) == 9, "", | |
ifelse(nchar(x) == 10, paste0("/00",substr(x,10,10)), | |
ifelse(nchar(x) == 11, paste0("/0",substr(x,10,11)), | |
paste0("/",substr(x,10,12))))) | |
paste0(prefix,dir1,dir2,"/",x) | |
} |
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
docker run \ | |
--name {{printf "%q" .Name}} \ | |
{{- with .HostConfig}} | |
{{- if .Privileged}} | |
--privileged \ | |
{{- end}} | |
{{- if .AutoRemove}} | |
--rm \ | |
{{- end}} | |
{{- if .Runtime}} |
$ uname -r
![screenshot][]
In the following we will be using R’s “restarts” feature to implement the state machine that drives generators in languages such as Python. Generators allow lazily generating values on demand: a consumer invokes a generator, and consumes values as they are produced. A new value is only produced once the previous one has been consumed.