view galaxy/wrappers/DiffExprLimma.xml @ 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
line wrap: on
line source

<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>
    <requirement type="package" version="3.36.5">bioconductor-limma</requirement>
    <requirement type="package" version="2.36.1">bioconductor-biomart</requirement>
    <requirement type="package" version="3.0.0">r-ggplot2</requirement>
    <requirement type="package" version="4.8.0">r-plotly</requirement>
    <requirement type="package" version="1.3.1">r-stringr</requirement>
    <requirement type="package" version="1.1_2">r-rcolorbrewer</requirement>
    <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"
           level="fatal"
           description="Execution halted, please contact tool developer or administrators." />
    <regex match="Error in"
           source="both"
           level="fatal"
           description="An error occured during R execution, please contact tool developer." />
    <exit_code range="15" level="fatal" description="Error during formating scripts, see log file for more information." />
    <exit_code range="10" level="fatal" description="Missing file during html report, see log file for more information." />
    <exit_code range="1:9" level="fatal" description="Error in R execution, see log file for more information." />
  </stdio>
  <command>	<![CDATA[
  bash $scriptPrepareTable;
  ret_code=\$?;
  if [ \$ret_code != 0 ]; then
     exit \$ret_code;
  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")';
  #else:
    python -c 'import LIMMA_options;LIMMA_options.replaceNamesInFiles("$inputSection.inputData","./factorTable.csv","./expressionRenamed.csv","./factorTableRenamed.csv","./dictionnaryRenamed.csv")';
  #end if


  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'
        -u $advSection.confoundingPolicy
      #end if
        -r '${contrastSection.factorSelection}'
      #for $i, $s in enumerate( $contrastSection.contrastList )
        -p '${s.groupName}'
        -m '${s.firstGroupToCompare}'
        -n '${s.secondGroupToCompare}'
      #end for
      #if $contrastSection.interactionSelection.interactionContrast == "true":
        -c '$contrastSection.interactionSelection.controlSelection'
      #end if
        -t $plotSection.cutoffTh
        -d $plotSection.FCthreshold
      #if $plotSection.histogramToPlot:
        -h 'Histograms'
      #end if
      #if $plotSection.volcanoToPlot:
        -v 'Volcanos'
      #end if
      #if $plotSection.geneInformation.addGeneInfo:
        -x '$plotSection.geneInformation.organismID'
        -y '$plotSection.geneInformation.infoInRowType'
      #end if
    ;
     ret_code=\$?;
     if [ \$ret_code != 0 ]; then
      exit \$ret_code;
     else
      bash $scriptTransfer;
      ret_code=\$?;
      if [ \$ret_code != 0 ]; then
        exit \$ret_code;
      fi 
     fi;
  else
    printf "[ERROR]Error during renaming, factor information file should not contain special characters '*',':',',','|' in factor names and possible values\n" >> $log;
    exit 15;
  fi;
  printf "[INFO]End of tool script" >> $log; 
	]]>
  </command>



  <configfiles>
    <configfile name="scriptPrepareTable">
    <![CDATA[
    awk -v fact="$contrastSection.factorSelection" 'BEGIN{OFS="";ORS="";FS="\t";split(fact,tab,",");for(i in tab)dico[tab[i]]=1} FNR==1{for(i=2;i<=NF;i++){if(\$i in dico)colToSelect[i]=1}} {print \$1;for(i in colToSelect)print "\t"\$i ; print "\n"}' $inputSection.conditionInformation > ./factorTable.csv;

    if [ ! -e ./factorTable.csv ]; then
      printf "[ERROR]factorTable.csv is missing" >> $log; 
      exit 15
    fi


     #if $blockingSection.blockingConditional.addBlocking == "true":
     awk -v fact="$blockingSection.blockingConditional.blockingToInclude" ' BEGIN{OFS="";ORS="";FS="\t";split(fact, facto, ",");for(i in facto)factors[facto[i]]=1} FNR==1{for(i=2;i<=NF;i++)if(\$i in factors)dico[i]=1} {print $1;for(factorID in dico)print "\t"\$factorID; print "\n"}'  $inputSection.conditionInformation > ./blockingTable.csv;

      if [ ! -e ./blockingTable.csv ]; then
        printf "[ERROR]blockingTable.csv is missing" >> $log; 
        exit 15
      fi

     #end if
     printf "[INFO]End of scriptPrepareTable\n" >> $log 
    ]]>
    </configfile>

    <configfile name="scriptTableToHtml">
