changeset 1:9f2ddab68c9e draft

"planemo upload for repository https://github.com/juliechevalier/GIANT/tree/master commit e2b27d6ff2eab66454f984dbf1a519192f41db97"
author vandelj
date Wed, 09 Sep 2020 10:28:02 +0000
parents f274c8d45613
children 3dc31e252649
files galaxy/wrappers/DiffExprLimma.xml src/General_functions.py
diffstat 2 files changed, 68 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/galaxy/wrappers/DiffExprLimma.xml	Fri Jun 26 09:43:41 2020 -0400
+++ b/galaxy/wrappers/DiffExprLimma.xml	Wed Sep 09 10:28:02 2020 +0000
@@ -1,4 +1,4 @@
-<tool name="GIANT-Differential Expression with LIMMA" id="giant_limma_analysis" version="0.3.8">
+<tool name="GIANT-Differential Expression with LIMMA" id="giant_limma_analysis" version="0.3.9">
   <description>Use LIMMA to detect differentially expressed genes</description>
   <requirements>
     <requirement type="package" version="1.7.1">r-r.methodss3</requirement>
@@ -11,6 +11,7 @@
     <requirement type="package" version="1.4.32">r-statmod</requirement>
   </requirements>
   <code file="../../src/LIMMA_options.py"/>
+  <!--<code file="./src/LIMMA_options.py"/> change for Planemo test-->
   <stdio>
     <regex match="Execution halted"
            source="both"
@@ -32,6 +33,8 @@
   fi;
 
   cp '$__tool_directory__/../../src/LIMMA_options.py' ./LIMMA_options.py;
+  ##change for Planemo test
+  ##cp '$__tool_directory__/src/LIMMA_options.py' ./LIMMA_options.py;
   
   #if $blockingSection.blockingConditional.addBlocking == "true":
     python -c 'import LIMMA_options;LIMMA_options.replaceNamesBlockInFiles("$inputSection.inputData","./factorTable.csv","./blockingTable.csv","./expressionRenamed.csv","./factorTableRenamed.csv","./blockingTableRenamed.csv","./dictionnaryRenamed.csv")';
@@ -43,6 +46,8 @@
   if [ -f ./dictionnaryRenamed.csv ]; then
     printf "[INFO]Renaming is done\n" >> $log;
     Rscript '$__tool_directory__/../../src/LIMMAscriptV4.R' -i 'expressionRenamed.csv' -l '$log' -o '$outputData' -z '$outputDfData' -f 'pdf'
+    ##change for Planemo test
+    ##Rscript '$__tool_directory__/src/LIMMAscriptV4.R' -i 'expressionRenamed.csv' -l '$log' -o '$outputData' -z '$outputDfData' -f 'pdf'
       -a 'factorTableRenamed.csv' -s 'sumSquareFtest' -g 'dictionnaryRenamed.csv'
       #if $blockingSection.blockingConditional.addBlocking == "true":
         -b 'blockingTableRenamed.csv'
@@ -360,7 +365,7 @@
     <param name="factorSelection" type="select" label="Select all factors to include in the global model (excepting confounding factors)" refresh_on_change="true" display="checkboxes" optional="false" multiple="true" dynamic_options="get_column_names(inputSection['conditionInformation'].file_name)" help="Confounding factors are selected in the coresponding section below." />
 
      <repeat name="contrastList" title="Contrast">
-        <param type="text" name="groupName" value="" label="Contrast name"/>
+        <param name="groupName" type="text" value="" label="Contrast name"/>
 
         <param name="firstGroupToCompare" type="select" label="Select factor levels of 1st group" display="checkboxes" multiple="true" refresh_on_change="true" dynamic_options="get_row_names_allInteractions(inputSection['conditionInformation'].file_name,factorSelection)">
         </param>
@@ -477,23 +482,54 @@
   
  <tests>
   <test maxseconds="3600">
