Description Author(s) Examples
This module implements basic parsing of sieve MS and MS/MS data, into a logically constructed R data frame, suitable for further processing. Also a case study of how to explicitly pipeline analysis and data processing, using functions, decorators, and magrittr n'est pas une pipelines.
Maintainer: matt s mattthew@gmail.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | EXAMPLE of how to use this package
example <- function(){
library(ggplot2)
library(reshape2)
library(magrittr)
writeOut <- function(dd, n){
write.csv(dd, file=n, quote=F, row.names=F)
return(dd)
}
fname <- "example_sieve_data_file.csv"
example_prepare_data <- function(fname){
fname %>%
#
# Read in the data file, and immediately write out a copy as v1.csv
p(read_data_file)() %>%
p(writeOut)("v1.csv") %>%
# Remove columns that contain "blank", "pool", or "pr", and write out a
# copy of this intermediate data as v2.csv
p(remove_cols)(c(function(x){grep("blank",names(x),ignore.case=T)}
, function(x){grep("pool",names(x),ignore.case=T)}
, function(x){grep("pr",names(x),ignore.case=T)})) %>%
p(writeOut)("v2.csv") %>%
# Transpose this smaller frame, treating the 1st three columns as row-information. This row information
# is processed into the names(...) of the transposed data frame, and the original names(...) become the
# "sample_id" column.
p(transpose)(1:3, "sample_id") %>%
p(writeOut)("v3.csv")
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.