<![CDATA[
printf  "<!DOCTYPE html>
<html>
<head>
<meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\">
<link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css\">
<script type=\"text/javascript\" language=\"javascript\" src=\"https://code.jquery.com/jquery-1.12.4.js\">
</script>
<script type=\"text/javascript\" language=\"javascript\" src=\"https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js\">
</script>
<script type=\"text/javascript\" class=\"init\">
\\$(document).ready(function() {
  \\$(\'\#example\').DataTable( {
        \"columnDefs\": [ {
            \"visible\": false,
            \"targets\": -1
        } ]
    } );
} );
</script>
</head>
<body style=\"background-color:white;\">
<table id=\"example\" class=\"display\" cellspacing=\"0\">
" > ${html_file.extra_files_path}/outputLIMMA.html

printf "<colgroup>\n" >> ${html_file.extra_files_path}/outputLIMMA.html
printf "<col span=\"2\" style=\"background-color:rgb(224,235,235)\">\n" >> ${html_file.extra_files_path}/outputLIMMA.html
awk 'BEGIN{odd=1;FS="\t"} NR==1{for(i=3;i<=NF;i=i+5){if(odd==1){odd=0;printf "<col span=\"5\" style=\"background-color:rgb(224,238,255)\">\n"}else{odd=1;printf "<col span=\"5\" style=\"background-color:rgb(255,221,224)\">\n"}}}' $outputData >> ${html_file.extra_files_path}/outputLIMMA.html
printf "</colgroup>\n" >> ${html_file.extra_files_path}/outputLIMMA.html


printf "<thead>\n<tr>\n" >> ${html_file.extra_files_path}/outputLIMMA.html
printf "<th rowspan=\"2\">Gene</th>\n" >> ${html_file.extra_files_path}/outputLIMMA.html
printf "<th rowspan=\"2\">Info</th>\n" >> ${html_file.extra_files_path}/outputLIMMA.html
awk 'BEGIN{FS="\t"} NR==1{for(i=3;i<=NF;i=i+5)printf "<th colspan=\"5\">"\$i"</th>\n"}' $outputData >> ${html_file.extra_files_path}/outputLIMMA.html
printf "<th></th>\n" >> ${html_file.extra_files_path}/outputLIMMA.html
printf "</tr>\n<tr>\n" >> ${html_file.extra_files_path}/outputLIMMA.html
awk 'BEGIN{FS="\t"} NR==2{for(i=3;i<=NF;i++)printf "<th>"\$i"</th>\n"}' $outputData >> ${html_file.extra_files_path}/outputLIMMA.html
printf "<th></th>\n" >> ${html_file.extra_files_path}/outputLIMMA.html
printf "</tr>\n</thead>\n" >> ${html_file.extra_files_path}/outputLIMMA.html

printf "<tfoot>\n<tr>\n" >> ${html_file.extra_files_path}/outputLIMMA.html
awk 'BEGIN{FS="\t"} NR==2{for(i=1;i<=NF;i++)printf "<th>"\$i"</th>\n"}' $outputData >> ${html_file.extra_files_path}/outputLIMMA.html
printf "<th></th>\n" >> ${html_file.extra_files_path}/outputLIMMA.html
printf "</tr>\n</tfoot>\n">> ${html_file.extra_files_path}/outputLIMMA.html

printf "<tbody>\n" >> ${html_file.extra_files_path}/outputLIMMA.html
awk 'BEGIN{FS="\t"} NR>2{printf "<tr>\n";for(i=1;i<=NF;i++){printf "<th>"\$i"</th>\n"};printf "<th></th>\n";printf "</tr>\n"}' $outputData >> ${html_file.extra_files_path}/outputLIMMA.html
printf "</tbody>\n" >> ${html_file.extra_files_path}/outputLIMMA.html

printf "</table>
</body>
</html>" >> ${html_file.extra_files_path}/outputLIMMA.html

]]>
    </configfile>

    <configfile name="scriptTransfer">
