## This workflow uses chromatoplots
# > Sys.info()
# sysname
# "Darwin"
# release
# "10.8.0"
# version
# "Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386"
# nodename
# "Marie-Vendettuolis-Mac-Pro.local"
# machine
# "i386"
# login
# "marie"
# user
# "marie"
# effective_user
# "marie"
# > sessionInfo()
# R version 2.14.1 (2011-12-22)
# Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
#
# locale:
# [1] C/en_US.UTF-8/C/C/C/C
#
# attached base packages:
# [1] stats graphics grDevices utils datasets methods base
#
# other attached packages:
# [1] chromatoplots_0.0.8 commandr_0.0.1
#
# loaded via a namespace (and not attached):
# [1] Biobase_2.14.0 IRanges_1.12.6 MASS_7.3-17 RColorBrewer_1.0-5 RGtk2_2.20.21
# [6] cairoDevice_2.19 colorspace_1.1-1 dichromat_1.2-4 digest_0.5.2 ggplot2_0.9.0
# [11] grid_2.14.1 memoise_0.1 munsell_0.3 plyr_1.7.1 proto_0.3-9.2
# [16] reshape2_1.2.1 scales_0.2.0 stringr_0.6 tools_2.14.1 xcms_1.30.3
# setwd('Documents/chromatoplotsgui')
setwd('data/raw/treatment_0')
# load a file
raw1 <- loadSample('IS01.CDF')
# generate profile
raw_prof1 <- genProfile(raw1)
## Step 3: Remove baseline
cor_prof1 <- removeBaseline(raw_prof1, "median", scanrad = 100)
## Step 4: Find Peaks
peaks1 <- findPeaks(cor_prof1, "gauss")
# save(raw1, raw_prof1, cor_prof1, peaks1, file = 'data/processed/mac_control_step1_4.rda')
## Step 5: Load Experiment
setwd('raw')
ci_exp <- loadExperiment(dir())
# save(ci_exp, file = 'data/processed/mac_step5.rda')
## Step 6: Find components
xset_comps <- findComps(ci_exp, "sigma")
comps <- xset_comps@comps
pks <- as.data.frame(xset_comps@peaks)
inter <- interaction(pks[,"sample"],pks[,"comp"])
pks$inter <- inter
lst <- by(pks,pks$inter,function(obj){
## 50-800
mz.name <- paste("mz",50:800,sep="")
df <- t(data.frame(rep(0,length(50:800))))
colnames(df) <-mz.name
rownames(df) <- unique(obj$inter)
nms <- paste("mz",obj$mz,sep="")
df[,nms] <- obj$maxf
df
})
df <- do.call("rbind",lst)
df <- as.data.frame(df)
df$id <- rownames(df)
comps <- as.data.frame(comps)
comps$id <- interaction(comps$sample,comps$comp)
head(comps)
mets <- merge(comps,df,by="id")
# save(mets, xset_comps, file = 'data/processed/mac_step6.rda')
## Step 7: Grouping Components
xset_groups <- groupComps(xset_comps, "angle")
## Step 8: Retentio Time Correction
xset_rtcor <- rtcor(xset_groups, "rloess")
## Step 9: regroup after rt correction
xset_groups2 <- groupComps(xset_rtcor, "angle", rt_window = 1)
## Step 10: Summarize by common peaks
xset_sum <- summarize(xset_groups2, "common")
## Step 11: Normalize (by simple scaling)
xset_norm <- normalize(xset_sum, "scale")
# save(xset_groups, xset_rtcor, xset_groups2, xset_sum, xset_norm, file = 'data/processed/mac_step7_11.rda')
### load all files as raw objects
setwd('../raw')
allrawdata <- list.files(recursive = TRUE)[-1]
plyr:::loop_apply(length(allrawdata) , f = function(x){
assign(paste('raw', x + 1, sep = ''), loadSample(allrawdata[x]), envir = parent.env(environment()))
})
# save(raw1, raw2, raw3, raw4, raw5, raw6, raw7, raw8, raw9, file = 'data/processed/mac_loadSample_calibrated.rda')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.