Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import argparse
import os
import sys
# Deinterlace an interlaced fastq file
# (modified from iamdelf/deinterlace)
# usage:
@ConradStack
ConradStack / 0_reuse_code.js
Created June 22, 2016 16:04
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#!/bin/bash
## Tested and worked on Mac OSX 10.11
# Download bedtools2 from github:
wget https://github.com/arq5x/bedtools2/releases/download/v2.25.0/bedtools-2.25.0.tar.gz
# unzip, navigate, and build
tar -zxvf bedtools-2.25.0.tar.gz
cd bedtools2/
# Template for ~/.Rprofile script
# environmental variables:
Sys.setenv(
AUTHOR="Conrad Stack",
EMAIL="conrad.stack@someserver.com"
)
# options():
options("stringsAsFactors"=FALSE)
@ConradStack
ConradStack / metadata.R
Created June 11, 2016 16:30
Adding metadata to R files
##
## From http://www.r-bloggers.com/adding-metadata-to-variables/
##
# add a comment to a variable (NB -> comment(...) function is base R)
# example
xx <- 1:10
comment(xx) <- "one through ten"
attributes(xx)
comment(xx) <- "another one" # NB -> adding another comment overwrites the last one
@ConradStack
ConradStack / Install.BSgenome.Tcacao.R
Last active June 22, 2016 15:35
How to install the cacao genome data packages in R
# Steps:
# 1. Install prerequisite R packages (devtools, BSgenome)
# 2. Install BSgenome.Tcacao packages from github
### install devtools (if needed)
install.packages("devtools")
### install BSgenome from bioconductor
source("https://bioconductor.org/biocLite.R")
biocLite("BSgenome")
@ConradStack
ConradStack / scrape.r
Created June 8, 2015 22:22
Use R to download links from a simple HTML page
require(RCurl)
require(XML)
require(stringr)
pull.to = "~/tmp"
misc.dir = sprintf("%s/lectures",pull.to)
base.url = "http://www.stat.cmu.edu/~cshalizi/uADA/15/"
lns = readLines(base.url)
top = grep("<h2>schedule",lns,ignore.case=T)
use = lns[top:length(lns)]