<![CDATA[


##for LIMMA output table

mkdir -p $html_file.extra_files_path

##create HTML file for limma output table
source $scriptTableToHtml

##check outputLIMMA.html is here
if ! [ -e ${html_file.extra_files_path}/outputLIMMA.html ]; then
  printf "[ERROR]outputLIMMA.html is missing" >> $log; 
  exit 10
fi

##create header of main HTML file
printf  "<!DOCTYPE html>\n<html>\n<body>"  > $html_file

##first add reference of the LIMMA output table
printf "<h3>LIMMA statistics (p.val, FC)</h3>\n" >> $html_file
printf "<a href=\"outputLIMMA.html\">LIMMA results</a>\n"  >> $html_file



#if $plotSection.histogramToPlot:

printf "<h3>P-val histograms</h3>\n" >> $html_file

##create folders in media
counter=1
for histogram in \$(ls ./plotLyDir/Histograms_*html)
do
histogramShort=\${histogram%\.*}
histogramShort=\${histogramShort\#\#*/}

conditionName=\${histogram%\.*}
conditionName=\${conditionName\#\#*Histograms_}

echo \$conditionName > ./temporaryConditionName
conditionFormatedName=\$(awk 'BEGIN{FS="\t"} ARGIND==1{dico[\$1]=\$2} ARGIND==2{print dico[\$1]}' ./correspondanceFileNames.csv ./temporaryConditionName)

##modify HTML to point to plotLy folder
sed -i "s/\${histogramShort}_files/PlotLy_Histogram_scripts/g" \$histogram

##copy HTML files in both folders
cp \$histogram ${html_file.extra_files_path}/Histogram_\$conditionName.html

##add HTML link
printf "<p>\n<a href=\"Histogram_\$conditionName.html\">Histogram \$conditionFormatedName</a>\n</p>\n"  >> $html_file

if [ \$counter = 1 ]; then
#if $plotSection.imagePlotlyFormat=="svg":
##before copying scripts folder modify them to replace png snapshot with svg (not proud of solution but seems to work)
cd ./plotLyDir/\${histogramShort}_files/plotly-main-*/
awk '{gsub("\"png\"","\"svg\"",\$0);print \$0}' ./plotly-latest.min.js > ./plotly-latest.minTemp.js
awk '{gsub("Download plot as a png","Download plot as a svg",\$0);print \$0}' ./plotly-latest.minTemp.js > ./plotly-latest.min.js
rm ./plotly-latest.minTemp.js
cd ../../../
#end if

##now copy only scripts folder for the first histogram and rename
cp -r ./plotLyDir/\${histogramShort}_files $html_file.extra_files_path
mv ${html_file.extra_files_path}/\${histogramShort}_files ${html_file.extra_files_path}/PlotLy_Histogram_scripts
fi

((counter++))
done

if [ \$counter = 1 ]; then
  printf "[ERROR]Histograms are missing" >> $log; 
  exit 10
fi

#end if  


if [ -e ./plotLyDir/sumSquareFtest.html ]; then

printf "<h3>Source of variation</h3>\n" >> $html_file

##modify HTML to point to the first script folder
sed -i "s/sumSquareFtest_files/PlotLy_sumSquareFtest_scripts/g" ./plotLyDir/sumSquareFtest.html

##copy HTML files in both folders
cp ./plotLyDir/sumSquareFtest.html ${html_file.extra_files_path}/

##add HTML link
printf "<a href=\"sumSquareFtest.html\">F-ratio barplot</a>\n"  >> $html_file

#if $plotSection.imagePlotlyFormat=="svg":
##before copying scripts folder modify them to replace png snapshot with svg (not proud of solution but seems to work)
cd ./plotLyDir/sumSquareFtest_files/plotly-main-*/
awk '{gsub("\"png\"","\"svg\"",\$0);print \$0}' ./plotly-latest.min.js > ./plotly-latest.minTemp.js
awk '{gsub("Download plot as a png","Download plot as a svg",\$0);print \$0}' ./plotly-latest.minTemp.js > ./plotly-latest.min.js
rm ./plotly-latest.minTemp.js
cd ../../../
#end if

##now copy scripts folder
cp -r ./plotLyDir/sumSquareFtest_files $html_file.extra_files_path
mv ${html_file.extra_files_path}/sumSquareFtest_files ${html_file.extra_files_path}/PlotLy_sumSquareFtest_scripts

else
  printf "[ERROR]sumSquareFtest plot is missing" >> $log; 
  exit 10
fi



#if $plotSection.volcanoToPlot:

printf "<h3>Volcanos</h3>\n" >> $html_file

##create folders in media
counter=1
for volcano in \$(ls ./plotLyDir/Volcanos_*html)
do
volcanoShort=\${volcano%\.*}
volcanoShort=\${volcanoShort\#\#*/}

conditionName=\${volcano%\.*}
conditionName=\${conditionName\#\#*Volcanos_}

echo \$conditionName > ./temporaryConditionName
conditionFormatedName=\$(awk 'BEGIN{FS="\t"} ARGIND==1{dico[\$1]=\$2} ARGIND==2{print dico[\$1]}' ./correspondanceFileNames.csv ./temporaryConditionName)


##modify HTML to point to plotLy folder
sed -i "s/\${volcanoShort}_files/PlotLy_Volcano_scripts/g" \$volcano

##copy HTML files in both folders
cp \$volcano ${html_file.extra_files_path}/Volcano_\$conditionName.html

##add HTML link
printf "<p>\n<a href=\"Volcano_\$conditionName.html\">Volcano \$conditionFormatedName</a>\n</p>\n"  >> $html_file

if [ \$counter = 1 ]; then

#if $plotSection.imagePlotlyFormat=="svg":
##before copying scripts folder modify them to replace png snapshot with svg (not proud of solution but seems to work)
cd ./plotLyDir/\${volcanoShort}_files/plotly-main-*/
awk '{gsub("\"png\"","\"svg\"",\$0);print \$0}' ./plotly-latest.min.js > ./plotly-latest.minTemp.js
awk '{gsub("Download plot as a png","Download plot as a svg",\$0);print \$0}' ./plotly-latest.minTemp.js > ./plotly-latest.min.js
rm ./plotly-latest.minTemp.js
cd ../../../
#end if

##now copy only scripts folder for the first volcano and rename
cp -r ./plotLyDir/\${volcanoShort}_files $html_file.extra_files_path
mv ${html_file.extra_files_path}/\${volcanoShort}_files ${html_file.extra_files_path}/PlotLy_Volcano_scripts
fi

((counter++))
done

if [ \$counter = 1 ]; then
  printf "[ERROR]Volcano plots are missing" >> $log; 
  exit 10
fi

#end if


##create footer of HTML file
printf  "</body>\n</html>" >> $html_file
]]>
    </configfile>
  </configfiles>



  <inputs>
    <section name="inputSection" title="Input files" expanded="True">
      <param type="text" name="title" value="LIMMA_toPersonalize" label="Title for output"/>

      <param type="data" name="inputData" format="tabular" label="Normalized expression tabular file" optional="false" multiple="false" help="Expression data have to be log2 transformed."/>

      <param type="data" name="conditionInformation" format="tabular" label="Factor information tabular file" optional="false" multiple="false">
      </param>
    </section>

  <section name="contrastSection" title="Contrast definition" expanded="True">

    <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 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>

        <param name="secondGroupToCompare" type="select" label="Select factor levels of 2nd group" display="checkboxes" multiple="true" refresh_on_change="true" dynamic_options="get_row_names_allInteractions(inputSection['conditionInformation'].file_name,factorSelection)">
        </param>
    </repeat>

    <conditional name="interactionSelection">
    <param name="interactionContrast" type="boolean" label="Add interaction contrasts" checked="false" help="If you have selected two factors at least."/>
      <when value="true">
         <param name="controlSelection" type="select" label="Select one control level for each factor (and only one)" display="checkboxes" multiple="true" refresh_on_change="true" dynamic_options="get_allrow_names(inputSection['conditionInformation'].file_name,factorSelection)">
        </param>
      </when>
      <when value="false">
      </when>
    </conditional>

  </section>



  <section name="blockingSection" title="Paired analysis/confounding factor" expanded="True">
    <conditional name="blockingConditional">
     <param name="addBlocking" type="boolean" label="Add confounding factors" checked="false" help="To control factors producing spurious association as batch effects or to analyze paired data"/>
      <when value="true">
          <param name="blockingToInclude" type="select" label="Select confounding factors" multiple="true" dynamic_options="get_column_names(inputSection['conditionInformation'].file_name)">
            <validator type="empty_field" message="You should select at least one factor"></validator>
          </param>
      </when>
      <when value="false">
      </when>
    </conditional>
  </section>

	<section name="plotSection" title="Output section" expanded="True">
    <param name="cutoffTh" type="float" value="0.05" label="Output FDR p-val threshold" >
      <validator type="in_range" min="0" max="1" message="Threshold should be between 0 and 1"/>
    </param>
    <param name="FCthreshold" type="float" value="2" label="Output Fold Change threshold (both 'log2(threshold)' and 'log2(1/threshold)' values will be used)" >
      <validator type="in_range" min="1" exclude_min="false" message="Threshold should be greater or equal to 1"/>
    </param>
		<param type="boolean" name="histogramToPlot" checked="true" label="Plot histograms" help="Plot nominal p-val distribution for each comparison.">
	    </param>
		<param type="boolean" name="volcanoToPlot" checked="true" label="Plot volcanos" help="Plot volcano for each comparison.">
	    </param>

    <conditional name="geneInformation">
    <param name="addGeneInfo" type="boolean" label="Add gene/probe information" checked="false"/>
      <when value="true">
        <param name="organismID" label="Organism" type="select">
          <options from_data_table="LimmaTool" >
            <column name="name" index="1"/>
            <column name="value" index="0"/>
            <filter type="unique_value" column="0"/>
          </options>
        </param>
        <param name="infoInRowType" label="Nature of row names" type="select">
            <options from_data_table="LimmaTool" >
              <column name="name" index="3"/>
              <column name="value" index="2"/>
              <filter type="param_value" ref="organismID" column="0"/>
            </options>
        </param>
      </when>
      <when value="false">
      </when>
    </conditional>

    <param type="select" name="imagePlotlyFormat" display="radio" label="Html snapshot format">
      <option value="png">PNG format</option>
      <option value="svg">SVG format</option>
    </param>
	</section>

    <section name="advSection" title="Advanced parameters" expanded="False">
    <param type="select" name="confoundingPolicy" display="radio" label="Confounding effect policy" help="DO NOT modify this parameter unless you know what you are doing!">
      <option value="additive">As an additive factor (default)</option>
      <option value="correlated">As a correlation constraint</option>
    </param>
    </section>
	
  </inputs>



  <outputs>
    <data format="tabular" name="outputData" label="${inputSection.title}_LIMMAstatistics"/>

    <data format="tabular" name="outputDfData" label="${inputSection.title}_LIMMAdetailed"/>
	
	<data format="html" name="html_file" label="${inputSection.title}_HTML.html"/>
	<!--
	<collection name="outputHistogramsList" label="${inputSection.title}_HistogramsList" type="list">
	  <discover_datasets pattern="(?P&lt;designation&gt;Histograms[0-9]+)\.(?P&lt;ext&gt;[^\._]+)?" directory="plotDir" visible="false"/>
	  <filter>plotSection['histogramToPlot']</filter>
	</collection>
	
	<collection name="outputVolcanosList" label="${inputSection.title}_VolcanosList" type="list">
	  <discover_datasets pattern="(?P&lt;designation&gt;Volcanos\_.*)\.(?P&lt;ext&gt;[^\._]+)?" directory="plotDir" visible="false"/>
	  <filter>plotSection['volcanoToPlot']</filter>
	</collection>

  <data name="fRatioOutput" format="png" label="${inputSection.title}_F-ratio">
        <change_format>
            <when input="plotSection['imageFormat']" value="pdf" format="pdf" />
        </change_format>
  </data>
	-->
    <data format="txt" name="log" label="${inputSection.title}_Log" />
  </outputs>


  
 <tests>
  <test maxseconds="3600">
    <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> 



  <help>
<![CDATA[
**What it does ?**

This tool compute differential expressions for a set of genes.
This tool use the LIMMA function from R package limma. (only adapted for arrays data)

-----

**Parameters**

\- **Input Files**

- **Title** to personalize output file names (please avoid special characters).
- **Normalized expression tabular file** with samples as columns and genes as rows (header contains sample names and first column gene identifiers). WARNING Expression data have to be already log2 transformed.

    ::

        Conditions  157_(HuGene-2_0-st).CEL 156_(HuGene-2_0-st).CEL  155_(HuGene-2_0-st).CEL    154_(HuGene-2_0-st).CEL                        
        DDX11L2     4.500872                4.429759                 4.780281                   4.996189             
        MIR1302-2   3.415065                3.520472                 3.471503                   3.567988           
        OR4F5       3.737956                3.011586                 3.424494                   3.497545
        VWA1        5.189621                5.129595                 4.806793                   5.227014

- **Factor information tabular file** with factors as columns and samples as rows (header contains factor names and first column sample names).

    ::

        Conditions                Sex   Treatment Reaction
        138_(HuGene-2_0-st).CEL   1     TreatA    Pos
        148_(HuGene-2_0-st).CEL   0     NoTreat   Pos
        139_(HuGene-2_0-st).CEL   0     TreatB    Neg
        149_(HuGene-2_0-st).CEL   0     NoTreat   Neg

\- **Contrast definition**

- **Select all factors to include in the global model** : automatically extracted from factor information file. Confounding factors or paired-analysis information (replicates number,dates...) should not be selected here, but in specific section below.

- **Contrast**

    \- **Contrast Name** displayed in output file

    \- **Select factor levels of 1st group** : the contrast will be computed with the formula "1st group versus 2nd group" so "1st group - 2nd group".

    \- **Select factor levels of 2nd group** : see below for some examples

    ::

	Nb Factors	List of Factors 	Factor levels		Expected Contrast				Select as 1st gr		Select as 2nd gr
	1		Strain			WT, KO			KO vs WT					KO			 	WT
	2		Strain, Treatment	WT, KO, NoTreat,TreatA	TreatA vs NoTreat in WT mice			TreatA*WT			NoTreat*WT
	2		Strain, Treatment	WT, KO, NoTreat,TreatA	Treatment effect on Strain dependent genes	See results of interaction contrast

- **Add interaction contrasts** : to compute automatically each level of interaction

    \- **Control groups** for each factor, select its level used as control. Thus interaction contrasts will be computed for each factor level regarding to this control level.

\- **Paired analysis / confounding factors**

- **Add confounding factors** which can define "blocks" in the data different from those selected previously in the global model. Typically confounding factors are linked to batch effect (dates...) or paired-analysis situation (replicates number...).

\- **Output section**

- **Output FDR p-val threshold**, only genes with FDR <= this threshold (in at least one of defined contrasts) are kept in tabular result file and displayed dynamically in volcano plot.

- **Plot histograms** of unadjusted p-values for each defined contrast.

- **Plot volcanos** for each defined contrast with specified FDR p-val and FC thresholds.

- **Output Fold Change threshold** only genes with absolute FC >= this threshold (in at least one of defined contrast) are kept in tabular result file and displayed dynamically in volcano plot (both 'log2(threshold)' and 'log2(1/threshold)' values will be used).

- **Add gene/probe information** : if yes, add description of genes to the result tab.

  \- **Organism** coresponding to experimental data used.

  \- **Nature of row names** coresponding to experimental data used in input.

- **Html snapshot format** : for interactive plotly plots.

\- **Advanced Parameters**

- **Confounding effect policy** : DO NOT modify this parameter unless you know what you are doing! See Limma documentation for more information.

-----

**Outputs**

- **LIMMA statistic tabular** is the main result file for LIMMA, represented as tab delimited matrix. First and second columns contain respectively gene names and information grabbed from BiomaRt R package. Then, the following colums contain differential expression statistics (p.val, FDR, FC, log2FC and t-statistic) for defined contrasts, for each gene (in rows).

- **LIMMA detailed tabular** contains specific statistics required for additional analysis tools (eg SMAGEXP tool), represented as tab delimited matrix where each colum contains specific statistics (residual, eBayes prior and total degree of freedom) between groups for each gene (in rows).

- **HTML file** to access interactive version of histograms, F-Ratio barplots and volcanos through PlotLy html pages and tabulated differential results.

- **LOG file** for job log. If you see errors, please attached this in the bug report

]]>  </help>


 <citations>
  <citation type="bibtex">@misc{vandel_jimmy_2018_1477870, author = {Vandel, J. and Gheeraert, C. and Eeckhoute, J. and Staels, B. and Lefebvre, P. and Dubois-Chevalier, J.}, title = {GIANT: Galaxy-based Interactive tools for ANalaysis of Transcriptomic data}, month = nov, year = 2018, doi = {10.5281/zenodo.1477870}, url = {https://doi.org/10.5281/zenodo.1477870}
  }</citation>

  <citation type="bibtex">@article{doi:10.1093/nar/gkv007,
  author = {Ritchie, Matthew E. and Phipson, Belinda and Wu, Di and Hu, Yifang and Law, Charity W. and Shi, Wei and Smyth, Gordon K.},
  title = {limma powers differential expression analyses for RNA-sequencing and microarray studies},
  journal = {Nucleic Acids Research},
  volume = {43},
  number = {7},
  pages = {e47},
  year = {2015},
  doi = {10.1093/nar/gkv007},
  URL = {http://dx.doi.org/10.1093/nar/gkv007},
  eprint = {/oup/backfile/content_public/journal/nar/43/7/10.1093_nar_gkv007/2/gkv007.pdf}
  }</citation>

  <citation type="bibtex">@online{plotly, author = {Plotly Technologies Inc.}, title = {Collaborative data science}, publisher = {Plotly Technologies Inc.}, address = {Montreal, QC}, year = {2015}, url = {https://plot.ly}
  }</citation>
 </citations>

</tool>