Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single file #5

Merged
merged 3 commits into from
Feb 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ before_install:
- virtualenv planemo-venv
- . planemo-venv/bin/activate
- pip install --upgrade pip setuptools
- pip install planemo
- planemo conda_init

install:
- planemo conda_install ${TRAVIS_BUILD_DIR}/galaxy/probmetab
- pip install planemo==0.37.0

script:
- planemo test --install_galaxy --no_cache_galaxy --conda_dependency_resolution ${TRAVIS_BUILD_DIR}/galaxy/probmetab
- planemo lint ${TRAVIS_BUILD_DIR}/galaxy/probmetab
- planemo test --conda_auto_init --conda_auto_install --conda_dependency_resolution --galaxy_branch release_17.01 --no_cache_galaxy ${TRAVIS_BUILD_DIR}/galaxy/probmetab

276 changes: 153 additions & 123 deletions galaxy/probmetab/ProbMetab.xml

Large diffs are not rendered by default.

12 changes: 4 additions & 8 deletions galaxy/probmetab/README.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
Changelog/News
--------------

**Version 1.1.0 - 15/02/2017**

- IMPROVEMENT: Probmetab is now compatible with merged individual data from xcms.xcmsSet

**Version 1.0.1 - 16/05/2016**

- TEST: refactoring to pass planemo test using conda dependencies


**Version 1.0.0 - 10/06/2015**

- NEW: ProbMetab first version


Test Status
-----------

Planemo test using conda: passed

Planemo shed_test : passed
511 changes: 295 additions & 216 deletions galaxy/probmetab/lib.r

Large diffs are not rendered by default.

110 changes: 90 additions & 20 deletions galaxy/probmetab/macros.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,99 @@
<token name="@COMMAND_CAMERA_SCRIPT@">
LANG=C Rscript $__tool_directory__/probmetab.r
</token>

<!-- zipfile load for planemo test -->
<token name="@COMMAND_ZIPFILE_LOAD@">
#if $zipfile_load_conditional.zipfile_load_select == "yes":
#if $zipfile_load_conditional.zip_file:
zipfile $zipfile_load_conditional.zip_file

<token name="@COMMAND_LOG_EXIT@">
;
return=\$?;
mv log.txt '$log';
cat '$log';
sh -c "exit \$return"
</token>

<!-- raw file load for planemo test -->
<token name="@COMMAND_FILE_LOAD_NEUTRAL@">
#if $file_load_section_selected.file_load_conditional.file_load_select == "yes":
#if $file_load_section_selected.file_load_conditional.inputs.input == "zip_file":
zipfile$polarity '$file_load_section_selected.file_load_conditional.inputs.zip_file'
#else
#set singlefile_galaxyPath = ','.join( [ str( $single_file ) for $single_file in $file_load_section_selected.file_load_conditional.inputs.single_file ] )
#set singlefile_sampleName = ','.join( [ str( $single_file.name ) for $single_file in $file_load_section_selected.file_load_conditional.inputs.single_file ] )

singlefile_galaxyPath$polarity '$singlefile_galaxyPath'
singlefile_sampleName$polarity '$singlefile_sampleName'
#end if
#end if
#end if
</token>

<token name="@COMMAND_FILE_LOAD_ONE@">
#set file_load_section_selected = $file_load_section
#set polarity=""
@COMMAND_FILE_LOAD_NEUTRAL@
</token>

<token name="@COMMAND_FILE_LOAD_POSITIVE@">
#set file_load_section_selected = $file_load_sectionPositive
#set polarity="Positive"
@COMMAND_FILE_LOAD_NEUTRAL@
</token>
<xml name="zipfile_load">
<conditional name="zipfile_load_conditional">
<param name="zipfile_load_select" type="select" label="Resubmit your zip file" help="Use only if you get a message which say that your original zip file have been deleted on the server." >
<option value="no" >no need</option>
<option value="yes" selected="peakgroups">yes</option>
</param>
<when value="no">
</when>
<when value="yes">
<param name="zip_file" type="data" format="no_unzip.zip,zip" label="Zip file" />
</when>
</conditional>

<token name="@COMMAND_FILE_LOAD_NEGATIVE@">
#set file_load_section_selected = $file_load_sectionNegative
#set polarity="Negative"
@COMMAND_FILE_LOAD_NEUTRAL@
</token>

