view mainglm.xml @ 0:df3ce23d0d23 draft

"planemo upload for repository https://github.com/Alanamosse/Galaxy-E/tree/stoctool/tools/stoc commit f82f897ab22464de40c878e17616333855814e25"
author ecology
date Thu, 02 Apr 2020 03:32:56 -0400
parents
children a961be0a964f
line wrap: on
line source

<tool id="stoceps_glm" name="Estimate temporal population evolution" version="@VERSION@">
    <description>by species</description>
    <macros>
        <import>stoceps_macros.xml</import>
    </macros>
    <expand macro="mainglm_requirements"/>
    <command detect_errors="exit_code"><![CDATA[
        Rscript
         '$__tool_directory__/ExeMainGlmGalaxy.r'
         '$input'
         '$inputtabSpecies'
         #if $settings.advanced=='advanced'
             'mainglm'
             $settings.sp_code
             $settings.compute_ic
         #else
             'mainglm'
             ''
             'TRUE'
         #end if
         '$__tool_directory__/FunctTrendSTOCGalaxy.r'


        '$yearly_variations'
        '$global_tendencies'
        #if $settings.advanced=='advanced'
            #if $settings.return_plot=='plot'
                '$plots'
            #end if
        #end if
    ]]>
    </command>
    <inputs>
        <expand macro="stoceps_input_filtered"/>
        <param name="inputtabSpecies" type="data" format="tabular" label="Species file" help="Input species tabular file, with 5 columns (species ID, species name, species scientific name, specialization status)." />
        <conditional name="settings">
            <expand macro="stoceps_advanced_params_select"/>
            <when value="advanced">
                <param name="sp_code" type="select" label="Filter species to exclude" help="Create a subsample by selecting species codes you don't want to use." multiple="true" optional="true">
                    <options from_dataset="input">
                        <column name="value" index="2"/>
                        <filter type="unique_value" name="espece" column="2"/>
                    </options>
                    <sanitizer>
                        <valid initial="string.printable">
                            <remove value="&quot;"/>
                        </valid>
                    </sanitizer>
                </param>
                <param name="return_plot" type="boolean" truevalue="plot" falsevalue="noplot" checked="yes" help="All the figures will be stocked in a datacollection" label="Return visualizations."/>
                <expand macro="stoceps_compute_ic"/>
            </when>
        </conditional>
    </inputs>
    <outputs>
        <data name="yearly_variations" from_work_dir="Output/mainglm/variationsAnnuellesEspece_mainglm.tabular" format="tabular" label="GLM - Yearly variations on ${on_string}"/>
        <data name="global_tendencies" from_work_dir="Output/mainglm/tendanceGlobalEspece_mainglm.tabular" format="tabular" label="GLM - Global species tendencies on ${on_string}"/>
        <collection type="list" name="plots">
            <filter>return_plot == 'plot'</filter>
            <discover_datasets pattern="(?P&lt;designation&gt;.+)\.png" visible="false" format="png" directory="Output/mainglm/"/>
        </collection>
    </outputs>
    <tests>
        <test>
            <param name="inputtabSpecies" value="tabSpecies.csv"/>
            <param name="input" value="Datafilteredfortrendanalysis.tabular"/>
            <param name="advanced" value="simple"/>
            <output name="yearly_variations">
                <assert_contents>
                    <has_n_lines n="37"/>
                    <has_n_columns n="14"/>
                    <has_size value="3247" delta="100"/>
                </assert_contents>
            </output> 
            <output name="global_tendencies">
                <assert_contents>
                    <has_n_lines n="3"/>
                    <has_size value="468" delta="50"/>
                </assert_contents>
            </output>
            <output_collection name="plots"  type="list" count="2">
                <element name="ALAARV_mainglm">
                    <assert_contents>
                        <has_text text="PNG"/>
                    </assert_contents>
                </element>
                <element name="PARCAE_mainglm">
                    <assert_contents>
                        <has_text text="PNG"/>
                    </assert_contents>
                </element>
            </output_collection>
        </test>
    </tests>
    <help><![CDATA[
=================================================
STOC Estimate species population evolution
=================================================

**What it does**

Compute and plot evolution of species population, using a glm model.

|

**Input description**

A first mandatory tabular file with species count shaped and filtered with the STOCs 'Preprocess population data' ans 'Filter species' tools.

A second optional "species details file" containing indicator status of species (Column with TRUE or FALSE), including the species name or ID (one used in the species count data). If you are not analyzing the default STOC data, you need one file of this kind.

Example dataset ::

"espece"  "nom"                       "nomscientific"               "indicateur"     "specialisation"
"ACCGEN"  "Autour des palombes"       "Accipiter gentilis"          FALSE            ""
"ACCNIS"  "Epervier d'Europe"         "Accipiter nisus"             FALSE            ""
"ACRARU"  "Rousserolle turdoïde"      "Acrocephalus arundinaceus"   FALSE            ""
"ACRMEL"  "Lusciniole à moustaches"   "Acrocephalus melanopogon"    FALSE            ""
"ACRPAL"  "Phragmite aquatique"       "Acrocephalus paludicola"     FALSE            ""
"ACRRIS"  "Rousserolle verderolle"    "Acrocephalus palustris"      FALSE            ""
"ACRSCH"  "Phragmite des joncs"       "Acrocephalus schoenobaenus"  FALSE            ""
"ACRSCI"  "Rousserolle effarvatte"    "Acrocephalus scirpaceus"     FALSE            ""
"ACTHYP"  "Chevalier guignette"       "Actitis hypoleucos"          FALSE            ""
"AEGCAU"  "Mésange à longue queue"    "Aegithalos caudatus"         FALSE            ""
"AEGFUN"  "Chouette de Tengmalm"      "Aegolius funereus"           FALSE            ""
"AIXGAL"  "Canard mandarin"           "Aix galericulata"            FALSE            ""
"AIXSPO"  "Canard carolin"            "Aix sponsa"                  FALSE            ""
"ALAARV"  "Alouette des champs"       "Alauda arvensis"             TRUE             "milieux agricoles"

|

**Output**

For each species present in the data, a plot of populations trend is created and stocked in a common data collection.

Two tabular files are created, they describe global tendencies and yearly variations.

|

**Source**

UnPublished script available at http://www.vigienature.fr/sites/vigienature/files/atoms/files/analysestoceps_0.zip
the first version written by Romain Lorrilliere

Original script information:

Estimate temporal evolution of population per species - ExeMainGlmGalaxy.r
This script analyse the temporal evolution of species population and create graphical vizualisation.

Script needs the followings inputs :
 - stoc or community data filtered with at least 4 columns: year, site, species, and abundance with 0. Corresponding to "observed" or predicted 0 abundance. May come from the tools "Preprocess population data for evolution trend analyzes" (ExemakeTableAnalyseGalaxy.r) followed by "Filter species with rare and low abundances" (ExeFilteringRareLowabundSPGalaxy.r).
 - species details file with name and indicator status file with at least 2 columns: the species name or species ID (found in the community data or in stoc data) and his status as indicator species
 - file that stocks functions : "FunctTrendSTOCGalaxy.r"


Arguments are :
 - spExclude: list of species (using the the species name or ID) that you want to exclude
 - assessIC : compute and show confidence interval in plots (TRUE / FALSE)
 - analysis custom id


How to execute, eg :
 # all files are available in github repo
 #Exec id=mainglm, return IC on plot, no species excluded
 $ Rscript ExeMainGlmGalaxy.r' Datafilteredfortrendanalysis.tabular tabSpecies.csv 'mainglm' '' 'TRUE' FunctTrendSTOCGalaxy.r


Outputs are created in an Output repo :
GLM gives 1 graph per species and 2 tables:
- nameofspecies_id.png (one plot per species)
- tendanceGlobalEspece_id.tabular
- variationsAnnuellesEspece_id.tabular


R library needed
r-lme4  version 1.1.18.1
r-ggplot2  version 3.0.0
r-speedglm  version 0.3.2
r-arm  version 1.10.1
r-reshape  version 0.8.8
r-data.table  version 1.12.0
r-reshape2   version 1.4.3
  ]]></help>
  <expand macro="stoceps_bibref" />
</tool>