# HG changeset patch
# User marie-tremblay-metatoul
# Date 1537530173 14400
# Node ID 0ff2d9211ebe3b093855665a753de088e03549b2
# Parent 9b45c0a33573dccbc3b337fbd164e2c9de014fed
planemo upload for repository https://github.com/workflow4metabolomics/nmr_annotation commit 3791815505685d0038e392a702860843fe1d443e
diff -r 9b45c0a33573 -r 0ff2d9211ebe DrawSpec.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawSpec.R Fri Sep 21 07:42:53 2018 -0400
@@ -0,0 +1,74 @@
+drawSpec <- function (X, startP = -1, endP = -1, groupLabel = NULL, useLog = -1, highBound = -1, lowBound = -1,
+ xlab = NULL, ylab = NULL, main = NULL, nAxisPos = 4, offside = 0)
+{
+ groupLabel_name = groupLabel
+ X = as.data.frame(X)
+# colnames(X) = c(1:ncol(X))
+ X = as.matrix(X)
+ if (highBound != -1) {
+ for (i in 1:nrow(X)) {
+ myIndex = which(X[i, ] > highBound)
+ X[i, myIndex] = highBound
+ }
+ }
+ if (lowBound != -1) {
+ for (i in 1:nrow(X)) {
+ myIndex = which(X[i, ] < lowBound)
+ X[i, myIndex] = lowBound
+ }
+ }
+ if (is.null(groupLabel)) {
+ groupLabel = c(1:nrow(X))
+ groupLabel = as.factor(groupLabel)
+ }
+ else {
+ levels(groupLabel) = c(1:length(levels(groupLabel)))
+ }
+ if (startP == -1)
+ startP = 1
+ if (endP == -1)
+ endP = ncol(X)
+ if (is.null(xlab)) {
+ xlab = "index"
+ }
+ if (is.null(ylab)) {
+ ylab = "intensity"
+ }
+ if (is.null(main)) {
+ main = paste(" ", startP + offside, "-", endP + offside)
+ }
+ GraphRange <- c(startP:endP)
+ yn <- X[, GraphRange]
+ if (useLog != -1)
+ yn = log(yn)
+ if (length(yn) > ncol(X))
+ {
+ plot(yn[1, ], ylim = c(min(yn), max(yn)), type = "n", ylab = ylab, xlab = xlab, main = main, xaxt = "n")
+ tempVal = trunc(length(GraphRange)/nAxisPos)
+ xPos = c(0:nAxisPos) * tempVal
+ axis(1, at = xPos, labels = colnames(X)[xPos + startP + offside])
+ for (i in 1:length(levels(groupLabel)))
+ {
+ groupLabelIdx = which(groupLabel == levels(groupLabel)[i])
+ color <- palette(rainbow(length(levels(groupLabel))))
+ for (j in 1:length(groupLabelIdx))
+ {
+ lines(yn[groupLabelIdx[j], ], col = color[i])
+ }
+ }
+ if (!is.null(groupLabel_name))
+ {
+ legendPos = "topleft"
+ legend(legendPos, levels(groupLabel_name), col = as.integer(levels(groupLabel)), text.col = "black", pch = c(19, 19), bg = "gray90")
+ }
+ }
+ if (length(yn) == ncol(X))
+ {
+ plot(yn, ylim = c(min(yn), max(yn)), type = "n", ylab = ylab, xlab = xlab, main = main, xaxt = "n")
+ tempVal = trunc(length(GraphRange)/nAxisPos)
+ xPos = c(0:nAxisPos) * tempVal
+# axis(1, at = xPos, labels = xPos + startP + offside)
+ axis(1, at = xPos, labels = colnames(X)[xPos + startP + offside])
+ lines(yn)
+ }
+}
\ No newline at end of file
diff -r 9b45c0a33573 -r 0ff2d9211ebe Library.Rdata
Binary file Library.Rdata has changed
diff -r 9b45c0a33573 -r 0ff2d9211ebe asics_wrapper.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/asics_wrapper.R Fri Sep 21 07:42:53 2018 -0400
@@ -0,0 +1,198 @@
+#!/usr/local/public/bin/Rscript --vanilla --slave --no-site-file
+
+## 29122017_asics_wrapper.R
+## Remi Servien, Patrick Tardivel, Marie Tremblay-Franco and Gaelle Lefort
+## marie.tremblay-franco@inra.fr
+
+runExampleL <- FALSE
+
+##------------------------------
+## Options
+##------------------------------
+strAsFacL <- options()$stringsAsFactors
+options(stringsAsFactors=FALSE)
+
+
+##------------------------------
+## Libraries loading
+##------------------------------
+# ParseCommandArgs function
+library(batch)
+library(ASICS)
+
+
+
+# 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("DrawSpec.R")
+
+
+##------------------------------
+## Errors ?????????????????????
+##------------------------------
+
+
+##------------------------------
+## Constants
+##------------------------------
+topEnvC <- environment()
+flagC <- "\n"
+
+
+##------------------------------
+## Script
+##------------------------------
+if(!runExampleL)
+ argLs <- parseCommandArgs(evaluate=FALSE)
+
+# Standards loading
+load(argLs[["standards"]])
+
+## Parameters Loading
+##-------------------
+# Inputs
+## Spectrum to annotate
+zipfile= argLs[["zipfile"]]
+directory=unzip(zipfile, list=F)
+directory=paste(getwd(),strsplit(directory[1],"/")[[1]][2],sep="/")
+
+
+##Exclusion zone(s)
+exclusionZones <- argLs[["zone_exclusion_choices.choice"]]
+exclusionZonesBorders <- NULL
+if (!is.null(argLs$zone_exclusion_left))
+{
+ for(i in which(names(argLs)=="zone_exclusion_left"))
+ {
+# exclusionZonesBorders <- c(exclusionZonesBorders,list(c(argLs[[i]],argLs[[i+1]])))
+ exclusionZonesBorders <- c(exclusionZonesBorders,argLs[[i]],argLs[[i+1]])
+ }
+ exclusionZonesBorders <- matrix(exclusionZonesBorders, byrow=T, ncol=2)
+}
+if (is.null(argLs$zone_exclusion_left))
+{
+ exclusionZonesBorders <- matrix(c(0,0), byrow=T, ncol=2)
+}
+## Maximal allowed shift
+shift <- argLs[["shift"]]
+
+## Graphical zone(s)
+graphicalZones <- argLs[["zone_graphical_choices.choice"]]
+graphicalZonesBorders <- NULL
+if (!is.null(argLs$zone_exclusion_left))
+{
+ for(i in which(names(argLs)=="zone_graphical_left"))
+ {
+ graphicalZonesBorders <- c(graphicalZonesBorders,list(c(argLs[[i]],argLs[[i+1]])))
+ }
+}
+
+# Outputs
+logOut <- argLs[["logOut"]]
+proportionEstimation <- argLs[["proportionEstimation"]]
+graphOut <- argLs[["graphOut"]]
+
+sink(logOut)
+cat("\tPACKAGE INFO\n")
+# pkgs=c("batch", "ASICS")
+pkgs=c("batch", "ASICS")
+for(pkg in pkgs) {
+ suppressPackageStartupMessages( stopifnot( library(pkg, quietly=TRUE, logical.return=TRUE, character.only=TRUE)))
+ cat(pkg,"\t",as.character(packageVersion(pkg)),"\n",sep="")
+}
+cat("\n")
+
+
+## Checking arguments
+##-------------------
+error.stock <- "\n"
+if(length(error.stock) > 1)
+ stop(error.stock)
+
+
+## Computation
+##------------
+# annotation.Asics <- ASICS(directory, exclusion.areas=matrix(exclusionZonesBorders, byrow=T, ncol=2),
+# max.shift=shift, which.spectra="last", library.metabolites=NULL,
+# threshold.noise=0.02, seed=1234, nb.iter.signif=400)
+annotation.Asics <- ASICS(directory, exclusion.areas=exclusionZonesBorders,
+ max.shift=shift, which.spectra="last", library.metabolites=NULL,
+ threshold.noise=0.02, seed=1234, nb.iter.signif=400)
+
+
+## Saving
+##-------
+# Identified metabolites
+metabolites.estimation <- present_metabolites(annotation.Asics)
+colnames(metabolites.estimation) <- c("Metabolite",colnames(metabolites.estimation)[-1])
+write.table(metabolites.estimation,file=argLs$proportionEstimation,row.names=FALSE,quote=FALSE,sep="\t")
+
+
+## Graphical display
+##------------------
+# Raw and annotated spectra comparison
+pdf(graphOut,onefile=TRUE)
+
+## Graphical output: overlay of raw and estimated spectra
+ppm.metabolites.estimation <- data.frame(round(ppm_grid(annotation.Asics),3),
+ original_mixture(annotation.Asics))
+colnames(ppm.metabolites.estimation) <- c("PPM", "EstimatedProportion")
+ppm.metabolites.estimation <- ppm.metabolites.estimation[order(ppm.metabolites.estimation[,1],decreasing=T), ]
+
+mix <- data.frame(t(ppm.metabolites.estimation[,2]))
+colnames(mix) <- ppm.metabolites.estimation[,1]
+ppm <- ppm.metabolites.estimation[,1]
+
+estimatedMix <- data.frame(round(ppm_grid(annotation.Asics),3), reconstituted_mixture(annotation.Asics))
+colnames(estimatedMix) <- c("PPM","EstimatedProportion")
+estimatedMix <- estimatedMix[order(estimatedMix[,1],decreasing=T), ]
+estimatedMix <- estimatedMix[,2]
+
+## Whole spectra
+GraphRange <- 1:ncol(mix)
+tempVal <- trunc(length(GraphRange)/10)
+xPos <- c(10:0) * tempVal
+plot(1:ncol(mix), mix, type='l', xlab="", main="", xaxt="n", ylab="")
+axis(1, at=xPos, labels=colnames(mix)[xPos + 1])
+lines(estimatedMix, col="red")
+legend("topleft",legend=c("Real Mixture","Estimated Composition"),lty=c(1,1),col=c("black","red"))
+
+## Zoomed spectral window depending on user-selected zone(s)
+graphical.zone.length <- length(graphicalZonesBorders)
+if (graphical.zone.length != 0)
+
+ # par(mfrow=c(2,1))
+for (g in 1:graphical.zone.length)
+ {
+ print(g)
+ plot(1:length((which(round(as.numeric(colnames(mix)),2) == graphicalZonesBorders[[g]][1])[1]):(which(round(as.numeric(colnames(mix)),2) == max(graphicalZonesBorders[[g]][2],0.5))[1])),
+ mix[(which(round(as.numeric(colnames(mix)),2) == graphicalZonesBorders[[g]][1])[1]):(which(round(as.numeric(colnames(mix)),2) == max(graphicalZonesBorders[[g]][2],0.5))[1])], type='l', xlab="", ylab="Intensity", main="", xaxt="n")
+ lines(estimatedMix[(which(round(as.numeric(colnames(mix)),2) == graphicalZonesBorders[[g]][1])[1]):(which(round(as.numeric(colnames(mix)),2) == max(graphicalZonesBorders[[g]][2],0.5))[1])],col="red")
+
+ xPos <- 1
+ nAxisPos <- 4
+ startP <- length(nAxisPos)
+ endP <- length((which(round(as.numeric(colnames(mix)),2) == graphicalZonesBorders[[g]][1])[1]):(which(round(as.numeric(colnames(mix)),2) == max(graphicalZonesBorders[[g]][2],0.5))[1]))
+ GraphRange <- c(startP:endP)
+ tempVal <- trunc(length(GraphRange)/nAxisPos)
+ xPos <- c(0:nAxisPos) * tempVal
+ noms <- ppm.metabolites.estimation[xPos + which(ppm == round(graphicalZonesBorders[[g]][1],1))[1],1]
+ axis(1, at=xPos, labels=noms)
+ }
+
+invisible(dev.off())
+
+
+## Ending
+##---------------------
+cat("\nEnd of 'NMR annotation' Galaxy module call: ", as.character(Sys.time()), sep="")
+options(stringsAsFactors=strAsFacL)
+rm(list=ls())
+sink()
+
diff -r 9b45c0a33573 -r 0ff2d9211ebe asics_xml.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/asics_xml.xml Fri Sep 21 07:42:53 2018 -0400
@@ -0,0 +1,226 @@
+
+
+ Annotation of complex mixture NMR spectra and metabolite proportion estimation
+
+
+ r-batch
+ r-asics
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 10.1007/s11306-017-1244-5
+ 10.1093/bioinformatics/btu813
+
+
+
diff -r 9b45c0a33573 -r 0ff2d9211ebe nmr_annotation/.gitignore
--- a/nmr_annotation/.gitignore Mon Sep 03 08:45:57 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-tool_test_output.html
-tool_test_output.json
-*~
diff -r 9b45c0a33573 -r 0ff2d9211ebe nmr_annotation/.travis.yml
--- a/nmr_annotation/.travis.yml Mon Sep 03 08:45:57 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-
-# This is a special configuration file to run tests on Travis-CI via
-# GitHub notifications when changes are committed.
-#
-# See http://travis-ci.org/ for details
-language: python
-
-before_install:
- - sudo apt-get install -y python-virtualenv
- - virtualenv planemo-venv
- - . planemo-venv/bin/activate
- - pip install --upgrade pip setuptools
- - pip install planemo
-
-script:
- - planemo lint ${TRAVIS_BUILD_DIR}/galaxy/nmr_annotation/
- - planemo test --conda_auto_init --conda_auto_install --conda_dependency_resolution --galaxy_branch release_17.05 --no_cache_galaxy ${TRAVIS_BUILD_DIR}/galaxy/nmr_annotation/
diff -r 9b45c0a33573 -r 0ff2d9211ebe nmr_annotation/README.md
--- a/nmr_annotation/README.md Mon Sep 03 08:45:57 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-NMR Annotation for Galaxy
-========================
-
-[![bioconda-badge](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat-square)](http://bioconda.github.io) [![Build Status](https://travis-ci.org/workflow4metabolomics/nmr_annotation.svg?branch=master)](https://travis-ci.org/workflow4metabolomics/nmr_annotation)
-
-Our project
------------
-The [Workflow4Metabolomics](http://workflow4metabolomics.org), W4M in short, is a French infrastructure offering software tool processing, analyzing and annotating metabolomics data. It is based on the Galaxy platform.
-
-
-NMR Annotation
---------------
-Annotation of complex mixture NMR spectra and metabolite proportion estimation
-
-
-Galaxy
-------
-Galaxy is an open, web-based platform for data intensive biomedical research. Whether on the free public server or your own instance, you can perform, reproduce, and share complete analyses.
-
-Homepage: [https://galaxyproject.org/](https://galaxyproject.org/)
-
-
-Dependencies using Conda
-------------------------
-[![bioconda-badge](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat-square)](http://bioconda.github.io)
-
-#The main recipe: [https://github.com/bioconda/bioconda-recipes/tree/master/recipes/r-speaq](https://github.com/bioconda/bioconda-recipes/tree/master/recipes/r-speaq)
-
-```
-#To install miniconda2
-#http://conda.pydata.org/miniconda.html
-#To set an environment:
-conda create -n nmr_annotation r-batch r-asics`
-#To activate the environment:
-. activate nmr_annotation
-```
-
-[Conda](http://conda.pydata.org/) is package manager that among many other things can be used to manage Python packages.
-
-Travis
-------
-[![Build Status](https://travis-ci.org/workflow4metabolomics/nmr_annotation.svg?branch=master)](https://travis-ci.org/workflow4metabolomics/nmr_annotation)
-
-Test and Deploy with Confidence. Easily sync your GitHub projects with Travis CI and you'll be testing your code in minutes!
-
-Historic contributors
----------------------
- - Marie Tremblay-Franco @mtremblayfr - [French Metabolomics and Fluxomics Infrastructure (MetaboHUB)](http://www.metabohub.fr/en) - [MetaToul](http://www.metatoul.fr/)
- - Gildas Le Corguillé @lecorguille - [ABiMS](http://abims.sb-roscoff.fr/) / [IFB](http://www.france-bioinformatique.fr/) - [UPMC](www.upmc.fr)/[CNRS](www.cnrs.fr) - [Station Biologique de Roscoff](http://www.sb-roscoff.fr/) - France
diff -r 9b45c0a33573 -r 0ff2d9211ebe nmr_annotation/galaxy/nmr_annotation/.shed
--- a/nmr_annotation/galaxy/nmr_annotation/.shed Mon Sep 03 08:45:57 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-categories: [Metabolomics]
-description: '[Metabolomics][W4M][NMR] NMR Annotation - Annotation of complex mixture NMR spectra and metabolite proportion estimation'
-homepage_url: http://workflow4metabolomics.org
-long_description: 'Part of the W4M project: http://workflow4metabolomics.org'
-name: nmr_annotation
-owner: marie-tremblay-metatoul
-remote_repository_url: https://github.com/workflow4metabolomics/nmr_annotation
diff -r 9b45c0a33573 -r 0ff2d9211ebe nmr_annotation/galaxy/nmr_annotation/DrawSpec.R
--- a/nmr_annotation/galaxy/nmr_annotation/DrawSpec.R Mon Sep 03 08:45:57 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-drawSpec <- function (X, startP = -1, endP = -1, groupLabel = NULL, useLog = -1, highBound = -1, lowBound = -1,
- xlab = NULL, ylab = NULL, main = NULL, nAxisPos = 4, offside = 0)
-{
- groupLabel_name = groupLabel
- X = as.data.frame(X)
-# colnames(X) = c(1:ncol(X))
- X = as.matrix(X)
- if (highBound != -1) {
- for (i in 1:nrow(X)) {
- myIndex = which(X[i, ] > highBound)
- X[i, myIndex] = highBound
- }
- }
- if (lowBound != -1) {
- for (i in 1:nrow(X)) {
- myIndex = which(X[i, ] < lowBound)
- X[i, myIndex] = lowBound
- }
- }
- if (is.null(groupLabel)) {
- groupLabel = c(1:nrow(X))
- groupLabel = as.factor(groupLabel)
- }
- else {
- levels(groupLabel) = c(1:length(levels(groupLabel)))
- }
- if (startP == -1)
- startP = 1
- if (endP == -1)
- endP = ncol(X)
- if (is.null(xlab)) {
- xlab = "index"
- }
- if (is.null(ylab)) {
- ylab = "intensity"
- }
- if (is.null(main)) {
- main = paste(" ", startP + offside, "-", endP + offside)
- }
- GraphRange <- c(startP:endP)
- yn <- X[, GraphRange]
- if (useLog != -1)
- yn = log(yn)
- if (length(yn) > ncol(X))
- {
- plot(yn[1, ], ylim = c(min(yn), max(yn)), type = "n", ylab = ylab, xlab = xlab, main = main, xaxt = "n")
- tempVal = trunc(length(GraphRange)/nAxisPos)
- xPos = c(0:nAxisPos) * tempVal
- axis(1, at = xPos, labels = colnames(X)[xPos + startP + offside])
- for (i in 1:length(levels(groupLabel)))
- {
- groupLabelIdx = which(groupLabel == levels(groupLabel)[i])
- color <- palette(rainbow(length(levels(groupLabel))))
- for (j in 1:length(groupLabelIdx))
- {
- lines(yn[groupLabelIdx[j], ], col = color[i])
- }
- }
- if (!is.null(groupLabel_name))
- {
- legendPos = "topleft"
- legend(legendPos, levels(groupLabel_name), col = as.integer(levels(groupLabel)), text.col = "black", pch = c(19, 19), bg = "gray90")
- }
- }
- if (length(yn) == ncol(X))
- {
- plot(yn, ylim = c(min(yn), max(yn)), type = "n", ylab = ylab, xlab = xlab, main = main, xaxt = "n")
- tempVal = trunc(length(GraphRange)/nAxisPos)
- xPos = c(0:nAxisPos) * tempVal
-# axis(1, at = xPos, labels = xPos + startP + offside)
- axis(1, at = xPos, labels = colnames(X)[xPos + startP + offside])
- lines(yn)
- }
-}
\ No newline at end of file
diff -r 9b45c0a33573 -r 0ff2d9211ebe nmr_annotation/galaxy/nmr_annotation/Library.Rdata
Binary file nmr_annotation/galaxy/nmr_annotation/Library.Rdata has changed
diff -r 9b45c0a33573 -r 0ff2d9211ebe nmr_annotation/galaxy/nmr_annotation/asics_wrapper.R
--- a/nmr_annotation/galaxy/nmr_annotation/asics_wrapper.R Mon Sep 03 08:45:57 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,198 +0,0 @@
-#!/usr/local/public/bin/Rscript --vanilla --slave --no-site-file
-
-## 29122017_asics_wrapper.R
-## Remi Servien, Patrick Tardivel, Marie Tremblay-Franco and Gaelle Lefort
-## marie.tremblay-franco@inra.fr
-
-runExampleL <- FALSE
-
-##------------------------------
-## Options
-##------------------------------
-strAsFacL <- options()$stringsAsFactors
-options(stringsAsFactors=FALSE)
-
-
-##------------------------------
-## Libraries loading
-##------------------------------
-# ParseCommandArgs function
-library(batch)
-library(ASICS)
-
-
-
-# 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("DrawSpec.R")
-
-
-##------------------------------
-## Errors ?????????????????????
-##------------------------------
-
-
-##------------------------------
-## Constants
-##------------------------------
-topEnvC <- environment()
-flagC <- "\n"
-
-
-##------------------------------
-## Script
-##------------------------------
-if(!runExampleL)
- argLs <- parseCommandArgs(evaluate=FALSE)
-
-# Standards loading
-load(argLs[["standards"]])
-
-## Parameters Loading
-##-------------------
-# Inputs
-## Spectrum to annotate
-zipfile= argLs[["zipfile"]]
-directory=unzip(zipfile, list=F)
-directory=paste(getwd(),strsplit(directory[1],"/")[[1]][2],sep="/")
-
-
-##Exclusion zone(s)
-exclusionZones <- argLs[["zone_exclusion_choices.choice"]]
-exclusionZonesBorders <- NULL
-if (!is.null(argLs$zone_exclusion_left))
-{
- for(i in which(names(argLs)=="zone_exclusion_left"))
- {
-# exclusionZonesBorders <- c(exclusionZonesBorders,list(c(argLs[[i]],argLs[[i+1]])))
- exclusionZonesBorders <- c(exclusionZonesBorders,argLs[[i]],argLs[[i+1]])
- }
- exclusionZonesBorders <- matrix(exclusionZonesBorders, byrow=T, ncol=2)
-}
-if (is.null(argLs$zone_exclusion_left))
-{
- exclusionZonesBorders <- matrix(c(0,0), byrow=T, ncol=2)
-}
-## Maximal allowed shift
-shift <- argLs[["shift"]]
-
-## Graphical zone(s)
-graphicalZones <- argLs[["zone_graphical_choices.choice"]]
-graphicalZonesBorders <- NULL
-if (!is.null(argLs$zone_exclusion_left))
-{
- for(i in which(names(argLs)=="zone_graphical_left"))
- {
- graphicalZonesBorders <- c(graphicalZonesBorders,list(c(argLs[[i]],argLs[[i+1]])))
- }
-}
-
-# Outputs
-logOut <- argLs[["logOut"]]
-proportionEstimation <- argLs[["proportionEstimation"]]
-graphOut <- argLs[["graphOut"]]
-
-sink(logOut)
-cat("\tPACKAGE INFO\n")
-# pkgs=c("batch", "ASICS")
-pkgs=c("batch", "ASICS")
-for(pkg in pkgs) {
- suppressPackageStartupMessages( stopifnot( library(pkg, quietly=TRUE, logical.return=TRUE, character.only=TRUE)))
- cat(pkg,"\t",as.character(packageVersion(pkg)),"\n",sep="")
-}
-cat("\n")
-
-
-## Checking arguments
-##-------------------
-error.stock <- "\n"
-if(length(error.stock) > 1)
- stop(error.stock)
-
-
-## Computation
-##------------
-# annotation.Asics <- ASICS(directory, exclusion.areas=matrix(exclusionZonesBorders, byrow=T, ncol=2),
-# max.shift=shift, which.spectra="last", library.metabolites=NULL,
-# threshold.noise=0.02, seed=1234, nb.iter.signif=400)
-annotation.Asics <- ASICS(directory, exclusion.areas=exclusionZonesBorders,
- max.shift=shift, which.spectra="last", library.metabolites=NULL,
- threshold.noise=0.02, seed=1234, nb.iter.signif=400)
-
-
-## Saving
-##-------
-# Identified metabolites
-metabolites.estimation <- present_metabolites(annotation.Asics)
-colnames(metabolites.estimation) <- c("Metabolite",colnames(metabolites.estimation)[-1])
-write.table(metabolites.estimation,file=argLs$proportionEstimation,row.names=FALSE,quote=FALSE,sep="\t")
-
-
-## Graphical display
-##------------------
-# Raw and annotated spectra comparison
-pdf(graphOut,onefile=TRUE)
-
-## Graphical output: overlay of raw and estimated spectra
-ppm.metabolites.estimation <- data.frame(round(ppm_grid(annotation.Asics),3),
- original_mixture(annotation.Asics))
-colnames(ppm.metabolites.estimation) <- c("PPM", "EstimatedProportion")
-ppm.metabolites.estimation <- ppm.metabolites.estimation[order(ppm.metabolites.estimation[,1],decreasing=T), ]
-
-mix <- data.frame(t(ppm.metabolites.estimation[,2]))
-colnames(mix) <- ppm.metabolites.estimation[,1]
-ppm <- ppm.metabolites.estimation[,1]
-
-estimatedMix <- data.frame(round(ppm_grid(annotation.Asics),3), reconstituted_mixture(annotation.Asics))
-colnames(estimatedMix) <- c("PPM","EstimatedProportion")
-estimatedMix <- estimatedMix[order(estimatedMix[,1],decreasing=T), ]
-estimatedMix <- estimatedMix[,2]
-
-## Whole spectra
-GraphRange <- 1:ncol(mix)
-tempVal <- trunc(length(GraphRange)/10)
-xPos <- c(10:0) * tempVal
-plot(1:ncol(mix), mix, type='l', xlab="", main="", xaxt="n", ylab="")
-axis(1, at=xPos, labels=colnames(mix)[xPos + 1])
-lines(estimatedMix, col="red")
-legend("topleft",legend=c("Real Mixture","Estimated Composition"),lty=c(1,1),col=c("black","red"))
-
-## Zoomed spectral window depending on user-selected zone(s)
-graphical.zone.length <- length(graphicalZonesBorders)
-if (graphical.zone.length != 0)
-
- # par(mfrow=c(2,1))
-for (g in 1:graphical.zone.length)
- {
- print(g)
- plot(1:length((which(round(as.numeric(colnames(mix)),2) == graphicalZonesBorders[[g]][1])[1]):(which(round(as.numeric(colnames(mix)),2) == max(graphicalZonesBorders[[g]][2],0.5))[1])),
- mix[(which(round(as.numeric(colnames(mix)),2) == graphicalZonesBorders[[g]][1])[1]):(which(round(as.numeric(colnames(mix)),2) == max(graphicalZonesBorders[[g]][2],0.5))[1])], type='l', xlab="", ylab="Intensity", main="", xaxt="n")
- lines(estimatedMix[(which(round(as.numeric(colnames(mix)),2) == graphicalZonesBorders[[g]][1])[1]):(which(round(as.numeric(colnames(mix)),2) == max(graphicalZonesBorders[[g]][2],0.5))[1])],col="red")
-
- xPos <- 1
- nAxisPos <- 4
- startP <- length(nAxisPos)
- endP <- length((which(round(as.numeric(colnames(mix)),2) == graphicalZonesBorders[[g]][1])[1]):(which(round(as.numeric(colnames(mix)),2) == max(graphicalZonesBorders[[g]][2],0.5))[1]))
- GraphRange <- c(startP:endP)
- tempVal <- trunc(length(GraphRange)/nAxisPos)
- xPos <- c(0:nAxisPos) * tempVal
- noms <- ppm.metabolites.estimation[xPos + which(ppm == round(graphicalZonesBorders[[g]][1],1))[1],1]
- axis(1, at=xPos, labels=noms)
- }
-
-invisible(dev.off())
-
-
-## Ending
-##---------------------
-cat("\nEnd of 'NMR annotation' Galaxy module call: ", as.character(Sys.time()), sep="")
-options(stringsAsFactors=strAsFacL)
-rm(list=ls())
-sink()
-
diff -r 9b45c0a33573 -r 0ff2d9211ebe nmr_annotation/galaxy/nmr_annotation/asics_xml.xml
--- a/nmr_annotation/galaxy/nmr_annotation/asics_xml.xml Mon Sep 03 08:45:57 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,226 +0,0 @@
-
-
- Annotation of complex mixture NMR spectra and metabolite proportion estimation
-
-
- r-batch
- r-asics
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 10.1007/s11306-017-1244-5
- 10.1093/bioinformatics/btu813
-
-
-
diff -r 9b45c0a33573 -r 0ff2d9211ebe nmr_annotation/galaxy/nmr_annotation/static/images/NmrAnnotation_ASICS.png
Binary file nmr_annotation/galaxy/nmr_annotation/static/images/NmrAnnotation_ASICS.png has changed
diff -r 9b45c0a33573 -r 0ff2d9211ebe nmr_annotation/galaxy/nmr_annotation/test-data/ADG_007.zip
Binary file nmr_annotation/galaxy/nmr_annotation/test-data/ADG_007.zip has changed
diff -r 9b45c0a33573 -r 0ff2d9211ebe nmr_annotation/galaxy/nmr_annotation/test-data/MTBLS1_177_NMR_Annotation.pdf
Binary file nmr_annotation/galaxy/nmr_annotation/test-data/MTBLS1_177_NMR_Annotation.pdf has changed
diff -r 9b45c0a33573 -r 0ff2d9211ebe nmr_annotation/galaxy/nmr_annotation/test-data/MTBLS1_177_NMR_Annotation_proportionEstimation.tabular
--- a/nmr_annotation/galaxy/nmr_annotation/test-data/MTBLS1_177_NMR_Annotation_proportionEstimation.tabular Mon Sep 03 08:45:57 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-Metabolite Relative_Concentration
-Creatinine 0.0569174516124917
-Citrate 0.0285947900676533
-AceticAcid 0.00931139835139612
-L-Glycine 0.00700618802859799
-ThreonicAcid 0.00312228402191229
-Lactose 0.00274471352269867
-Malonate 0.0026239869463794
-Indoxylsulfate 0.00256983041226207
-L-Arabitol 0.00247809838365845
-L-GlutamicAcid 0.00219750986486448
-Threitol 0.00185008716865122
-L-Alanine 0.00176514469439213
-HippuricAcid 0.00173759535227614
-Betaine 0.00163016358478906
-MalicAcid 0.00154536802871288
-1,3-Diaminopropane 0.00150129592201832
-2-oxoglutarate 0.00142533208121273
-Dimethylamine 0.00131575320617744
-L-Aspartate 0.00127266582522283
-AscorbicAcid 0.00100873973025415
-L-Asparagine 0.00099187237086438
-GuanidinoaceticAcid 0.000925290560878349
-Ethanolamine 0.00089279079362688
-Glycerol 0.00088244833185825
-5,6-Dihydro-5-Methyluracil 0.000849548732878672
-Creatine 0.00079525125560122
-MethylmalonicAcid 0.000792506060661937
-Xylitol 0.000787992683508674
-Taurine 0.000787744798563012
-Succinate 0.000527784171596945
-4-HydroxyphenylAceticAcid 0.000522123163032416
-Methylguanidine 0.000486125204031847
-Myo-Inositol 0.0004425385208034
-beta-HydroxyisovalericAcid 0.000419265217514307
-Propionate 0.000392879831159886
-TMAO 0.000391632855219129
-L-Valine 0.000329117139315598
-Isobutyrate 0.000312582908447652
-CholineChloride 0.000306877971629503
diff -r 9b45c0a33573 -r 0ff2d9211ebe static/images/NmrAnnotation_ASICS.png
Binary file static/images/NmrAnnotation_ASICS.png has changed
diff -r 9b45c0a33573 -r 0ff2d9211ebe test-data/ADG_007.zip
Binary file test-data/ADG_007.zip has changed
diff -r 9b45c0a33573 -r 0ff2d9211ebe test-data/MTBLS1_177_NMR_Annotation.pdf
Binary file test-data/MTBLS1_177_NMR_Annotation.pdf has changed
diff -r 9b45c0a33573 -r 0ff2d9211ebe test-data/MTBLS1_177_NMR_Annotation_proportionEstimation.tabular
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/MTBLS1_177_NMR_Annotation_proportionEstimation.tabular Fri Sep 21 07:42:53 2018 -0400
@@ -0,0 +1,40 @@
+Metabolite Relative_Concentration
+Creatinine 0.0569174516124917
+Citrate 0.0285947900676533
+AceticAcid 0.00931139835139612
+L-Glycine 0.00700618802859799
+ThreonicAcid 0.00312228402191229
+Lactose 0.00274471352269867
+Malonate 0.0026239869463794
+Indoxylsulfate 0.00256983041226207
+L-Arabitol 0.00247809838365845
+L-GlutamicAcid 0.00219750986486448
+Threitol 0.00185008716865122
+L-Alanine 0.00176514469439213
+HippuricAcid 0.00173759535227614
+Betaine 0.00163016358478906
+MalicAcid 0.00154536802871288
+1,3-Diaminopropane 0.00150129592201832
+2-oxoglutarate 0.00142533208121273
+Dimethylamine 0.00131575320617744
+L-Aspartate 0.00127266582522283
+AscorbicAcid 0.00100873973025415
+L-Asparagine 0.00099187237086438
+GuanidinoaceticAcid 0.000925290560878349
+Ethanolamine 0.00089279079362688
+Glycerol 0.00088244833185825
+5,6-Dihydro-5-Methyluracil 0.000849548732878672
+Creatine 0.00079525125560122
+MethylmalonicAcid 0.000792506060661937
+Xylitol 0.000787992683508674
+Taurine 0.000787744798563012
+Succinate 0.000527784171596945
+4-HydroxyphenylAceticAcid 0.000522123163032416
+Methylguanidine 0.000486125204031847
+Myo-Inositol 0.0004425385208034
+beta-HydroxyisovalericAcid 0.000419265217514307
+Propionate 0.000392879831159886
+TMAO 0.000391632855219129
+L-Valine 0.000329117139315598
+Isobutyrate 0.000312582908447652
+CholineChloride 0.000306877971629503