Skip to content

Instantly share code, notes, and snippets.

@kdaily
kdaily / knitr.mk
Created May 16, 2012 12:48 — forked from halpo/knitr.mk
knitr makefile
################################################################################
# Copyright 2011
# Andrew Redd
# 11/23/2011
#
# Description of File:
# Makefile for knitr compiling
#
################################################################################
all:pdf # default rule DO NOT EDIT
@kdaily
kdaily / example-r-markdown.rmd
Created December 5, 2012 18:44 — forked from jeromyanglim/example-r-markdown.rmd
Example of using R Markdown
This post examines the features of [R Markdown](http://www.rstudio.org/docs/authoring/using_markdown)
using [knitr](http://yihui.name/knitr/) in Rstudio 0.96.
This combination of tools provides an exciting improvement in usability for
[reproducible analysis](http://stats.stackexchange.com/a/15006/183).
Specifically, this post
(1) discusses getting started with R Markdown and `knitr` in Rstudio 0.96;
(2) provides a basic example of producing console output and plots using R Markdown;
(3) highlights several code chunk options such as caching and controlling how input and output is displayed;
(4) demonstrates use of standard Markdown notation as well as the extended features of formulas and tables; and
(5) discusses the implications of R Markdown.
@kdaily
kdaily / bamsplit.py
Created February 14, 2013 20:12 — forked from seandavi/bamsplit.py
#!/usr/bin/env python
# split a bam file by read group ID
# Sean Davis <seandavi@gmail.com>
# March 10, 2012
#
import pysam
import argparse
import logging
logging.basicConfig(level=logging.INFO)
@kdaily
kdaily / arrangeMusic.R
Last active December 19, 2015 16:29 — forked from Vessy/arrangeMusic.R
Read .mp3 files from a given directory, compare songs, and play them in order of similarity
# Read .mp3 files from a given directory, compare songs, and play them in order of similarity
# To run, source this file, then:
# arrangeMusicC(inDirectory = getwd())
library("plyr")
library("tuneR")
library("seewave")
library("compiler")
@kdaily
kdaily / 3D_net.R
Last active August 29, 2015 13:59 — forked from Vessy/3D_net.R
library("igraph")
rm(list = ls())
##########################################################################
# Read data
dataSet <- read.table("http://www.vesnam.com/Rblog/wp-content/uploads/2013/07/lesmis.txt",
header = FALSE, sep = "\t")
# Create a graph. Use simplify to ensure that there are no duplicated edges or self loops
gD <- simplify(graph.data.frame(dataSet, directed=FALSE))
library("igraph")
library("plyr")
library("HiveR")
library("RColorBrewer")
library("grDevices")
############################################################################################
rm(list = ls())
dataSet <- read.table("http://www.vesnam.com/Rblog/wp-content/uploads/2013/07/lesmis.txt",
dual_dendogram_tile_plot <- function(data.matrix, main="Title"){
#Dual dendrogram ############
x <- data.matrix
dd.col <- as.dendrogram(hclust(method="ward",dist(x)))
col.ord <- order.dendrogram(dd.col)
dd.row <- as.dendrogram(hclust(method="ward",dist(t(x))))
row.ord <- order.dendrogram(dd.row)
#####
## AUTHOR: BRIAN M. BOT
## ORGANIZATION: SAGE BIONETWORKS
##
## ALLOW USERS TO LEVERAGE KNITR WHEN CONSTRUCTING SYNAPSE WIKI CONTENT
#####
## PARAMETERS:
## file: path to a local .Rmd file which to knit
## owner: a Synapse object which will own the resulting WikiPage (usually a Project, Folder, or File)
## parentWikiId (optional): if the resulting WikiPage is to be a subpage of another WikiPage, this is the id for the parent WikiPage (NOTE: owner is still required)
# Note: using the devel versions of both packages!
library(DESeq) # version 1.9.11
library(edgeR) # version 2.99.8
library(VennDiagram)
# Read in data ------------------------------------------------------------
## Use pasilla data
datafile = system.file( "extdata/pasilla_gene_counts.tsv", package="pasilla" )
datafile
@kdaily
kdaily / 0_reuse_code.js
Last active August 29, 2015 14:15
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