Previous changeset 2:5e64657b4fe5 (2018-03-28) Next changeset 4:a6c9f5d6fdc9 (2018-08-09) |
Commit message:
Uploaded |
added:
nmr_preprocessing/.Rhistory nmr_preprocessing/.shed.yml nmr_preprocessing/Apodization_wrapper_Manon.R nmr_preprocessing/DrawFunctions.R nmr_preprocessing/Int_Funct.R nmr_preprocessing/NmrPreprocessing_script.R nmr_preprocessing/NmrPreprocessing_wrapper.R nmr_preprocessing/NmrPreprocessing_xml.xml nmr_preprocessing/README.rst nmr_preprocessing/ReadFids.R nmr_preprocessing/ReadFids_Manon.R nmr_preprocessing/ReadFids_script.R nmr_preprocessing/ReadFids_wrapper.R nmr_preprocessing/ReadFids_xml.xml nmr_preprocessing/macros.xml nmr_preprocessing/ptw.R nmr_preprocessing/static/images/Mth_Travaux.png nmr_preprocessing/static/images/NmrPreprocessing.png nmr_preprocessing/static/images/ReadFids.png nmr_preprocessing/test-data/MTBLS1.zip nmr_preprocessing/test-data/MTBLS1_alignedSpectra.tabular nmr_preprocessing/test-data/NMR_Preprocessing_dataMatrix.tabular nmr_preprocessing/test-data/NMR_ReadFids_dataMatrix.tabular nmr_preprocessing/test-data/sampleMetadata.tabular |
removed:
DrawFunctions.R NmrPreprocessing_script.R NmrPreprocessing_wrapper.R NmrPreprocessing_xml.xml README.rst ReadFids_script.R ReadFids_wrapper.R ReadFids_xml.xml macros.xml static/images/Mth_Travaux.png static/images/ReadFids.png test-data/MTBLS1.zip test-data/NMR_Preprocessing_dataMatrix.tabular test-data/NMR_ReadFids_dataMatrix.tabular test-data/sampleMetadata.tabular |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 DrawFunctions.R --- a/DrawFunctions.R Wed Mar 28 08:05:12 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,268 +0,0 @@\n-require(ggplot2)\n-require(gridExtra)\n-require(reshape2)\n-\n-\n-Draw <- function(Signal_data, type.draw = c("signal", "pca"), output = c("default", \n- "window", "png", "pdf"), dirpath = ".", filename = "%003d", height = 480, \n- width = 640, pdf.onefile = TRUE, ...) {\n- \n- # Data initialisation and checks ----------------------------------------------\n- type.draw <- match.arg(type.draw)\n- output <- match.arg(output)\n- fullpath <- paste(file.path(dirpath, filename), output, sep = ".")\n- createFile <- TRUE\n- createWindow <- FALSE\n- \n- # Drawing --------------------------------------------------------------------\n- # output\n- switch(output, default = {\n- createFile <- FALSE\n- }, window = {\n- createWindow <- TRUE\n- createFile <- FALSE\n- }, png = {\n- grDevices::png(fullpath, width, height)\n- }, pdf = {\n- grDevices::pdf(fullpath, width = width/72, height = height/72, \n- onefile = pdf.onefile)\n- }, {\n- stop("Unknown output type.")\n- })\n- \n- # Drawing type (signal/spectrum or PCA)\n- funs <- list(signal = DrawSignal, pca = DrawPCA)\n- if (type.draw %in% names(funs)) {\n- fun <- funs[[type.draw]]\n- } else {\n- stop(paste("Unknown type:", type.draw))\n- }\n- \n- # Plot finalisation ----------------------------------------------\n- if (is.vector(Signal_data)) {\n- Signal_data <- vec2mat(Signal_data)\n- }\n- fun(Signal_data, createWindow = createWindow, ...)\n- if (createFile) {\n- grDevices::dev.off()\n- }\n-}\n-\n-\n-\n-##### DrawSignal\n-\n-DrawSignal <- function(Signal_data, subtype = c("stacked", "together", \n- "separate", "diffmean", "diffmedian", "diffwith"), \n- ReImModArg = c(TRUE, FALSE, FALSE, FALSE), vertical = T, \n- xlab = "rowname", RowNames = NULL, row = 1, num.stacked = 4, \n- main = NULL, createWindow) {\n- # nticks\n- \n- # Data initialisation and checks ----------------------------------------------\n- \n- subtype <- match.arg(subtype)\n- vec <- is.vector(Signal_data)\n- if (vec) {\n- Signal_data <- vec2mat(Signal_data)\n- }\n- \n- n <- nrow(Signal_data)\n- m <- ncol(Signal_data)\n- \n- if (n < num.stacked){\n- num.stacked <- n\n- }\n- \n- scale <- colnames(Signal_data)\n- \n- num.plot <- sum(ReImModArg)\n- \n- Var <- rowname <- value <- NULL # only for R CMD check\n- \n- # Drawing array\n- if (num.plot <= 0) {\n- stop("Nothing selected in ReImModArg.")\n- } else if (num.plot <= 2) {\n- if (vertical) {\n- nrow <- num.plot\n- ncol <- 1\n- } else {\n- nrow <- 1\n- ncol <- num.plot\n- }\n- } else {\n- nrow <- 2\n- ncol <- 2\n- }\n- \n- # RowNames \n- if (is.null(RowNames)) {\n- RowNames <- rownames(Signal_data)\n- if (is.null(RowNames)) {\n- RowNames <- 1:n\n- }\n- } else {\n- if (!is.vector(RowNames)) {\n- stop("RowNames is not a vector")\n- }\n- if (length(RowNames) != n) {\n- stop(paste("RowNames has length", length(RowNames), "and there are", n, "FIDs."))\n- }\n- }\n- \n- if (n == 1) {\n- RowNames <- deparse(substitute(Signal_data))\n- }\n- \n- elements <- list()\n- if (ReImModArg[1]) {\n- elements[["Re"]] <- Re(Signal_data)\n- rownames(elements[["Re"]]) <- RowNames\n- }\n- if (ReImModArg[2]) {\n- elements[["Im"]] <- Im(Signal_data)\n- rownames(elements[["Im"]]) <- RowNames\n- }\n- if (ReImModArg[3]) {\n- elements[["Mod"]] <- Mod(Signal_data)\n- rownames(elements[["Mod"]]) <- RowNames\n- }\n- if (ReImModArg[4]) {\n- elements[["Arg"]] <- Arg(Signal_data)\n- rownames(elements[["Arg"]]) <- RowNames\n- }\n- \n- \n- \n- \n- # Drawing --------------------------------------------------------------------\n- \n- y = x = NULL # only for R CMD check\n- \n- \n- # SEPARATE or STACKED ===============\n- if (subtype == "separate" | subtype == "stacked") {\n- \n- i <- 1\n- while '..b'x = as.numeric(scale), y = elements[[name]][i, ])\n- }\n- \n- plots[[name]] <- ggplot2::ggplot(data = df, ggplot2::aes(x = x, y = y)) + \n- ggplot2::geom_line(size = 1) + \n- ggplot2::theme(legend.position = "none") + \n- ggplot2::labs(x = xlab, y = name) +\n- ggplot2::ggtitle(RowNames[i]) +\n- ggplot2::theme_bw()\n- \n- if ((df[1, "x"] - df[(dim(df)[1]), "x"]) > 0) {\n- plots[[name]] <- plots[[name]] + ggplot2::scale_x_reverse()\n- }\n- \n- } else {\n- \n- if (n == 1 ) {\n- melted <- data.frame(rowname = rep(name, m), \n- Var = as.numeric(scale), value = elements[[name]][i,])\n- } else if (last==i){ \n- melted <- data.frame(rowname = rep(rownames(elements[[name]])[i], m), \n- Var = as.numeric(scale), value = elements[[name]][i,])\n- } else {melted <- reshape2::melt(elements[[name]][i:last, ], \n- varnames = c("rowname", "Var"))\n- }\n- \n- \n- plots[[name]] <- ggplot2::ggplot(data = melted, ggplot2::aes(x = Var, y = value)) + \n- ggplot2::geom_line(size = 0.3) + \n- ggplot2::facet_grid(rowname ~ ., scales = "free_y") + \n- ggplot2::theme(legend.position = "none") + \n- ggplot2::labs(x = xlab, y = name) +\n- ggplot2::ggtitle(label = main) +\n- ggplot2::theme_bw()\n- \n- if ((melted[1, "Var"] - melted[(dim(melted)[1]), "Var"]) > 0) {\n- plots[[name]] <- plots[[name]] + ggplot2::scale_x_reverse()\n- }\n- }\n- }\n- \n- if (subtype == "stacked") {\n- do.call(gridExtra::grid.arrange, c(plots, list(nrow = nrow, ncol = ncol)))\n- } \n- \n- i <- last + 1\n- }\n- } else if (subtype %in% c("together", "diffmean", "diffmedian", "diffwith")) {\n- \n- # TOGHETER or DIFFMEAN or DIFFMEDIAN or DIFFWITH ===============\n- \n- rainbow_colors <- grDevices::rainbow(n)\n- \n- if (createWindow) {\n- grDevices::dev.new(noRStudioGD = TRUE)\n- }\n- graphics::par(mfrow = c(nrow, ncol))\n- \n- plots <- list()\n- \n- # Loop for Re, Im, Mod and Arg\n- for (name in names(elements)) {\n- # Get this part of the signal\n- element <- elements[[name]]\n- \n- # Express the signal according to a reference if asked by `subtype\'\n- if (subtype == "diffmean") {\n- element <- sweep(element, MARGIN = 2, colMeans(element), `-`)\n- } else if (subtype == "diffmedian") {\n- element <- sweep(element, MARGIN = 2, matrixStats::colMedians(element), `-`)\n- } else if (subtype == "diffwith") {\n- element <- sweep(element, MARGIN = 2, element[row, ], `-`)\n- if (row == 1 & n > 1) {\n- # Since we use plot on the first row and lines on the following, the y\n- # scale is calculated at the first row so if the first row is all 0, it\n- # causes problems\n- tmp <- element[1, ]\n- element[1, ] <- element[2, ]\n- element[2, ] <- tmp\n- }\n- }\n- \n- \n- melted <- reshape2::melt(elements[[name]], varnames = c("rowname", "Var"))\n- \n- \n- plots[[name]] <- ggplot2::ggplot(melted, ggplot2::aes(x = Var, \n- y = value, group = rowname, colour = rowname)) + ggplot2::geom_line() + \n- ggplot2::labs(x = xlab, y = name) + ggplot2::scale_colour_discrete(name = NULL) + \n- ggplot2::ggtitle(main)\n- \n- if ((melted[1, "Var"] - melted[(dim(melted)[1]), "Var"]) > \n- 0) {\n- plots[[name]] <- plots[[name]] + ggplot2::scale_x_reverse()\n- }\n- \n- do.call(gridExtra::grid.arrange, c(plots, list(nrow = nrow, \n- ncol = ncol)))\n- }\n- }\n- \n- \n-}\n' |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 NmrPreprocessing_script.R --- a/NmrPreprocessing_script.R Wed Mar 28 08:05:12 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,1214 +0,0 @@\n-## ==========================\n-# Internal functions\n-## ==========================\n-\n-# beginTreatment \n-beginTreatment <- function(name, Signal_data = NULL, Signal_info = NULL, \n- force.real = FALSE) {\n- \n- cat("Begin", name, "\\n")\n- \n- \n- # Formatting the Signal_data and Signal_info -----------------------\n- \n- vec <- is.vector(Signal_data)\n- if (vec) {\n- Signal_data <- vec2mat(Signal_data)\n- }\n- if (is.vector(Signal_info)) {\n- Signal_info <- vec2mat(Signal_info)\n- }\n- if (!is.null(Signal_data)) {\n- if (!is.matrix(Signal_data)) {\n- stop("Signal_data is not a matrix.")\n- }\n- if (!is.complex(Signal_data) && !is.numeric(Signal_data)) {\n- stop("Signal_data contains non-numerical values.")\n- }\n- }\n- if (!is.null(Signal_info) && !is.matrix(Signal_info)) {\n- stop("Signal_info is not a matrix.")\n- }\n- \n- \n- Original_data <- Signal_data\n- \n- # Extract the real part of the spectrum ---------------------------\n- \n- if (force.real) {\n- if (is.complex(Signal_data)) {\n- Signal_data <- Re(Signal_data)\n- } else {\n- # The signal is numeric Im(Signal_data) is zero anyway so let\'s avoid\n- # using complex(real=...,imaginary=0) which would give a complex signal\n- # in endTreatment()\n- force.real <- FALSE\n- }\n- }\n- \n- \n- # Return the formatted data and metadata entries --------------------\n- \n- return(list(start = proc.time(), vec = vec, force.real = force.real, \n- Original_data = Original_data, Signal_data = Signal_data, Signal_info = Signal_info))\n-}\n-\n-# endTreatment \n-endTreatment <- function(name, begin_info, Signal_data) {\n- \n- # begin_info: object outputted from beginTreatment\n- \n- \n- # Formatting the entries and printing process time -----------------------\n- end_time <- proc.time() # record it as soon as possible\n- start_time <- begin_info[["start"]]\n- delta_time <- end_time - start_time\n- delta <- delta_time[]\n- cat("End", name, "\\n")\n- cat("It lasted", round(delta["user.self"], 3), "s user time,", round(delta["sys.self"],3),\n- "s system time and", round(delta["elapsed"], 3), "s elapsed time.\\n")\n- \n- \n- if (begin_info[["force.real"]]) {\n- # The imaginary part is left untouched\n- i <- complex(real = 0, imaginary = 1)\n- Signal_data <- Signal_data + i * Im(begin_info[["Original_data"]])\n- }\n- \n- if (begin_info[["vec"]]) {\n- Signal_data <- Signal_data[1, ]\n- }\n- \n- # Return the formatted data and metadata entries --------------------\n- return(Signal_data)\n-}\n-\n-# checkArg \n-checkArg <- function(arg, checks, can.be.null=FALSE) {\n- check.list <- list(bool=c(is.logical, "a boolean"),\n- int =c(function(x){x%%1==0}, "an integer"),\n- num =c(is.numeric, "a numeric"),\n- str =c(is.character, "a string"),\n- pos =c(function(x){x>0}, "positive"),\n- pos0=c(function(x){x>=0}, "positive or zero"),\n- l1 =c(function(x){length(x)==1}, "of length 1")\n- )\n- if (is.null(arg)) {\n- if (!can.be.null) {\n- stop(deparse(substitute(arg)), " is null.")\n- }\n- } else {\n- if (is.matrix(arg)) {\n- stop(deparse(substitute(arg)), " is not scalar.")\n- }\n- for (c in checks) {\n- if (!check.list[[c]][[1]](arg)) {\n- stop(deparse(substitute(arg)), " is not ", check.list[[c]][[2]], ".")\n- }\n- }\n- }\n-}\n-\n-# getArg \n-getArg <- function(arg, info, argname, can.be.absent=FALSE) {\n- if (is.null(arg)) {\n- start <- paste("impossible to get argument", argname, "it was not given directly and");\n- if (!is.matrix(info)) {\n- stop(paste(start, "the info matrix was not given"))\n- }\n- if (!(argname %in% colnames(info))) {\n- if (can.be.absent) {\n- return(NULL)\n- } else {\n- stop(paste(start, "is not in the info matrix"))\n- }\n- }\n- if (nrow(info) < 1) {\n- stop(paste(start, "the info matr'..b'in the column\n- # index\n- if (ppm.bc == TRUE) {\n- colindex <- as.numeric(colnames(Spectrum_data))\n- } else {\n- colindex <- 1:m\n- }\n- \n- Int <- vector("list", length(exclude.bc))\n- for (i in 1:length(exclude.bc)) {\n- Int[[i]] <- indexInterval(colindex, from = exclude.bc[[i]][1], \n- to = exclude.bc[[i]][2], inclusive = TRUE)\n- }\n- exclude_index <- unlist(Int)\n- }\n- \n- # Baseline Correction implementation definition ----------------------\n- \n- # 2 Ways: either use the function asysm from the ptw package or by \n- # built-in functions \n- if (ptw.bc) {\n- asysm <- ptw::asysm\n- } else {\n- difsmw <- function(y, lambda, w, d) {\n- # Weighted smoothing with a finite difference penalty cf Eilers, 2003.\n- # (A perfect smoother) \n- # y: signal to be smoothed \n- # lambda: smoothing parameter \n- # w: weights (use0 zeros for missing values) \n- # d: order of differences in penalty (generally 2)\n- m <- length(y)\n- W <- Matrix::Diagonal(x=w)\n- E <- Matrix::Diagonal(m)\n- D <- Matrix::diff(E, differences = d)\n- C <- Matrix::chol(W + lambda * t(D) %*% D)\n- x <- Matrix::solve(C, Matrix::solve(t(C), w * y))\n- return(as.numeric(x))\n- \n- }\n- asysm <- function(y, lambda, p, eps, exclude_index) {\n- # Baseline estimation with asymmetric least squares\n- # y: signal\n- # lambda: smoothing parameter (generally 1e5 to 1e8)\n- # p: asymmetry parameter (generally 0.001)\n- # d: order of differences in penalty (generally 2)\n- # eps: 1e-8 in ptw package\n- m <- length(y)\n- w <- rep(1, m)\n- i <- 1\n- repeat {\n- z <- difsmw(y, lambda, w, d = 2)\n- w0 <- w\n- p_vect <- rep((1-p), m) # if y <= z + eps\n- p_vect[y > z + eps | y < 0] <- p # if y > z + eps | y < 0\n- if(!is.null(exclude_index)){\n- p_vect[exclude_index] <- 0 # if exclude area\n- }\n- \n- w <- p_vect \n- # w <- p * (y > z + eps | y < 0) + (1 - p) * (y <= z + eps)\n- \n- if (sum(abs(w - w0)) == 0) {\n- break\n- }\n- i <- i + 1\n- if (i > maxIter) {\n- warning("cannot find Baseline estimation in asysm")\n- break\n- }\n- }\n- return(z)\n- }\n- }\n- \n- # Baseline estimation ----------------------------------------------\n- Baseline <- matrix(NA, nrow = nrow(Spectrum_data), ncol = ncol(Spectrum_data))\n- \n- # for (k in 1:n) {\n- # Baseline[k, ] <- asysm(y = Spectrum_data[k, ], lambda = lambda, p = p, eps = eps)\n- \n- if (ptw.bc ){\n- Baseline <- apply(Spectrum_data,1, asysm, lambda = lambda, p = p, \n- eps = eps)\n- }else {\n- Baseline <- apply(Spectrum_data,1, asysm, lambda = lambda, p = p, \n- eps = eps, exclude_index = exclude_index)\n- }\n- \n- \n- Spectrum_data <- Spectrum_data - t(Baseline)\n- # }\n- \n- # Data finalisation ----------------------------------------------\n- Spectrum_data <- endTreatment("BaselineCorrection", begin_info, Spectrum_data) # FIXME create removeImaginary filter ??\n- \n- if (returnBaseline) {\n- return(list(Spectrum_data = Spectrum_data, Baseline = Baseline))\n- } else {\n- return(Spectrum_data)\n- }\n-}\n-\n-\n-\n-## ====================================================\n-# NegativeValuesZeroing \n-## ====================================================\n-\n-NegativeValuesZeroing <- function(Spectrum_data) {\n- # Data initialisation and checks ----------------------------------------------\n- begin_info <- beginTreatment("NegativeValuesZeroing", Spectrum_data, force.real = T)\n- Spectrum_data <- begin_info[["Signal_data"]]\n- \n- # NegativeValuesZeroing ----------------------------------------------\n- Spectrum_data[Spectrum_data < 0] <- 0\n- \n- # Data finalisation ----------------------------------------------\n- return(endTreatment("NegativeValuesZeroing", begin_info, Spectrum_data))\n-}\n-\n-\n' |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 NmrPreprocessing_wrapper.R --- a/NmrPreprocessing_wrapper.R Wed Mar 28 08:05:12 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,411 +0,0 @@\n-#!/usr/local/public/bin/Rscript --vanilla --slave --no-site-file\n-\n-## 170116_NmrPreprocessing.R\n-## Manon Martin and Marie Tremblay-Franco\n-\n-##======================================================\n-##======================================================\n-# Preamble\n-##======================================================\n-##======================================================\n-\n-runExampleL <- FALSE\n-\n-\n-##------------------------------\n-## Options\n-##------------------------------\n-strAsFacL <- options()$stringsAsFactors\n-options(stringsAsFactors = FALSE)\n-\n-##------------------------------\n-## Libraries laoding\n-##------------------------------\n-library(batch)\n-library(ptw)\n-library(Matrix)\n-library(ggplot2)\n-library(gridExtra)\n-library(reshape2)\n-\n-\n-# R script call\n-source_local <- function(fname)\n-{\n-\targv <- commandArgs(trailingOnly = FALSE)\n-\tbase_dir <- dirname(substring(argv[grep("--file=", argv)], 8))\n-\tsource(paste(base_dir, fname, sep="/"))\n-}\n-#Import the different functions\n-source_local("NmrPreprocessing_script.R")\n-source_local("DrawFunctions.R")\n-\n-##------------------------------\n-## Script\n-##------------------------------\n-runExampleL <- FALSE\n-\n-\n-if(!runExampleL)\n- argLs <- parseCommandArgs(evaluate=FALSE)\n-\n-sink(argLs$logOut)\n-\n-\n-##------------------------------\n-## Errors ?????????????????????\n-##------------------------------\n-\n-\n-##------------------------------\n-## Constants\n-##------------------------------\n-topEnvC <- environment()\n-flagC <- "\\n"\n-\n-\n-\n-\n-# log file\n-# print(argLs[["logOut"]])\n-\n-## Starting\n-cat("\\nStart of \'Preprocessing\' Galaxy module call: ", as.character(Sys.time()), "\\n", sep = "")\n-\n-\n-##======================================================\n-##======================================================\n-## Parameters Loading\n-##======================================================\n-##======================================================\n-\n-# graphical inputs\n-FirstOPCGraph <- argLs[["FirstOPCGraph"]]\n-SSGraph <- argLs[["SSGraph"]]\n-ApodGraph <- argLs[["ApodGraph"]]\n-FTGraph <- argLs[["FTGraph"]]\n-SRGraph <- argLs[["SRGraph"]]\n-ZeroOPCGraph <- argLs[["ZeroOPCGraph"]]\n-BCGraph <- argLs[["BCGraph"]]\n-FinalGraph <- argLs[["FinalGraph"]]\n-\n-\n-# 1rst order phase correction ------------------------\n- # Inputs\n-\t## Data matrix\n-Fid_data0 <- read.table(argLs[["dataMatrixFid"]],header=TRUE, check.names=FALSE, sep=\'\\t\')\n-# Fid_data0 <- Fid_data0[,-1]\n-Fid_data0 <- as.matrix(Fid_data0)\n-\n-\t## Samplemetadata\n-samplemetadataFid <- read.table(argLs[["sampleMetadataFid"]],check.names=FALSE,header=TRUE,sep="\\t")\n-samplemetadataFid <- as.matrix(samplemetadataFid)\n-\n-\n-# water and solvent(s) correction ------------------------\n- # Inputs\n-lambda <- argLs[["lambda"]]\n-\n-\n-\n-# apodization -----------------------------------------\n- # Inputs\n-phase=0\n-rectRatio=1/2\n-gaussLB=1\n-expLB=1\n-apodization <- argLs[["apodizationMethod"]]\n-\n-if (apodization==\'exp\'){\n- expLB <- argLs[["expLB"]]\n- } else if (apodization==\'cos2\'){\n- phase <- argLs[["phase"]]\n- } else if (apodization==\'hanning\'){\n- phase <- argLs[["phase"]]\n- } else if (apodization==\'hamming\'){\n- phase <- argLs[["phase"]]\n- } else if (apodization==\'blockexp\'){\n- rectRatio <- argLs[["rectRatio"]]\n- expLB <- argLs[["expLB"]]\n- } else if (apodization==\'blockcos2\'){\n- rectRatio <- argLs[["rectRatio"]]\n- } else if (apodization==\'gauss\'){\n- rectRatio <- argLs[["rectRatio"]]\n- gaussLB <- argLs[["gaussLB"]]\n- }\t\t\n-\n-\n-# Fourier transform ----------------------------------\n- # Inputs\n-\n-\n-# Internal referencering ----------------------------------\n- # Inputs\n-shiftTreshold = 2 # c\n-ppm = TRUE\n-shiftReferencingRangeList = NULL # fromto.RC\n-pctNearValue = 0.02 # pc \n-rowindex_graph = NULL\n-ppm_ref = 0 # ppm.ref\n-\n-# \n-# shiftReferencing <- argLs[["shiftReferencing"]]\n-# print(shiftReferencing)\n-# \n-# if (shiftReferencing=="YES")\n-# {\n-# \n-\t# shiftReferencingMethod <- argLs[["shiftReferencingMethod"]]\n-\t'..b' TRUE)\n-\n-\n-if (FTGraph == "YES") {\n- title = "Fourier transformed spectra"\n- DrawSignal(Spectrum_data, subtype = "stacked",\n- ReImModArg = c(TRUE, FALSE, FALSE, FALSE), vertical = T, \n- xlab = "Frequency", num.stacked = 4, \n- main = title, createWindow=FALSE)\n-}\n-\n-\n-\n-# ZeroOrderPhaseCorrection ---------------------------------\n-Spectrum_data <- ZeroOrderPhaseCorrection(Spectrum_data, type.zopc = zeroOrderPhaseMethod,\n- plot_rms = NULL, returnAngle = FALSE,\n- createWindow = TRUE,angle = angle,\n- plot_spectra = FALSE,\n- ppm.zopc = TRUE, exclude.zopc = excludeZOPC)\n-\n-\n-# InternalReferencing ---------------------------------\n-# if (shiftReferencing=="YES") {\n-Spectrum_data <- InternalReferencing(Spectrum_data, samplemetadataFid, method = "max", range = shiftReferencingRange,\n- ppm.value = ppmvalue, shiftHandling = shiftHandling, ppm.ir = TRUE,\n- fromto.RC = shiftReferencingRangeList, pc = pctNearValue)\n-\n-if (SRGraph == "YES") {\n- title = "Spectra after Shift Referencing"\n- DrawSignal(Spectrum_data, subtype = "stacked",\n- ReImModArg = c(TRUE, FALSE, FALSE, FALSE), vertical = T, \n- xlab = "Frequency", num.stacked = 4, \n- main = title, createWindow=FALSE)\n-}\n-\n-# }\n-\n-if (ZeroOPCGraph == "YES") {\n-title = "Spectra after Zero Order Phase Correction"\n-DrawSignal(Spectrum_data, subtype = "stacked",\n- ReImModArg = c(TRUE, FALSE, FALSE, FALSE), vertical = T, \n- xlab = "Frequency", num.stacked = 4, \n- main = title, createWindow=FALSE)\n-}\n-\n-\n-# BaselineCorrection ---------------------------------\t\t\t\t\t\t\t\t\t \n-Spectrum_data <- BaselineCorrection(Spectrum_data, ptw.bc = TRUE, lambda.bc = lambdaBc, \n- p.bc = pBc, eps = epsilon, ppm.bc = TRUE, \n- exclude.bc = excludeBC,\n- returnBaseline = F) \n-\n-\n-\n-if (BCGraph == "YES") {\n-title = "Spectra after Baseline Correction"\n-DrawSignal(Spectrum_data, subtype = "stacked",\n- ReImModArg = c(TRUE, FALSE, FALSE, FALSE), vertical = T, \n- xlab = "Frequency", num.stacked = 4, \n- main = title, createWindow=FALSE)\n-}\n-\n-\n-# NegativeValuesZeroing ---------------------------------\n-if (NegativetoZero=="YES") {\n- Spectrum_data <- NegativeValuesZeroing(Spectrum_data)\n-}\n-\n-if (FinalGraph == "YES") {\n- title = "Final preprocessed spectra"\n- DrawSignal(Spectrum_data, subtype = "stacked",\n- ReImModArg = c(TRUE, FALSE, FALSE, FALSE), vertical = T, \n- xlab = "Frequency", num.stacked = 4, \n- main = title, createWindow=FALSE)\n-}\n-\n-invisible(dev.off())\n-\n-\n-data_variable <- matrix(NA, nrow = 1, ncol = dim(Spectrum_data)[2], dimnames = list("ID", NULL)) \n-colnames(data_variable) <- colnames(Spectrum_data)\n-data_variable[1,] <- colnames(data_variable)\n-\n-\n-##======================================================\n-##======================================================\n-## Saving\n-##======================================================\n-##======================================================\n-\n-# Data Matrix\n-write.table(round(t(Re(Spectrum_data)),6), file=argLs$dataMatrix, quote=FALSE, row.names=TRUE, sep="\\t", col.names=TRUE)\n-\n-# Variable metadata\n-write.table(data_variable,file=argLs$variableMetadata, quote=FALSE, row.names=TRUE, sep="\\t", col.names=TRUE)\n-\n-# log file\n-# write.table(t(data.frame(argLs)), file = argLs$logOut, col.names = FALSE, quote=FALSE)\n-\n-# input arguments\n-cat("\\n INPUT and OUTPUT ARGUMENTS :\\n")\n-\n-argLs\n-\n-\n-## Ending\n-\n-cat("\\nEnd of \'Preprocessing\' Galaxy module call: ", as.character(Sys.time()), sep = "")\n-\n-sink()\n-\n-options(stringsAsFactors = strAsFacL)\n-\n-rm(list = ls())\n' |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 NmrPreprocessing_xml.xml --- a/NmrPreprocessing_xml.xml Wed Mar 28 08:05:12 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
b'@@ -1,575 +0,0 @@\n-<tool id="NMR_Preprocessing" name="NMR_Preprocessing" version="@WRAPPER_VERSION@">\n- <description> Preprocessing of 1D NMR spectra </description>\n-\n- <macros>\n- <import>macros.xml</import>\n- </macros>\n-\n- <expand macro="requirements">\n- <requirement type="package" version="1.9_12">r-ptw</requirement>\n- <requirement type="package" version="1.2_12">r-matrix</requirement>\n- </expand>\n-\n- <expand macro="stdio"/>\n-\n- <command>\n- ## Wrapper\n- Rscript $__tool_directory__/NmrPreprocessing_wrapper.R\n-\n- ## Data matrix of FID spectra\n- dataMatrixFid $dataMatrixFid\n- ## Sample metadata matrix\n- sampleMetadataFid $sampleMetadataFid\n-\n- ## First order phase correction\n- ## Graphical display\n- FirstOPCGraph $GDC.FirstOPCGraph\n-\n- ## Water and / or solvents suppression\n- ## Smoothing parameter\n- lambda $SS.lambda\n-\n- ## Graphical display\n- SSGraph $SS.SSGraph\n-\n-\n- ## Apodization\n- ## Graphical display\n- ApodGraph $Apod.ApodGraph\n-\n- apodizationMethod $Apod.apodizationMethod.method\n- #if $Apod.apodizationMethod.method == "exp":\n- ## Line broadening for the exponential window\n- expLB $Apod.apodizationMethod.expLB\n- #end if\n- #if $Apod.apodizationMethod.method == "cos2":\n- ## Phase\n- phase $Apod.apodizationMethod.phase\n- #end if\n- #if $Apod.apodizationMethod.method == "hanning":\n- ## Phase\n- phase $Apod.apodizationMethod.phase\n- #end if\n- #if $Apod.apodizationMethod.method == "hamming":\n- ## Phase\n- phase $Apod.apodizationMethod.phase\n- #end if\n- #if $Apod.apodizationMethod.method == "blockexp":\n- ## Proportion of signal in the window\n- rectRatio $Apod.apodizationMethod.rectRatio\n- expLB $Apod.apodizationMethod.expLB\n- #end if\n- #if $Apod.apodizationMethod.method == "blockcos2":\n- ## Proportion of signal in the window\n- rectRatio $Apod.apodizationMethod.rectRatio\n- #end if\n- #if $Apod.apodizationMethod.method == "gauss":\n- ## Line broadening for the gaussian window\n- gaussLB $Apod.apodizationMethod.gaussLB\n- #end if\n-\n- ## Fourier transform\n- ## Graphical display\n- FTGraph $FT.FTGraph\n-\n- ## Zero order phase correction\n- ## Graphical display\n- ZeroOPCGraph $ZOPC.ZeroOPCGraph\n-\n- zeroOrderPhaseMethod $ZOPC.zeroOrderPhaseMethod\n-\n- excludeZoneZeroPhase.choice ${ZOPC.excludeZoneZeroPhase.choice}\n- #if str($ZOPC.excludeZoneZeroPhase.choice) == "YES":\n- #for $i in $ZOPC.excludeZoneZeroPhase.conditions:\n- excludeZoneZeroPhase_left ${i.excludeZoneZeroPhase_left}\n- excludeZoneZeroPhase_right ${i.excludeZoneZeroPhase_right}\n- #end for\n- #end if\n-\n- ## Shift referencing\n- ## Graphical display\n- SRGraph $SR.SRGraph\n-\n- ## Definition of the search zone\n- shiftReferencingRange $SR.shiftReferencingRange.method\n- #if $SR.shiftReferencingRange.method == "nearvalue":\n- pctNearValue $SR.shiftReferencingRange.pctNearValue\n- #end if\n- #if $SR.shiftReferencingRange.method == "window":\n- #for $i in $SR.shiftReferencingRange.conditions:\n- shiftReferencingRangeLeft ${i.shiftReferencingRangeLeft}\n- shiftReferencingRangeRight ${i.shiftReferencingRangeRight}\n- #end for\n- #end if\n- shiftHandling $SR.shiftHandling\n- ppmvalue $SR.ppmvalue\n-\n- ## Baseline correction\n- ## Graphical display\n- BCGraph $BC.BCGraph\n-\n- lambdaBc $BC.lambdaBc\n- pBc $BC.pBc\n- epsilon $BC.epsilon\n-\n- excludeZoneBC.choice ${BC.excludeZoneBC.choice'..b'-----\n-\n-**Smoothing parameter** lambda: The higher lambda is, the smoother the estimated solvent signal will be\n-\n-\n-**Apodization**\n-----------------------\n-\n-The **types of apodization** are:\n-\n-* exp: The signal is multiplied by a decreasing exponential exp(-t/LineBroadening).\n-\n-* cos2: The signal is multiplied by the value of a cosinus squared from 0 (where its value is 1) until pi/2 (where its value is 0).\n-\n-* blockexp: The first part of the signal (described by the proportion of signal in the window) is left unchanged and the second is multiplied by exp(-t/LineBroadening) starting at value 1.\n-\n-* blockcos2: The first part is left unchanged as with blockexp and the second part is multiplied by a cosinus squared where its value starts at 1 at the end of the block and ends at 0 at the end of the signal.\n-\n-* gauss: The signal is multiplied by a gaussian window centered at the beginning of the FID and with sigma=1/LineBroadening.\n-\n-* hanning: The signal is multiplied by a hanning window : 0.5 + 0.5 cos.\n-\n-* hamming: The signal is multiplied by a hamming window : 0.54 + 0.46 cos.\n-\n-\n-\n-\n-**Zero Order Phase Correction**\n------------------------------------\n-\n-**Zero Order Phase correction method**:\n-\n-* rms: A positiveness criterion is applied on the spectrum with a quantile probability parameter to trim the values.\n-\n-* max: Optimization of the maximal spectral intensity.\n-\n-\n-**Exclusion area(s) for the Zero Order Phase Correction**: enables to optimize the criterion with excluded spectral window(s), by default the water region is excluded.\n-\n-\n-**Shift Referencing**\n-----------------------\n-\n-The **searching window** can be adapted:\n-\n-* nearvalue: the search concentrates around the value of the reference peak in ppm.\n-\n-* all: search accross the whole ppm axis.\n-\n-* window: the search is operated in the windows defined by the Search_zone bounds.\n-\n-\n-**shiftHandling**: spectra can be shifted differently, we can handle misalignment of the left and right of the spectrum by different ways:\n-\n-* zerofilling: The extremities at which a spectrum is not defined are replaced by 0. It makes sense since in practice the spectrum is close to zero at the extremities.\n-\n-* NAfilling: The extremities at which a spectrum is not defined are replaced by NA.\n-\n-* circular: The spectra are shifted circularly which means that the end of a spectrum is reproduced at the beginning.\n-\n-* cut: The ppm values for which some spectra are not defined are removed.\n-\n-\n-**value of the reference peak**: the value in ppm of the reference peak. By default the value is 0 ppm.\n-\n-\n-\n-**Baseline Correction**\n-----------------------------\n-\n-**Smoothing parameter**: the larger it is, the smoother the estimated baseline will be.\n-\n-**Asymmetry parameter**: the smaller it is, the less the estimated baseline will try to follow peaks when it is under the spectrum and the more it will try to be under the spectrum.\n-\n-**numerical precision**: numerical precision for convergence when estimating the baseline.\n-\n-**Exclusion area(s) for the Baseline Correction**: enables to optimize the criterion with excluded spectral window(s), by default the water region is excluded.\n-\n-\n-\n-**Negative intensities to Zero**\n-------------------------------------\n-\n-**Set negative intensities to zero**: the set of negative intensities to zero is optional.\n-\n-\n-------------\n-Output files\n-------------\n-\n-NMR_Preprocessing_dataMatrix\n- | tabular output\n- | Data matrix with n rows (descriptors) and p columns (samples) containing the preprocessed spectra.\n- |\n-\n-NMR_Preprocessing_variableMetadata\n- | tabular output\n- | Data matrix with 1 row (ppm value) and p columns (descriptors).\n- |\n-\n-NMR_Preprocessing_log\n- | text output\n- | Contains warnings and the input parameters\n- |\n-\n-NMR_Preprocessing_graph.pdf\n- | pdf output\n- | line plots of preprocessed spectra\n- |\n-\n-\n-@HELP_CHANGELOG@\n-\n- </help>\n-\n- <expand macro="citation" />\n-\n-</tool>\n' |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 README.rst --- a/README.rst Wed Mar 28 08:05:12 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,19 +0,0 @@ - -Changelog/News --------------- -**Version 3.2.0** - -* Updated R scripts and the help section of NMR_ReadFids and NMR_preprocessing -* Added sections -* Created a variableMetadata file in output of the NMR_preprocessing module -* Homogenised the input-output file names with the other modules -* Suppressed the option ptw for the baseline correction, set to TRUE all the time now -* Shift referencing: other values than 0 are admitted -* The log file recovers the input/output parameters -* Added an exclusion zone for the computation of the Baseline Correction criterion -* Switched Internal Referencing (goes second) and Zero Order Phase Correction (goes first) - - -**Version 3.1.0** - -* Implementation of NMR_ReadFids and NMR_preprocessing |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 ReadFids_script.R --- a/ReadFids_script.R Wed Mar 28 08:05:12 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
b'@@ -1,404 +0,0 @@\n-################################################################################################\n-#\n-# Read FIDs in Bruker format\n-#\n-#\n-################################################################################################\n-\n-\n-# vec2mat ==============================================================================\n-vec2mat <- function(vec) {\n- return(matrix(vec, nrow = 1, dimnames = list(c(1), names(vec)))) \n-}\n-\n-\n-# ReadFid ==============================================================================\n-ReadFid <- function(path) {\n- \n- # Read 1D FID using Bruker XWinNMR and TopSpin format. It is inspired of the\n- # matNMR matlab library which deals with 2D FID and also other formats\n- # Read also the parameters in the acqus file\n- \n- paramFile <- file.path(path, "acqus")\n- # BYTEORDA: 0 -> Little Endian 1 -> Big Endian\n- params <- readParams(paramFile, c("TD", "BYTORDA", "DIGMOD", "DECIM", "DSPFVS", \n- "SW_h", "SW", "O1"))\n- \n- if (params[["DSPFVS"]] >= 20) {\n- # The group delay first order phase correction is given directly from version 20\n- grpdly <- readParams(paramFile, c("GRPDLY"))\n- params[["GRPDLY"]] <- grpdly[["GRPDLY"]]\n- }\n- TD <- params[["TD"]]\n- endianness <- if (params$BYTORDA) \n- "big" else "little"\n- if (TD%%2 != 0) {\n- stop(paste("Only even numbers are allowed for size in TD because it is complex \n- data with the real and imaginary part for each element.", \n- "The TD value is in the", paramFile, "file"))\n- }\n- \n- # Interpret params Dwell Time, time between 2 data points in the FID\n- params[["DT"]] <- 1/(2 * params[["SW_h"]])\n- \n- # Read fid\n- fidFile <- file.path(path, "fid")\n- fidOnDisk <- readBin(fidFile, what = "int", n = TD, size = 4L, endian = endianness)\n- \n- # Real size that is on disk (it should be equal to TD2, except for TopSpin/Bruker\n- # (which is our case) according to matNMR as just discussed\n- TDOnDisk <- length(fidOnDisk)\n- if (TDOnDisk < TD) {\n- warning("Size is smaller than expected, the rest is filled with zero so the size is the same for every fid")\n- fidGoodSize <- sapply(vector("list", length = TD), function(x) 0)\n- fidGoodSize[1:TDOnDisk] <- fidOnDisk\n- \n- } else if (TDOnDisk > TD) {\n- warning("Size is bigger than expected, the rest ignored so the size is the same for every fid")\n- fidGoodSize <- fidOnDisk(1:TD)\n- \n- } else {\n- fidGoodSize <- fidOnDisk\n- }\n- \n- fidRePart <- fidGoodSize[seq(from = 1, to = TD, by = 2)]\n- fidImPart <- fidGoodSize[seq(from = 2, to = TD, by = 2)]\n- fid <- complex(real = fidRePart, imaginary = fidImPart)\n- \n- return(list(fid = fid, params = params))\n-}\n-\n-\n-\n-\n-# getDirsContainingFid ==============================================================================\n-getDirsContainingFid <- function(path) {\n- subdirs <- dir(path, full.names = TRUE)\n- if (length(subdirs) > 0) {\n- cond <- sapply(subdirs, function(x) {\n- content <- dir(x)\n- # subdirs must contain fid, acqu and acqus files\n- return("fid" %in% content && "acqu" %in% content && "acqus" %in% content)\n- })\n- subdirs <- subdirs[cond]\n- }\n- return(subdirs)\n-}\n-\n-\n-\n-\n-\n-\n-# beginTreatment ==============================================================================\n-\n-beginTreatment <- function(name, Signal_data = NULL, Signal_info = NULL, \n- force.real = FALSE) {\n- \n- cat("Begin", name, "\\n")\n- \n- \n- # Formatting the Signal_data and Signal_info -----------------------\n- \n- vec <- is.vector(Signal_data)\n- if (vec) {\n- Signal_data <- vec2mat(Signal_data)\n- }\n- if (is.vector(Signal_info)) {\n- Signal_info <- vec2mat(Signal_info)\n- }\n- if (!is.null(Signal_data)) {\n- if (!is.matrix(Signal_data)) {\n- stop("Signal_data is not a matrix.")\n- }\n- if (!is.complex(Signal_data) && !is.numeric(Signal_data)) {\n- stop("Signal_data contains non-numerical values."'..b'\n- while (last > 0 & !isDigit(substr(line, last, last))) {\n- last <- last - 1\n- }\n- params[paramName] <- as.numeric(substr(line, first, last))\n- }\n- return(params)\n-}\n-\n-\n-\n-# ReadFids ==============================================================================\n-\n-ReadFids <- function(path, l = 1, subdirs = FALSE, dirs.names = FALSE) {\n- \n- # Data initialisation and checks ----------------------------------------------\n- begin_info <- beginTreatment("ReadFids")\n- checkArg(path, c("str"))\n- checkArg(l, c("pos"))\n- if (file.exists(path) == FALSE) {\n- stop(paste("Invalid path:", path))\n- }\n- \n- \n- # Extract the FIDs and their info ----------------------------------------------\n- \n- if (subdirs == FALSE) {\n- fidDirs <- getDirsContainingFid(path)\n- n <- length(fidDirs)\n- if (n == 0L) {\n- stop(paste("No valid fid in", path))\n- }\n- if (dirs.names) {\n- separator <- .Platform$file.sep\n- path_elem <- strsplit(fidDirs,separator)\n- fidNames <- sapply(path_elem, function(x) x[[length(path_elem[[1]])]])\n- }else {fidNames <- sapply(X = fidDirs, FUN = getTitle, l = l, subdirs = subdirs, USE.NAMES = F)}\n- \n- for (i in 1:n) {\n- fidList <- ReadFid(fidDirs[i])\n- fid <- fidList[["fid"]]\n- info <- fidList[["params"]]\n- m <- length(fid)\n- if (i == 1) {\n- Fid_data <- matrix(nrow = n, ncol = m, dimnames = list(fidNames, \n- info[["DT"]] * (0:(m - 1))))\n- Fid_info <- matrix(nrow = n, ncol = length(info), dimnames = list(fidNames, \n- names(info)))\n- }\n- Fid_data[i, ] <- fid\n- Fid_info[i, ] <- unlist(info)\n- }\n- \n- } else {\n- maindirs <- dir(path, full.names = TRUE) # subdirectories\n- Fid_data <- numeric()\n- Fid_info <- numeric()\n- \n- fidDirs <- c()\n- for (j in maindirs) {\n- fd <- getDirsContainingFid(j) # recoved FIDs from subdirectories\n- n <- length(fd)\n- if (n > 0L) {\n- fidDirs <- c(fidDirs, fd)\n- } else {warning(paste("No valid fid in",j ))}\n- }\n- \n- if (dirs.names==TRUE) {\n- if (length(fidDirs)!= length(dir(path))) { # at least one subdir contains more than 1 FID\n- separator <- .Platform$file.sep\n- path_elem <- strsplit(fidDirs,separator)\n- fidNames <- sapply(path_elem, function(x) paste(x[[length(path_elem[[1]])-1]],\n- x[[length(path_elem[[1]])]], sep = "_"))\n- }else {fidNames <- dir(path)}\n- \n- } else {fidNames <- sapply(X = fidDirs, FUN = getTitle, l = l, subdirs = subdirs, USE.NAMES = F)}\n- \n- for (i in 1:length(fidNames)) {\n- fidList <- ReadFid(fidDirs[i])\n- fid <- fidList[["fid"]]\n- info <- fidList[["params"]]\n- m <- length(fid)\n- if (i == 1) {\n- Fid_data <- matrix(nrow = length(fidNames), ncol = m, dimnames = list(fidNames, \n- info[["DT"]] * (0:(m - 1))))\n- Fid_info <- matrix(nrow = length(fidNames), ncol = length(info), dimnames = list(fidNames, \n- names(info)))\n- }\n- Fid_data[i, ] <- fid\n- Fid_info[i, ] <- unlist(info)\n- }\n- \n- \n- }\n- \n- # Check for non-unique IDs ----------------------------------------------\n- NonnuniqueIds <- sum(duplicated(row.names(Fid_data)))\n- cat("dim Fid_data: ", dim(Fid_data), "\\n")\n- cat("IDs: ", rownames(Fid_data), "\\n")\n- cat("non-unique IDs?", NonnuniqueIds, "\\n")\n- if (NonnuniqueIds > 0) {\n- warning("There are duplicated IDs: ", Fid_data[duplicated(Fid_data)])\n- }\n- \n- \n- # Return the results ----------------------------------------------\n- return(list(Fid_data = endTreatment("ReadFids", begin_info, Fid_data), Fid_info = Fid_info))\n- \n-}\n-\n' |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 ReadFids_wrapper.R --- a/ReadFids_wrapper.R Wed Mar 28 08:05:12 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
[ |
@@ -1,158 +0,0 @@ -#!/usr/local/public/bin/Rscript --vanilla --slave --no-site-file - -## 08122016_ReadFids_wrapper.R -## Manon Martin -## manon.martin@uclouvain.be - -##====================================================== -##====================================================== -# Preamble -##====================================================== -##====================================================== - -runExampleL <- FALSE - - -##------------------------------ -## Options -##------------------------------ -strAsFacL <- options()$stringsAsFactors -options(stringsAsFactors = FALSE) -options(warn=1) - -##------------------------------ -## Libraries laoding -##------------------------------ -library(batch) -library(ggplot2) -library(gridExtra) -library(reshape2) - - -# R script call -source_local <- function(fname) -{ - argv <- commandArgs(trailingOnly = FALSE) - base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)) - source(paste(base_dir, fname, sep="/")) -} -#Import the different functions -source_local("ReadFids_script.R") -source_local("DrawFunctions.R") -##------------------------------ -## Errors ????????????????????? -##------------------------------ - - -##------------------------------ -## Constants -##------------------------------ -topEnvC <- environment() -flagC <- "\n" - - -##------------------------------ -## Script -##------------------------------ -if(!runExampleL) - argLs <- parseCommandArgs(evaluate=FALSE) - -sink(argLs$logOut) - -##====================================================== -##====================================================== -## Parameters Loading -##====================================================== -##====================================================== - - ## Inputs - # Path - ## Bruker FIDs -fileType="Bruker" -zipfile= argLs[["fidzipfile"]] -directory=unzip(zipfile, list=F) -path=paste(getwd(),strsplit(directory[1],"/")[[1]][2],sep="/") - - -# other inputs from ReadFids -l = argLs[["title_line"]] -subdirs <- argLs[["subdirectories"]] -dirs.names <- argLs[["dirs_names"]] - - -# Outputs -# dataMatrix <- argLs[["dataMatrix"]] -# sampleMetadata <- argLs[["sampleMetadata"]] -logOut <- argLs[["logOut"]] -nomGraphe <- argLs[["graphOut"]] - - - -## Checking arguments -##------------------- -error.stock <- "\n" - -if(length(error.stock) > 1) - stop(error.stock) - - - -##====================================================== -##====================================================== -## Computation -##====================================================== -##====================================================== -sink(logOut,append=TRUE) - -if(length(warnings())>0){ # or !is.null(warnings()) - print("something happened") -} - -## Starting -cat("\nStart of 'ReadFids' Galaxy module call: ", as.character(Sys.time()), "\n\n", sep = "") - -outputs <- ReadFids(path = path, l=l, subdirs = subdirs, dirs.names = dirs.names) - -data_matrix <- outputs[["Fid_data"]] # Data matrix -data_sample <- outputs[["Fid_info"]] # Sample metadata - - - -pdf(nomGraphe, onefile = TRUE, width = 13, height = 13) -title = "Raw FID data" -DrawSignal(data_matrix, subtype = "stacked", - ReImModArg = c(TRUE, FALSE, FALSE, FALSE), vertical = T, - xlab = "Frequency", num.stacked = 4, - main = title, createWindow=FALSE) -invisible(dev.off()) - -##====================================================== -##====================================================== -## Saving -##====================================================== -##====================================================== - -# Data matrix -write.table(data_matrix,file=argLs$dataMatrix, quote=FALSE, row.names=TRUE, sep="\t", col.names=TRUE) - -# Sample metadata -write.table(data_sample,file=argLs$sampleMetadata, quote=FALSE, row.names=TRUE, sep="\t", col.names=TRUE) - -# log file -# write.table(t(data.frame(argLs)), file = argLs$logOut, col.names = FALSE, quote=FALSE) - -# input arguments -cat("\n INPUT and OUTPUT ARGUMENTS :\n") - -argLs - -## Ending - -cat("\nEnd of 'ReadFids' Galaxy module call: ", as.character(Sys.time()), sep = "") - -sink() - - -options(stringsAsFactors = strAsFacL) - -rm(list = ls()) \ No newline at end of file |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 ReadFids_xml.xml --- a/ReadFids_xml.xml Wed Mar 28 08:05:12 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,211 +0,0 @@ -<tool id="NMR_Read" name="NMR_Read" version="@WRAPPER_VERSION@"> - <description> Read Bruker NMR raw files</description> - - <macros> - <import>macros.xml</import> - </macros> - - <expand macro="requirements" /> - - <expand macro="stdio"/> - - <command> - ## Wrapper - Rscript $__tool_directory__/ReadFids_wrapper.R - - ## File input - fidzipfile $fidzipfile - - ## Title line - title_line $title_line - - ## Subdirectories - subdirectories $subdirectories - - ## Use subdirectories names as FID names? - dirs_names $dirs_names - - ## Outputs - dataMatrix $dataMatrix - sampleMetadata $sampleMetadata - logOut $logOut - graphOut $graphOut - - </command> - - <inputs> - <param name="fidzipfile" type="data" format="no_unzip.zip" label="Bruker FID file" /> - <param name="title_line" label="Specify the line in the title file to recover the FID names (usually in pdata/1/title)" type="integer" value="1" size="100" help="Default value is line 1"/> - - <param name="subdirectories" label="Presence of subdirectories?" type="select" help="Select 'FALSE' when there is no subdirectories, 'TRUE' if there are subdirectories"> - <option value="FALSE"> FALSE </option> - <option value="TRUE"> TRUE </option> - </param> - - <param name="dirs_names" label="Use (sub)directories names as FID names?" type="select" help="Select 'TRUE' to use the subdirectories names as the FID names (instead of looking in the title file)"> - <option value="FALSE"> FALSE </option> - <option value="TRUE"> TRUE </option> - </param> - </inputs> - - <outputs> - <data format="tabular" name="dataMatrix" label="${tool.name}_dataMatrix" /> - <data format="tabular" name="sampleMetadata" label="${tool.name}_sampleMetadata" /> - <data format="txt" name="logOut" label="${tool.name}_log" /> - <data format="pdf" name="graphOut" label="${tool.name}_graph" /> - </outputs> - - - <tests> - <test> - <param name="fidzipfile" value="MTBLS1.zip" ftype="zip" /> - <param name="title_line" value="1" /> - <param name="subdirectories" value="TRUE" /> - <param name="dirs_names" value="TRUE" /> - - <output name="dataMatrix" value="NMR_ReadFids_dataMatrix.tabular" /> - </test> - </tests> - - <help> - -@HELP_AUTHORS@ - - -============= -NMR Read -============= - ------------ -Description ------------ - -Nuclear Magnetic Resonance Bruker files reading (from the PEPS-NMR R package (https://github.com/ManonMartin/PEPSNMR)) - ------------------ -Workflow position ------------------ - -**Upstream tools** - -========================= ================= ======= -Name output file format -========================= ================= ======= -NA NA NA -========================= ================= ======= - - -**Downstream tools** - -+-----------------------+--------------------------+--------+ -| Name | Output file | Format | -+=======================+==========================+========+ -|NMR_Preprocessing | dataMatrix | Tabular| -+-----------------------+--------------------------+--------+ -|NMR_Preprocessing | sampleMetadata | Tabular| -+-----------------------+--------------------------+--------+ -|NMR_Preprocessing | NMR_Read_log | TXT | -+-----------------------+--------------------------+--------+ -|NMR_Preprocessing | NMR_Read_graph | PDF | -+-----------------------+--------------------------+--------+ -|NMR_Alignement | dataMatrix | Tabular| -+-----------------------+--------------------------+--------+ -|NMR_Bucketing | dataMatrix | Tabular| -+-----------------------+--------------------------+--------+ -|Normalization | dataMatrix | Tabular| -+-----------------------+--------------------------+--------+ -|Univariate | variableMetadata | Tabular| -+-----------------------+--------------------------+--------+ -|Multivariate | sampleMetadata | Tabular| -+-----------------------+--------------------------+--------+ -| | variableMetadata | Tabular| -+-----------------------+--------------------------+--------+ - - ------------ -Input files ------------ - -+---------------------------+-----------------+ -| Parameter : num + label | Format | -+===========================+=================+ -| 1 : Choose your inputs | zip | -+---------------------------+-----------------+ - - -**Choose your inputs** - - | Zip file (recommended) of FID Bruker files: you can put a zip file containing your FID Bruker files: myinputs.zip. - - ----------- -Parameters ----------- - -FID Title line - | Line in the acqus file to find the FID title (name) - | - -subdirectories - | Organization of individual's files - | TRUE: will search inside subdirectories for FIDs and will merge them to have unique FID and info matrices. - | - -dirs_names - | Use the (sub)directories names as FID names? - | - - ------------- -Output files ------------- - -NMR_Read_dataMatrix - | tabular output - | Data matrix with n rows (samples) and p columns (time) containing the raw FIDs. - | - -NMR_Read_sampleMetadata - | tabular output - | Data matrix with n rows (samples) containing the acquisition parameters for each sample. - | - -NMR_Read_log - | Text output - | Contains warnings - | - - -NMR_Read_graph - | pdf output - | line plots of FID - | - - -Creating the zip file ------------------------ - -.. class:: warningmark you must use the 7Zip software (http://www.7-zip.org/) to zip under Windows. - -Must contain at least the following files for every sample: fid, acqu and acqus - -.. image:: ./static/images/ReadFids.png - - - -**Possible structure and parameters values:** - - -(1) use title file and presence of sub-directories: set the FID Title line, subdirectories = TRUE, dirs_names = FALSE -(2) use title file and no sub-directories: set the FID Title line, subdirectories = FALSE, dirs_names = FALSE -(3) don't use title file and presence of sub-directories: subdirectories = TRUE, dirs_names = TRUE -(4) don't use title file and no sub-directories: subdirectories = FALSE, dirs_names = TRUE - - -@HELP_CHANGELOG@ - - </help> - - <expand macro="citation" /> - -</tool> |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 macros.xml --- a/macros.xml Wed Mar 28 08:05:12 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,71 +0,0 @@ -<?xml version="1.0"?> -<macros> - <token name="@WRAPPER_VERSION@">3.2.0</token> - - <xml name="requirements"> - <requirements> - <requirement type="package" version="1.1_4">r-batch</requirement> - <requirement type="package" version="2.2.1">r-ggplot2</requirement> - <requirement type="package" version="2.3">r-gridextra</requirement> - <requirement type="package" version="1.4.3">r-reshape2</requirement> - <yield /> - </requirements> - </xml> - - <xml name="stdio"> - <stdio> - <exit_code range="1" level="fatal" /> - </stdio> - </xml> - - - <token name="@HELP_AUTHORS@"> -.. class:: infomark - -**Authors** Manon Martin (manon.martin@uclouvain.be) and Marie Tremblay-Franco (marie.tremblay-franco@inra.fr; Galaxy integration) - -.. class:: infomark - -| Contact support@workflow4metabolomics.org for any questions or concerns about the Galaxy implementation of this tool. - ---------------------------------------------------- - - </token> - - <token name="@HELP_CHANGELOG@"> - ---------------------------------------------------- - -Changelog/News --------------- -**Version 3.2.0** - -* Updated R scripts and the help section of NMR_ReadFids and NMR_preprocessing -* Added sections -* Created a variableMetadata file in output of the NMR_preprocessing module -* Homogenised the input-output file names with the other modules -* Suppressed the option ptw for the baseline correction, set to TRUE all the time now -* Shift referencing: other values than 0 are admitted -* The log file recovers the input/output parameters -* Added an exclusion zone for the computation of the Baseline Correction criterion -* Switched Internal Referencing (goes second) and Zero Order Phase Correction (goes first) - -**Version 3.1.0** - -* Implementation of NMR_ReadFids and NMR_preprocessing - - </token> - - <xml name="citation"> - <citations> - <citation type="bibtex">@PhDThesis{Rousseau2011, - title = {Statistical contribution to the analysis of metabonomics data in $^1$H NMR spectroscopy}, - author = {Rousseau, R.}, - school = {Institut de Statistique, Biostatistique et Sciences Actuarielles, Universit{\'e} catholique de Louvain}, - year = {2011}} - </citation> - <citation type="doi">10.1093/bioinformatics/btu813</citation> - </citations> - </xml> - -</macros> |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/.shed.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/.shed.yml Wed Apr 11 05:32:23 2018 -0400 |
[ |
@@ -0,0 +1,7 @@ +categories: [Metabolomics] +description: '[Metabolomics][W4M][NMR] NMR Preprocessing - Preprocessing of 1D NMR spectra from FID to baseline correction' +homepage_url: http://workflow4metabolomics.org +long_description: 'Part of the W4M project: http://workflow4metabolomics.org' +name: nmr_preprocessing +owner: marie-tremblay-metatoul +remote_repository_url: https://github.com/workflow4metabolomics/nmr_preprocessing |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/Apodization_wrapper_Manon.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/Apodization_wrapper_Manon.R Wed Apr 11 05:32:23 2018 -0400 |
[ |
@@ -0,0 +1,187 @@ +#!/usr/local/public/bin/Rscript --vanilla --slave --no-site-file + +## 12012017_Apodization_wrapper.R +## Manon Martin +## manon.martin@uclouvain.be + + +#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# Use of runExampleL ? +#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +runExampleL <- FALSE +# +# if(runExampleL) { +# ##------------------------------ +# ## Example of arguments +# ##------------------------------ +# argLs <- list(StudyDir = "Tlse_BPASourisCerveau", +# upper = "10.0", +# lower = "0.50", +# bucket.width = "0.01", +# exclusion = "TRUE", +# exclusion.zone = list(c(6.5,4.5)), +# graph="Overlay") +# +# argLs <- c(argLs, +# list(dataMatrixOut = paste(directory,"_NmrBucketing_dataMatrix.tsv",sep=""), +# sampleMetadataOut = paste(directory,"_NmrBucketing_sampleMetadata.tsv",sep=""), +# variableMetadataOut = paste(directory,"_NmrBucketing_variableMetadata.tsv",sep=""), +# graphOut = paste(directory,"_NmrBucketing_graph.pdf",sep=""), +# logOut = paste(directory,"_NmrBucketing_log.txt",sep=""))) +# } + + + +##------------------------------ +## Options +##------------------------------ +strAsFacL <- options()$stringsAsFactors +#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# stringsAsFactors = FALSE utilis?? o?? ?? +#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +options(stringsAsFactors = FALSE) + + + + +##------------------------------ +## Libraries loading +##------------------------------ +# For parseCommandArgs function +library(batch) + +# R script call +source_local <- function(fname) +{ + argv <- commandArgs(trailingOnly = FALSE) + base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)) + source(paste(base_dir, fname, sep="/")) +} +#Import the different functions +source_local("Apodization_Manon.R") + +##------------------------------ +## Errors ????????????????????? +##------------------------------ + + +##------------------------------ +## Constants +##------------------------------ +#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# interviennent ou ? +#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +topEnvC <- environment() +flagC <- "\n" + + +##------------------------------ +## Script +##------------------------------ +if(!runExampleL) + argLs <- parseCommandArgs(evaluate=FALSE) # If FALSE valeurs par d??faut d??finies dans le software + + +## Parameters Loading +##------------------- +## Inputs +# data + +# --- Galaxy_preformatted data +# data <- read.table(argLs[["dataMatrix"]],check.names=FALSE,header=TRUE,sep="\t") +# rownames(data) <- data[,1] +# data <- data[,-1] +# --- + +# --- data from ReadFids +Fid_data <- read.table(argLs[["dataMatrixOut"]],check.names=FALSE,header=TRUE,sep="\t") +Fid_info <- read.table(argLs[["sampleOut"]],check.names=FALSE,header=TRUE,sep="\t") +# --- + +# other inputs (cf. XML wrapper) +DT = argLs[["DT"]] +type.apod = argLs[["ApodizationMethod"]] + +# set default values for optional arguments +phase=0 +rectRatio=1/2 +gaussLB=1 +expLB=1 + +# change the default values +if (type.apod %in% c("cos2", "hanning", "hamming")) { + phase = argLs[["phase"]] +} + +if (type.apod == "blockexp") { + rectRatio = argLs[["rectRatio"]] + expLB = argLs[["expLB"]] +} + +if (type.apod == "blockcos2") { + rectRatio = argLs[["rectRatio"]] +} + +if (type.apod == "gauss") { +gaussLB = argLs[["gaussLB"]] +} + +if (type.apod == "exp") { + expLB = argLs[["expLB"]] +} + +plotWindow = FALSE +returnFactor = FALSE + + + +#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# Utility of Outputs ?? +#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# Outputs +dataMatrixOut <- argLs[["dataMatrixOut"]] # Names from Saving + + + +## Checking arguments +##------------------- +error.stock <- "\n" + +#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +# error.stock utilis?? ou ? +#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +if(length(error.stock) > 1) + stop(error.stock) + + +## Computation +##------------ +outputs <- Apodization(Fid_data = Fid_data, Fid_info = Fid_info, DT = DT, + type.apod = type.apod, phase = phase, rectRatio = rectRatio, + gaussLB = gaussLB, expLB = expLB, plotWindow = plotWindow, returnFactor = returnFactor) + +data_matrix <- outputs # Data matrix + + + +## Saving +##------- +# Data matrix +data_matrix <- cbind(rownames(data_matrix),data_matrix) +colnames(data_matrix) <- c("Sample",colnames(data_matrix)[-1]) +write.table(data_matrix,file=argLs$dataMatrixOut,quote=FALSE,row.names=FALSE,sep="\t") + + + +## Ending +##--------------------- + +cat("\nEnd of 'Apodization' Galaxy module call: ", as.character(Sys.time()), sep = "") + +## sink(NULL) + +options(stringsAsFactors = strAsFacL) + +rm(list = ls()) \ No newline at end of file |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/DrawFunctions.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/DrawFunctions.R Wed Apr 11 05:32:23 2018 -0400 |
[ |
b'@@ -0,0 +1,268 @@\n+require(ggplot2)\r\n+require(gridExtra)\r\n+require(reshape2)\r\n+\r\n+\r\n+Draw <- function(Signal_data, type.draw = c("signal", "pca"), output = c("default", \r\n+ "window", "png", "pdf"), dirpath = ".", filename = "%003d", height = 480, \r\n+ width = 640, pdf.onefile = TRUE, ...) {\r\n+ \r\n+ # Data initialisation and checks ----------------------------------------------\r\n+ type.draw <- match.arg(type.draw)\r\n+ output <- match.arg(output)\r\n+ fullpath <- paste(file.path(dirpath, filename), output, sep = ".")\r\n+ createFile <- TRUE\r\n+ createWindow <- FALSE\r\n+ \r\n+ # Drawing --------------------------------------------------------------------\r\n+ # output\r\n+ switch(output, default = {\r\n+ createFile <- FALSE\r\n+ }, window = {\r\n+ createWindow <- TRUE\r\n+ createFile <- FALSE\r\n+ }, png = {\r\n+ grDevices::png(fullpath, width, height)\r\n+ }, pdf = {\r\n+ grDevices::pdf(fullpath, width = width/72, height = height/72, \r\n+ onefile = pdf.onefile)\r\n+ }, {\r\n+ stop("Unknown output type.")\r\n+ })\r\n+ \r\n+ # Drawing type (signal/spectrum or PCA)\r\n+ funs <- list(signal = DrawSignal, pca = DrawPCA)\r\n+ if (type.draw %in% names(funs)) {\r\n+ fun <- funs[[type.draw]]\r\n+ } else {\r\n+ stop(paste("Unknown type:", type.draw))\r\n+ }\r\n+ \r\n+ # Plot finalisation ----------------------------------------------\r\n+ if (is.vector(Signal_data)) {\r\n+ Signal_data <- vec2mat(Signal_data)\r\n+ }\r\n+ fun(Signal_data, createWindow = createWindow, ...)\r\n+ if (createFile) {\r\n+ grDevices::dev.off()\r\n+ }\r\n+}\r\n+\r\n+\r\n+\r\n+##### DrawSignal\r\n+\r\n+DrawSignal <- function(Signal_data, subtype = c("stacked", "together", \r\n+ "separate", "diffmean", "diffmedian", "diffwith"), \r\n+ ReImModArg = c(TRUE, FALSE, FALSE, FALSE), vertical = T, \r\n+ xlab = "rowname", RowNames = NULL, row = 1, num.stacked = 4, \r\n+ main = NULL, createWindow) {\r\n+ # nticks\r\n+ \r\n+ # Data initialisation and checks ----------------------------------------------\r\n+ \r\n+ subtype <- match.arg(subtype)\r\n+ vec <- is.vector(Signal_data)\r\n+ if (vec) {\r\n+ Signal_data <- vec2mat(Signal_data)\r\n+ }\r\n+ \r\n+ n <- nrow(Signal_data)\r\n+ m <- ncol(Signal_data)\r\n+ \r\n+ if (n < num.stacked){\r\n+ num.stacked <- n\r\n+ }\r\n+ \r\n+ scale <- colnames(Signal_data)\r\n+ \r\n+ num.plot <- sum(ReImModArg)\r\n+ \r\n+ Var <- rowname <- value <- NULL # only for R CMD check\r\n+ \r\n+ # Drawing array\r\n+ if (num.plot <= 0) {\r\n+ stop("Nothing selected in ReImModArg.")\r\n+ } else if (num.plot <= 2) {\r\n+ if (vertical) {\r\n+ nrow <- num.plot\r\n+ ncol <- 1\r\n+ } else {\r\n+ nrow <- 1\r\n+ ncol <- num.plot\r\n+ }\r\n+ } else {\r\n+ nrow <- 2\r\n+ ncol <- 2\r\n+ }\r\n+ \r\n+ # RowNames \r\n+ if (is.null(RowNames)) {\r\n+ RowNames <- rownames(Signal_data)\r\n+ if (is.null(RowNames)) {\r\n+ RowNames <- 1:n\r\n+ }\r\n+ } else {\r\n+ if (!is.vector(RowNames)) {\r\n+ stop("RowNames is not a vector")\r\n+ }\r\n+ if (length(RowNames) != n) {\r\n+ stop(paste("RowNames has length", length(RowNames), "and there are", n, "FIDs."))\r\n+ }\r\n+ }\r\n+ \r\n+ if (n == 1) {\r\n+ RowNames <- deparse(substitute(Signal_data))\r\n+ }\r\n+ \r\n+ elements <- list()\r\n+ if (ReImModArg[1]) {\r\n+ elements[["Re"]] <- Re(Signal_data)\r\n+ rownames(elements[["Re"]]) <- RowNames\r\n+ }\r\n+ if (ReImModArg[2]) {\r\n+ elements[["Im"]] <- Im(Signal_data)\r\n+ rownames(elements[["Im"]]) <- RowNames\r\n+ }\r\n+ if (ReImModArg[3]) {\r\n+ elements[["Mod"]] <- Mod(Signal_data)\r\n+ rownames(elements[["Mod"]]) <- RowNames\r\n+ }\r\n+ if (ReImModArg[4]) {\r\n+ elements[["Arg"]] <- Arg(Signal_data)\r\n+ rownames(elements[["Arg"]]) <- RowNames\r\n+ }\r\n+ \r\n+ \r\n+ \r\n+ \r\n+ # Drawing --------------------------------------------------------------------\r\n+ \r\n+ y = x = NULL # only for R CMD '..b'<- ggplot2::ggplot(data = df, ggplot2::aes(x = x, y = y)) + \r\n+ ggplot2::geom_line(size = 1) + \r\n+ ggplot2::theme(legend.position = "none") + \r\n+ ggplot2::labs(x = xlab, y = name) +\r\n+ ggplot2::ggtitle(RowNames[i]) +\r\n+ ggplot2::theme_bw()\r\n+ \r\n+ if ((df[1, "x"] - df[(dim(df)[1]), "x"]) > 0) {\r\n+ plots[[name]] <- plots[[name]] + ggplot2::scale_x_reverse()\r\n+ }\r\n+ \r\n+ } else {\r\n+ \r\n+ if (n == 1 ) {\r\n+ melted <- data.frame(rowname = rep(name, m), \r\n+ Var = as.numeric(scale), value = elements[[name]][i,])\r\n+ } else if (last==i){ \r\n+ melted <- data.frame(rowname = rep(rownames(elements[[name]])[i], m), \r\n+ Var = as.numeric(scale), value = elements[[name]][i,])\r\n+ } else {melted <- reshape2::melt(elements[[name]][i:last, ], \r\n+ varnames = c("rowname", "Var"))\r\n+ }\r\n+ \r\n+ \r\n+ plots[[name]] <- ggplot2::ggplot(data = melted, ggplot2::aes(x = Var, y = value)) + \r\n+ ggplot2::geom_line(size = 0.3) + \r\n+ ggplot2::facet_grid(rowname ~ ., scales = "free_y") + \r\n+ ggplot2::theme(legend.position = "none") + \r\n+ ggplot2::labs(x = xlab, y = name) +\r\n+ ggplot2::ggtitle(label = main) +\r\n+ ggplot2::theme_bw()\r\n+ \r\n+ if ((melted[1, "Var"] - melted[(dim(melted)[1]), "Var"]) > 0) {\r\n+ plots[[name]] <- plots[[name]] + ggplot2::scale_x_reverse()\r\n+ }\r\n+ }\r\n+ }\r\n+ \r\n+ if (subtype == "stacked") {\r\n+ do.call(gridExtra::grid.arrange, c(plots, list(nrow = nrow, ncol = ncol)))\r\n+ } \r\n+ \r\n+ i <- last + 1\r\n+ }\r\n+ } else if (subtype %in% c("together", "diffmean", "diffmedian", "diffwith")) {\r\n+ \r\n+ # TOGHETER or DIFFMEAN or DIFFMEDIAN or DIFFWITH ===============\r\n+ \r\n+ rainbow_colors <- grDevices::rainbow(n)\r\n+ \r\n+ if (createWindow) {\r\n+ grDevices::dev.new(noRStudioGD = TRUE)\r\n+ }\r\n+ graphics::par(mfrow = c(nrow, ncol))\r\n+ \r\n+ plots <- list()\r\n+ \r\n+ # Loop for Re, Im, Mod and Arg\r\n+ for (name in names(elements)) {\r\n+ # Get this part of the signal\r\n+ element <- elements[[name]]\r\n+ \r\n+ # Express the signal according to a reference if asked by `subtype\'\r\n+ if (subtype == "diffmean") {\r\n+ element <- sweep(element, MARGIN = 2, colMeans(element), `-`)\r\n+ } else if (subtype == "diffmedian") {\r\n+ element <- sweep(element, MARGIN = 2, matrixStats::colMedians(element), `-`)\r\n+ } else if (subtype == "diffwith") {\r\n+ element <- sweep(element, MARGIN = 2, element[row, ], `-`)\r\n+ if (row == 1 & n > 1) {\r\n+ # Since we use plot on the first row and lines on the following, the y\r\n+ # scale is calculated at the first row so if the first row is all 0, it\r\n+ # causes problems\r\n+ tmp <- element[1, ]\r\n+ element[1, ] <- element[2, ]\r\n+ element[2, ] <- tmp\r\n+ }\r\n+ }\r\n+ \r\n+ \r\n+ melted <- reshape2::melt(elements[[name]], varnames = c("rowname", "Var"))\r\n+ \r\n+ \r\n+ plots[[name]] <- ggplot2::ggplot(melted, ggplot2::aes(x = Var, \r\n+ y = value, group = rowname, colour = rowname)) + ggplot2::geom_line() + \r\n+ ggplot2::labs(x = xlab, y = name) + ggplot2::scale_colour_discrete(name = NULL) + \r\n+ ggplot2::ggtitle(main)\r\n+ \r\n+ if ((melted[1, "Var"] - melted[(dim(melted)[1]), "Var"]) > \r\n+ 0) {\r\n+ plots[[name]] <- plots[[name]] + ggplot2::scale_x_reverse()\r\n+ }\r\n+ \r\n+ do.call(gridExtra::grid.arrange, c(plots, list(nrow = nrow, \r\n+ ncol = ncol)))\r\n+ }\r\n+ }\r\n+ \r\n+ \r\n+}\r\n' |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/Int_Funct.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/Int_Funct.R Wed Apr 11 05:32:23 2018 -0400 |
[ |
@@ -0,0 +1,236 @@ +beginTreatment <- function(name, Signal_data = NULL, Signal_info = NULL, + force.real = FALSE) { + + cat("Begin", name, "\n") + + + # Formatting the Signal_data and Signal_info ----------------------- + + vec <- is.vector(Signal_data) + if (vec) { + Signal_data <- vec2mat(Signal_data) + } + if (is.vector(Signal_info)) { + Signal_info <- vec2mat(Signal_info) + } + if (!is.null(Signal_data)) { + if (!is.matrix(Signal_data)) { + stop("Signal_data is not a matrix.") + } + if (!is.complex(Signal_data) && !is.numeric(Signal_data)) { + stop("Signal_data contains non-numerical values.") + } + } + if (!is.null(Signal_info) && !is.matrix(Signal_info)) { + stop("Signal_info is not a matrix.") + } + + + Original_data <- Signal_data + + # Extract the real part of the spectrum --------------------------- + + if (force.real) { + if (is.complex(Signal_data)) { + Signal_data <- Re(Signal_data) + } else { + # The signal is numeric Im(Signal_data) is zero anyway so let's avoid + # using complex(real=...,imaginary=0) which would give a complex signal + # in endTreatment() + force.real <- FALSE + } + } + + + # Return the formatted data and metadata entries -------------------- + + return(list(start = proc.time(), vec = vec, force.real = force.real, + Original_data = Original_data, Signal_data = Signal_data, Signal_info = Signal_info)) +} + +binarySearch <- function(a, target, lower = TRUE) { + # search the index i in a such that a[i] == target + # if it doesn't exists and lower, it searches the closer a[i] such that a[i] < target + # if !lower, it seraches the closer a[i] such that a[i] > target + # a should be monotone but can be increasing or decreasing + + # if a is increasing INVARIANT: a[amin] < target < a[amax] + N <- length(a) + if ((a[N] - target) * (a[N] - a[1]) <= 0) { + return(N) + } + if ((a[1] - target) * (a[N] - a[1]) >= 0) { + return(1) + } + amin <- 1 + amax <- N + while (amin + 1 < amax) { + amid <- floor((amin + amax)/2) + if ((a[amid] - target) * (a[amax] - a[amid]) < 0) { + amin <- amid + } else if ((a[amid] - target) * (a[amax] - a[amid]) > 0) { + amax <- amid + } else { + # a[amid] == a[amax] or a[amid] == target In both cases, a[amid] == + # target + return(amid) + } + } + if (xor(lower, a[amin] > a[amax])) { + # (lower && a[amin] < a[amax]) || (!lower && a[min] > a[max]) + # If increasing and we want the lower, we take amin + # If decreasing and we want the bigger, we take amin too + return(amin) + } else { + return(amax) + } +} + +checkArg <- function(arg, checks, can.be.null=FALSE) { + check.list <- list(bool=c(is.logical, "a boolean"), + int =c(function(x){x%%1==0}, "an integer"), + num =c(is.numeric, "a numeric"), + str =c(is.character, "a string"), + pos =c(function(x){x>0}, "positive"), + pos0=c(function(x){x>=0}, "positive or zero"), + l1 =c(function(x){length(x)==1}, "of length 1") + ) + if (is.null(arg)) { + if (!can.be.null) { + stop(deparse(substitute(arg)), " is null.") + } + } else { + if (is.matrix(arg)) { + stop(deparse(substitute(arg)), " is not scalar.") + } + for (c in checks) { + if (!check.list[[c]][[1]](arg)) { + stop(deparse(substitute(arg)), " is not ", check.list[[c]][[2]], ".") + } + } + } +} + +endTreatment <- function(name, begin_info, Signal_data) { + + # begin_info: object outputted from beginTreatment + + + # Formatting the entries and printing process time ----------------------- + end_time <- proc.time() # record it as soon as possible + start_time <- begin_info[["start"]] + delta_time <- end_time - start_time + delta <- delta_time[] + cat("End", name, "\n") + cat("It lasted", round(delta["user.self"], 3), "s user time,", round(delta["sys.self"],3), + "s system time and", round(delta["elapsed"], 3), "s elapsed time.\n") + + + if (begin_info[["force.real"]]) { + # The imaginary part is left untouched + i <- complex(real = 0, imaginary = 1) + Signal_data <- Signal_data + i * Im(begin_info[["Original_data"]]) + } + + if (begin_info[["vec"]]) { + Signal_data <- Signal_data[1, ] + } + + # Return the formatted data and metadata entries -------------------- + return(Signal_data) +} + +Interpol <- function(t, y) { + # y: sample + # t : warping function + + m <- length(y) + # t <= m-1 + # because if t > m-1, y[ti+1] will be NA when we compute g + valid <- 1 <= t & t <= m-1 # FIXME it was '<' in Bubble v2 + s <- (1:m)[valid] + ti <- floor(t[s]) + tr <- t[s] - ti + g <- y[ti + 1] - y[ti] + f <- y[ti] + tr * g + list(f=f, s=s, g=g) +} + +vec2mat <- function(vec) { + + return(matrix(vec, nrow = 1, dimnames = list(c(1), names(vec)))) + +} + +getArg <- function(arg, info, argname, can.be.absent=FALSE) { + if (is.null(arg)) { + start <- paste("impossible to get argument", argname, "it was not given directly and"); + if (!is.matrix(info)) { + stop(paste(start, "the info matrix was not given")) + } + if (!(argname %in% colnames(info))) { + if (can.be.absent) { + return(NULL) + } else { + stop(paste(start, "is not in the info matrix")) + } + } + if (nrow(info) < 1) { + stop(paste(start, "the info matrix has no row")) + } + arg <- info[1,argname] + if (is.na(arg)) { + stop(paste(start, "it is NA in the info matrix")) + } + } + return(arg) +} + +binarySearch <- function(a, target, lower = TRUE) { + # search the index i in a such that a[i] == target + # if it doesn't exists and lower, it searches the closer a[i] such that a[i] < target + # if !lower, it seraches the closer a[i] such that a[i] > target + # a should be monotone but can be increasing or decreasing + + # if a is increasing INVARIANT: a[amin] < target < a[amax] + N <- length(a) + if ((a[N] - target) * (a[N] - a[1]) <= 0) { + return(N) + } + if ((a[1] - target) * (a[N] - a[1]) >= 0) { + return(1) + } + amin <- 1 + amax <- N + while (amin + 1 < amax) { + amid <- floor((amin + amax)/2) + if ((a[amid] - target) * (a[amax] - a[amid]) < 0) { + amin <- amid + } else if ((a[amid] - target) * (a[amax] - a[amid]) > 0) { + amax <- amid + } else { + # a[amid] == a[amax] or a[amid] == target In both cases, a[amid] == + # target + return(amid) + } + } + if (xor(lower, a[amin] > a[amax])) { + # (lower && a[amin] < a[amax]) || (!lower && a[min] > a[max]) + # If increasing and we want the lower, we take amin + # If decreasing and we want the bigger, we take amin too + return(amin) + } else { + return(amax) + } +} + +# returns the discrete borders of the interval for a numeric vector a + +indexInterval <- function (a, from, to, inclusive=TRUE) { + # If inclusive and from <= to, we need to take the lower + # If not inclusive and from > to, we need to take the lower too + lowerFrom <- xor(inclusive, from > to) + fromIndex <- binarySearch(a, from, lowerFrom) + toIndex <- binarySearch(a, to, !lowerFrom) + return(fromIndex:toIndex) +} |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/NmrPreprocessing_script.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/NmrPreprocessing_script.R Wed Apr 11 05:32:23 2018 -0400 |
[ |
b'@@ -0,0 +1,1214 @@\n+## ==========================\r\n+# Internal functions\r\n+## ==========================\r\n+\r\n+# beginTreatment \r\n+beginTreatment <- function(name, Signal_data = NULL, Signal_info = NULL, \r\n+ force.real = FALSE) {\r\n+ \r\n+ cat("Begin", name, "\\n")\r\n+ \r\n+ \r\n+ # Formatting the Signal_data and Signal_info -----------------------\r\n+ \r\n+ vec <- is.vector(Signal_data)\r\n+ if (vec) {\r\n+ Signal_data <- vec2mat(Signal_data)\r\n+ }\r\n+ if (is.vector(Signal_info)) {\r\n+ Signal_info <- vec2mat(Signal_info)\r\n+ }\r\n+ if (!is.null(Signal_data)) {\r\n+ if (!is.matrix(Signal_data)) {\r\n+ stop("Signal_data is not a matrix.")\r\n+ }\r\n+ if (!is.complex(Signal_data) && !is.numeric(Signal_data)) {\r\n+ stop("Signal_data contains non-numerical values.")\r\n+ }\r\n+ }\r\n+ if (!is.null(Signal_info) && !is.matrix(Signal_info)) {\r\n+ stop("Signal_info is not a matrix.")\r\n+ }\r\n+ \r\n+ \r\n+ Original_data <- Signal_data\r\n+ \r\n+ # Extract the real part of the spectrum ---------------------------\r\n+ \r\n+ if (force.real) {\r\n+ if (is.complex(Signal_data)) {\r\n+ Signal_data <- Re(Signal_data)\r\n+ } else {\r\n+ # The signal is numeric Im(Signal_data) is zero anyway so let\'s avoid\r\n+ # using complex(real=...,imaginary=0) which would give a complex signal\r\n+ # in endTreatment()\r\n+ force.real <- FALSE\r\n+ }\r\n+ }\r\n+ \r\n+ \r\n+ # Return the formatted data and metadata entries --------------------\r\n+ \r\n+ return(list(start = proc.time(), vec = vec, force.real = force.real, \r\n+ Original_data = Original_data, Signal_data = Signal_data, Signal_info = Signal_info))\r\n+}\r\n+\r\n+# endTreatment \r\n+endTreatment <- function(name, begin_info, Signal_data) {\r\n+ \r\n+ # begin_info: object outputted from beginTreatment\r\n+ \r\n+ \r\n+ # Formatting the entries and printing process time -----------------------\r\n+ end_time <- proc.time() # record it as soon as possible\r\n+ start_time <- begin_info[["start"]]\r\n+ delta_time <- end_time - start_time\r\n+ delta <- delta_time[]\r\n+ cat("End", name, "\\n")\r\n+ cat("It lasted", round(delta["user.self"], 3), "s user time,", round(delta["sys.self"],3),\r\n+ "s system time and", round(delta["elapsed"], 3), "s elapsed time.\\n")\r\n+ \r\n+ \r\n+ if (begin_info[["force.real"]]) {\r\n+ # The imaginary part is left untouched\r\n+ i <- complex(real = 0, imaginary = 1)\r\n+ Signal_data <- Signal_data + i * Im(begin_info[["Original_data"]])\r\n+ }\r\n+ \r\n+ if (begin_info[["vec"]]) {\r\n+ Signal_data <- Signal_data[1, ]\r\n+ }\r\n+ \r\n+ # Return the formatted data and metadata entries --------------------\r\n+ return(Signal_data)\r\n+}\r\n+\r\n+# checkArg \r\n+checkArg <- function(arg, checks, can.be.null=FALSE) {\r\n+ check.list <- list(bool=c(is.logical, "a boolean"),\r\n+ int =c(function(x){x%%1==0}, "an integer"),\r\n+ num =c(is.numeric, "a numeric"),\r\n+ str =c(is.character, "a string"),\r\n+ pos =c(function(x){x>0}, "positive"),\r\n+ pos0=c(function(x){x>=0}, "positive or zero"),\r\n+ l1 =c(function(x){length(x)==1}, "of length 1")\r\n+ )\r\n+ if (is.null(arg)) {\r\n+ if (!can.be.null) {\r\n+ stop(deparse(substitute(arg)), " is null.")\r\n+ }\r\n+ } else {\r\n+ if (is.matrix(arg)) {\r\n+ stop(deparse(substitute(arg)), " is not scalar.")\r\n+ }\r\n+ for (c in checks) {\r\n+ if (!check.list[[c]][[1]](arg)) {\r\n+ stop(deparse(substitute(arg)), " is not ", check.list[[c]][[2]], ".")\r\n+ }\r\n+ }\r\n+ }\r\n+}\r\n+\r\n+# getArg \r\n+getArg <- function(arg, info, argname, can.be.absent=FALSE) {\r\n+ if (is.null(arg)) {\r\n+ start <- paste("impossible to get argument", argname, "it was not given directly and");\r\n+ if (!is.matrix(info)) {\r\n+ stop(paste(start, "the info matrix was not given"))\r\n+ }\r\n+ if (!(argname %in% colnames(info))) {\r\n+ if (can.be.absent) {\r\n+ return(NULL)\r\n+ } else {\r\n+ stop(pas'..b'else {\r\n+ colindex <- 1:m\r\n+ }\r\n+ \r\n+ Int <- vector("list", length(exclude.bc))\r\n+ for (i in 1:length(exclude.bc)) {\r\n+ Int[[i]] <- indexInterval(colindex, from = exclude.bc[[i]][1], \r\n+ to = exclude.bc[[i]][2], inclusive = TRUE)\r\n+ }\r\n+ exclude_index <- unlist(Int)\r\n+ }\r\n+ \r\n+ # Baseline Correction implementation definition ----------------------\r\n+ \r\n+ # 2 Ways: either use the function asysm from the ptw package or by \r\n+ # built-in functions \r\n+ if (ptw.bc) {\r\n+ asysm <- ptw::asysm\r\n+ } else {\r\n+ difsmw <- function(y, lambda, w, d) {\r\n+ # Weighted smoothing with a finite difference penalty cf Eilers, 2003.\r\n+ # (A perfect smoother) \r\n+ # y: signal to be smoothed \r\n+ # lambda: smoothing parameter \r\n+ # w: weights (use0 zeros for missing values) \r\n+ # d: order of differences in penalty (generally 2)\r\n+ m <- length(y)\r\n+ W <- Matrix::Diagonal(x=w)\r\n+ E <- Matrix::Diagonal(m)\r\n+ D <- Matrix::diff(E, differences = d)\r\n+ C <- Matrix::chol(W + lambda * t(D) %*% D)\r\n+ x <- Matrix::solve(C, Matrix::solve(t(C), w * y))\r\n+ return(as.numeric(x))\r\n+ \r\n+ }\r\n+ asysm <- function(y, lambda, p, eps, exclude_index) {\r\n+ # Baseline estimation with asymmetric least squares\r\n+ # y: signal\r\n+ # lambda: smoothing parameter (generally 1e5 to 1e8)\r\n+ # p: asymmetry parameter (generally 0.001)\r\n+ # d: order of differences in penalty (generally 2)\r\n+ # eps: 1e-8 in ptw package\r\n+ m <- length(y)\r\n+ w <- rep(1, m)\r\n+ i <- 1\r\n+ repeat {\r\n+ z <- difsmw(y, lambda, w, d = 2)\r\n+ w0 <- w\r\n+ p_vect <- rep((1-p), m) # if y <= z + eps\r\n+ p_vect[y > z + eps | y < 0] <- p # if y > z + eps | y < 0\r\n+ if(!is.null(exclude_index)){\r\n+ p_vect[exclude_index] <- 0 # if exclude area\r\n+ }\r\n+ \r\n+ w <- p_vect \r\n+ # w <- p * (y > z + eps | y < 0) + (1 - p) * (y <= z + eps)\r\n+ \r\n+ if (sum(abs(w - w0)) == 0) {\r\n+ break\r\n+ }\r\n+ i <- i + 1\r\n+ if (i > maxIter) {\r\n+ warning("cannot find Baseline estimation in asysm")\r\n+ break\r\n+ }\r\n+ }\r\n+ return(z)\r\n+ }\r\n+ }\r\n+ \r\n+ # Baseline estimation ----------------------------------------------\r\n+ Baseline <- matrix(NA, nrow = nrow(Spectrum_data), ncol = ncol(Spectrum_data))\r\n+ \r\n+ # for (k in 1:n) {\r\n+ # Baseline[k, ] <- asysm(y = Spectrum_data[k, ], lambda = lambda, p = p, eps = eps)\r\n+ \r\n+ if (ptw.bc ){\r\n+ Baseline <- apply(Spectrum_data,1, asysm, lambda = lambda, p = p, \r\n+ eps = eps)\r\n+ }else {\r\n+ Baseline <- apply(Spectrum_data,1, asysm, lambda = lambda, p = p, \r\n+ eps = eps, exclude_index = exclude_index)\r\n+ }\r\n+ \r\n+ \r\n+ Spectrum_data <- Spectrum_data - t(Baseline)\r\n+ # }\r\n+ \r\n+ # Data finalisation ----------------------------------------------\r\n+ Spectrum_data <- endTreatment("BaselineCorrection", begin_info, Spectrum_data) # FIXME create removeImaginary filter ??\r\n+ \r\n+ if (returnBaseline) {\r\n+ return(list(Spectrum_data = Spectrum_data, Baseline = Baseline))\r\n+ } else {\r\n+ return(Spectrum_data)\r\n+ }\r\n+}\r\n+\r\n+\r\n+\r\n+## ====================================================\r\n+# NegativeValuesZeroing \r\n+## ====================================================\r\n+\r\n+NegativeValuesZeroing <- function(Spectrum_data) {\r\n+ # Data initialisation and checks ----------------------------------------------\r\n+ begin_info <- beginTreatment("NegativeValuesZeroing", Spectrum_data, force.real = T)\r\n+ Spectrum_data <- begin_info[["Signal_data"]]\r\n+ \r\n+ # NegativeValuesZeroing ----------------------------------------------\r\n+ Spectrum_data[Spectrum_data < 0] <- 0\r\n+ \r\n+ # Data finalisation ----------------------------------------------\r\n+ return(endTreatment("NegativeValuesZeroing", begin_info, Spectrum_data))\r\n+}\r\n+\r\n+\r\n' |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/NmrPreprocessing_wrapper.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/NmrPreprocessing_wrapper.R Wed Apr 11 05:32:23 2018 -0400 |
[ |
b'@@ -0,0 +1,411 @@\n+#!/usr/local/public/bin/Rscript --vanilla --slave --no-site-file\r\n+\r\n+## 170116_NmrPreprocessing.R\r\n+## Manon Martin and Marie Tremblay-Franco\r\n+\r\n+##======================================================\r\n+##======================================================\r\n+# Preamble\r\n+##======================================================\r\n+##======================================================\r\n+\r\n+runExampleL <- FALSE\r\n+\r\n+\r\n+##------------------------------\r\n+## Options\r\n+##------------------------------\r\n+strAsFacL <- options()$stringsAsFactors\r\n+options(stringsAsFactors = FALSE)\r\n+\r\n+##------------------------------\r\n+## Libraries laoding\r\n+##------------------------------\r\n+library(batch)\r\n+library(ptw)\r\n+library(Matrix)\r\n+library(ggplot2)\r\n+library(gridExtra)\r\n+library(reshape2)\r\n+\r\n+\r\n+# R script call\r\n+source_local <- function(fname)\r\n+{\r\n+\targv <- commandArgs(trailingOnly = FALSE)\r\n+\tbase_dir <- dirname(substring(argv[grep("--file=", argv)], 8))\r\n+\tsource(paste(base_dir, fname, sep="/"))\r\n+}\r\n+#Import the different functions\r\n+source_local("NmrPreprocessing_script.R")\r\n+source_local("DrawFunctions.R")\r\n+\r\n+##------------------------------\r\n+## Script\r\n+##------------------------------\r\n+runExampleL <- FALSE\r\n+\r\n+\r\n+if(!runExampleL)\r\n+ argLs <- parseCommandArgs(evaluate=FALSE)\r\n+\r\n+sink(argLs$logOut)\r\n+\r\n+\r\n+##------------------------------\r\n+## Errors ?????????????????????\r\n+##------------------------------\r\n+\r\n+\r\n+##------------------------------\r\n+## Constants\r\n+##------------------------------\r\n+topEnvC <- environment()\r\n+flagC <- "\\n"\r\n+\r\n+\r\n+\r\n+\r\n+# log file\r\n+# print(argLs[["logOut"]])\r\n+\r\n+## Starting\r\n+cat("\\nStart of \'Preprocessing\' Galaxy module call: ", as.character(Sys.time()), "\\n", sep = "")\r\n+\r\n+\r\n+##======================================================\r\n+##======================================================\r\n+## Parameters Loading\r\n+##======================================================\r\n+##======================================================\r\n+\r\n+# graphical inputs\r\n+FirstOPCGraph <- argLs[["FirstOPCGraph"]]\r\n+SSGraph <- argLs[["SSGraph"]]\r\n+ApodGraph <- argLs[["ApodGraph"]]\r\n+FTGraph <- argLs[["FTGraph"]]\r\n+SRGraph <- argLs[["SRGraph"]]\r\n+ZeroOPCGraph <- argLs[["ZeroOPCGraph"]]\r\n+BCGraph <- argLs[["BCGraph"]]\r\n+FinalGraph <- argLs[["FinalGraph"]]\r\n+\r\n+\r\n+# 1rst order phase correction ------------------------\r\n+ # Inputs\r\n+\t## Data matrix\r\n+Fid_data0 <- read.table(argLs[["dataMatrixFid"]],header=TRUE, check.names=FALSE, sep=\'\\t\')\r\n+# Fid_data0 <- Fid_data0[,-1]\r\n+Fid_data0 <- as.matrix(Fid_data0)\r\n+\r\n+\t## Samplemetadata\r\n+samplemetadataFid <- read.table(argLs[["sampleMetadataFid"]],check.names=FALSE,header=TRUE,sep="\\t")\r\n+samplemetadataFid <- as.matrix(samplemetadataFid)\r\n+\r\n+\r\n+# water and solvent(s) correction ------------------------\r\n+ # Inputs\r\n+lambda <- argLs[["lambda"]]\r\n+\r\n+\r\n+\r\n+# apodization -----------------------------------------\r\n+ # Inputs\r\n+phase=0\r\n+rectRatio=1/2\r\n+gaussLB=1\r\n+expLB=1\r\n+apodization <- argLs[["apodizationMethod"]]\r\n+\r\n+if (apodization==\'exp\'){\r\n+ expLB <- argLs[["expLB"]]\r\n+ } else if (apodization==\'cos2\'){\r\n+ phase <- argLs[["phase"]]\r\n+ } else if (apodization==\'hanning\'){\r\n+ phase <- argLs[["phase"]]\r\n+ } else if (apodization==\'hamming\'){\r\n+ phase <- argLs[["phase"]]\r\n+ } else if (apodization==\'blockexp\'){\r\n+ rectRatio <- argLs[["rectRatio"]]\r\n+ expLB <- argLs[["expLB"]]\r\n+ } else if (apodization==\'blockcos2\'){\r\n+ rectRatio <- argLs[["rectRatio"]]\r\n+ } else if (apodization==\'gauss\'){\r\n+ rectRatio <- argLs[["rectRatio"]]\r\n+ gaussLB <- argLs[["gaussLB"]]\r\n+ }\t\t\r\n+\r\n+\r\n+# Fourier transform ----------------------------------\r\n+ # Inputs\r\n+\r\n+\r\n+# Internal referencering ----------------------------------\r\n+ # Inputs\r\n+shiftTreshold = 2 # c\r\n+ppm = TRUE\r\n+shiftReferencingRangeList = NULL # fromto.RC\r\n+pctNearValue = 0.02 # pc \r\n+rowindex_graph = NULL\r\n+ppm_ref = 0 # ppm.ref\r\n+\r\n+# \r\n+# shiftReferencing <- argLs[["shiftRefe'..b'type = "stacked",\r\n+ ReImModArg = c(TRUE, FALSE, FALSE, FALSE), vertical = T, \r\n+ xlab = "Frequency", num.stacked = 4, \r\n+ main = title, createWindow=FALSE)\r\n+}\r\n+\r\n+\r\n+\r\n+# ZeroOrderPhaseCorrection ---------------------------------\r\n+Spectrum_data <- ZeroOrderPhaseCorrection(Spectrum_data, type.zopc = zeroOrderPhaseMethod,\r\n+ plot_rms = NULL, returnAngle = FALSE,\r\n+ createWindow = TRUE,angle = angle,\r\n+ plot_spectra = FALSE,\r\n+ ppm.zopc = TRUE, exclude.zopc = excludeZOPC)\r\n+\r\n+\r\n+# InternalReferencing ---------------------------------\r\n+# if (shiftReferencing=="YES") {\r\n+Spectrum_data <- InternalReferencing(Spectrum_data, samplemetadataFid, method = "max", range = shiftReferencingRange,\r\n+ ppm.value = ppmvalue, shiftHandling = shiftHandling, ppm.ir = TRUE,\r\n+ fromto.RC = shiftReferencingRangeList, pc = pctNearValue)\r\n+\r\n+if (SRGraph == "YES") {\r\n+ title = "Spectra after Shift Referencing"\r\n+ DrawSignal(Spectrum_data, subtype = "stacked",\r\n+ ReImModArg = c(TRUE, FALSE, FALSE, FALSE), vertical = T, \r\n+ xlab = "Frequency", num.stacked = 4, \r\n+ main = title, createWindow=FALSE)\r\n+}\r\n+\r\n+# }\r\n+\r\n+if (ZeroOPCGraph == "YES") {\r\n+title = "Spectra after Zero Order Phase Correction"\r\n+DrawSignal(Spectrum_data, subtype = "stacked",\r\n+ ReImModArg = c(TRUE, FALSE, FALSE, FALSE), vertical = T, \r\n+ xlab = "Frequency", num.stacked = 4, \r\n+ main = title, createWindow=FALSE)\r\n+}\r\n+\r\n+\r\n+# BaselineCorrection ---------------------------------\t\t\t\t\t\t\t\t\t \r\n+Spectrum_data <- BaselineCorrection(Spectrum_data, ptw.bc = TRUE, lambda.bc = lambdaBc, \r\n+ p.bc = pBc, eps = epsilon, ppm.bc = TRUE, \r\n+ exclude.bc = excludeBC,\r\n+ returnBaseline = F) \r\n+\r\n+\r\n+\r\n+if (BCGraph == "YES") {\r\n+title = "Spectra after Baseline Correction"\r\n+DrawSignal(Spectrum_data, subtype = "stacked",\r\n+ ReImModArg = c(TRUE, FALSE, FALSE, FALSE), vertical = T, \r\n+ xlab = "Frequency", num.stacked = 4, \r\n+ main = title, createWindow=FALSE)\r\n+}\r\n+\r\n+\r\n+# NegativeValuesZeroing ---------------------------------\r\n+if (NegativetoZero=="YES") {\r\n+ Spectrum_data <- NegativeValuesZeroing(Spectrum_data)\r\n+}\r\n+\r\n+if (FinalGraph == "YES") {\r\n+ title = "Final preprocessed spectra"\r\n+ DrawSignal(Spectrum_data, subtype = "stacked",\r\n+ ReImModArg = c(TRUE, FALSE, FALSE, FALSE), vertical = T, \r\n+ xlab = "Frequency", num.stacked = 4, \r\n+ main = title, createWindow=FALSE)\r\n+}\r\n+\r\n+invisible(dev.off())\r\n+\r\n+\r\n+data_variable <- matrix(NA, nrow = 1, ncol = dim(Spectrum_data)[2], dimnames = list("ID", NULL)) \r\n+colnames(data_variable) <- colnames(Spectrum_data)\r\n+data_variable[1,] <- colnames(data_variable)\r\n+\r\n+\r\n+##======================================================\r\n+##======================================================\r\n+## Saving\r\n+##======================================================\r\n+##======================================================\r\n+\r\n+# Data Matrix\r\n+write.table(round(t(Re(Spectrum_data)),6), file=argLs$dataMatrix, quote=FALSE, row.names=TRUE, sep="\\t", col.names=TRUE)\r\n+\r\n+# Variable metadata\r\n+write.table(data_variable,file=argLs$variableMetadata, quote=FALSE, row.names=TRUE, sep="\\t", col.names=TRUE)\r\n+\r\n+# log file\r\n+# write.table(t(data.frame(argLs)), file = argLs$logOut, col.names = FALSE, quote=FALSE)\r\n+\r\n+# input arguments\r\n+cat("\\n INPUT and OUTPUT ARGUMENTS :\\n")\r\n+\r\n+argLs\r\n+\r\n+\r\n+## Ending\r\n+\r\n+cat("\\nEnd of \'Preprocessing\' Galaxy module call: ", as.character(Sys.time()), sep = "")\r\n+\r\n+sink()\r\n+\r\n+options(stringsAsFactors = strAsFacL)\r\n+\r\n+rm(list = ls())\r\n' |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/NmrPreprocessing_xml.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/NmrPreprocessing_xml.xml Wed Apr 11 05:32:23 2018 -0400 |
b |
b'@@ -0,0 +1,575 @@\n+<tool id="NMR_Preprocessing" name="NMR_Preprocessing" version="@WRAPPER_VERSION@">\r\n+ <description> Preprocessing of 1D NMR spectra </description>\r\n+\r\n+ <macros>\r\n+ <import>macros.xml</import>\r\n+ </macros>\r\n+\r\n+ <expand macro="requirements">\r\n+ <requirement type="package" version="1.9_12">r-ptw</requirement>\r\n+ <requirement type="package" version="1.2_12">r-matrix</requirement>\r\n+ </expand>\r\n+\r\n+ <expand macro="stdio"/>\r\n+\r\n+ <command>\r\n+ ## Wrapper\r\n+ Rscript $__tool_directory__/NmrPreprocessing_wrapper.R\r\n+\r\n+ ## Data matrix of FID spectra\r\n+ dataMatrixFid $dataMatrixFid\r\n+ ## Sample metadata matrix\r\n+ sampleMetadataFid $sampleMetadataFid\r\n+\r\n+ ## First order phase correction\r\n+ ## Graphical display\r\n+ FirstOPCGraph $GDC.FirstOPCGraph\r\n+\r\n+ ## Water and / or solvents suppression\r\n+ ## Smoothing parameter\r\n+ lambda $SS.lambda\r\n+\r\n+ ## Graphical display\r\n+ SSGraph $SS.SSGraph\r\n+\r\n+\r\n+ ## Apodization\r\n+ ## Graphical display\r\n+ ApodGraph $Apod.ApodGraph\r\n+\r\n+ apodizationMethod $Apod.apodizationMethod.method\r\n+ #if $Apod.apodizationMethod.method == "exp":\r\n+ ## Line broadening for the exponential window\r\n+ expLB $Apod.apodizationMethod.expLB\r\n+ #end if\r\n+ #if $Apod.apodizationMethod.method == "cos2":\r\n+ ## Phase\r\n+ phase $Apod.apodizationMethod.phase\r\n+ #end if\r\n+ #if $Apod.apodizationMethod.method == "hanning":\r\n+ ## Phase\r\n+ phase $Apod.apodizationMethod.phase\r\n+ #end if\r\n+ #if $Apod.apodizationMethod.method == "hamming":\r\n+ ## Phase\r\n+ phase $Apod.apodizationMethod.phase\r\n+ #end if\r\n+ #if $Apod.apodizationMethod.method == "blockexp":\r\n+ ## Proportion of signal in the window\r\n+ rectRatio $Apod.apodizationMethod.rectRatio\r\n+ expLB $Apod.apodizationMethod.expLB\r\n+ #end if\r\n+ #if $Apod.apodizationMethod.method == "blockcos2":\r\n+ ## Proportion of signal in the window\r\n+ rectRatio $Apod.apodizationMethod.rectRatio\r\n+ #end if\r\n+ #if $Apod.apodizationMethod.method == "gauss":\r\n+ ## Line broadening for the gaussian window\r\n+ gaussLB $Apod.apodizationMethod.gaussLB\r\n+ #end if\r\n+\r\n+ ## Fourier transform\r\n+ ## Graphical display\r\n+ FTGraph $FT.FTGraph\r\n+\r\n+ ## Zero order phase correction\r\n+ ## Graphical display\r\n+ ZeroOPCGraph $ZOPC.ZeroOPCGraph\r\n+\r\n+ zeroOrderPhaseMethod $ZOPC.zeroOrderPhaseMethod\r\n+\r\n+ excludeZoneZeroPhase.choice ${ZOPC.excludeZoneZeroPhase.choice}\r\n+ #if str($ZOPC.excludeZoneZeroPhase.choice) == "YES":\r\n+ #for $i in $ZOPC.excludeZoneZeroPhase.conditions:\r\n+ excludeZoneZeroPhase_left ${i.excludeZoneZeroPhase_left}\r\n+ excludeZoneZeroPhase_right ${i.excludeZoneZeroPhase_right}\r\n+ #end for\r\n+ #end if\r\n+\r\n+ ## Shift referencing\r\n+ ## Graphical display\r\n+ SRGraph $SR.SRGraph\r\n+\r\n+ ## Definition of the search zone\r\n+ shiftReferencingRange $SR.shiftReferencingRange.method\r\n+ #if $SR.shiftReferencingRange.method == "nearvalue":\r\n+ pctNearValue $SR.shiftReferencingRange.pctNearValue\r\n+ #end if\r\n+ #if $SR.shiftReferencingRange.method == "window":\r\n+ #for $i in $SR.shiftReferencingRange.conditions:\r\n+ shiftReferencingRangeLeft ${i.shiftReferencingRangeLeft}\r\n+ shiftReferencingRangeRight ${i.shiftReferencingRangeRight}\r\n+ #end for\r\n+ #end if\r\n+ shiftHandling $SR.shiftHandling\r\n+ ppmvalue $SR.ppmvalue\r\n+\r\n+ ## Baseline correction\r\n+ ## Graphical display\r\n+ BCGraph $BC.BCGraph\r\n+\r\n+ lambdaBc $BC.lambda'..b'\n+\r\n+**Apodization**\r\n+----------------------\r\n+\r\n+The **types of apodization** are:\r\n+\r\n+* exp: The signal is multiplied by a decreasing exponential exp(-t/LineBroadening).\r\n+\r\n+* cos2: The signal is multiplied by the value of a cosinus squared from 0 (where its value is 1) until pi/2 (where its value is 0).\r\n+\r\n+* blockexp: The first part of the signal (described by the proportion of signal in the window) is left unchanged and the second is multiplied by exp(-t/LineBroadening) starting at value 1.\r\n+\r\n+* blockcos2: The first part is left unchanged as with blockexp and the second part is multiplied by a cosinus squared where its value starts at 1 at the end of the block and ends at 0 at the end of the signal.\r\n+\r\n+* gauss: The signal is multiplied by a gaussian window centered at the beginning of the FID and with sigma=1/LineBroadening.\r\n+\r\n+* hanning: The signal is multiplied by a hanning window : 0.5 + 0.5 cos.\r\n+\r\n+* hamming: The signal is multiplied by a hamming window : 0.54 + 0.46 cos.\r\n+\r\n+\r\n+\r\n+\r\n+**Zero Order Phase Correction**\r\n+-----------------------------------\r\n+\r\n+**Zero Order Phase correction method**:\r\n+\r\n+* rms: A positiveness criterion is applied on the spectrum with a quantile probability parameter to trim the values.\r\n+\r\n+* max: Optimization of the maximal spectral intensity.\r\n+\r\n+\r\n+**Exclusion area(s) for the Zero Order Phase Correction**: enables to optimize the criterion with excluded spectral window(s), by default the water region is excluded.\r\n+\r\n+\r\n+**Shift Referencing**\r\n+----------------------\r\n+\r\n+The **searching window** can be adapted:\r\n+\r\n+* nearvalue: the search concentrates around the value of the reference peak in ppm.\r\n+\r\n+* all: search accross the whole ppm axis.\r\n+\r\n+* window: the search is operated in the windows defined by the Search_zone bounds.\r\n+\r\n+\r\n+**shiftHandling**: spectra can be shifted differently, we can handle misalignment of the left and right of the spectrum by different ways:\r\n+\r\n+* zerofilling: The extremities at which a spectrum is not defined are replaced by 0. It makes sense since in practice the spectrum is close to zero at the extremities.\r\n+\r\n+* NAfilling: The extremities at which a spectrum is not defined are replaced by NA.\r\n+\r\n+* circular: The spectra are shifted circularly which means that the end of a spectrum is reproduced at the beginning.\r\n+\r\n+* cut: The ppm values for which some spectra are not defined are removed.\r\n+\r\n+\r\n+**value of the reference peak**: the value in ppm of the reference peak. By default the value is 0 ppm.\r\n+\r\n+\r\n+\r\n+**Baseline Correction**\r\n+----------------------------\r\n+\r\n+**Smoothing parameter**: the larger it is, the smoother the estimated baseline will be.\r\n+\r\n+**Asymmetry parameter**: the smaller it is, the less the estimated baseline will try to follow peaks when it is under the spectrum and the more it will try to be under the spectrum.\r\n+\r\n+**numerical precision**: numerical precision for convergence when estimating the baseline.\r\n+\r\n+**Exclusion area(s) for the Baseline Correction**: enables to optimize the criterion with excluded spectral window(s), by default the water region is excluded.\r\n+\r\n+\r\n+\r\n+**Negative intensities to Zero**\r\n+------------------------------------\r\n+\r\n+**Set negative intensities to zero**: the set of negative intensities to zero is optional.\r\n+\r\n+\r\n+------------\r\n+Output files\r\n+------------\r\n+\r\n+NMR_Preprocessing_dataMatrix\r\n+ | tabular output\r\n+ | Data matrix with n rows (descriptors) and p columns (samples) containing the preprocessed spectra.\r\n+ |\r\n+\r\n+NMR_Preprocessing_variableMetadata\r\n+ | tabular output\r\n+ | Data matrix with 1 row (ppm value) and p columns (descriptors).\r\n+ |\r\n+\r\n+NMR_Preprocessing_log\r\n+ | text output\r\n+ | Contains warnings and the input parameters\r\n+ |\r\n+\r\n+NMR_Preprocessing_graph.pdf\r\n+ | pdf output\r\n+ | line plots of preprocessed spectra\r\n+ |\r\n+\r\n+\r\n+@HELP_CHANGELOG@\r\n+\r\n+ </help>\r\n+\r\n+ <expand macro="citation" />\r\n+\r\n+</tool>\r\n' |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/README.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/README.rst Wed Apr 11 05:32:23 2018 -0400 |
b |
@@ -0,0 +1,19 @@ + +Changelog/News +-------------- +**Version 3.2.0** + +* Updated R scripts and the help section of NMR_ReadFids and NMR_preprocessing +* Added sections +* Created a variableMetadata file in output of the NMR_preprocessing module +* Homogenised the input-output file names with the other modules +* Suppressed the option ptw for the baseline correction, set to TRUE all the time now +* Shift referencing: other values than 0 are admitted +* The log file recovers the input/output parameters +* Added an exclusion zone for the computation of the Baseline Correction criterion +* Switched Internal Referencing (goes second) and Zero Order Phase Correction (goes first) + + +**Version 3.1.0** + +* Implementation of NMR_ReadFids and NMR_preprocessing |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/ReadFids.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/ReadFids.R Wed Apr 11 05:32:23 2018 -0400 |
[ |
b'@@ -0,0 +1,382 @@\n+################################################################################################\r\n+#\r\n+# Read FIDs in Bruker format\r\n+#\r\n+#\r\n+################################################################################################\r\n+\r\n+# ReadFid ==============================================================================\r\n+ReadFid <- function(path) {\r\n+ \r\n+ # Read 1D FID using Bruker XWinNMR and TopSpin format. It is inspired of the\r\n+ # matNMR matlab library which deals with 2D FID and also other formats\r\n+ # Read also the parameters in the acqus file\r\n+ \r\n+ paramFile <- file.path(path, "acqus")\r\n+ # BYTEORDA: 0 -> Little Endian 1 -> Big Endian\r\n+ params <- readParams(paramFile, c("TD", "BYTORDA", "DIGMOD", "DECIM", "DSPFVS", \r\n+ "SW_h", "SW", "O1"))\r\n+ \r\n+ if (params[["DSPFVS"]] >= 20) {\r\n+ # The group delay first order phase correction is given directly from version 20\r\n+ grpdly <- readParams(paramFile, c("GRPDLY"))\r\n+ params[["GRPDLY"]] <- grpdly[["GRPDLY"]]\r\n+ }\r\n+ TD <- params[["TD"]]\r\n+ endianness <- if (params$BYTORDA) \r\n+ "big" else "little"\r\n+ if (TD%%2 != 0) {\r\n+ stop(paste("Only even numbers are allowed for size in TD because it is complex \r\n+ data with the real and imaginary part for each element.", \r\n+ "The TD value is in the", paramFile, "file"))\r\n+ }\r\n+ \r\n+ # Interpret params Dwell Time, time between 2 data points in the FID\r\n+ params[["DT"]] <- 1/(2 * params[["SW_h"]])\r\n+ \r\n+ # Read fid\r\n+ fidFile <- file.path(path, "fid")\r\n+ fidOnDisk <- readBin(fidFile, what = "int", n = TD, size = 4L, endian = endianness)\r\n+ \r\n+ # Real size that is on disk (it should be equal to TD2, except for TopSpin/Bruker\r\n+ # (which is our case) according to matNMR as just discussed\r\n+ TDOnDisk <- length(fidOnDisk)\r\n+ if (TDOnDisk < TD) {\r\n+ warning("Size is smaller than expected, the rest is filled with zero so the size is the same for every fid")\r\n+ fidGoodSize <- sapply(vector("list", length = TD), function(x) 0)\r\n+ fidGoodSize[1:TDOnDisk] <- fidOnDisk\r\n+ \r\n+ } else if (TDOnDisk > TD) {\r\n+ warning("Size is bigger than expected, the rest ignored so the size is the same for every fid")\r\n+ fidGoodSize <- fidOnDisk(1:TD)\r\n+ \r\n+ } else {\r\n+ fidGoodSize <- fidOnDisk\r\n+ }\r\n+ \r\n+ fidRePart <- fidGoodSize[seq(from = 1, to = TD, by = 2)]\r\n+ fidImPart <- fidGoodSize[seq(from = 2, to = TD, by = 2)]\r\n+ fid <- complex(real = fidRePart, imaginary = fidImPart)\r\n+ \r\n+ return(list(fid = fid, params = params))\r\n+}\r\n+\r\n+\r\n+\r\n+\r\n+# getDirsContainingFid ==============================================================================\r\n+getDirsContainingFid <- function(path) {\r\n+ subdirs <- dir(path, full.names = TRUE)\r\n+ if (length(subdirs) > 0) {\r\n+ cond <- sapply(subdirs, function(x) {\r\n+ content <- dir(x)\r\n+ # subdirs must contain fid, acqu and acqus files\r\n+ return("fid" %in% content && "acqu" %in% content && "acqus" %in% content)\r\n+ })\r\n+ subdirs <- subdirs[cond]\r\n+ }\r\n+ return(subdirs)\r\n+}\r\n+\r\n+\r\n+\r\n+\r\n+\r\n+\r\n+# beginTreatment ==============================================================================\r\n+\r\n+beginTreatment <- function(name, Signal_data = NULL, Signal_info = NULL, \r\n+ force.real = FALSE) {\r\n+ \r\n+ cat("Begin", name, "\\n")\r\n+ \r\n+ \r\n+ # Formatting the Signal_data and Signal_info -----------------------\r\n+ \r\n+ vec <- is.vector(Signal_data)\r\n+ if (vec) {\r\n+ Signal_data <- vec2mat(Signal_data)\r\n+ }\r\n+ if (is.vector(Signal_info)) {\r\n+ Signal_info <- vec2mat(Signal_info)\r\n+ }\r\n+ if (!is.null(Signal_data)) {\r\n+ if (!is.matrix(Signal_data)) {\r\n+ stop("Signal_data is not a matrix.")\r\n+ }\r\n+ if (!is.complex(Signal_data) && !is.numeric(Signal_data)) {\r\n+ stop("Signal_data contains non-numerical values.")\r\n+ }\r\n+ }\r\n+ if (!is.null(Signal_info) && !is.matrix(Signal_info)) {\r\n+ stop("S'..b'ttern <- paste("\\\\$", paramName, "=", sep = "")\r\n+ occurences <- grep(pattern, lines)\r\n+ if (length(occurences) == 0L) {\r\n+ stop(paste(file, "has no field", pattern))\r\n+ }\r\n+ if (length(occurences) > 1L) {\r\n+ warning(paste(file, "has more that one field", pattern, " I take the first one"))\r\n+ }\r\n+ line <- lines[occurences[1]]\r\n+ \r\n+ # Cut beginning and end of the line \'##$TD= 65536\' -> \'65536\'\r\n+ igual = as.numeric(regexpr("=", line))\r\n+ \r\n+ first <- igual\r\n+ while (first <= nchar(line) & !isDigit(substr(line, first, first))) {\r\n+ first <- first + 1\r\n+ }\r\n+ last <- nchar(line)\r\n+ while (last > 0 & !isDigit(substr(line, last, last))) {\r\n+ last <- last - 1\r\n+ }\r\n+ params[paramName] <- as.numeric(substr(line, first, last))\r\n+ }\r\n+ return(params)\r\n+}\r\n+\r\n+\r\n+\r\n+# ReadFids ==============================================================================\r\n+ReadFids <- function(path, l = 1, subdirs = FALSE) {\r\n+ \r\n+ # Data initialisation and checks ----------------------------------------------\r\n+ begin_info <- beginTreatment("ReadFids")\r\n+ checkArg(path, c("str"))\r\n+ checkArg(l, c("pos"))\r\n+ if (file.exists(path) == FALSE) {\r\n+ stop(paste("Invalid path:", path))\r\n+ }\r\n+ \r\n+ \r\n+ # Extract the FIDs and their info ----------------------------------------------\r\n+ \r\n+ if (subdirs == FALSE) {\r\n+ fidDirs <- getDirsContainingFid(path)\r\n+ n <- length(fidDirs)\r\n+ if (n == 0L) {\r\n+ stop(paste("No valid fid in", path))\r\n+ }\r\n+ fidNames <- sapply(X = fidDirs, FUN = getTitle, l = l, subdirs = subdirs, USE.NAMES = F)\r\n+ for (i in 1:n) {\r\n+ fidList <- ReadFid(fidDirs[i])\r\n+ fid <- fidList[["fid"]]\r\n+ info <- fidList[["params"]]\r\n+ m <- length(fid)\r\n+ if (i == 1) {\r\n+ Fid_data <- matrix(nrow = n, ncol = m, dimnames = list(fidNames, \r\n+ info[["DT"]] * (0:(m - 1))))\r\n+ Fid_info <- matrix(nrow = n, ncol = length(info), dimnames = list(fidNames, \r\n+ names(info)))\r\n+ }\r\n+ Fid_data[i, ] <- fid\r\n+ Fid_info[i, ] <- unlist(info)\r\n+ }\r\n+ \r\n+ } else {\r\n+ maindirs <- dir(path, full.names = TRUE)\r\n+ Fid_data <- numeric()\r\n+ Fid_info <- numeric()\r\n+ \r\n+ fidDirs <- c()\r\n+ for (j in maindirs) {\r\n+ fd <- getDirsContainingFid(j)\r\n+ n <- length(fd)\r\n+ if (n > 0L) {\r\n+ fidDirs <- c(fidDirs, fd)\r\n+ } else {warning(paste("No valid fid in",j ))}\r\n+ }\r\n+ \r\n+ fidNames <- sapply(X = fidDirs, FUN = getTitle, l = l, subdirs = subdirs, USE.NAMES = F)\r\n+ for (i in 1:length(fidNames)) {\r\n+ fidList <- ReadFid(fidDirs[i])\r\n+ fid <- fidList[["fid"]]\r\n+ info <- fidList[["params"]]\r\n+ m <- length(fid)\r\n+ if (i == 1) {\r\n+ Fid_data <- matrix(nrow = length(fidNames), ncol = m, dimnames = list(fidNames, \r\n+ info[["DT"]] * (0:(m - 1))))\r\n+ Fid_info <- matrix(nrow = length(fidNames), ncol = length(info), dimnames = list(fidNames, \r\n+ names(info)))\r\n+ }\r\n+ Fid_data[i, ] <- fid\r\n+ Fid_info[i, ] <- unlist(info)\r\n+ }\r\n+ \r\n+ \r\n+ }\r\n+ \r\n+ # Check for non-unique IDs ----------------------------------------------\r\n+ NonnuniqueIds <- sum(duplicated(row.names(Fid_data)))\r\n+ cat("dim Fid_data: ", dim(Fid_data), "\\n")\r\n+ cat("IDs: ", rownames(Fid_data), "\\n")\r\n+ cat("non-unique IDs?", NonnuniqueIds, "\\n")\r\n+ if (NonnuniqueIds > 0) {\r\n+ warning("There are duplicated IDs: ", Fid_data[duplicated(Fid_data)])\r\n+ }\r\n+ \r\n+ \r\n+ # Return the results ----------------------------------------------\r\n+ return(list(Fid_data = endTreatment("ReadFids", begin_info, Fid_data), Fid_info = Fid_info))\r\n+ \r\n+}\r\n+\r\n+\r\n' |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/ReadFids_Manon.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/ReadFids_Manon.R Wed Apr 11 05:32:23 2018 -0400 |
[ |
b'@@ -0,0 +1,386 @@\n+################################################################################################\r\n+#\r\n+# Read FIDs in Bruker format\r\n+#\r\n+#\r\n+################################################################################################\r\n+\r\n+# ReadFid ==============================================================================\r\n+ReadFid <- function(path) {\r\n+ \r\n+ # Read 1D FID using Bruker XWinNMR and TopSpin format. It is inspired of the\r\n+ # matNMR matlab library which deals with 2D FID and also other formats\r\n+ # Read also the parameters in the acqus file\r\n+ \r\n+ paramFile <- file.path(path, "acqus")\r\n+ # BYTEORDA: 0 -> Little Endian 1 -> Big Endian\r\n+ params <- readParams(paramFile, c("TD", "BYTORDA", "DIGMOD", "DECIM", "DSPFVS", \r\n+ "SW_h", "SW", "O1"))\r\n+ \r\n+ if (params[["DSPFVS"]] >= 20) {\r\n+ # The group delay first order phase correction is given directly from version 20\r\n+ grpdly <- readParams(paramFile, c("GRPDLY"))\r\n+ params[["GRPDLY"]] <- grpdly[["GRPDLY"]]\r\n+ }\r\n+ TD <- params[["TD"]]\r\n+ endianness <- if (params$BYTORDA) \r\n+ "big" else "little"\r\n+ if (TD%%2 != 0) {\r\n+ stop(paste("Only even numbers are allowed for size in TD because it is complex \r\n+ data with the real and imaginary part for each element.", \r\n+ "The TD value is in the", paramFile, "file"))\r\n+ }\r\n+ \r\n+ # Interpret params Dwell Time, time between 2 data points in the FID\r\n+ params[["DT"]] <- 1/(2 * params[["SW_h"]])\r\n+ \r\n+ # Read fid\r\n+ fidFile <- file.path(path, "fid")\r\n+ fidOnDisk <- readBin(fidFile, what = "int", n = TD, size = 4L, endian = endianness)\r\n+ \r\n+ # Real size that is on disk (it should be equal to TD2, except for TopSpin/Bruker\r\n+ # (which is our case) according to matNMR as just discussed\r\n+ TDOnDisk <- length(fidOnDisk)\r\n+ if (TDOnDisk < TD) {\r\n+ warning("Size is smaller than expected, the rest is filled with zero so the size is the same for every fid")\r\n+ fidGoodSize <- sapply(vector("list", length = TD), function(x) 0)\r\n+ fidGoodSize[1:TDOnDisk] <- fidOnDisk\r\n+ \r\n+ } else if (TDOnDisk > TD) {\r\n+ warning("Size is bigger than expected, the rest ignored so the size is the same for every fid")\r\n+ fidGoodSize <- fidOnDisk(1:TD)\r\n+ \r\n+ } else {\r\n+ fidGoodSize <- fidOnDisk\r\n+ }\r\n+ \r\n+ fidRePart <- fidGoodSize[seq(from = 1, to = TD, by = 2)]\r\n+ fidImPart <- fidGoodSize[seq(from = 2, to = TD, by = 2)]\r\n+ fid <- complex(real = fidRePart, imaginary = fidImPart)\r\n+ \r\n+ return(list(fid = fid, params = params))\r\n+}\r\n+\r\n+\r\n+\r\n+\r\n+# getDirsContainingFid ==============================================================================\r\n+getDirsContainingFid <- function(path) {\r\n+ subdirs <- dir(path, full.names = TRUE)\r\n+ if (length(subdirs) > 0) {\r\n+ cond <- sapply(subdirs, function(x) {\r\n+ content <- dir(x)\r\n+ # subdirs must contain fid, acqu and acqus files\r\n+ return("fid" %in% content && "acqu" %in% content && "acqus" %in% content)\r\n+ })\r\n+ subdirs <- subdirs[cond]\r\n+ }\r\n+ return(subdirs)\r\n+}\r\n+\r\n+\r\n+\r\n+\r\n+\r\n+\r\n+# beginTreatment ==============================================================================\r\n+\r\n+beginTreatment <- function(name, Signal_data = NULL, Signal_info = NULL, \r\n+ force.real = FALSE) {\r\n+ \r\n+ cat("Begin", name, "\\n")\r\n+ \r\n+ \r\n+ # Formatting the Signal_data and Signal_info -----------------------\r\n+ \r\n+ vec <- is.vector(Signal_data)\r\n+ if (vec) {\r\n+ Signal_data <- vec2mat(Signal_data)\r\n+ }\r\n+ if (is.vector(Signal_info)) {\r\n+ Signal_info <- vec2mat(Signal_info)\r\n+ }\r\n+ if (!is.null(Signal_data)) {\r\n+ if (!is.matrix(Signal_data)) {\r\n+ stop("Signal_data is not a matrix.")\r\n+ }\r\n+ if (!is.complex(Signal_data) && !is.numeric(Signal_data)) {\r\n+ stop("Signal_data contains non-numerical values.")\r\n+ }\r\n+ }\r\n+ if (!is.null(Signal_info) && !is.matrix(Signal_info)) {\r\n+ stop("S'..b'as no field", pattern))\r\n+ }\r\n+ if (length(occurences) > 1L) {\r\n+ warning(paste(file, "has more that one field", pattern, " I take the first one"))\r\n+ }\r\n+ line <- lines[occurences[1]]\r\n+ \r\n+ # Cut beginning and end of the line \'##$TD= 65536\' -> \'65536\'\r\n+ igual = as.numeric(regexpr("=", line))\r\n+ \r\n+ first <- igual\r\n+ while (first <= nchar(line) & !isDigit(substr(line, first, first))) {\r\n+ first <- first + 1\r\n+ }\r\n+ last <- nchar(line)\r\n+ while (last > 0 & !isDigit(substr(line, last, last))) {\r\n+ last <- last - 1\r\n+ }\r\n+ params[paramName] <- as.numeric(substr(line, first, last))\r\n+ }\r\n+ return(params)\r\n+}\r\n+\r\n+\r\n+\r\n+# ReadFids ==============================================================================\r\n+ReadFids <- function(path, l = 1, subdirs = FALSE, subdirs.names = FALSE) {\r\n+\r\n+ # Data initialisation and checks ----------------------------------------------\r\n+ begin_info <- beginTreatment("ReadFids")\r\n+ checkArg(path, c("str"))\r\n+ checkArg(l, c("pos"))\r\n+ if (file.exists(path) == FALSE) {\r\n+ stop(paste("Invalid path:", path))\r\n+ }\r\n+ \r\n+ \r\n+ # Extract the FIDs and their info ----------------------------------------------\r\n+ \r\n+ if (subdirs == FALSE) {\r\n+ fidDirs <- getDirsContainingFid(path)\r\n+ n <- length(fidDirs)\r\n+ if (n == 0L) {\r\n+ stop(paste("No valid fid in", path))\r\n+ }\r\n+ fidNames <- sapply(X = fidDirs, FUN = getTitle, l = l, subdirs = subdirs, USE.NAMES = F)\r\n+ for (i in 1:n) {\r\n+ fidList <- ReadFid(fidDirs[i])\r\n+ fid <- fidList[["fid"]]\r\n+ info <- fidList[["params"]]\r\n+ m <- length(fid)\r\n+ if (i == 1) {\r\n+ Fid_data <- matrix(nrow = n, ncol = m, dimnames = list(fidNames, \r\n+ info[["DT"]] * (0:(m - 1))))\r\n+ Fid_info <- matrix(nrow = n, ncol = length(info), dimnames = list(fidNames, \r\n+ names(info)))\r\n+ }\r\n+ Fid_data[i, ] <- fid\r\n+ Fid_info[i, ] <- unlist(info)\r\n+ }\r\n+ \r\n+ } else {\r\n+ maindirs <- dir(path, full.names = TRUE) # subdirectories\r\n+ Fid_data <- numeric()\r\n+ Fid_info <- numeric()\r\n+ \r\n+ fidDirs <- c()\r\n+ for (j in maindirs) {\r\n+ fd <- getDirsContainingFid(j) # recoved FIDs from subdirectories\r\n+ n <- length(fd)\r\n+ if (n > 0L) {\r\n+ fidDirs <- c(fidDirs, fd)\r\n+ } else {warning(paste("No valid fid in",j ))}\r\n+ }\r\n+ \r\n+ if (subdirs.names==TRUE) {\r\n+ fidNames <- dir(path)\r\n+ } else {fidNames <- sapply(X = fidDirs, FUN = getTitle, l = l, subdirs = subdirs, USE.NAMES = F)}\r\n+ \r\n+ for (i in 1:length(fidNames)) {\r\n+ fidList <- ReadFid(fidDirs[i])\r\n+ fid <- fidList[["fid"]]\r\n+ info <- fidList[["params"]]\r\n+ m <- length(fid)\r\n+ if (i == 1) {\r\n+ Fid_data <- matrix(nrow = length(fidNames), ncol = m, dimnames = list(fidNames, \r\n+ info[["DT"]] * (0:(m - 1))))\r\n+ Fid_info <- matrix(nrow = length(fidNames), ncol = length(info), dimnames = list(fidNames, \r\n+ names(info)))\r\n+ }\r\n+ Fid_data[i, ] <- fid\r\n+ Fid_info[i, ] <- unlist(info)\r\n+ }\r\n+ \r\n+ \r\n+ }\r\n+ \r\n+ # Check for non-unique IDs ----------------------------------------------\r\n+ NonnuniqueIds <- sum(duplicated(row.names(Fid_data)))\r\n+ cat("dim Fid_data: ", dim(Fid_data), "\\n")\r\n+ cat("IDs: ", rownames(Fid_data), "\\n")\r\n+ cat("non-unique IDs?", NonnuniqueIds, "\\n")\r\n+ if (NonnuniqueIds > 0) {\r\n+ warning("There are duplicated IDs: ", Fid_data[duplicated(Fid_data)])\r\n+ }\r\n+ \r\n+ \r\n+ # Return the results ----------------------------------------------\r\n+ return(list(Fid_data = endTreatment("ReadFids", begin_info, Fid_data), Fid_info = Fid_info))\r\n+ \r\n+}\r\n+\r\n+\r\n+\r\n' |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/ReadFids_script.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/ReadFids_script.R Wed Apr 11 05:32:23 2018 -0400 |
[ |
b'@@ -0,0 +1,404 @@\n+################################################################################################\r\n+#\r\n+# Read FIDs in Bruker format\r\n+#\r\n+#\r\n+################################################################################################\r\n+\r\n+\r\n+# vec2mat ==============================================================================\r\n+vec2mat <- function(vec) {\r\n+ return(matrix(vec, nrow = 1, dimnames = list(c(1), names(vec)))) \r\n+}\r\n+\r\n+\r\n+# ReadFid ==============================================================================\r\n+ReadFid <- function(path) {\r\n+ \r\n+ # Read 1D FID using Bruker XWinNMR and TopSpin format. It is inspired of the\r\n+ # matNMR matlab library which deals with 2D FID and also other formats\r\n+ # Read also the parameters in the acqus file\r\n+ \r\n+ paramFile <- file.path(path, "acqus")\r\n+ # BYTEORDA: 0 -> Little Endian 1 -> Big Endian\r\n+ params <- readParams(paramFile, c("TD", "BYTORDA", "DIGMOD", "DECIM", "DSPFVS", \r\n+ "SW_h", "SW", "O1"))\r\n+ \r\n+ if (params[["DSPFVS"]] >= 20) {\r\n+ # The group delay first order phase correction is given directly from version 20\r\n+ grpdly <- readParams(paramFile, c("GRPDLY"))\r\n+ params[["GRPDLY"]] <- grpdly[["GRPDLY"]]\r\n+ }\r\n+ TD <- params[["TD"]]\r\n+ endianness <- if (params$BYTORDA) \r\n+ "big" else "little"\r\n+ if (TD%%2 != 0) {\r\n+ stop(paste("Only even numbers are allowed for size in TD because it is complex \r\n+ data with the real and imaginary part for each element.", \r\n+ "The TD value is in the", paramFile, "file"))\r\n+ }\r\n+ \r\n+ # Interpret params Dwell Time, time between 2 data points in the FID\r\n+ params[["DT"]] <- 1/(2 * params[["SW_h"]])\r\n+ \r\n+ # Read fid\r\n+ fidFile <- file.path(path, "fid")\r\n+ fidOnDisk <- readBin(fidFile, what = "int", n = TD, size = 4L, endian = endianness)\r\n+ \r\n+ # Real size that is on disk (it should be equal to TD2, except for TopSpin/Bruker\r\n+ # (which is our case) according to matNMR as just discussed\r\n+ TDOnDisk <- length(fidOnDisk)\r\n+ if (TDOnDisk < TD) {\r\n+ warning("Size is smaller than expected, the rest is filled with zero so the size is the same for every fid")\r\n+ fidGoodSize <- sapply(vector("list", length = TD), function(x) 0)\r\n+ fidGoodSize[1:TDOnDisk] <- fidOnDisk\r\n+ \r\n+ } else if (TDOnDisk > TD) {\r\n+ warning("Size is bigger than expected, the rest ignored so the size is the same for every fid")\r\n+ fidGoodSize <- fidOnDisk(1:TD)\r\n+ \r\n+ } else {\r\n+ fidGoodSize <- fidOnDisk\r\n+ }\r\n+ \r\n+ fidRePart <- fidGoodSize[seq(from = 1, to = TD, by = 2)]\r\n+ fidImPart <- fidGoodSize[seq(from = 2, to = TD, by = 2)]\r\n+ fid <- complex(real = fidRePart, imaginary = fidImPart)\r\n+ \r\n+ return(list(fid = fid, params = params))\r\n+}\r\n+\r\n+\r\n+\r\n+\r\n+# getDirsContainingFid ==============================================================================\r\n+getDirsContainingFid <- function(path) {\r\n+ subdirs <- dir(path, full.names = TRUE)\r\n+ if (length(subdirs) > 0) {\r\n+ cond <- sapply(subdirs, function(x) {\r\n+ content <- dir(x)\r\n+ # subdirs must contain fid, acqu and acqus files\r\n+ return("fid" %in% content && "acqu" %in% content && "acqus" %in% content)\r\n+ })\r\n+ subdirs <- subdirs[cond]\r\n+ }\r\n+ return(subdirs)\r\n+}\r\n+\r\n+\r\n+\r\n+\r\n+\r\n+\r\n+# beginTreatment ==============================================================================\r\n+\r\n+beginTreatment <- function(name, Signal_data = NULL, Signal_info = NULL, \r\n+ force.real = FALSE) {\r\n+ \r\n+ cat("Begin", name, "\\n")\r\n+ \r\n+ \r\n+ # Formatting the Signal_data and Signal_info -----------------------\r\n+ \r\n+ vec <- is.vector(Signal_data)\r\n+ if (vec) {\r\n+ Signal_data <- vec2mat(Signal_data)\r\n+ }\r\n+ if (is.vector(Signal_info)) {\r\n+ Signal_info <- vec2mat(Signal_info)\r\n+ }\r\n+ if (!is.null(Signal_data)) {\r\n+ if (!is.matrix(Signal_data)) {\r\n+ stop("Signal_data is not a matrix.")\r\n+ }\r\n+ if '..b'paramName] <- as.numeric(substr(line, first, last))\r\n+ }\r\n+ return(params)\r\n+}\r\n+\r\n+\r\n+\r\n+# ReadFids ==============================================================================\r\n+\r\n+ReadFids <- function(path, l = 1, subdirs = FALSE, dirs.names = FALSE) {\r\n+ \r\n+ # Data initialisation and checks ----------------------------------------------\r\n+ begin_info <- beginTreatment("ReadFids")\r\n+ checkArg(path, c("str"))\r\n+ checkArg(l, c("pos"))\r\n+ if (file.exists(path) == FALSE) {\r\n+ stop(paste("Invalid path:", path))\r\n+ }\r\n+ \r\n+ \r\n+ # Extract the FIDs and their info ----------------------------------------------\r\n+ \r\n+ if (subdirs == FALSE) {\r\n+ fidDirs <- getDirsContainingFid(path)\r\n+ n <- length(fidDirs)\r\n+ if (n == 0L) {\r\n+ stop(paste("No valid fid in", path))\r\n+ }\r\n+ if (dirs.names) {\r\n+ separator <- .Platform$file.sep\r\n+ path_elem <- strsplit(fidDirs,separator)\r\n+ fidNames <- sapply(path_elem, function(x) x[[length(path_elem[[1]])]])\r\n+ }else {fidNames <- sapply(X = fidDirs, FUN = getTitle, l = l, subdirs = subdirs, USE.NAMES = F)}\r\n+ \r\n+ for (i in 1:n) {\r\n+ fidList <- ReadFid(fidDirs[i])\r\n+ fid <- fidList[["fid"]]\r\n+ info <- fidList[["params"]]\r\n+ m <- length(fid)\r\n+ if (i == 1) {\r\n+ Fid_data <- matrix(nrow = n, ncol = m, dimnames = list(fidNames, \r\n+ info[["DT"]] * (0:(m - 1))))\r\n+ Fid_info <- matrix(nrow = n, ncol = length(info), dimnames = list(fidNames, \r\n+ names(info)))\r\n+ }\r\n+ Fid_data[i, ] <- fid\r\n+ Fid_info[i, ] <- unlist(info)\r\n+ }\r\n+ \r\n+ } else {\r\n+ maindirs <- dir(path, full.names = TRUE) # subdirectories\r\n+ Fid_data <- numeric()\r\n+ Fid_info <- numeric()\r\n+ \r\n+ fidDirs <- c()\r\n+ for (j in maindirs) {\r\n+ fd <- getDirsContainingFid(j) # recoved FIDs from subdirectories\r\n+ n <- length(fd)\r\n+ if (n > 0L) {\r\n+ fidDirs <- c(fidDirs, fd)\r\n+ } else {warning(paste("No valid fid in",j ))}\r\n+ }\r\n+ \r\n+ if (dirs.names==TRUE) {\r\n+ if (length(fidDirs)!= length(dir(path))) { # at least one subdir contains more than 1 FID\r\n+ separator <- .Platform$file.sep\r\n+ path_elem <- strsplit(fidDirs,separator)\r\n+ fidNames <- sapply(path_elem, function(x) paste(x[[length(path_elem[[1]])-1]],\r\n+ x[[length(path_elem[[1]])]], sep = "_"))\r\n+ }else {fidNames <- dir(path)}\r\n+ \r\n+ } else {fidNames <- sapply(X = fidDirs, FUN = getTitle, l = l, subdirs = subdirs, USE.NAMES = F)}\r\n+ \r\n+ for (i in 1:length(fidNames)) {\r\n+ fidList <- ReadFid(fidDirs[i])\r\n+ fid <- fidList[["fid"]]\r\n+ info <- fidList[["params"]]\r\n+ m <- length(fid)\r\n+ if (i == 1) {\r\n+ Fid_data <- matrix(nrow = length(fidNames), ncol = m, dimnames = list(fidNames, \r\n+ info[["DT"]] * (0:(m - 1))))\r\n+ Fid_info <- matrix(nrow = length(fidNames), ncol = length(info), dimnames = list(fidNames, \r\n+ names(info)))\r\n+ }\r\n+ Fid_data[i, ] <- fid\r\n+ Fid_info[i, ] <- unlist(info)\r\n+ }\r\n+ \r\n+ \r\n+ }\r\n+ \r\n+ # Check for non-unique IDs ----------------------------------------------\r\n+ NonnuniqueIds <- sum(duplicated(row.names(Fid_data)))\r\n+ cat("dim Fid_data: ", dim(Fid_data), "\\n")\r\n+ cat("IDs: ", rownames(Fid_data), "\\n")\r\n+ cat("non-unique IDs?", NonnuniqueIds, "\\n")\r\n+ if (NonnuniqueIds > 0) {\r\n+ warning("There are duplicated IDs: ", Fid_data[duplicated(Fid_data)])\r\n+ }\r\n+ \r\n+ \r\n+ # Return the results ----------------------------------------------\r\n+ return(list(Fid_data = endTreatment("ReadFids", begin_info, Fid_data), Fid_info = Fid_info))\r\n+ \r\n+}\r\n+\r\n' |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/ReadFids_wrapper.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/ReadFids_wrapper.R Wed Apr 11 05:32:23 2018 -0400 |
[ |
@@ -0,0 +1,158 @@ +#!/usr/local/public/bin/Rscript --vanilla --slave --no-site-file + +## 08122016_ReadFids_wrapper.R +## Manon Martin +## manon.martin@uclouvain.be + +##====================================================== +##====================================================== +# Preamble +##====================================================== +##====================================================== + +runExampleL <- FALSE + + +##------------------------------ +## Options +##------------------------------ +strAsFacL <- options()$stringsAsFactors +options(stringsAsFactors = FALSE) +options(warn=1) + +##------------------------------ +## Libraries laoding +##------------------------------ +library(batch) +library(ggplot2) +library(gridExtra) +library(reshape2) + + +# R script call +source_local <- function(fname) +{ + argv <- commandArgs(trailingOnly = FALSE) + base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)) + source(paste(base_dir, fname, sep="/")) +} +#Import the different functions +source_local("ReadFids_script.R") +source_local("DrawFunctions.R") +##------------------------------ +## Errors ????????????????????? +##------------------------------ + + +##------------------------------ +## Constants +##------------------------------ +topEnvC <- environment() +flagC <- "\n" + + +##------------------------------ +## Script +##------------------------------ +if(!runExampleL) + argLs <- parseCommandArgs(evaluate=FALSE) + +sink(argLs$logOut) + +##====================================================== +##====================================================== +## Parameters Loading +##====================================================== +##====================================================== + + ## Inputs + # Path + ## Bruker FIDs +fileType="Bruker" +zipfile= argLs[["fidzipfile"]] +directory=unzip(zipfile, list=F) +path=paste(getwd(),strsplit(directory[1],"/")[[1]][2],sep="/") + + +# other inputs from ReadFids +l = argLs[["title_line"]] +subdirs <- argLs[["subdirectories"]] +dirs.names <- argLs[["dirs_names"]] + + +# Outputs +# dataMatrix <- argLs[["dataMatrix"]] +# sampleMetadata <- argLs[["sampleMetadata"]] +logOut <- argLs[["logOut"]] +nomGraphe <- argLs[["graphOut"]] + + + +## Checking arguments +##------------------- +error.stock <- "\n" + +if(length(error.stock) > 1) + stop(error.stock) + + + +##====================================================== +##====================================================== +## Computation +##====================================================== +##====================================================== +sink(logOut,append=TRUE) + +if(length(warnings())>0){ # or !is.null(warnings()) + print("something happened") +} + +## Starting +cat("\nStart of 'ReadFids' Galaxy module call: ", as.character(Sys.time()), "\n\n", sep = "") + +outputs <- ReadFids(path = path, l=l, subdirs = subdirs, dirs.names = dirs.names) + +data_matrix <- outputs[["Fid_data"]] # Data matrix +data_sample <- outputs[["Fid_info"]] # Sample metadata + + + +pdf(nomGraphe, onefile = TRUE, width = 13, height = 13) +title = "Raw FID data" +DrawSignal(data_matrix, subtype = "stacked", + ReImModArg = c(TRUE, FALSE, FALSE, FALSE), vertical = T, + xlab = "Frequency", num.stacked = 4, + main = title, createWindow=FALSE) +invisible(dev.off()) + +##====================================================== +##====================================================== +## Saving +##====================================================== +##====================================================== + +# Data matrix +write.table(data_matrix,file=argLs$dataMatrix, quote=FALSE, row.names=TRUE, sep="\t", col.names=TRUE) + +# Sample metadata +write.table(data_sample,file=argLs$sampleMetadata, quote=FALSE, row.names=TRUE, sep="\t", col.names=TRUE) + +# log file +# write.table(t(data.frame(argLs)), file = argLs$logOut, col.names = FALSE, quote=FALSE) + +# input arguments +cat("\n INPUT and OUTPUT ARGUMENTS :\n") + +argLs + +## Ending + +cat("\nEnd of 'ReadFids' Galaxy module call: ", as.character(Sys.time()), sep = "") + +sink() + + +options(stringsAsFactors = strAsFacL) + +rm(list = ls()) \ No newline at end of file |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/ReadFids_xml.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/ReadFids_xml.xml Wed Apr 11 05:32:23 2018 -0400 |
b |
@@ -0,0 +1,211 @@ +<tool id="NMR_Read" name="NMR_Read" version="@WRAPPER_VERSION@"> + <description> Read Bruker NMR raw files</description> + + <macros> + <import>macros.xml</import> + </macros> + + <expand macro="requirements" /> + + <expand macro="stdio"/> + + <command> + ## Wrapper + Rscript $__tool_directory__/ReadFids_wrapper.R + + ## File input + fidzipfile $fidzipfile + + ## Title line + title_line $title_line + + ## Subdirectories + subdirectories $subdirectories + + ## Use subdirectories names as FID names? + dirs_names $dirs_names + + ## Outputs + dataMatrix $dataMatrix + sampleMetadata $sampleMetadata + logOut $logOut + graphOut $graphOut + + </command> + + <inputs> + <param name="fidzipfile" type="data" format="no_unzip.zip" label="Bruker FID file" /> + <param name="title_line" label="Specify the line in the title file to recover the FID names (usually in pdata/1/title)" type="integer" value="1" size="100" help="Default value is line 1"/> + + <param name="subdirectories" label="Presence of subdirectories?" type="select" help="Select 'FALSE' when there is no subdirectories, 'TRUE' if there are subdirectories"> + <option value="FALSE"> FALSE </option> + <option value="TRUE"> TRUE </option> + </param> + + <param name="dirs_names" label="Use (sub)directories names as FID names?" type="select" help="Select 'TRUE' to use the subdirectories names as the FID names (instead of looking in the title file)"> + <option value="FALSE"> FALSE </option> + <option value="TRUE"> TRUE </option> + </param> + </inputs> + + <outputs> + <data format="tabular" name="dataMatrix" label="${tool.name}_dataMatrix" /> + <data format="tabular" name="sampleMetadata" label="${tool.name}_sampleMetadata" /> + <data format="txt" name="logOut" label="${tool.name}_log" /> + <data format="pdf" name="graphOut" label="${tool.name}_graph" /> + </outputs> + + + <tests> + <test> + <param name="fidzipfile" value="MTBLS1.zip" ftype="zip" /> + <param name="title_line" value="1" /> + <param name="subdirectories" value="TRUE" /> + <param name="dirs_names" value="TRUE" /> + + <output name="dataMatrix" value="NMR_ReadFids_dataMatrix.tabular" /> + </test> + </tests> + + <help> + +@HELP_AUTHORS@ + + +============= +NMR Read +============= + +----------- +Description +----------- + +Nuclear Magnetic Resonance Bruker files reading (from the PEPS-NMR R package (https://github.com/ManonMartin/PEPSNMR)) + +----------------- +Workflow position +----------------- + +**Upstream tools** + +========================= ================= ======= +Name output file format +========================= ================= ======= +NA NA NA +========================= ================= ======= + + +**Downstream tools** + ++-----------------------+--------------------------+--------+ +| Name | Output file | Format | ++=======================+==========================+========+ +|NMR_Preprocessing | dataMatrix | Tabular| ++-----------------------+--------------------------+--------+ +|NMR_Preprocessing | sampleMetadata | Tabular| ++-----------------------+--------------------------+--------+ +|NMR_Preprocessing | NMR_Read_log | TXT | ++-----------------------+--------------------------+--------+ +|NMR_Preprocessing | NMR_Read_graph | PDF | ++-----------------------+--------------------------+--------+ +|NMR_Alignement | dataMatrix | Tabular| ++-----------------------+--------------------------+--------+ +|NMR_Bucketing | dataMatrix | Tabular| ++-----------------------+--------------------------+--------+ +|Normalization | dataMatrix | Tabular| ++-----------------------+--------------------------+--------+ +|Univariate | variableMetadata | Tabular| ++-----------------------+--------------------------+--------+ +|Multivariate | sampleMetadata | Tabular| ++-----------------------+--------------------------+--------+ +| | variableMetadata | Tabular| ++-----------------------+--------------------------+--------+ + + +----------- +Input files +----------- + ++---------------------------+-----------------+ +| Parameter : num + label | Format | ++===========================+=================+ +| 1 : Choose your inputs | zip | ++---------------------------+-----------------+ + + +**Choose your inputs** + + | Zip file (recommended) of FID Bruker files: you can put a zip file containing your FID Bruker files: myinputs.zip. + + +---------- +Parameters +---------- + +FID Title line + | Line in the acqus file to find the FID title (name) + | + +subdirectories + | Organization of individual's files + | TRUE: will search inside subdirectories for FIDs and will merge them to have unique FID and info matrices. + | + +dirs_names + | Use the (sub)directories names as FID names? + | + + +------------ +Output files +------------ + +NMR_Read_dataMatrix + | tabular output + | Data matrix with n rows (samples) and p columns (time) containing the raw FIDs. + | + +NMR_Read_sampleMetadata + | tabular output + | Data matrix with n rows (samples) containing the acquisition parameters for each sample. + | + +NMR_Read_log + | Text output + | Contains warnings + | + + +NMR_Read_graph + | pdf output + | line plots of FID + | + + +Creating the zip file +----------------------- + +.. class:: warningmark you must use the 7Zip software (http://www.7-zip.org/) to zip under Windows. + +Must contain at least the following files for every sample: fid, acqu and acqus + +.. image:: ./static/images/ReadFids.png + + + +**Possible structure and parameters values:** + + +(1) use title file and presence of sub-directories: set the FID Title line, subdirectories = TRUE, dirs_names = FALSE +(2) use title file and no sub-directories: set the FID Title line, subdirectories = FALSE, dirs_names = FALSE +(3) don't use title file and presence of sub-directories: subdirectories = TRUE, dirs_names = TRUE +(4) don't use title file and no sub-directories: subdirectories = FALSE, dirs_names = TRUE + + +@HELP_CHANGELOG@ + + </help> + + <expand macro="citation" /> + +</tool> |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/macros.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/macros.xml Wed Apr 11 05:32:23 2018 -0400 |
b |
@@ -0,0 +1,71 @@ +<?xml version="1.0"?> +<macros> + <token name="@WRAPPER_VERSION@">3.2.0</token> + + <xml name="requirements"> + <requirements> + <requirement type="package" version="1.1_4">r-batch</requirement> + <requirement type="package" version="2.2.1">r-ggplot2</requirement> + <requirement type="package" version="2.3">r-gridextra</requirement> + <requirement type="package" version="1.4.3">r-reshape2</requirement> + <yield /> + </requirements> + </xml> + + <xml name="stdio"> + <stdio> + <exit_code range="1" level="fatal" /> + </stdio> + </xml> + + + <token name="@HELP_AUTHORS@"> +.. class:: infomark + +**Authors** Manon Martin (manon.martin@uclouvain.be) and Marie Tremblay-Franco (marie.tremblay-franco@inra.fr; Galaxy integration) + +.. class:: infomark + +| Contact support@workflow4metabolomics.org for any questions or concerns about the Galaxy implementation of this tool. + +--------------------------------------------------- + + </token> + + <token name="@HELP_CHANGELOG@"> + +--------------------------------------------------- + +Changelog/News +-------------- +**Version 3.2.0** + +* Updated R scripts and the help section of NMR_ReadFids and NMR_preprocessing +* Added sections +* Created a variableMetadata file in output of the NMR_preprocessing module +* Homogenised the input-output file names with the other modules +* Suppressed the option ptw for the baseline correction, set to TRUE all the time now +* Shift referencing: other values than 0 are admitted +* The log file recovers the input/output parameters +* Added an exclusion zone for the computation of the Baseline Correction criterion +* Switched Internal Referencing (goes second) and Zero Order Phase Correction (goes first) + +**Version 3.1.0** + +* Implementation of NMR_ReadFids and NMR_preprocessing + + </token> + + <xml name="citation"> + <citations> + <citation type="bibtex">@PhDThesis{Rousseau2011, + title = {Statistical contribution to the analysis of metabonomics data in $^1$H NMR spectroscopy}, + author = {Rousseau, R.}, + school = {Institut de Statistique, Biostatistique et Sciences Actuarielles, Universit{\'e} catholique de Louvain}, + year = {2011}} + </citation> + <citation type="doi">10.1093/bioinformatics/btu813</citation> + </citations> + </xml> + +</macros> |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/ptw.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/ptw.R Wed Apr 11 05:32:23 2018 -0400 |
[ |
@@ -0,0 +1,98 @@ +ptw <- function (ref, samp, selected.traces, init.coef = c(0, 1, 0), + try = FALSE, warp.type = c("individual", "global"), optim.crit = c("WCC", + "RMS"), mode = c("forward", "backward"), smooth.param = ifelse(try, + 0, 1e+05), trwdth = 20, trwdth.res = trwdth, verbose = FALSE, + ...) +{ + optim.crit <- match.arg(optim.crit) + warp.type <- match.arg(warp.type) + mode <- match.arg(mode) + if (is.vector(ref)) + ref <- matrix(ref, nrow = 1) + if (is.vector(samp)) + samp <- matrix(samp, nrow = 1) + if (nrow(ref) > 1 && nrow(ref) != nrow(samp)) + stop("The number of references does not equal the number of samples") + if (length(dim(ref)) > 2) + stop("Reference cannot be an array") + if (length(dim(samp)) > 2) + stop("Sample cannot be an array") + if (nrow(samp) == 1) + warp.type <- "individual" + r <- nrow(samp) + if (!missing(selected.traces)) { + samp <- samp[selected.traces, , drop = FALSE] + if (nrow(ref) > 1) + ref <- ref[selected.traces, , drop = FALSE] + } + if (is.vector(init.coef)) + init.coef <- matrix(init.coef, nrow = 1) + if (warp.type == "global") { + if (nrow(init.coef) != 1) + stop("Only one warping function is allowed with global alignment.") + } + else { + if (nrow(init.coef) != nrow(samp)) + if (nrow(init.coef) == 1) { + init.coef <- matrix(init.coef, byrow = TRUE, + nrow = nrow(samp), ncol = length(init.coef)) + } + else { + stop("The number of warping functions does not match the number of samples") + } + } + if (warp.type == "individual") { + w <- matrix(0, nrow(samp), ncol(ref)) + a <- matrix(0, nrow(samp), ncol(init.coef)) + v <- rep(0, nrow(samp)) + warped.sample <- matrix(NA, nrow = nrow(samp), ncol = ncol(samp)) + for (i in 1:nrow(samp)) { + if (verbose & nrow(samp) > 1) + cat(ifelse(nrow(ref) == 1, paste("Warping sample", + i, "with the reference \n"), paste("Warping sample", + i, "with reference \n", i))) + if (nrow(ref) == 1) { + rfrnc <- ref + } + else { + rfrnc <- ref[i, , drop = FALSE] + } + quad.res <- pmwarp(rfrnc, samp[i, , drop = FALSE], + optim.crit, init.coef[i, ], try = try, mode = mode, + smooth.param = smooth.param, trwdth = trwdth, + trwdth.res = trwdth.res, ...) + w[i, ] <- quad.res$w + a[i, ] <- quad.res$a + v[i] <- quad.res$v + warped.sample[i, ] <- c(warp.sample(samp[i, , drop = FALSE], + w[i, ], mode = mode)) + } + } + else { + if (nrow(ref) == 1) + ref <- matrix(ref, nrow = nrow(samp), ncol = ncol(ref), + byrow = TRUE) + if (verbose) { + if (nrow(ref) == 1) { + cat("Simultaneous warping of samples with reference... \n") + } + else { + cat("Simultaneous warping of samples with references... \n") + } + } + quad.res <- pmwarp(ref, samp, optim.crit, c(init.coef), + try = try, mode = mode, smooth.param = smooth.param, + trwdth = trwdth, trwdth.res = trwdth.res, ...) + w <- t(as.matrix(quad.res$w)) + a <- t(as.matrix(quad.res$a)) + v <- quad.res$v + warped.sample <- t(warp.sample(samp, w, mode)) + } + if (verbose) + cat("\nFinished.\n") + result <- list(reference = ref, sample = samp, warped.sample = warped.sample, + warp.coef = a, warp.fun = w, crit.value = v, optim.crit = optim.crit, + mode = mode, warp.type = warp.type) + class(result) <- "ptw" + result +} \ No newline at end of file |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/static/images/Mth_Travaux.png |
b |
Binary file nmr_preprocessing/static/images/Mth_Travaux.png has changed |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/static/images/NmrPreprocessing.png |
b |
Binary file nmr_preprocessing/static/images/NmrPreprocessing.png has changed |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/static/images/ReadFids.png |
b |
Binary file nmr_preprocessing/static/images/ReadFids.png has changed |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/test-data/MTBLS1.zip |
b |
Binary file nmr_preprocessing/test-data/MTBLS1.zip has changed |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/test-data/MTBLS1_alignedSpectra.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/test-data/MTBLS1_alignedSpectra.tabular Wed Apr 11 05:32:23 2018 -0400 |
b |
b'@@ -0,0 +1,29802 @@\n+ADG10003u_007\tADG10003u_009\tADG10003u_015\tADG10003u_017\tADG10003u_021\tADG10003u_023\tADG10003u_051\tADG10003u_053\tADG10003u_067\tADG10003u_071\tADG10003u_073\tADG10003u_087\tADG10003u_089\tADG10003u_097\r\n+9.2997\t-0.00172384578396177\t-0.000133260203713335\t0.00188546634303473\t0.00145955595536551\t0.00266060722603239\t-0.00456406825398832\t-0.00131195747929342\t0.000299817194153485\t0.000241533956195763\t-0.00349445210212112\t0.00449073847864704\t-0.00150200410788306\t-0.00479292634495511\t-0.00845701750085149\r\n+9.2994\t-0.002312062118707\t-0.000821498405692276\t0.00530663314770368\t0.0031937690024524\t-0.00295334219789086\t-0.00562040636826083\t0.000544476077311362\t0.000328645770514397\t0.00269356222036034\t-3.40676966964021e-05\t0.00203230500493516\t-0.000176706365633302\t-0.00197312886982787\t-0.00571063951344053\r\n+9.2991\t0.00293819295016693\t0.000917760076187904\t0.00843046810963003\t-0.000269595302370741\t0.00164391778956326\t-0.00116020450231351\t0.00180051068287967\t0.00190620953248653\t0.0037736553777559\t0.0093018774151955\t-0.000394479670034688\t-0.003086471186395\t0.00198994473348899\t-0.00300222608200099\r\n+9.2988\t-0.00452049127972714\t-0.00104938317666152\t0.00739844285463343\t-0.00723747846021565\t0.00239897800809775\t0.00247439274074376\t0.00110713566571126\t0.00128511387066643\t0.00345596457000934\t0.00696433078367433\t0.00224254345372155\t-0.00566245731651603\t0.000398110507158\t-0.00679345467506024\r\n+9.2985\t-0.00679644435394394\t0.00108834623376689\t0.00259733552669646\t-0.000234823010309861\t-0.00287387338820875\t0.00360433314397773\t0.00131195747929342\t0.000999710964693405\t0.000689024945235094\t0.00650078671387083\t0.0031892946618048\t-0.00307469076201945\t-0.00265731165999202\t-0.0097797246393341\r\n+9.2982\t-0.00277642443085087\t0.00566634173332424\t-0.00691481595689443\t-0.0028308607137917\t-0.00725637584172303\t-0.0016260295153459\t0.00171405323393041\t0.000538453742918813\t0.00428868693222166\t0.0079838484938265\t0.00181890167627456\t0.00292768088283286\t-0.00247963078733168\t-0.00681381248043622\r\n+9.2979\t0.0018982524688494\t0.00520336893713099\t-0.00477951684143076\t-0.00662236101521466\t-0.00714026189728136\t-0.00179792959811773\t0.00189382983412648\t-0.00159037646257698\t0.00846508420011296\t0.00553739693024306\t0.000491234569046061\t0.0065864843534735\t-0.000949387194169153\t-0.000196700416808458\r\n+9.2976\t0.00679969416794806\t0.00526852564607191\t0.000441679666812651\t-0.00120910742140804\t-0.00213479215285431\t-0.000118151042806551\t0.000152672876120703\t-0.00308433735310247\t0.00592967252184167\t-0.000913405212245339\t0.00251223643157335\t0.00205224809642454\t-0.00322256779992628\t0.00248695352160624\r\n+9.2973\t0.0142226304437968\t0.00623769076398707\t0.000127692305908127\t0.00213321409459558\t-0.00336112584864566\t0.000102171598492551\t-0.00158299472004702\t-0.00277298872840462\t0.00392207785486584\t0.00206109565013233\t0.00669824219090419\t-0.00475364666104364\t-0.000766236100799773\t0.00362478977883671\r\n+9.297\t0.0095699800612356\t0.0038963057105373\t0.00351092154143045\t-0.00115056672717896\t-0.00313273291572552\t0.00197273503440119\t0.00124299737120294\t-0.000204042257132233\t0.00372445916343294\t-0.00169081888112061\t0.00880017455307183\t-0.00277600791899761\t0.00325660472878254\t-0.00132985988091201\r\n+9.2967\t0.00329603358106473\t0.00164692585915988\t-0.00187004456695887\t0.00352938764417924\t-0.00634216495071527\t0.00176403380714863\t0.00254534846727977\t-0.000827380141558176\t0.00593828880796603\t0.000819579424622461\t0.00804286401174449\t-0.00315985341323439\t0.00436989594345592\t-0.00604406735284172\r\n+9.2964\t0.00459126500692792\t0.00211219059988875\t-0.0050096097404826\t0.00286563300585258\t-0.00620346737671246\t0.00252983657025749\t0.000727340443541328\t-0.00440212361031127\t0.00549691260262785\t0.00261260139583228\t0.00773247972122436\t0.0021570447882654\t0.000121155258666913\t-0.000861080146308356\r\n+9.2961\t-0.000111938037919595\t0.00239344493647291\t-0.00924072822465575\t0.00409058602870609\t-0.00303387627311829\t-0.00573516783197047\t0.00190686706849184\t-0.00350107044027521\t0.00336757815105623\t0.00231464867144653\t0.0069998100303461'..b'77632683724\t-0.00376535913578589\t-0.00189051397424559\t-0.00680797781709899\t0.00220797768670862\t0.000364413311229752\t0.00462651624799079\t0.00499289330198562\t-0.0113395726998991\r\n+0.2037\t-0.00173576176864353\t0.000437761406301544\t0.000580167215973881\t0.00201899371750953\t0.00560137929048828\t-0.0079577632683724\t-0.00376535913578589\t-0.00127838720284889\t-0.00680797781709899\t-0.00129066306664566\t-0.00171378245188136\t-0.000434157723340709\t0.00830663144706259\t-0.00234747504423297\r\n+0.2034\t-0.00247527499980266\t0.000416806484833108\t-0.00300200293092705\t0.00609923608971649\t0.00340480173600446\t-0.0079577632683724\t-0.00376535913578589\t0.00338543581731644\t-0.00680797781709899\t-7.53957221969555e-06\t-0.00361949226184836\t0.00424659756187919\t0.00552958273377266\t0.00552741926505671\r\n+0.2031\t0.00054344111957739\t-0.00068660109873922\t0.00441371231291134\t0.00608933258881308\t0.00585129058742422\t-0.0079577632683724\t-0.00376535913578589\t0.00275184777240662\t-0.00680797781709899\t0.00633435763820644\t-0.00334233921000737\t0.00861222649505304\t0.00292555507550204\t0.00768149515821787\r\n+0.2028\t8.88282494458724e-05\t-0.00183519273172786\t0.0110009697459545\t0.00410885248592794\t0.0110917579111525\t-0.0079577632683724\t-0.0011345824749015\t0.00165508060063147\t-0.00738054392729838\t0.00380245758946646\t-0.00781250596947208\t0.00850792065422783\t0.00171359728729891\t0.000210180585233094\r\n+0.2025\t0.00254316000344422\t-0.0030761169874368\t0.00813837967075322\t0.00410885248592794\t0.0103098530008755\t-0.0079577632683724\t0.00219162771384057\t0.00228354356529936\t-0.00133941557526741\t-0.00210186518880179\t-0.00742752093906001\t0.00598911866742981\t0.0043536878820958\t0.004245152631848\r\n+0.2022\t0.00234564353008287\t-0.0045118565286726\t-0.00333850608490233\t0.00410885248592794\t0.0111906145537597\t-0.0079577632683724\t0.00279820219694485\t0.00318267483024469\t-0.0019044771781972\t-0.00718297837804551\t-0.00844050856165338\t0.00561705359756858\t0.00229810050009832\t0.00193399151071813\r\n+0.2019\t-0.000822564033486575\t-0.0040515030976629\t-0.00796658108526813\t0.00410885248592794\t0.0111910406599779\t-0.0038357929737381\t0.00141728460956096\t1.28127006048498e-05\t0.000142307693408781\t-0.0043810499464742\t-0.00639260522019536\t0.00376237303494238\t0.00180395722938159\t-0.00401076276454617\r\n+0.2016\t-0.00322453767297415\t-0.00410487266327783\t-0.00458643620496098\t0.00410885248592794\t0.011761383832951\t-0.000322736352584289\t0.00112291758099565\t-0.000356513394329946\t0.00264936901088379\t-0.00804193112425971\t-0.00513162665317331\t0.00391821823241064\t-0.00198893172965399\t-0.00319700076046307\r\n+0.2013\t-0.00509715272023551\t0.00140921846875231\t0.00132164620970126\t-0.00839068612096886\t0.0126843299014305\t0.000420792033602021\t0.0003677872431492\t0.000191870191557626\t0.00253318812056178\t-0.00941497099849093\t-0.00805778415972288\t0.00426009596480952\t-0.00233902585503262\t0.000656676776114392\r\n+0.201\t0.000761178657853248\t0.00155000934736837\t0.00579704562691605\t-0.00447396155256717\t0.00786613383987363\t-0.00118828958625933\t0.00191750270705306\t-0.000602517245943062\t0.00493796578339922\t-0.00887212179867285\t-0.00843078785918261\t-0.0009743392660614\t-0.000338140680125548\t0.00136672401497122\r\n+0.2007\t0.00609592889083422\t0.00516571556261739\t0.00594756216141645\t-0.00749474940590659\t0.00803891991132721\t0.00248480359082712\t-0.0030404202880487\t-0.00130433292157371\t0.00596802889233075\t-0.00572141834108675\t-0.00758938193834072\t-0.00445790892411569\t0.00262611114187379\t0.00898632044062698\r\n+0.2004\t0.00381564273127859\t0.00426530878077054\t0.00435325895069397\t-0.00396602199512091\t0.00999751714298286\t0.00384741438778465\t-0.00201699739036767\t-0.00225087117875699\t0.00396905051147928\t-0.00392727939621475\t-0.00596308580869628\t-0.00598543728481245\t0.00439076382245708\t0.000253097039809485\r\n+0.2001\t0.00347693989396059\t0.00341008604834\t0.0123071941795799\t0.00155969135338893\t0.00947255428224105\t0.00357649017282454\t0.0018327606836782\t-0.0032220738846046\t0.00134108324354955\t0.00179022953705438\t-0.00319313773022348\t-0.00350001316707849\t0.0046579942341321\t-0.00175132147329041\r\n' |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/test-data/NMR_Preprocessing_dataMatrix.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/test-data/NMR_Preprocessing_dataMatrix.tabular Wed Apr 11 05:32:23 2018 -0400 |
b |
b'@@ -0,0 +1,65336 @@\n+ADG10003u_007\tADG10003u_009\tADG10003u_015\tADG10003u_017\tADG10003u_021\r\n+<<<<<<< HEAD\r\n+14.7722158796892\t0\t440513.532234769\t206138.121855941\t386826.808374734\t92280.0131501408\r\n+14.7716051547065\t0\t438297.908551098\t205525.154993051\t384756.026954071\t91945.8093173809\r\n+14.7709944297239\t0\t436082.064610661\t204912.0850611\t382685.052120003\t0\r\n+14.7703837047413\t0\t433865.561007737\t204298.706228449\t380613.498081113\t0\r\n+14.7697729797587\t30144.8119983755\t431647.740295574\t203684.710207419\t378540.787703458\t23696.6165445194\r\n+14.769162254776\t0\t429427.728094639\t203069.686560974\t0\t7754.08402369477\r\n+14.7685515297934\t5926.73644284898\t427204.434201527\t0\t0\t19590.6029616454\r\n+14.7679408048108\t36986.2255620162\t0\t0\t0\t25058.0694442252\r\n+14.7673300798282\t70143.6115586768\t0\t6942.80166939506\t0\t0\r\n+14.7667193548455\t90574.2536680185\t0\t19793.0915533878\t0\t1978.80832132518\r\n+14.7661086298629\t79089.9203496244\t0\t16683.8090673361\t12180.9955964271\t33785.5250916638\r\n+14.7654979048803\t72400.5256625149\t0\t0\t91434.6961606296\t26307.2320436728\r\n+14.7648871798977\t91724.9381991385\t35417.2496639297\t0\t15143.0247514394\t0\r\n+14.7642764549151\t7302.11448863981\t219.649400987197\t29624.9884578175\t27541.2779513435\t0\r\n+14.7636657299324\t64685.7651771302\t0\t40730.9463263804\t52275.8413168968\t20636.2884581411\r\n+14.7630550049498\t46784.0072468099\t14884.9183776884\t3004.26610640489\t44232.4911551095\t9534.57448936871\r\n+14.7624442799672\t26331.3169893605\t2675.32533106103\t32911.8233718391\t78790.1071316482\t3464.8303096389\r\n+14.7618335549846\t275.980938694731\t61671.6188975403\t18895.3136958877\t29703.2703198509\t15765.3654977631\r\n+14.7612228300019\t97562.6277645925\t71104.8400093025\t51479.0358929405\t71036.5396579774\t5281.23886798379\r\n+14.7606121050193\t0\t45125.2967255506\t13545.2412686505\t69471.6259213319\t30180.0036257685\r\n+14.7600013800367\t113484.551027679\t64100.5125279474\t37387.3369167877\t33785.4994261957\t25.064036706739\r\n+14.7593906550541\t55395.4523825558\t57851.7413212176\t35378.3770915604\t98237.9055881621\t48815.487828535\r\n+14.7587799300714\t44661.3357435991\t47590.5905180213\t26581.3819672198\t141366.450120351\t7083.52571554123\r\n+14.7581692050888\t36475.9050251448\t0\t18639.4812528994\t51477.3383035234\t0\r\n+14.7575584801062\t0\t74204.0834911913\t20895.6019714467\t33839.2365367223\t20607.3277338556\r\n+14.7569477551236\t48542.7572804512\t46841.8794917137\t47586.1981681534\t59719.6908817074\t4312.35555130724\r\n+14.7563370301409\t34111.1750789239\t59226.3786693994\t2987.47762360141\t0\t0\r\n+14.7557263051583\t50795.2724328581\t35114.8377929819\t25911.7101641376\t48887.3051690677\t7541.56272336398\r\n+14.7551155801757\t5499.11078507005\t65682.9807913334\t16747.2884535374\t97974.0261761903\t8375.14266184885\r\n+14.7545048551931\t0\t72761.21850802\t23123.0783127933\t62881.4144799234\t7946.36660989953\r\n+14.7538941302105\t95186.7387449513\t16351.254511064\t0\t60464.5949522876\t7969.71033352629\r\n+14.7532834052278\t96593.3663525092\t24177.982913017\t58782.3157580608\t65987.1287113844\t7627.4371407849\r\n+14.7526726802452\t44305.7649991353\t72813.0336050838\t36743.0537271027\t64751.6834527152\t0\r\n+14.7520619552626\t94224.5205617654\t23463.6639256763\t0\t95852.8449954447\t300.955526139966\r\n+14.75145123028\t87493.5870291964\t58796.132466105\t40234.5815756267\t74059.606363308\t23252.5277940441\r\n+14.7508405052973\t37413.6555846478\t67993.0341827511\t0\t27822.3512351813\t37292.6871961524\r\n+14.7502297803147\t95174.0237518195\t33555.1360774164\t52034.0057960021\t58092.7462412568\t10728.8797605836\r\n+14.7496190553321\t36154.1178795401\t54292.4567687972\t72012.0681579454\t64901.3681339195\t14281.5448310932\r\n+14.7490083303495\t104940.494574311\t17549.7351009792\t60210.6804534211\t47150.5235399407\t0\r\n+14.7483976053668\t29295.0495227508\t125107.449528275\t0\t54571.0864760204\t11195.161926094\r\n+14.7477868803842\t44015.2581802983\t47916.0664394849\t0\t112718.159419718\t14917.9621603628\r\n+14.7471761554016\t10687.5252592473\t48314.3441882255\t52359.2234142178\t72233.7148329129\t17025.8856819391\r\n+14.746565430419\t78175.9536668928\t76899.9866205082\t39167.5679287497\t77730.8135634694\t7014.11474969854\r\n+14.7459547054364\t5404'..b'.313375\r\n+-5.2143699016366\t76777.870058\t139339.688146\t55795.986706\t114007.067861\t16416.989989\r\n+-5.21498062661922\t87343.538217\t139417.131966\t41548.287371\t48901.259066\t35765.061465\r\n+-5.21559135160184\t134376.402222\t123784.519485\t65088.404866\t96010.004818\t27851.231928\r\n+-5.21620207658446\t110398.716299\t135340.968436\t67820.297567\t163884.59935\t15549.133317\r\n+-5.21681280156709\t94719.832963\t98439.519016\t74404.036631\t66343.129291\t11486.596934\r\n+-5.21742352654971\t77458.993866\t125545.79072\t57606.947453\t72707.310092\t15715.334629\r\n+-5.21803425153233\t114782.143052\t119837.192763\t72920.080972\t116797.686405\t29247.140598\r\n+-5.21864497651496\t104390.19186\t134116.91302\t18556.171689\t124759.126211\t12888.183822\r\n+-5.21925570149758\t122508.383272\t146918.686771\t54925.216891\t107658.438015\t29523.200169\r\n+-5.2198664264802\t100984.375867\t112925.918113\t43469.967405\t61097.641379\t26659.504725\r\n+-5.22047715146283\t121244.681201\t115568.116341\t74418.008355\t133904.944345\t31476.021545\r\n+-5.22108787644545\t95492.138209\t113321.364591\t41019.96692\t76947.770414\t5686.645329\r\n+-5.22169860142807\t95746.006154\t114108.511928\t62765.614419\t79703.563319\t28143.730408\r\n+-5.2223093264107\t65167.805146\t143017.871246\t79753.272518\t134138.935527\t15828.600113\r\n+-5.22292005139332\t76232.676063\t158155.78001\t64355.02733\t130550.55296\t10972.069483\r\n+-5.22353077637594\t39513.559138\t133432.052645\t78585.33843\t94604.67302\t24000.548272\r\n+-5.22414150135857\t100788.060473\t151592.55936\t73633.588072\t99659.703826\t29790.322293\r\n+-5.22475222634119\t90733.914786\t132182.593608\t56800.360801\t129667.91989\t41635.378802\r\n+-5.22536295132381\t72054.198713\t164397.164937\t52492.108627\t113571.820311\t4351.434202\r\n+-5.22597367630644\t97395.794519\t162706.603928\t66323.420709\t125015.897185\t23244.282805\r\n+-5.22658440128906\t72239.294145\t187777.971768\t88127.734811\t84392.782361\t4374.024649\r\n+-5.22719512627168\t80170.002331\t146058.841924\t77647.21693\t139254.682873\t21808.729605\r\n+-5.22780585125431\t89543.26773\t177776.183084\t69545.56343\t109517.12696\t5177.19751\r\n+-5.22841657623693\t57494.500232\t154857.451331\t64277.843009\t47242.514689\t28966.265866\r\n+-5.22902730121955\t49784.792536\t177355.523207\t67276.427857\t118185.829721\t14990.215956\r\n+-5.22963802620218\t82091.914529\t169953.1797\t83524.056125\t101572.093811\t13338.54061\r\n+-5.2302487511848\t68709.162289\t179468.076431\t61888.709673\t124955.606009\t30568.714124\r\n+-5.23085947616742\t46785.897343\t168554.803953\t77159.290517\t145300.786494\t7842.166664\r\n+-5.23147020115004\t35805.92775\t184402.035985\t75064.431185\t95995.886342\t20962.600401\r\n+-5.23208092613267\t49663.818141\t192694.720669\t44325.357693\t130868.687572\t22379.625682\r\n+-5.23269165111529\t88776.054829\t156815.358793\t96997.946251\t126347.851106\t10890.318024\r\n+-5.23330237609791\t65410.407657\t136984.455643\t81996.141767\t151575.60582\t15230.800861\r\n+-5.23391310108054\t67569.366232\t190492.444327\t47139.131475\t116950.815303\t0\r\n+-5.23452382606316\t40166.875766\t156406.715218\t38253.271008\t107543.642545\t15530.596971\r\n+-5.23513455104578\t25837.407641\t148877.98073\t54664.787125\t82636.983843\t11077.776388\r\n+-5.23574527602841\t51644.090578\t171898.479512\t62444.12625\t88887.725956\t0\r\n+-5.23635600101103\t0\t168274.130156\t55697.445233\t103798.572923\t0\r\n+-5.23696672599365\t0\t144523.773995\t55288.762151\t106073.227849\t8824.242922\r\n+-5.23757745097628\t0\t167243.776449\t77491.944542\t79404.366635\t0\r\n+-5.2381881759589\t0\t163484.769057\t57582.266016\t44248.087032\t6117.065798\r\n+-5.23879890094152\t0\t151664.041336\t41750.009234\t91968.557069\t0\r\n+-5.23940962592415\t0\t147258.620094\t39430.282189\t57015.926643\t0\r\n+-5.24002035090677\t812043.565709\t82927.345515\t0\t6190.743301\t0\r\n+-5.24063107588939\t815748.054046\t61483.703824\t0\t5500.392145\t0\r\n+-5.24124180087202\t819446.322696\t81749.33671\t4368.559129\t0\t187711.210227\r\n+-5.24185252585464\t823140.438734\t64686.665829\t0\t0\t188473.903958\r\n+-5.24246325083726\t826832.059516\t0\t0\t0\t189236.026933\r\n+-5.24307397581988\t830522.430824\t0\t0\t1034867.843743\t189997.864151\r\n+-5.24368470080251\t834212.385026\t0\t571394.702131\t1040949.40358\t190759.605988\r\n+>>>>>>> ca361a347cd305108e1b662c443e79559ddeaca7\r\n' |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/test-data/NMR_ReadFids_dataMatrix.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/test-data/NMR_ReadFids_dataMatrix.tabular Wed Apr 11 05:32:23 2018 -0400 |
b |
b'@@ -0,0 +1,6 @@\n+0\t3.56999999999999e-05\t7.13999999999998e-05\t0.0001071\t0.0001428\t0.000178499999999999\t0.000214199999999999\t0.000249899999999999\t0.000285599999999999\t0.000321299999999999\t0.000356999999999999\t0.000392699999999999\t0.000428399999999999\t0.000464099999999999\t0.000499799999999998\t0.000535499999999998\t0.000571199999999998\t0.000606899999999998\t0.000642599999999998\t0.000678299999999998\t0.000713999999999998\t0.000749699999999998\t0.000785399999999998\t0.000821099999999998\t0.000856799999999997\t0.000892499999999997\t0.000928199999999997\t0.000963899999999997\t0.000999599999999997\t0.0010353\t0.001071\t0.0011067\t0.0011424\t0.0011781\t0.0012138\t0.0012495\t0.0012852\t0.0013209\t0.0013566\t0.0013923\t0.001428\t0.0014637\t0.0014994\t0.0015351\t0.0015708\t0.0016065\t0.0016422\t0.00167789999999999\t0.00171359999999999\t0.00174929999999999\t0.00178499999999999\t0.00182069999999999\t0.00185639999999999\t0.00189209999999999\t0.00192779999999999\t0.00196349999999999\t0.00199919999999999\t0.00203489999999999\t0.00207059999999999\t0.00210629999999999\t0.00214199999999999\t0.00217769999999999\t0.00221339999999999\t0.00224909999999999\t0.00228479999999999\t0.00232049999999999\t0.00235619999999999\t0.00239189999999999\t0.00242759999999999\t0.00246329999999999\t0.00249899999999999\t0.00253469999999999\t0.00257039999999999\t0.00260609999999999\t0.00264179999999999\t0.00267749999999999\t0.00271319999999999\t0.00274889999999999\t0.00278459999999999\t0.00282029999999999\t0.00285599999999999\t0.00289169999999999\t0.00292739999999999\t0.00296309999999999\t0.00299879999999999\t0.00303449999999999\t0.00307019999999999\t0.00310589999999999\t0.00314159999999999\t0.00317729999999999\t0.00321299999999999\t0.00324869999999999\t0.00328439999999999\t0.00332009999999999\t0.00335579999999999\t0.00339149999999999\t0.00342719999999999\t0.00346289999999999\t0.00349859999999999\t0.00353429999999999\t0.00356999999999999\t0.00360569999999999\t0.00364139999999999\t0.00367709999999999\t0.00371279999999999\t0.00374849999999999\t0.00378419999999999\t0.00381989999999999\t0.00385559999999999\t0.00389129999999999\t0.00392699999999999\t0.00396269999999999\t0.00399839999999999\t0.00403409999999999\t0.00406979999999999\t0.00410549999999999\t0.00414119999999999\t0.00417689999999999\t0.00421259999999999\t0.00424829999999999\t0.00428399999999999\t0.00431969999999999\t0.00435539999999999\t0.00439109999999999\t0.00442679999999999\t0.00446249999999999\t0.00449819999999999\t0.00453389999999999\t0.00456959999999999\t0.00460529999999999\t0.00464099999999999\t0.00467669999999999\t0.00471239999999999\t0.00474809999999999\t0.00478379999999999\t0.00481949999999999\t0.00485519999999998\t0.00489089999999999\t0.00492659999999998\t0.00496229999999998\t0.00499799999999999\t0.00503369999999998\t0.00506939999999998\t0.00510509999999998\t0.00514079999999998\t0.00517649999999998\t0.00521219999999998\t0.00524789999999998\t0.00528359999999998\t0.00531929999999998\t0.00535499999999998\t0.00539069999999998\t0.00542639999999998\t0.00546209999999998\t0.00549779999999998\t0.00553349999999998\t0.00556919999999998\t0.00560489999999998\t0.00564059999999998\t0.00567629999999998\t0.00571199999999998\t0.00574769999999998\t0.00578339999999998\t0.00581909999999998\t0.00585479999999998\t0.00589049999999998\t0.00592619999999998\t0.00596189999999998\t0.00599759999999998\t0.00603329999999998\t0.00606899999999998\t0.00610469999999998\t0.00614039999999998\t0.00617609999999998\t0.00621179999999998\t0.00624749999999998\t0.00628319999999998\t0.00631889999999998\t0.00635459999999998\t0.00639029999999998\t0.00642599999999998\t0.00646169999999998\t0.00649739999999998\t0.00653309999999998\t0.00656879999999998\t0.00660449999999998\t0.00664019999999998\t0.00667589999999998\t0.00671159999999998\t0.00674729999999998\t0.00678299999999998\t0.00681869999999998\t0.00685439999999998\t0.00689009999999998\t0.00692579999999998\t0.00696149999999998\t0.00699719999999998\t0.00703289999999998\t0.00706859999999998\t0.00710429999999998\t0.00713999999999998\t0.00717569999999998\t0.00721139999999998\t0.00724709999999998\t0.00728279999999998\t0.00731849999999998\t0.00735419999999998\t0.00738989999999998\t0.00742559999999'..b'12-862i\t-334+248i\t498+744i\t719-92i\t27-800i\t-555+19i\t125+712i\t1008+67i\t536-610i\t-327-264i\t-99+741i\t830+273i\t664-396i\t-381-516i\t-295+454i\t668+386i\t592-476i\t-261-481i\t-716+277i\t234+603i\t880-319i\t132-458i\t-411+332i\t469+912i\t961-187i\t140-946i\t-435-2i\t170+613i\t696+346i\t235-754i\t-686+45i\t-256+1064i\t778+462i\t433-864i\t-26-502i\t-200+334i\t719+351i\t658-503i\t-143-667i\t-576+487i\t251+437i\t659-213i\t-221-550i\t-420+81i\t439+621i\t1077-149i\t208-710i\t-567-120i\t147+783i\t734-126i\t220-371i\t-430-280i\t-87+584i\t590+546i\t674-526i\t-358-232i\t-306+735i\t1015+344i\t907-573i\t-162-537i\t-571+230i\t442+417i\t1027-508i\t-103-635i\t-413+223i\t25+984i\t859+159i\t67-571i\t-481+14i\t405+681i\t675+132i\t441-452i\t-437-293i\t-203+487i\t504+196i\t417-310i\t-473-365i\t-252+632i\t381+379i\t823-373i\t-274-613i\t-377+360i\t403+591i\t921-217i\t-81-718i\t-769+255i\t153+607i\t934-192i\t158-727i\t-492+55i\t184+796i\t1025+183i\t425-555i\t-208-399i\t109+447i\t796+448i\t711-1017i\t-691-584i\t-355+320i\t397+510i\t534-616i\t-340-431i\t-469+462i\t350+936i\t735-304i\t59-621i\t-434+165i\t270+655i\t851-48i\t145-474i\t-465+76i\t135+543i\t673+258i\t260-579i\t-527-301i\t-193+608i\t951+231i\t715-570i\t-334-471i\t-294+455i\t528+505i\t721-420i\t-92-335i\t-519+330i\t377+526i\t730+17i\t-37-716i\t-583+179i\t356+403i\t583-41i\t-50-685i\t-686+139i\t-128+786i\t736+304i\t505-647i\t-915-167i\t62+535i\t675+386i\t576-662i\t-215-211i\t-191+590i\t846+427i\t546-390i\t-433-665i\t-443+342i\t395+374i\t312-266i\t-118-608i\t-465+283i\t358+729i\t1157-43i\t315-911i\t-387-146i\t215+513i\t894+35i\t348-865i\t-678-133i\t-330+775i\t892+302i\t577-415i\t-351-437i\t-350+607i\t834+595i\t670-636i\t-243-544i\t-399+520i\t466+559i\t826-399i\t56-612i\t-718+38i\t71+1006i\t1068+41i\t533-738i\t-317+203i\t11+738i\t981+17i\t693-702i\t-323-405i\t-259+531i\t809+80i\t460-849i\t-373-223i\t-603+492i\t596+483i\t776-439i\t-333-561i\t-276+343i\t446+676i\t648-288i\t-155-616i\t-459+190i\t361+549i\t697+82i\t31-713i\t-386+98i\t10+894i\t828+282i\t466-588i\t-829-370i\t-13+638i\t928+361i\t621-509i\t-407-364i\t-257+432i\t861+403i\t630-471i\t-30-605i\t-203+409i\t376+632i\t896-609i\t-102-861i\t-535+312i\t267+436i\t588-165i\t-82-705i\t-681+37i\t-95+640i\t681+94i\t271-489i\t-337-81i\t-140+691i\t798+173i\t657-719i\t-162-485i\t-89+366i\t673+438i\t552-638i\t-360-480i\t-167+342i\t827+605i\t841-176i\t135-337i\t-483+382i\t242+524i\t907+35i\t184-514i\t-600-204i\t84+629i\t576+52i\t216-434i\t-432-2i\t-284+878i\t1000+514i\t767-482i\t-246-593i\t-16+486i\t667+554i\t807-719i\t-490-431i\t-477+406i\t538+834i\t726-343i\t-177-294i\t-454+322i\t415+793i\t894-11i\t35-755i\t-348-51i\t443+802i\t931-71i\t370-910i\t-447-558i\t-208+538i\t711+390i\t405-726i\t-350-125i\t-368+487i\t662+658i\t627-404i\t-157-239i\t-414+548i\t414+568i\t726-389i\t-142-799i\t-578+206i\t118+845i\t717-46i\t37-343i\t-662+85i\t210+756i\t922+1i\t199-799i\t-440-389i\t-296+828i\t836+448i\t521-463i\t-408-464i\t-348+727i\t681+861i\t828-445i\t-361-487i\t-367+588i\t629+529i\t765-509i\t-380-540i\t-672+230i\t445+577i\t824-60i\t9-524i\t-764+36i\t-148+910i\t822+160i\t385-750i\t-396-175i\t-53+714i\t981+413i\t624-427i\t-371-287i\t-390+455i\t587+454i\t630-327i\t-277-627i\t-389+806i\t539+434i\t730-311i\t150-772i\t-287+246i\t251+783i\t768-137i\t30-452i\t-717-150i\t5+938i\t644+26i\t155-663i\t-575-107i\t-153+692i\t828+353i\t543-641i\t-180-575i\t-133+601i\t393+380i\t348-531i\t-435-418i\t-399+700i\t394+726i\t795-127i\t-246-350i\t-440+293i\t670+748i\t1045+224i\t56-708i\t-723+60i\t145+578i\t904+61i\t427-664i\t-514-229i\t135+719i\t781+431i\t602-590i\t-319-227i\t-336+577i\t582+313i\t662-773i\t-325-694i\t-531+251i\t199+400i\t518-335i\t-64-710i\t-679+310i\t319+831i\t885-89i\t74-574i\t-432+148i\t149+693i\t760-92i\t151-579i\t-450-297i\t-236+673i\t728+168i\t461-633i\t-474-207i\t-148+751i\t1029+485i\t793-584i\t-156-593i\t-168+153i\t595+609i\t715-447i\t-232-501i\t-714+7i\t302+800i\t751-232i\t145-694i\t-554+121i\t24+715i\t922-105i\t250-747i\t-555-207i\t-122+606i\t763+227i\t334-482i\t-435-235i\t-302+635i\t866+508i\t780-411i\t-401-678i\t-268+345i\t268+664i\t986-371i\t-76-811i\t-638+338i\t64+696i\t1009-395i\t415-523i\t-448+59i\t210+798i\t686+229i\t321-688i\t-519-222i\t-128+509i\t646-53i\t372-706i\t-645-262i\t-164+524i\t612+410i\t582-497i\t-214-375i\t-436+415i\t660+504i\t871-282i\t-119-712i\t-446+259i\t437+617i\t830-257i\t310-532i\t-715-203i\t-112+1075i\t652+166i\t259-330i\t-368-172i\t307+779i\t792+395i\n' |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 nmr_preprocessing/test-data/sampleMetadata.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nmr_preprocessing/test-data/sampleMetadata.tabular Wed Apr 11 05:32:23 2018 -0400 |
b |
@@ -0,0 +1,6 @@ +TD BYTORDA DIGMOD DECIM DSPFVS SW_h SW O1 DT +ADG10003u_007 65536 1 1 12 12 14005.6022408964 20.0116255056133 3290.5 3.56999999999999e-05 +ADG10003u_009 65536 1 1 12 12 14005.6022408964 20.0116255056133 3290.5 3.56999999999999e-05 +ADG10003u_015 65536 1 1 12 12 14005.6022408964 20.0116255056133 3290.5 3.56999999999999e-05 +ADG10003u_017 65536 1 1 12 12 14005.6022408964 20.0116255056133 3290.5 3.56999999999999e-05 +ADG10003u_021 65536 1 1 12 12 14005.6022408964 20.0116255056133 3290.5 3.56999999999999e-05 |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 static/images/Mth_Travaux.png |
b |
Binary file static/images/Mth_Travaux.png has changed |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 static/images/ReadFids.png |
b |
Binary file static/images/ReadFids.png has changed |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 test-data/MTBLS1.zip |
b |
Binary file test-data/MTBLS1.zip has changed |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 test-data/NMR_Preprocessing_dataMatrix.tabular --- a/test-data/NMR_Preprocessing_dataMatrix.tabular Wed Mar 28 08:05:12 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
b'@@ -1,32776 +0,0 @@\n-ADG10003u_007\tADG10003u_009\tADG10003u_015\tADG10003u_017\tADG10003u_021\n-14.7722158796892\t0\t1174862.468375\t523094.432353\t987842.271828\t187683.753975\n-14.7716051547065\t0\t1168640.529211\t520492.500529\t982124.168853\t186652.936916\n-14.7709944297239\t0\t1162418.002616\t517890.307158\t976405.571958\t0\n-14.7703837047413\t2921.46522\t1156193.716838\t515287.330446\t970685.496157\t0\n-14.7697729797587\t37455.763025\t1149965.918917\t512682.789655\t964962.468267\t6789.713144\n-14.769162254776\t22175.25381\t1143732.277795\t510075.646402\t0\t3930.965529\n-14.7685515297934\t33874.51083\t1137489.887432\t0\t0\t14171.461071\n-14.7679408048108\t63615.244093\t0\t0\t0\t19208.159781\n-14.7673300798282\t103886.968883\t0\t0\t0\t0\n-14.7667193548455\t117382.609894\t0\t0\t0\t4123.795537\n-14.7661086298629\t109111.667957\t0\t1674.828892\t16899.970242\t28103.704787\n-14.7654979048803\t112929.240453\t0\t0\t84175.26796\t25960.593841\n-14.7648871798977\t120797.161767\t22261.535736\t0\t44268.827343\t5924.814132\n-14.7642764549151\t66826.278646\t13016.213354\t23830.990126\t66156.075733\t3235.26686\n-14.7636657299324\t106924.923865\t22732.928977\t34560.634915\t90184.759705\t24926.733428\n-14.7630550049498\t97890.030054\t48697.311306\t11794.700731\t86128.237874\t15489.569604\n-14.7624442799672\t86911.159185\t48856.046093\t34697.919494\t113161.542787\t10413.110432\n-14.7618335549846\t71454.580732\t93536.021105\t29572.596688\t88390.137917\t18675.746839\n-14.7612228300019\t136141.057773\t106010.814163\t54592.693846\t119732.983816\t14167.468717\n-14.7606121050193\t60073.291676\t93148.331947\t35444.876855\t117380.117105\t33656.17999\n-14.7600013800367\t149045.568203\t110301.384342\t53269.549207\t95432.294523\t12370.207454\n-14.7593906550541\t107086.302065\t109183.15647\t47858.927464\t140937.794063\t45197.008831\n-14.7587799300714\t88613.356612\t102932.166392\t41649.372804\t169331.310116\t20843.882725\n-14.7581692050888\t85113.882038\t70611.394674\t39948.800301\t106010.313693\t7197.237027\n-14.7575584801062\t56896.433958\t126861.14823\t43282.246442\t92827.699315\t22476.755259\n-14.7569477551236\t96540.657336\t111584.174334\t59431.639948\t113555.953154\t10957.415566\n-14.7563370301409\t95065.63324\t118985.367982\t28668.121031\t74245.260567\t5435.253329\n-14.7557263051583\t103050.548136\t102146.565828\t44827.928393\t102726.199071\t13420.890393\n-14.7551155801757\t61490.95886\t121767.268897\t43031.995234\t133401.288057\t13963.761954\n-14.7545048551931\t51721.384187\t127222.842558\t48361.71785\t114126.409737\t13817.412669\n-14.7538941302105\t118834.811272\t85979.869661\t27388.237167\t119164.146254\t14561.922565\n-14.7532834052278\t128216.507158\t87475.906781\t67881.883959\t121957.950332\t13322.477021\n-14.7526726802452\t104378.775902\t124457.440431\t50792.534824\t117208.837945\t9046.376049\n-14.7520619552626\t127032.008821\t93425.525492\t10419.68068\t136639.625604\t10072.543288\n-14.75145123028\t111208.661956\t112978.306506\t56444.509288\t112516.977279\t27135.290997\n-14.7508405052973\t78767.437652\t121705.139386\t29988.114963\t76805.204542\t41427.528851\n-14.7502297803147\t116476.002095\t100950.508458\t64810.663572\t101311.429398\t21000.710884\n-14.7496190553321\t72946.608093\t115034.904605\t76839.681595\t108633.75392\t18750.691632\n-14.7490083303495\t115701.609743\t88967.15809\t66426.941023\t98711.116937\t2274.400433\n-14.7483976053668\t70382.437013\t161145.148643\t0\t108158.399552\t14634.473689\n-14.7477868803842\t84699.578944\t109947.606202\t20432.62196\t143556.5091\t18090.969484\n-14.7471761554016\t58754.728706\t107876.759347\t62308.739857\t110326.505067\t20909.355063\n-14.746565430419\t99301.822147\t127739.30046\t55800.647616\t111344.195133\t13196.048447\n-14.7459547054364\t81648.495416\t108161.222285\t61514.29869\t102128.081545\t31832.83464\n-14.7453439804537\t74087.862503\t107011.116254\t48013.446622\t129799.284772\t14075.275334\n-14.7447332554711\t101225.489989\t126181.172037\t28244.636399\t114349.938191\t17842.321792\n-14.7441225304885\t94507.947648\t117226.529108\t59337.06039\t120960.176423\t7682.906987\n-14.7435118055059\t114132.898121\t104335.314956\t37663.26204\t95541.517117\t2681.304624\n-14.7429010805232\t36621.180725\t109342.185448\t48638.984185\t102144.441232\t20863.403928\n-14.7422903555406\t80220.043434\t95718'..b'3795.201705\t11045.412893\n--5.21375917665397\t53529.244462\t122604.270141\t56254.286804\t79138.11952\t28394.313375\n--5.2143699016366\t76777.870058\t139339.688146\t55795.986706\t114007.067861\t16416.989989\n--5.21498062661922\t87343.538217\t139417.131966\t41548.287371\t48901.259066\t35765.061465\n--5.21559135160184\t134376.402222\t123784.519485\t65088.404866\t96010.004818\t27851.231928\n--5.21620207658446\t110398.716299\t135340.968436\t67820.297567\t163884.59935\t15549.133317\n--5.21681280156709\t94719.832963\t98439.519016\t74404.036631\t66343.129291\t11486.596934\n--5.21742352654971\t77458.993866\t125545.79072\t57606.947453\t72707.310092\t15715.334629\n--5.21803425153233\t114782.143052\t119837.192763\t72920.080972\t116797.686405\t29247.140598\n--5.21864497651496\t104390.19186\t134116.91302\t18556.171689\t124759.126211\t12888.183822\n--5.21925570149758\t122508.383272\t146918.686771\t54925.216891\t107658.438015\t29523.200169\n--5.2198664264802\t100984.375867\t112925.918113\t43469.967405\t61097.641379\t26659.504725\n--5.22047715146283\t121244.681201\t115568.116341\t74418.008355\t133904.944345\t31476.021545\n--5.22108787644545\t95492.138209\t113321.364591\t41019.96692\t76947.770414\t5686.645329\n--5.22169860142807\t95746.006154\t114108.511928\t62765.614419\t79703.563319\t28143.730408\n--5.2223093264107\t65167.805146\t143017.871246\t79753.272518\t134138.935527\t15828.600113\n--5.22292005139332\t76232.676063\t158155.78001\t64355.02733\t130550.55296\t10972.069483\n--5.22353077637594\t39513.559138\t133432.052645\t78585.33843\t94604.67302\t24000.548272\n--5.22414150135857\t100788.060473\t151592.55936\t73633.588072\t99659.703826\t29790.322293\n--5.22475222634119\t90733.914786\t132182.593608\t56800.360801\t129667.91989\t41635.378802\n--5.22536295132381\t72054.198713\t164397.164937\t52492.108627\t113571.820311\t4351.434202\n--5.22597367630644\t97395.794519\t162706.603928\t66323.420709\t125015.897185\t23244.282805\n--5.22658440128906\t72239.294145\t187777.971768\t88127.734811\t84392.782361\t4374.024649\n--5.22719512627168\t80170.002331\t146058.841924\t77647.21693\t139254.682873\t21808.729605\n--5.22780585125431\t89543.26773\t177776.183084\t69545.56343\t109517.12696\t5177.19751\n--5.22841657623693\t57494.500232\t154857.451331\t64277.843009\t47242.514689\t28966.265866\n--5.22902730121955\t49784.792536\t177355.523207\t67276.427857\t118185.829721\t14990.215956\n--5.22963802620218\t82091.914529\t169953.1797\t83524.056125\t101572.093811\t13338.54061\n--5.2302487511848\t68709.162289\t179468.076431\t61888.709673\t124955.606009\t30568.714124\n--5.23085947616742\t46785.897343\t168554.803953\t77159.290517\t145300.786494\t7842.166664\n--5.23147020115004\t35805.92775\t184402.035985\t75064.431185\t95995.886342\t20962.600401\n--5.23208092613267\t49663.818141\t192694.720669\t44325.357693\t130868.687572\t22379.625682\n--5.23269165111529\t88776.054829\t156815.358793\t96997.946251\t126347.851106\t10890.318024\n--5.23330237609791\t65410.407657\t136984.455643\t81996.141767\t151575.60582\t15230.800861\n--5.23391310108054\t67569.366232\t190492.444327\t47139.131475\t116950.815303\t0\n--5.23452382606316\t40166.875766\t156406.715218\t38253.271008\t107543.642545\t15530.596971\n--5.23513455104578\t25837.407641\t148877.98073\t54664.787125\t82636.983843\t11077.776388\n--5.23574527602841\t51644.090578\t171898.479512\t62444.12625\t88887.725956\t0\n--5.23635600101103\t0\t168274.130156\t55697.445233\t103798.572923\t0\n--5.23696672599365\t0\t144523.773995\t55288.762151\t106073.227849\t8824.242922\n--5.23757745097628\t0\t167243.776449\t77491.944542\t79404.366635\t0\n--5.2381881759589\t0\t163484.769057\t57582.266016\t44248.087032\t6117.065798\n--5.23879890094152\t0\t151664.041336\t41750.009234\t91968.557069\t0\n--5.23940962592415\t0\t147258.620094\t39430.282189\t57015.926643\t0\n--5.24002035090677\t812043.565709\t82927.345515\t0\t6190.743301\t0\n--5.24063107588939\t815748.054046\t61483.703824\t0\t5500.392145\t0\n--5.24124180087202\t819446.322696\t81749.33671\t4368.559129\t0\t187711.210227\n--5.24185252585464\t823140.438734\t64686.665829\t0\t0\t188473.903958\n--5.24246325083726\t826832.059516\t0\t0\t0\t189236.026933\n--5.24307397581988\t830522.430824\t0\t0\t1034867.843743\t189997.864151\n--5.24368470080251\t834212.385026\t0\t571394.702131\t1040949.40358\t190759.605988\n' |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 test-data/NMR_ReadFids_dataMatrix.tabular --- a/test-data/NMR_ReadFids_dataMatrix.tabular Wed Mar 28 08:05:12 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
b'@@ -1,6 +0,0 @@\n-0\t3.56999999999999e-05\t7.13999999999998e-05\t0.0001071\t0.0001428\t0.000178499999999999\t0.000214199999999999\t0.000249899999999999\t0.000285599999999999\t0.000321299999999999\t0.000356999999999999\t0.000392699999999999\t0.000428399999999999\t0.000464099999999999\t0.000499799999999998\t0.000535499999999998\t0.000571199999999998\t0.000606899999999998\t0.000642599999999998\t0.000678299999999998\t0.000713999999999998\t0.000749699999999998\t0.000785399999999998\t0.000821099999999998\t0.000856799999999997\t0.000892499999999997\t0.000928199999999997\t0.000963899999999997\t0.000999599999999997\t0.0010353\t0.001071\t0.0011067\t0.0011424\t0.0011781\t0.0012138\t0.0012495\t0.0012852\t0.0013209\t0.0013566\t0.0013923\t0.001428\t0.0014637\t0.0014994\t0.0015351\t0.0015708\t0.0016065\t0.0016422\t0.00167789999999999\t0.00171359999999999\t0.00174929999999999\t0.00178499999999999\t0.00182069999999999\t0.00185639999999999\t0.00189209999999999\t0.00192779999999999\t0.00196349999999999\t0.00199919999999999\t0.00203489999999999\t0.00207059999999999\t0.00210629999999999\t0.00214199999999999\t0.00217769999999999\t0.00221339999999999\t0.00224909999999999\t0.00228479999999999\t0.00232049999999999\t0.00235619999999999\t0.00239189999999999\t0.00242759999999999\t0.00246329999999999\t0.00249899999999999\t0.00253469999999999\t0.00257039999999999\t0.00260609999999999\t0.00264179999999999\t0.00267749999999999\t0.00271319999999999\t0.00274889999999999\t0.00278459999999999\t0.00282029999999999\t0.00285599999999999\t0.00289169999999999\t0.00292739999999999\t0.00296309999999999\t0.00299879999999999\t0.00303449999999999\t0.00307019999999999\t0.00310589999999999\t0.00314159999999999\t0.00317729999999999\t0.00321299999999999\t0.00324869999999999\t0.00328439999999999\t0.00332009999999999\t0.00335579999999999\t0.00339149999999999\t0.00342719999999999\t0.00346289999999999\t0.00349859999999999\t0.00353429999999999\t0.00356999999999999\t0.00360569999999999\t0.00364139999999999\t0.00367709999999999\t0.00371279999999999\t0.00374849999999999\t0.00378419999999999\t0.00381989999999999\t0.00385559999999999\t0.00389129999999999\t0.00392699999999999\t0.00396269999999999\t0.00399839999999999\t0.00403409999999999\t0.00406979999999999\t0.00410549999999999\t0.00414119999999999\t0.00417689999999999\t0.00421259999999999\t0.00424829999999999\t0.00428399999999999\t0.00431969999999999\t0.00435539999999999\t0.00439109999999999\t0.00442679999999999\t0.00446249999999999\t0.00449819999999999\t0.00453389999999999\t0.00456959999999999\t0.00460529999999999\t0.00464099999999999\t0.00467669999999999\t0.00471239999999999\t0.00474809999999999\t0.00478379999999999\t0.00481949999999999\t0.00485519999999998\t0.00489089999999999\t0.00492659999999998\t0.00496229999999998\t0.00499799999999999\t0.00503369999999998\t0.00506939999999998\t0.00510509999999998\t0.00514079999999998\t0.00517649999999998\t0.00521219999999998\t0.00524789999999998\t0.00528359999999998\t0.00531929999999998\t0.00535499999999998\t0.00539069999999998\t0.00542639999999998\t0.00546209999999998\t0.00549779999999998\t0.00553349999999998\t0.00556919999999998\t0.00560489999999998\t0.00564059999999998\t0.00567629999999998\t0.00571199999999998\t0.00574769999999998\t0.00578339999999998\t0.00581909999999998\t0.00585479999999998\t0.00589049999999998\t0.00592619999999998\t0.00596189999999998\t0.00599759999999998\t0.00603329999999998\t0.00606899999999998\t0.00610469999999998\t0.00614039999999998\t0.00617609999999998\t0.00621179999999998\t0.00624749999999998\t0.00628319999999998\t0.00631889999999998\t0.00635459999999998\t0.00639029999999998\t0.00642599999999998\t0.00646169999999998\t0.00649739999999998\t0.00653309999999998\t0.00656879999999998\t0.00660449999999998\t0.00664019999999998\t0.00667589999999998\t0.00671159999999998\t0.00674729999999998\t0.00678299999999998\t0.00681869999999998\t0.00685439999999998\t0.00689009999999998\t0.00692579999999998\t0.00696149999999998\t0.00699719999999998\t0.00703289999999998\t0.00706859999999998\t0.00710429999999998\t0.00713999999999998\t0.00717569999999998\t0.00721139999999998\t0.00724709999999998\t0.00728279999999998\t0.00731849999999998\t0.00735419999999998\t0.00738989999999998\t0.00742559999999'..b'12-862i\t-334+248i\t498+744i\t719-92i\t27-800i\t-555+19i\t125+712i\t1008+67i\t536-610i\t-327-264i\t-99+741i\t830+273i\t664-396i\t-381-516i\t-295+454i\t668+386i\t592-476i\t-261-481i\t-716+277i\t234+603i\t880-319i\t132-458i\t-411+332i\t469+912i\t961-187i\t140-946i\t-435-2i\t170+613i\t696+346i\t235-754i\t-686+45i\t-256+1064i\t778+462i\t433-864i\t-26-502i\t-200+334i\t719+351i\t658-503i\t-143-667i\t-576+487i\t251+437i\t659-213i\t-221-550i\t-420+81i\t439+621i\t1077-149i\t208-710i\t-567-120i\t147+783i\t734-126i\t220-371i\t-430-280i\t-87+584i\t590+546i\t674-526i\t-358-232i\t-306+735i\t1015+344i\t907-573i\t-162-537i\t-571+230i\t442+417i\t1027-508i\t-103-635i\t-413+223i\t25+984i\t859+159i\t67-571i\t-481+14i\t405+681i\t675+132i\t441-452i\t-437-293i\t-203+487i\t504+196i\t417-310i\t-473-365i\t-252+632i\t381+379i\t823-373i\t-274-613i\t-377+360i\t403+591i\t921-217i\t-81-718i\t-769+255i\t153+607i\t934-192i\t158-727i\t-492+55i\t184+796i\t1025+183i\t425-555i\t-208-399i\t109+447i\t796+448i\t711-1017i\t-691-584i\t-355+320i\t397+510i\t534-616i\t-340-431i\t-469+462i\t350+936i\t735-304i\t59-621i\t-434+165i\t270+655i\t851-48i\t145-474i\t-465+76i\t135+543i\t673+258i\t260-579i\t-527-301i\t-193+608i\t951+231i\t715-570i\t-334-471i\t-294+455i\t528+505i\t721-420i\t-92-335i\t-519+330i\t377+526i\t730+17i\t-37-716i\t-583+179i\t356+403i\t583-41i\t-50-685i\t-686+139i\t-128+786i\t736+304i\t505-647i\t-915-167i\t62+535i\t675+386i\t576-662i\t-215-211i\t-191+590i\t846+427i\t546-390i\t-433-665i\t-443+342i\t395+374i\t312-266i\t-118-608i\t-465+283i\t358+729i\t1157-43i\t315-911i\t-387-146i\t215+513i\t894+35i\t348-865i\t-678-133i\t-330+775i\t892+302i\t577-415i\t-351-437i\t-350+607i\t834+595i\t670-636i\t-243-544i\t-399+520i\t466+559i\t826-399i\t56-612i\t-718+38i\t71+1006i\t1068+41i\t533-738i\t-317+203i\t11+738i\t981+17i\t693-702i\t-323-405i\t-259+531i\t809+80i\t460-849i\t-373-223i\t-603+492i\t596+483i\t776-439i\t-333-561i\t-276+343i\t446+676i\t648-288i\t-155-616i\t-459+190i\t361+549i\t697+82i\t31-713i\t-386+98i\t10+894i\t828+282i\t466-588i\t-829-370i\t-13+638i\t928+361i\t621-509i\t-407-364i\t-257+432i\t861+403i\t630-471i\t-30-605i\t-203+409i\t376+632i\t896-609i\t-102-861i\t-535+312i\t267+436i\t588-165i\t-82-705i\t-681+37i\t-95+640i\t681+94i\t271-489i\t-337-81i\t-140+691i\t798+173i\t657-719i\t-162-485i\t-89+366i\t673+438i\t552-638i\t-360-480i\t-167+342i\t827+605i\t841-176i\t135-337i\t-483+382i\t242+524i\t907+35i\t184-514i\t-600-204i\t84+629i\t576+52i\t216-434i\t-432-2i\t-284+878i\t1000+514i\t767-482i\t-246-593i\t-16+486i\t667+554i\t807-719i\t-490-431i\t-477+406i\t538+834i\t726-343i\t-177-294i\t-454+322i\t415+793i\t894-11i\t35-755i\t-348-51i\t443+802i\t931-71i\t370-910i\t-447-558i\t-208+538i\t711+390i\t405-726i\t-350-125i\t-368+487i\t662+658i\t627-404i\t-157-239i\t-414+548i\t414+568i\t726-389i\t-142-799i\t-578+206i\t118+845i\t717-46i\t37-343i\t-662+85i\t210+756i\t922+1i\t199-799i\t-440-389i\t-296+828i\t836+448i\t521-463i\t-408-464i\t-348+727i\t681+861i\t828-445i\t-361-487i\t-367+588i\t629+529i\t765-509i\t-380-540i\t-672+230i\t445+577i\t824-60i\t9-524i\t-764+36i\t-148+910i\t822+160i\t385-750i\t-396-175i\t-53+714i\t981+413i\t624-427i\t-371-287i\t-390+455i\t587+454i\t630-327i\t-277-627i\t-389+806i\t539+434i\t730-311i\t150-772i\t-287+246i\t251+783i\t768-137i\t30-452i\t-717-150i\t5+938i\t644+26i\t155-663i\t-575-107i\t-153+692i\t828+353i\t543-641i\t-180-575i\t-133+601i\t393+380i\t348-531i\t-435-418i\t-399+700i\t394+726i\t795-127i\t-246-350i\t-440+293i\t670+748i\t1045+224i\t56-708i\t-723+60i\t145+578i\t904+61i\t427-664i\t-514-229i\t135+719i\t781+431i\t602-590i\t-319-227i\t-336+577i\t582+313i\t662-773i\t-325-694i\t-531+251i\t199+400i\t518-335i\t-64-710i\t-679+310i\t319+831i\t885-89i\t74-574i\t-432+148i\t149+693i\t760-92i\t151-579i\t-450-297i\t-236+673i\t728+168i\t461-633i\t-474-207i\t-148+751i\t1029+485i\t793-584i\t-156-593i\t-168+153i\t595+609i\t715-447i\t-232-501i\t-714+7i\t302+800i\t751-232i\t145-694i\t-554+121i\t24+715i\t922-105i\t250-747i\t-555-207i\t-122+606i\t763+227i\t334-482i\t-435-235i\t-302+635i\t866+508i\t780-411i\t-401-678i\t-268+345i\t268+664i\t986-371i\t-76-811i\t-638+338i\t64+696i\t1009-395i\t415-523i\t-448+59i\t210+798i\t686+229i\t321-688i\t-519-222i\t-128+509i\t646-53i\t372-706i\t-645-262i\t-164+524i\t612+410i\t582-497i\t-214-375i\t-436+415i\t660+504i\t871-282i\t-119-712i\t-446+259i\t437+617i\t830-257i\t310-532i\t-715-203i\t-112+1075i\t652+166i\t259-330i\t-368-172i\t307+779i\t792+395i\n' |
b |
diff -r 5e64657b4fe5 -r 7d8451d9fff6 test-data/sampleMetadata.tabular --- a/test-data/sampleMetadata.tabular Wed Mar 28 08:05:12 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
b |
@@ -1,6 +0,0 @@ -TD BYTORDA DIGMOD DECIM DSPFVS SW_h SW O1 DT -ADG10003u_007 65536 1 1 12 12 14005.6022408964 20.0116255056133 3290.5 3.56999999999999e-05 -ADG10003u_009 65536 1 1 12 12 14005.6022408964 20.0116255056133 3290.5 3.56999999999999e-05 -ADG10003u_015 65536 1 1 12 12 14005.6022408964 20.0116255056133 3290.5 3.56999999999999e-05 -ADG10003u_017 65536 1 1 12 12 14005.6022408964 20.0116255056133 3290.5 3.56999999999999e-05 -ADG10003u_021 65536 1 1 12 12 14005.6022408964 20.0116255056133 3290.5 3.56999999999999e-05 |