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
//-- | |
// Clojure's Transducers | |
// (the simpler parts) | |
//-- | |
// References: |
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
package code | |
object Process0 { | |
sealed trait Process[I, O] { | |
import Process._ | |
def |>[O2](p2: Process[O,O2]): Process[I,O2] = compose(this, p2) | |
def ++(p2: Process[I,O]): Process[I,O] = concat(this, p2) | |
def flatMap[O2](f: O => Process[I,O2]): Process[I,O2] = nest(this)(f) | |
} |
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
Instructions: you would have to download and format the Marks et al. data from | |
their supplement first. Then, save this file as an .Rnw, Stangle and | |
source the resulting .R file. | |
Import data from Marks et al. Cell 2012. | |
<<>>= | |
dat <- read.table('./marks2i.serum.example.txt') | |
# > head(dat) | |
# GeneSymbol log2Fold pval |
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
% Instructions: Save as .Rnw, run Stangle in an R session and source the resulting .R file. | |
% Some required libraries: data.table, GO.db, stringr | |
A helper function to exclude GO terms that are too small or too big, as measured by the number or genes annotated for it. | |
<<>>= | |
require(data.table) | |
f.GOsizefilter <- function( gotable, gosizecutoff=250, keepsmaller = TRUE ){ | |
# gotable: One column is Category, another is GeneSymbol. | |
# One row for every Category that contains the gene | |
gotable <- as.data.table(gotable) |