<xml name="input_file_load" token_polarity="">
<section name="file_load_section@POLARITY@" title="@POLARITY@ Resubmit your raw dataset or your zip file">
<conditional name="file_load_conditional">
<param name="file_load_select" type="select" label="@POLARITY@ Resubmit your dataset or your zip file" help="Use only if you get a message which say that your original dataset or zip file have been deleted on the server." >
<option value="no" >no need</option>
<option value="yes" >yes</option>
</param>
<when value="no">
</when>
<when value="yes">
<conditional name="inputs">
<param name="input" type="select" label="Choose your inputs method" >
<option value="zip_file" selected="true">Zip file from your history containing your chromatograms</option>
<option value="single_file">A mzXML or netCDF file from your history</option>
</param>
<when value="zip_file">
<param name="zip_file" type="data" format="no_unzip.zip,zip" label="Zip file" />
</when>
<when value="single_file">
<param name="single_file" type="data" format="mzxml,netcdf" label="Single file" multiple="true"/>
</when>
</conditional>
</when>
</conditional>
</section>
</xml>

<xml name="test_file_load_zip">
<section name="file_load_section">
<conditional name="file_load_conditional">
<param name="file_load_select" value="yes" />
<conditional name="inputs">
<param name="input" value="zip_file" />
<param name="zip_file" value="faahKO_reduce.zip" ftype="zip" />
</conditional>
</conditional>
</section>
</xml>

<xml name="test_file_load_single" token_polarity="">>
<section name="file_load_section@POLARITY@">
<conditional name="file_load_conditional">
<param name="file_load_select" value="yes" />
<conditional name="inputs">
<param name="input" value="single_file" />
<param name="single_file" value="wt15.CDF,ko16.CDF,ko15.CDF,wt16.CDF" ftype="netcdf" />
</conditional>
</conditional>
</section>
</xml>

<token name="@HELP_AUTHORS@">
.. class:: infomark

Expand Down
122 changes: 54 additions & 68 deletions galaxy/probmetab/probmetab.r
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@


# ----- LOG -----
log_file=file("probmetab.log", open = "wt")
log_file=file("log.txt", open = "wt")
sink(log_file)
sink(log_file, type = "out")

# ----- PACKAGE -----
cat("\tPACKAGE INFO\n")
pkgs=c("parallel","BiocGenerics", "Biobase", "Rcpp", "mzR", "igraph", "xcms","snow","CAMERA","batch","ProbMetab")
for(p in pkgs) {
suppressWarnings( suppressPackageStartupMessages( stopifnot( library(p, quietly=TRUE, logical.return=TRUE, character.only=TRUE))))
cat(p,"\t",as.character(packageVersion(p)),"\n",sep="")
suppressWarnings( suppressPackageStartupMessages( stopifnot( library(p, quietly=TRUE, logical.return=TRUE, character.only=TRUE))))
cat(p,"\t",as.character(packageVersion(p)),"\n",sep="")
}

