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(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)] |
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
# 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") |
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
## | |
## 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 |
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
# Template for ~/.Rprofile script | |
# environmental variables: | |
Sys.setenv( | |
AUTHOR="Conrad Stack", | |
EMAIL="[email protected]" | |
) | |
# options(): | |
options("stringsAsFactors"=FALSE) |
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 | |
## 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/ |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 python3 | |
import argparse | |
import os | |
import sys | |
# Deinterlace an interlaced fastq file | |
# (modified from iamdelf/deinterlace) | |
# usage: |
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(rtracklayer) | |
# Where syn is a list of GRanges objects: | |
test = GenomicRangesList(syn) | |
export.gff(test,"~/tmp/tmp.gff3", version="3") | |
# ... or a single GRanges element: | |
export.gff(syn[[1]],"~/tmp/tmp.gff3", version="3") | |
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
## If python 3.5, say, has been installed but you want to use v2.7 for | |
## a particular project | |
# Create environment for different (or specific) version of python: | |
conda create -n py27 python=2.7 anaconda | |
# Check available environments (optional) | |
# conda info --envs |
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 | |
# From: http://www.cyberciti.biz/faq/exclude-certain-files-when-creating-a-tarball-using-tar-command/ | |
tar --exclude-vcs --exclude='nohup.out' -cjf ~/tmp/whatever.tar.bz2 ./* | |
OlderNewer