-    <param name="wfile" value="wiggle.wig" />
-    <param name="bfile" value="bedfile.bed" />
-    <param name="span" value="3000" />
-    <param name="pfres" value="50" />
-    <param name="lowersize" value="1000" />
-    <param name="middlesize" value="2000" />
-    <param name="uppersize" value="3000" />
-    <param name="lowerbisize" value="2500" />
-    <param name="upperbisize" value="5000" />
-    <param name="reldist" value="3000" />
-    <param name="genome" value="hg18" />
-    <param name="imagetype" value="PDF" />
-    <param name="enable" value="no" />
-    <output name="outputData" file="ceas_1/ceas_1.pdf" />
-    <output name="outputDfData" file="ceas_1/ceas_1.pdf" />
+    <section name="inputSection">
+      <param name="inputData" value="./NormalizedData.tabular" />
+      <param name="conditionInformation" value="./FactorFileGenerator/output/conditionsFile.csv" />
+    </section>
+    <section name="contrastSection">
+      <param name="factorSelection" value="Strain,Treatment" />
+      <repeat name="contrastList" >
+        <param name="groupName" value="TreatVsControl" />
+        <param name="firstGroupToCompare" value="WT*Treat,KO*Treat" />
+        <param name="secondGroupToCompare" value="WT*Control,KO*Control" />
+      </repeat>
+      <repeat name="contrastList" >
+        <param name="groupName" value="WTvsKO" />
+        <param name="firstGroupToCompare" value="WT*Control,WT*Treat" />
+        <param name="secondGroupToCompare" value="KO*Control,KO*Treat" />
+      </repeat>
+      <conditional name="interactionSelection">
+        <param name="interactionContrast" value="true" />
+        <param name="controlSelection" value="Strain:WT,Treatment:Control" />
+      </conditional>
+    </section>    
+    <section name="blockingSection">
+      <conditional name="blockingConditional">
+        <param name="addBlocking"  value="false"/>
+      </conditional>
+    </section>    
+    <section name="plotSection">
+      <param name="cutoffTh" value="0.05"/>
+      <param name="FCthreshold" value="1.2"/>
+      <param name="histogramToPlot" value="true"/>
+      <param name="volcanoToPlot" value="false"/>
+      <conditional name="geneInformation">
+        <param name="addGeneInfo" value="false"/>
+      </conditional>
+      <param name="imagePlotlyFormat" value="png"/>
+    </section>    
+    <section name="advSection">
+      <param name="confoundingPolicy" value="additive"/>
+    </section>  
+    <output name="outputData" file="./DiffExprLimma/output/outputStat.csv" />
+    <output name="outputDfData" file="./DiffExprLimma/output/outputStatDetailed.csv" />
+    <output name="html_file" file="./DiffExprLimma/output/outputHTML.zip" decompress="true" />
+    <output name="log" file="./DiffExprLimma/output/outputLog.txt" compare="sim_size" delta_frac="0.10" />    
   </test>
-</tests> 
+ </tests> 
+
+
+
   <help>
 <![CDATA[
 **What it does ?**
--- a/src/General_functions.py	Fri Jun 26 09:43:41 2020 -0400
+++ b/src/General_functions.py	Wed Sep 09 10:28:02 2020 +0000
@@ -1,5 +1,6 @@
 import re
 import numpy as np
+import galaxy.model
 
 def get_column_names( file_path, toNotConsider=-1, each=1):
 	options=[]
@@ -76,7 +77,7 @@
 
 def get_condition_file_names( file_list, toNotConsider=-1, each=1):
 	options=[]
-	if not isinstance(file_list,list):#if input file is a tabular file, act as get_column_names
+	if not (isinstance(file_list,list) or isinstance(file_list,galaxy.model.HistoryDatasetCollectionAssociation) or isinstance(file_list,galaxy.model.DatasetCollection)) :#if input file is a tabular file, act as get_column_names
 		inputfile = open(file_list.file_name)
 		firstLine = next(inputfile).strip().split("\t")
 		cpt=0
@@ -88,13 +89,17 @@
 				if cpt==each:
 					cpt=0
 		inputfile.close()
-	else:#if input file is a .cel file list or a collection
-		if not hasattr(file_list[0],'collection'):#if it is not a collection, get name easily
-			for i, field_component in enumerate( file_list ):
-				options.append( ( field_component.name, field_component.name, False ) )
-		else:#if the file is a collection, have to get deeper in the corresponding HistoryDatasetCollectionAssociation object
-			for i, field_component in enumerate( file_list[0].collection.elements ):
-				options.append( ( field_component.element_identifier, field_component.element_identifier, False ) )
+	else:#if input file is a .cel file list, a DatasetCollection or a HistoryDatasetCollectionAssociation
+			if isinstance(file_list,list):#if it is a list, retrieve names easily
+				for i, field_component in enumerate( file_list ):
+					options.append( ( field_component.name, field_component.name, False ) )
+			else:#if the file is a DatasetCollection, have to get deeper in the corresponding DatasetCollection object
+				if isinstance(file_list,galaxy.model.DatasetCollection):#if it is a list, retrieve names easily
+					for i, field_component in enumerate( file_list.elements ):
+						options.append( ( field_component.element_identifier, field_component.element_identifier, False ) )
+				else:#if the file is a HistoryDatasetCollectionAssociation, have to get a little bit deeper in the corresponding HistoryDatasetCollectionAssociation object
+					for i, field_component in enumerate( file_list.collection.elements ):
+						options.append( ( field_component.element_identifier, field_component.element_identifier, False ) )
 	return options
 
 def generateFactorFile( file_list, factor_list, outputFileName, logFile):
@@ -102,10 +107,7 @@
 	outputfile = open(outputFileName, 'w')
 	outputLog = open(logFile, 'w')
 	sampleList=[]
-	if not isinstance(file_list,list):
-		conditionNames=get_condition_file_names(file_list,0) #unique expression file, remove the first column (index=0)
-	else :
-		conditionNames=get_condition_file_names(file_list) #.CEL files
+	conditionNames=get_condition_file_names(file_list,0) #if it's a unique expression file, remove the first column (index=0)
 	for iSample, sample_component in enumerate (conditionNames):
 		sampleList.append(str(sample_component[1]))
 	outputLog.write("[INFO] "+str(len(sampleList))+" sample are detected as input\n")