source_local <- function(fname){
Expand All @@ -22,8 +22,10 @@ source_local <- function(fname){
source(paste(base_dir, fname, sep="/"))
}
cat("\n\n")


# ----- ARGUMENTS -----
cat("\tARGUMENTS INFO\n")
cat("\tARGUMENTS INFO\n")
listArguments = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
write.table(as.matrix(listArguments), col.names=F, quote=F, sep='\t')

Expand All @@ -35,68 +37,53 @@ cat("\tINFILE PROCESSING INFO\n")
# ----- INFILE PROCESSING -----

if(listArguments[["mode_acquisition"]]=="one") {
load(listArguments[["xa"]])

if (!is.null(listArguments[["zipfile"]])){
zipfile= listArguments[["zipfile"]]; listArguments[["zipfile"]]=NULL
}

#Unzip the chromatograms file for plotting EIC pour the HTML file
if(exists("zipfile"))
{
if (zipfile!=""){
directory=unzip(zipfile)
}
}
if (!exists("xa")) {
xa=xsAnnotate_object
}
source_local("lib.r")
if (!exists("variableMetadata")) variableMetadata= getVariableMetadata(xa);

load(listArguments[["image"]])
cat("\t\tXA OBJECT INFO\n")
print(xa)

source_local("lib.r")
rawFilePath = getRawfilePathFromArguments(listArguments)
zipfile = rawFilePath$zipfile
singlefile = rawFilePath$singlefile
retrieveRawfileInTheWorkingDirectory(singlefile, zipfile)

if (!exists("variableMetadata")) variableMetadata= getVariableMetadata(xa);

} else if(listArguments[["inputs_mode"]]=="two"){
load(listArguments[["image_pos"]])

if (!is.null(listArguments[["zipfile"]])){
zipfile= listArguments[["zipfile"]]; listArguments[["zipfile"]]=NULL
}

#Unzip the chromatograms file for plotting EIC pour the HTML file
if(exists("zipfile")) {
if (zipfile!=""){
directory=unzip(zipfile)
}
}
if (!exists("xa")) {
xa=xsAnnotate_object
}
xaP=xa
source_local("lib.r")
if (!exists("variableMetadata")) variableMetadataP= getVariableMetadata(xa)
else variableMetadataP=variableMetadata


load(listArguments[["image_neg"]])

if (!is.null(listArguments[["zipfile"]])){
zipfile= listArguments[["zipfile"]]; listArguments[["zipfile"]]=NULL
}

#Unzip the chromatograms file for plotting EIC pour the HTML file
if(exists("zipfile")) {

if (zipfile!=""){
directory=unzip(zipfile)
}
}
if (!exists("xa")) {
xa=xsAnnotate_object
}
xaN=xa
source_local("lib.r")

if (!exists("variableMetadata")) variableMetadataN= getVariableMetadata(xa)
else variableMetadataN=variableMetadata

# POSITIVE
load(listArguments[["image_pos"]])

if (!exists("xa")) xaP=xsAnnotate_object
else xaP=xa
cat("\t\tXA-POSITIVE OBJECT INFO\n")
print(xaP)

if (!exists("variableMetadata")) variableMetadataP = getVariableMetadata(xa)
else variableMetadataP = variableMetadata

source_local("lib.r")
rawFilePath = getRawfilePathFromArguments(listArguments)
zipfilePos = rawFilePath$zipfile
singlefilePos = rawFilePath$singlefile
retrieveRawfileInTheWorkingDirectory(singlefilePos, zipfilePos)

# NEGATIVE
load(listArguments[["image_neg"]])

if (!exists("xa")) xaN=xsAnnotate_object
else xaN=xa
cat("\t\tXA-NEGATIVE OBJECT INFO\n")
print(xaP)

if (!exists("variableMetadata")) variableMetadataN = getVariableMetadata(xa)
else variableMetadataN = variableMetadata

source_local("lib.r")
rawFilePath = getRawfilePathFromArguments(listArguments)
zipfileNeg = rawFilePath$zipfile
singlefileNeg = rawFilePath$singlefile
retrieveRawfileInTheWorkingDirectory(singlefileNeg, zipfileNeg)
}

#Import the different functions
Expand All @@ -107,13 +94,12 @@ source_local("export.class.table-color-graph.R")
cat("\tMAIN PROCESSING INFO\n")

if(listArguments[["mode_acquisition"]]=="one") {
results=probmetab(xa=xa, variableMetadata=variableMetadata,listArguments=listArguments)
results=probmetab(xa=xa, variableMetadata=variableMetadata,listArguments=listArguments)
} else if(listArguments[["inputs_mode"]]=="two"){
results=probmetab(xaP=xaP, xaN=xaN,variableMetadataP=variableMetadataP, variableMetadataN=variableMetadataN, listArguments=listArguments)
results=probmetab(xaP=xaP, xaN=xaN,variableMetadataP=variableMetadataP, variableMetadataN=variableMetadataN, listArguments=listArguments)
}
#delete the parameters to avoid the passage to the next tool in .RData image
#rm(listArguments)
cat("\tDONE\n")
#saving R data in .Rdata file to save the variables used in the present tool
#save.image(paste("probmetab","RData",sep="."))

Binary file not shown.
Binary file added galaxy/probmetab/test-data/ko15.CDF
Binary file not shown.
Binary file added galaxy/probmetab/test-data/ko16.CDF
Binary file not shown.
Binary file added galaxy/probmetab/test-data/wt15.CDF
Binary file not shown.
Binary file added galaxy/probmetab/test-data/wt16.CDF
Binary file not shown.
370 changes: 0 additions & 370 deletions galaxy/probmetab/tool_test_output.html

This file was deleted.

1 change: 0 additions & 1 deletion galaxy/probmetab/tool_test_output.json

This file was deleted.