Repository 'pampa_glmcomm'
hg clone https://toolshed.g2.bx.psu.edu/repos/ecology/pampa_glmcomm

Changeset 4:44b9069775ca (2020-11-22)
Previous changeset 3:97967fbcf6da (2020-07-27) Next changeset 5:8db02073b671 (2021-04-26)
Commit message:
"planemo upload for repository https://github.com/ColineRoyaux/PAMPA-Galaxy commit 3df1978827a91be30e815dee2ed83a92862d1b1c"
modified:
FunctExeCalcGLMGalaxy.r
FunctPAMPAGalaxy.r
PAMPA_GLM.xml
pampa_macros.xml
test-data/Community_metrics_cropped.tabular
removed:
test-data/GLM_table_community_on_Community_metrics_cropped.tabular
test-data/Simple_statistics_on_Community_metrics_cropped.txt
b
diff -r 97967fbcf6da -r 44b9069775ca FunctExeCalcGLMGalaxy.r
--- a/FunctExeCalcGLMGalaxy.r Mon Jul 27 09:52:47 2020 -0400
+++ b/FunctExeCalcGLMGalaxy.r Sun Nov 22 18:40:23 2020 +0000
[
b'@@ -1,4 +1,4 @@\n-#Rscript \r\n+#Rscript\r\n \r\n #####################################################################################################################\r\n #####################################################################################################################\r\n@@ -8,270 +8,253 @@\n \r\n ###################### Packages\r\n suppressMessages(library(multcomp))\r\n+suppressMessages(library(DHARMa))\r\n suppressMessages(library(glmmTMB)) ###Version: 0.2.3\r\n-suppressMessages(library(gap)) \r\n+suppressMessages(library(gap))\r\n+\r\n \r\n ###################### Load arguments and declaring variables\r\n \r\n-args = commandArgs(trailingOnly=TRUE)\r\n-#options(encoding = "UTF-8")\r\n+args <- commandArgs(trailingOnly = TRUE)\r\n \r\n if (length(args) < 10) {\r\n-    stop("At least 4 arguments must be supplied : \\n- two input dataset files (.tabular) : metrics table and unitobs table \\n- Interest variable field from metrics table \\n- Response variable from unitobs table.", call.=FALSE) #si pas d\'arguments -> affiche erreur et quitte / if no args -> error and exit1\r\n+    stop("At least 4 arguments must be supplied : \\n- two input dataset files (.tabular) : metrics table and unitobs table \\n- Interest variable field from metrics table \\n- Response variable from unitobs table.", call. = FALSE) # if no args -> error and exit1\r\n \r\n } else {\r\n-    Importdata <- args[1] ###### file name : metrics table\r\n-    ImportUnitobs <- args[2] ###### file name : unitobs informations\r\n+    import_data <- args[1] ###### file name : metrics table\r\n+    import_unitobs <- args[2] ###### file name : unitobs informations\r\n     colmetric <- as.numeric(args[3]) ###### Selected interest metric for GLM\r\n-    listFact <- strsplit(args [4],",")[[1]] ###### Selected response factors for GLM\r\n-    listRand <- strsplit(args [5],",")[[1]] ###### Selected randomized response factors for GLM\r\n-    colFactAna <- args[6] ####### (optional) Selected splitting factors for GLMs\r\n-    Distrib <- args[7] ###### (optional) Selected distribution for GLM \r\n-    log <- args[8] ###### (Optional) Log on interest metric ?\r\n+    list_fact <- strsplit(args [4], ",")[[1]] ###### Selected response factors for GLM\r\n+    list_rand <- strsplit(args [5], ",")[[1]] ###### Selected randomized response factors for GLM\r\n+    col_fact_ana <- args[6] ####### (optional) Selected splitting factors for GLMs\r\n+    distrib <- args[7] ###### (optional) Selected distribution for GLM\r\n+    glm_out <- args[8] ###### (Optional) GLM object as Rdata output ?\r\n     aggreg <- args[9] ###### Aggregation level of the data table\r\n     source(args[10]) ###### Import functions\r\n \r\n }\r\n-#### Data must be a dataframe with at least 3 variables : unitobs representing location and year ("observation.unit"), species code ("species.code") and abundance ("number")\r\n+\r\n+\r\n+#### d_ata must be a dataframe with at least 3 variables : unitobs representing location and year ("observation.unit"), species code ("species.code") and abundance ("number")\r\n \r\n \r\n-#Import des donn\xc3\xa9es / Import data \r\n-obs<- read.table(Importdata,sep="\\t",dec=".",header=TRUE,encoding="UTF-8") #\r\n-obs[obs == -999] <- NA \r\n+#Import des donn\xc3\xa9es / Import data\r\n+obs <- read.table(import_data, sep = "\\t", dec = ".", header = TRUE, encoding = "UTF-8") #\r\n+obs[obs == -999] <- NA\r\n metric <- colnames(obs)[colmetric]\r\n-tabUnitobs <- read.table(ImportUnitobs,sep="\\t",dec=".",header=TRUE,encoding="UTF-8")\r\n-tabUnitobs[tabUnitobs == -999] <- NA \r\n+tab_unitobs <- read.table(import_unitobs, sep = "\\t", dec = ".", header = TRUE, encoding = "UTF-8")\r\n+tab_unitobs[tab_unitobs == -999] <- NA\r\n \r\n-if (colFactAna != "None")\r\n-{\r\n-    FactAna <- colnames(tabUnitobs)[as.numeric(colFactAna)]\r\n-    if (class(tabUnitobs[FactAna]) == "numeric" || FactAna == "observation.unit"){stop("Wrong chosen separation factor : Analysis can\'t be separated by observation unit or numeric factor")}\r\n+if (col_fact_ana != "None") {\r\n+    fact_ana <- colnames(tab_unitobs)[as.numeric(col_fact_ana)]\r\n+    if (cla'..b'-    if (listRand[1] != "None")\r\n-    {\r\n-        resG <- glmmTMB(exprML,family=loiChoisie, data=tmpData)\r\n+    if (list_rand[1] != "None") {\r\n+        res_g <- glmmTMB::glmmTMB(expr_lm, family = chose_distrib, data = tmpd_ata)\r\n+        if (is.element("year", list_fact) && ! is.element("year", list_rand)) { #Model with year as continuous\r\n+            yr <- tmpd_ata$year\r\n+            tmpd_ata$year <- as.numeric(tmpd_ata$year)\r\n+            res_gy <- glmmTMB::glmmTMB(expr_lm, family = chose_distrib, data = tmpd_ata)\r\n+            tmpd_ata$year <- as.factor(tmpd_ata$year)\r\n+            tmpd_ata$year <- yr\r\n+        }else{\r\n+            res_gy <- ""\r\n+        }\r\n+\r\n     }else{\r\n-        resG <- glm(exprML,data=tmpData,family=loiChoisie)\r\n+        res_g <- glm(expr_lm, data = tmpd_ata, family = chose_distrib)\r\n+        if (is.element("year", list_fact)) { #Model with year as continuous\r\n+            yr <- tmpd_ata$year\r\n+            tmpd_ata$year <- as.numeric(tmpd_ata$year)\r\n+            res_gy <- glm(expr_lm, family = chose_distrib, data = tmpd_ata)\r\n+            tmpd_ata$year <- yr\r\n+        }else{\r\n+            res_gy <- ""\r\n+        }\r\n     }\r\n \r\n     ## write results :\r\n-    TabSum <- sortiesLM.f(objLM=resG, TabSum=TabSum, metrique=metrique,\r\n-                          factAna=factAna, cut="global", colAna="analysis", lev=lev, #modSel=iFactGraphSel, listFactSel=listFactSel,\r\n-                          listFact=listFact,\r\n-                          Data=tmpData, #Log=Log,\r\n-                          type=ifelse(tableMetrique == "unitSpSz" && factAna != "size.class",\r\n-                                      "CL_unitobs",\r\n-                                      "unitobs"))\r\n+\r\n+    save(res_g, file = "global_GLM.Rdata")\r\n \r\n-    TabRate[TabRate[,"analysis"]=="global",c(2:11)] <- noteGLM.f(data=tmpData, objLM=resG, metric=metrique, listFact=listFact, details=TRUE)\r\n-    noteGLMs.f(tabRate=TabRate,exprML=exprML,objLM=resG, file_out=TRUE)\r\n+    tab_sum <- sorties_lm_f(obj_lm = res_g, obj_lmy = res_gy, tab_sum = tab_sum, metrique = metrique,\r\n+                          fact_ana = fact_ana, cut = "global", col_ana = "analysis", lev = lev, #modSel = iFactGraphSel, list_fact_sel = list_fact_sel,\r\n+                          list_fact = list_fact, list_rand = list_rand,\r\n+                          d_ata = tmpd_ata)\r\n+\r\n+    tab_rate[tab_rate[, "analysis"] == "global", c(2:11)] <- .GlobalEnv$note_glm_f(data = tmpd_ata, obj_lm = res_g, metric = metrique, list_fact = list_fact, details = TRUE)\r\n+    .GlobalEnv$note_glms_f(tab_rate = tab_rate, expr_lm = expr_lm, obj_lm = res_g, file_out = TRUE)\r\n+\r\n     ## simple statistics and infos :\r\n     filename <- "GLMSummaryFull.txt"\r\n+    info_stats_f(filename = filename, d_ata = tmpd_ata, agreg_level = aggreg, type = "stat",\r\n+                metrique = metrique, fact_graph = fact_ana, #fact_graph_sel = modSel,\r\n+                list_fact = list_fact)#, list_fact_sel = list_fact_sel)\r\n \r\n-    ## Save data on model :\r\n-        \r\n-    infoStats.f(filename=filename, Data=tmpData, agregLevel=aggreg, type="stat",\r\n-                metrique=metrique, factGraph=factAna, #factGraphSel=modSel,\r\n-                listFact=listFact)#, listFactSel=listFactSel)\r\n+    tab_sum$separation <- fact_ana\r\n \r\n-    return(TabSum)\r\n+    return(tab_sum)\r\n \r\n }\r\n \r\n ################# Analysis\r\n \r\n-Tab <- modeleLineaireWP2.unitobs.f(metrique=metric, listFact=listFact, listRand=listRand, FactAna=FactAna, Distrib=Distrib, log=log, tabMetrics=obs, tableMetrique=aggreg, tabUnitobs=tabUnitobs, nbName="number")\r\n+tab <- glm_community(metrique = metric, list_fact = list_fact, list_rand = list_rand, fact_ana = fact_ana, distrib = distrib, tab_metrics = obs, tab_metrique = aggreg, tab_unitobs = tab_unitobs, nb_name = "number")\r\n \r\n-write.table(Tab,"GLMSummary.tabular", row.names=FALSE, sep="\\t", dec=".",fileEncoding="UTF-8")\r\n+write.table(tab, "GLMSummary.tabular", row.names = FALSE, sep = "\\t", dec = ".", fileEncoding = "UTF-8")\r\n'
b
diff -r 97967fbcf6da -r 44b9069775ca FunctPAMPAGalaxy.r
--- a/FunctPAMPAGalaxy.r Mon Jul 27 09:52:47 2020 -0400
+++ b/FunctPAMPAGalaxy.r Sun Nov 22 18:40:23 2020 +0000
[
b'@@ -11,77 +11,71 @@\n ######################################### start of the function fact.def.f called by FunctExeCalcCommIndexesGalaxy.r and FunctExeCalcPresAbsGalaxy.r\n ####### Define the finest aggregation with the observation table\n \n-fact.det.f <- function (Obs,\n-                        size.class="size.class",\n-                        code.especes="species.code",\n-                        unitobs="observation.unit")\n-{\n-    if (any(is.element(c(size.class), colnames(obs))) && all(! is.na(obs[, size.class])))\n-        {\n-            factors <- c(unitobs, code.especes, size.class)\n+fact_det_f <- function(obs,\n+                       size_class = "size.class",\n+                       code_species = "species.code",\n+                       unitobs = "observation.unit") {\n+    if (any(is.element(c(size_class), colnames(obs))) && all(! is.na(obs[, size_class]))) {\n+            factors <- c(unitobs, code_species, size_class)\n         }else{\n-            factors <- c(unitobs, code.especes)\n+            factors <- c(unitobs, code_species)\n         }\n     return(factors)\n }\n \n-######################################### end of the function fact.def.f \n+######################################### end of the function fact.def.f\n \n-######################################### start of the function def.typeobs.f called by FunctExeCalcCommIndexesGalaxy.r and FunctExeCalcPresAbsGalaxy.r\n+######################################### start of the function def_typeobs_f called by FunctExeCalcCommIndexesGalaxy.r and FunctExeCalcPresAbsGalaxy.r\n ####### Define observation type from colnames\n \n-def.typeobs.f <- function(Obs)\n-{\n-    if (any(is.element(c("rotation","rot","rotate"),colnames(obs))))\n-    {\n-        ObsType <- "SVR"\n+def_typeobs_f <- function(obs) {\n+    if (any(is.element(c("rotation", "rot", "rotate"), colnames(obs)))) {\n+        obs_type <- "SVR"\n     }else{\n-        ObsType <- "other"\n+        obs_type <- "other"\n     }\n-    return(ObsType)\n+    return(obs_type)\n }\n-######################################### end of the function fact.def.f \n+######################################### end of the function fact.def.f\n \n-######################################### start of the function create.unitobs called by FunctExeCalcCommIndexesGalaxy.r and FunctExeCalcPresAbsGalaxy.r\n+######################################### start of the function create_unitobs called by FunctExeCalcCommIndexesGalaxy.r and FunctExeCalcPresAbsGalaxy.r\n ####### Create unitobs column when inexistant\n-create.unitobs <- function(data,year="year",point="point", unitobs="observation.unit")\n-{\n-    if (is.element(paste(unitobs),colnames(data)) && all(grepl("[1-2][0|8|9][0-9]{2}_.*",data[,unitobs])==FALSE))\n-    {\n-        unitab <- data\n+create_unitobs <- function(data, year = "year", location = "location", unitobs = "observation.unit") {\n+    if (is.element(paste(unitobs), colnames(data))) {\n+            unitab <- data\n+    }else{\n \n-    }else{ \n-\n-        unitab <- unite(data,col="observation.unit",c(year,point))\n+        unitab <- tidyr::unite(data, col = "observation.unit", c(year, location))\n     }\n     return(unitab)\n }\n-######################################### start of the function create.unitobs\n+######################################### start of the function create_unitobs\n \n-######################################### start of the function create.year.point called by FunctExeCalcCommIndexesGalaxy.r and FunctExeCalcPresAbsGalaxy.r\n+######################################### start of the function create_year_location called by FunctExeCalcCommIndexesGalaxy.r and FunctExeCalcPresAbsGalaxy.r\n ####### separate unitobs column when existant\n-create.year.point <- function(data,year="year",point="point", unitobs="observation.unit")\n-{\n-    if (all(grepl("[1-2][0|8|9][0-9]{2}_.*",data[,unitobs]))==TRUE)\n-    {\n-        tab <- separate(data,col=unitobs,into=c(year,point),sep="_")\n+create_year_location <- function(data, year = "year", location = "location", unitobs = "observation.uni'..b' "Raw residuals" , ylab = "Residual", xlab = "Predicted")\n-  mtext("Conventional residual plots", outer = T)\n-}\n-\n-\n-\n-\n-#\n-#\n-# if(quantreg == F){\n-#\n-#   lines(smooth.spline(simulationOutput$fittedPredictedResponse, simulationOutput$scaledResiduals, df = 10), lty = 2, lwd = 2, col = "red")\n-#\n-#   abline(h = 0.5, col = "red", lwd = 2)\n-#\n-# }else{\n-#\n-#   #library(gamlss)\n-#\n-#   # qrnn\n-#\n-#   # http://r.789695.n4.nabble.com/Quantile-GAM-td894280.html\n-#\n-#   #require(quantreg)\n-#   #dat <- plyr::arrange(dat,pred)\n-#   #fit<-quantreg::rqss(resid~qss(pred,constraint="N"),tau=0.5,data = dat)\n-#\n-#   probs = c(0.25, 0.50, 0.75)\n-#\n-#   w <- p <- list()\n-#   for(i in seq_along(probs)){\n-#     capture.output(w[[i]] <- qrnn::qrnn.fit(x = as.matrix(simulationOutput$fittedPredictedResponse), y = as.matrix(simulationOutput$scaledResiduals), n.hidden = 4, tau = probs[i], iter.max = 1000, n.trials = 1, penalty = 1))\n-#     p[[i]] <- qrnn::qrnn.predict(as.matrix(sort(simulationOutput$fittedPredictedResponse)), w[[i]])\n-#   }\n-#\n-#\n-#\n-#   #plot(simulationOutput$fittedPredictedResponse, simulationOutput$scaledResiduals, xlab = "Predicted", ylab = "Residual", main = "Residual vs. predicted\\n lines should match", cex.main = 1)\n-#\n-#   #lines(sort(simulationOutput$fittedPredictedResponse), as.vector(p[[1]]), col = "red")\n-#\n-#   matlines(sort(simulationOutput$fittedPredictedResponse), matrix(unlist(p), nrow = length(simulationOutput$fittedPredictedResponse), ncol = length(p)), col = "red", lty = 1)\n-#\n-#   #     as.vector(p[[1]])\n-#   #\n-#   #\n-#   #     lines(simulationOutput$fittedPredictedResponse,p[[1]], col = "red", lwd = 2)\n-#   #     abline(h = 0.5, col = "red", lwd = 2)\n-#   #\n-#   #     fit<-quantreg::rqss(resid~qss(pred,constraint="N"),tau=0.25,data = dat)\n-#   #     lines(unique(dat$pred)[-1],fit$coef[1] + fit$coef[-1], col = "green", lwd = 2, lty =2)\n-#   #     abline(h = 0.25, col = "green", lwd = 2, lty =2)\n-#   #\n-#   #     fit<-quantreg::rqss(resid~qss(pred,constraint="N"),tau=0.75,data = dat)\n-#   #     lines(unique(dat$pred)[-1],fit$coef[1] + fit$coef[-1], col = "blue", lwd = 2, lty = 2)\n-#   #     abline(h = 0.75, col = "blue", lwd = 2, lty =2)\n-# }\n-\n-####################### plot.R\n-\n-####################### random.R\n-\n-#\' Record and restore a random state\n-#\' \n-#\' The aim of this function is to record, manipualate and restor a random state\n-#\' \n-#\' @details This function is intended for two (not mutually exclusive tasks)\n-#\' \n-#\' a) record the current random state\n-#\' \n-#\' b) change the current random state in a way that the previous state can be restored\n-#\' \n-#\' @return a list with various infos about the random state that after function execution, as well as a function to restore the previous state before the function execution\n-#\' \n-#\' @param seed seed argument to set.seed(). NULL = no seed, but random state will be restored. F = random state will not be restored\n-#\' @export\n-#\' @example inst/examples/getRandomStateHelp.R\n-#\' @author Florian Hartig\n-#\' \n-getRandomState <- function(seed = NULL){\n-  \n-  # better to explicitly access the global RS?\n-  # current = get(".Random.seed", .GlobalEnv, ifnotfound = NULL)\n-  \n-  current = mget(".Random.seed", envir = .GlobalEnv, ifnotfound = list(NULL))[[1]]\n-  \n-  if(is.logical(seed) & seed == F){\n-    restoreCurrent <- function(){}    \n-  }else{\n-    restoreCurrent <- function(){\n-      if(is.null(current)) rm(".Random.seed", envir = .GlobalEnv) else assign(".Random.seed", current , envir = .GlobalEnv)\n-    }    \n-  }\n-\n-  # setting seed\n-  if(is.numeric(seed)) set.seed(seed)\n-\n-  # ensuring that RNG has been initialized\n-  if (is.null(current))runif(1) \n-  \n-  randomState = list(seed, state = get(".Random.seed", globalenv()), kind = RNGkind(), restoreCurrent = restoreCurrent)  \n-  return(randomState)\n-}\n-\n-####################### random.R\n-\n-######################################### Package DHARMa\n+######################################### start of the function summary_fr\n'
b
diff -r 97967fbcf6da -r 44b9069775ca PAMPA_GLM.xml
--- a/PAMPA_GLM.xml Mon Jul 27 09:52:47 2020 -0400
+++ b/PAMPA_GLM.xml Sun Nov 22 18:40:23 2020 +0000
b
@@ -15,15 +15,21 @@
          '$sep'
          #if $settings.advanced=='advanced' 
              $settings.distrib
-             'FALSE'
+             $settings.rdata
          #else
              'None'
-             'FALSE'
+             'false'
          #end if
          'unit'
          '$__tool_directory__/FunctPAMPAGalaxy.r' 
          '$output_summary'
          '$output_recap'
+         '$output_rate'
+         #if $settings.advanced=='advanced'
+             #if $settings.rdata=='true'
+                 '$output_GLM'
+             #end if
+         #end if
     ]]>
     </command>
     <inputs>
@@ -39,14 +45,16 @@
         <expand macro="pampa_output_GLM"/>
     </outputs>
     <tests>
-        <test>
+        <test expect_num_outputs="4">
             <param name="input_metric" value="Community_metrics_cropped.tabular"/>
             <param name="input_unitobs" value="Unitobs.tabular"/>
             <param name="varint" value="4"/>
             <param name="varrep" value="year,site,habitat"/>
             <param name="varrand" value="site"/>
             <param name="sep" value="22"/>
-            <param name="advanced" value="simple"/>
+            <param name="advanced" value="advanced"/>
+            <param name="distrib" value="None"/>
+            <param name="rdata" value="true"/>
             <output name="output_summary">
                 <assert_contents> 
                     <has_n_lines n="9"/>
@@ -54,14 +62,31 @@
             </output>
             <output name="output_recap">
                 <assert_contents>
-                    <has_n_lines n="413"/>
+                    <has_n_lines n="412"/>
                 </assert_contents> 
             </output>
             <output name="output_rate">
                 <assert_contents> 
-                    <has_n_lines n="51"/>
+                    <has_n_lines n="50"/>
                 </assert_contents> 
             </output>
+            <output_collection name="output_GLM"  type="list" count="3">
+                <element name="GLM_HR" ftype="Rdata">
+                    <assert_contents> 
+                        <has_size value="185018" delta="10000"/>
+                    </assert_contents> 
+                </element>
+                <element name="GLM_RE" ftype="Rdata">
+                    <assert_contents> 
+                        <has_size value="168685" delta="10000"/>
+                    </assert_contents> 
+                </element>
+                <element name="global_GLM" ftype="Rdata">
+                    <assert_contents> 
+                        <has_size value="195910" delta="10000"/>
+                    </assert_contents> 
+                </element>
+            </output_collection>
         </test>
     </tests>
     <edam_topics>
@@ -118,13 +143,15 @@
 A tabular file with unitobs or location data which contains at least as much columns as used response variables and separation factor in addition with the 'observation.unit' or 'location' column.
 
 +--------------------------------+---------+--------+------------+-----+       
-| observation.unit OR location   | ??site? |  year  |  habitat   | ... |            
+| observation.unit OR location   |   site  |  year  |  habitat   | ... |            
 +================================+=========+========+============+=====+        
 |  site_yearID     OR locationID | site ID |  2000  | habitatID  | ... |            
 +--------------------------------+---------+--------+------------+-----+        
 |              ...               |   ...   |   ...  |     ...    | ... |       
 +--------------------------------+---------+--------+------------+-----+ 
 
+The site may represent the same entity as the location or represent an aggregation of several locations
+
 |
 
 **Output**
@@ -142,6 +169,5 @@
 Derived from PAMPA scripts (https://wwz.ifremer.fr/pampa/Meth.-Outils/Outils) written by Yves Reecht.
 
   ]]></help>
-
   <expand macro="pampa_bibref" />
 </tool>
b
diff -r 97967fbcf6da -r 44b9069775ca pampa_macros.xml
--- a/pampa_macros.xml Mon Jul 27 09:52:47 2020 -0400
+++ b/pampa_macros.xml Sun Nov 22 18:40:23 2020 +0000
[
@@ -1,5 +1,5 @@
 <macros>
-    <token name="@VERSION@">0.0.1</token>
+    <token name="@VERSION@">0.0.2</token>
     <xml name="Pampa_requirements">
         <requirements>
             <requirement type="package" version="1.0.2">r-tidyr</requirement>
@@ -10,11 +10,13 @@
             <requirement type="package" version="1.2.2">r-gap</requirement>
             <requirement type="package" version="1.0.1">r-glmmtmb</requirement>
             <requirement type="package" version="1.4_13">r-multcomp</requirement>
+            <requirement type="package" version="0.3.3.0">r-dharma</requirement>
         </requirements>    
     </xml>
     <xml name="Plot_requirements">
         <requirements>
             <requirement type="package" version="3.1.1">r-ggplot2</requirement>
+            <requirement type="package" version="1.3_25">r-boot</requirement>
         </requirements>    
     </xml>
     <xml name="pampa_input_calculate">
@@ -46,6 +48,7 @@
                 <option value="quasibinomial">Quasi-Binomial</option>
                 <option value="Gamma">Gamma</option>
             </param>
+            <param name="rdata" type="boolean" checked="yes" label="GLM object(s) as .Rdata output ?"/>
         </when>
     </xml>
     <xml name="pampa_input_GLM">
@@ -67,6 +70,10 @@
     <xml name="pampa_output_GLM">
         <data name="output_recap" from_work_dir="GLMSummaryFull.txt" format="txt" label="Simple statistics on chosen variables on ${on_string}"/>
         <data name="output_rate" from_work_dir="RatingGLM.txt" format="txt" label="Your analysis rating file on ${on_string}"/>
+        <collection type="list" name="output_GLM">
+            <discover_datasets pattern="(?P&lt;designation&gt;.+)\.Rdata" visible="false" format="Rdata"/>
+            <filter> settings['advanced'] == 'advanced' and settings['rdata']</filter>
+        </collection>
     </xml>
     <xml name="pampa_bibref">
         <citations>
b
diff -r 97967fbcf6da -r 44b9069775ca test-data/Community_metrics_cropped.tabular
--- a/test-data/Community_metrics_cropped.tabular Mon Jul 27 09:52:47 2020 -0400
+++ b/test-data/Community_metrics_cropped.tabular Sun Nov 22 18:40:23 2020 +0000
b
@@ -1,4 +1,4 @@
-"point" "year" "number" "species.richness" "simpson" "simpson.l" "shannon" "pielou" "hill" "observation.unit"
+"location" "year" "number" "species_richness" "simpson" "simpson_l" "shannon" "pielou" "hill" "observation.unit"
 "AB_0008" "08" 2.66666666666667 1 1 0 0 NA 0 "AB080008"
 "AB_0015" "08" 3 1 1 0 0 NA 0 "AB080015"
 "AB_0027" "08" 1.33333333333333 1 1 0 0 NA 0 "AB080027"
b
diff -r 97967fbcf6da -r 44b9069775ca test-data/GLM_table_community_on_Community_metrics_cropped.tabular
--- a/test-data/GLM_table_community_on_Community_metrics_cropped.tabular Mon Jul 27 09:52:47 2020 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
b
@@ -1,9 +0,0 @@
-"analysis" "AIC" "BIC" "logLik" "deviance" "df.resid" "site Std.Dev" "site NbObservation" "site NbLevels" "(Intercept) Estimate" "(Intercept) Std.Err" "(Intercept) Zvalue" "(Intercept) Pvalue" "(Intercept) signif" "2007 Estimate" "2007 Std.Err" "2007 Zvalue" "2007 Pvalue" "2007 signif" "2008 Estimate" "2008 Std.Err" "2008 Zvalue" "2008 Pvalue" "2008 signif" "2009 Estimate" "2009 Std.Err" "2009 Zvalue" "2009 Pvalue" "2009 signif" "2010 Estimate" "2010 Std.Err" "2010 Zvalue" "2010 Pvalue" "2010 signif" "2012 Estimate" "2012 Std.Err" "2012 Zvalue" "2012 Pvalue" "2012 signif" "2013 Estimate" "2013 Std.Err" "2013 Zvalue" "2013 Pvalue" "2013 signif" "2014 Estimate" "2014 Std.Err" "2014 Zvalue" "2014 Pvalue" "2014 signif" "2015 Estimate" "2015 Std.Err" "2015 Zvalue" "2015 Pvalue" "2015 signif" "2017 Estimate" "2017 Std.Err" "2017 Zvalue" "2017 Pvalue" "2017 signif" "Algueraie Estimate" "Algueraie Std.Err" "Algueraie Zvalue" "Algueraie Pvalue" "Algueraie signif" "Corail vivant Estimate" "Corail vivant Std.Err" "Corail vivant Zvalue" "Corail vivant Pvalue" "Corail vivant signif" "Detritique Estimate" "Detritique Std.Err" "Detritique Zvalue" "Detritique Pvalue" "Detritique signif" "Fond lagonaire Estimate" "Fond lagonaire Std.Err" "Fond lagonaire Zvalue" "Fond lagonaire Pvalue" "Fond lagonaire signif" "Herbier Estimate" "Herbier Std.Err" "Herbier Zvalue" "Herbier Pvalue" "Herbier signif"
-"global" 1169.85553483615 1229.8072692927 -570.927767418076 1141.85553483615 521 1.59251042176055e-10 535 87 0.118133111837098 0.434473586560398 0.271899409978692 0.785699364921455 "no" NA NA NA NA NA 0.118687708068083 0.399785006104677 0.296878838014765 0.766559013008675 "no" 0.0646371228103185 0.364459593521298 0.17735058689446 0.859233017913944 "no" 0.105507841016204 0.352103585938559 0.299650004230898 0.764444137876394 "no" 0.0851478702556891 0.351563458225979 0.242197726365968 0.80862695671179 "no" 0.1533487510054 0.339953377222602 0.451087594005536 0.6519264186766 "no" 0.228507846909817 0.353899401497984 0.645685881192764 0.518482806041728 "no" 0.239650172912319 0.364273785919598 0.657884761889548 0.51061218297113 "no" 0.337015353941636 0.362942156169953 0.928564919264499 0.353114609259249 "no" NA NA NA NA NA -0.142550193876975 0.452611064972199 -0.314950748907854 0.752799048806809 "no" -0.178796240015508 0.459730831359819 -0.38891505163283 0.697338987421269 "no" -0.221942617035652 0.460379354246399 -0.48208638156451 0.629744583695757 "no" -0.221404378122779 0.579179245722301 -0.382272637975248 0.702259148038755 "no"
-"AGDR" NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
-"HR" 768.456141857877 818.459845933627 -371.228070928939 742.456141857877 333 2.62888261448872e-10 346 72 0.112368399841429 0.526793925356224 0.213306179955367 0.831088153569532 "no" NA NA NA NA NA 0.11164543889717 0.593803894576803 0.188017357105309 0.850863044825241 "no" 0.121415944102037 0.557706781676539 0.217705697852633 0.827658423916931 "no" 0.115414609326645 0.569858403309597 0.202532082805739 0.839500779618622 "no" 0.112213383526748 0.519188312510869 0.21613233738654 0.828884593775827 "no" 0.210493458234632 0.503972480092199 0.417668556418245 0.676189464933743 "no" 0.275428865924547 0.514312937772411 0.535527780260559 0.59228495305055 "no" NA NA NA NA NA 0.385145331116451 0.520619460588355 0.739782816956547 0.45943178693481 "no" NA NA NA NA NA -0.182508346525939 0.505228061716246 -0.361239527958846 0.717920395287036 "no" -0.22036844899207 0.513754712627388 -0.428937085297157 0.66796901083435 "no" -0.27736617683739 0.516506926776123 -0.537003789220454 0.591264996648501 "no" -0.261218234913013 0.776178596326083 -0.336543981178362 0.736460691488969 "no"
-"RC" NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
-"RE" 326.411661917969 359.306420372536 -152.205830958985 304.411661917969 136 1.90565822135145e-10 147 13 -4.79551045071361e-05 1.00002389454798 -4.79539586689696e-05 0.999961738276763 "no" NA NA NA NA NA 0.128878371535427 0.554219868350424 0.232540150390168 0.816118506243687 "no" 0.00492161658531514 0.499014822988023 0.0098626661144959 0.992130858553858 "no" 0.0651305567756825 0.474549367503352 0.137247168020348 0.890835428948668 "no" 0.0890325415585215 0.504880301566295 0.176343860678095 0.860023806067967 "no" -0.023292299954742 0.561775902245214 -0.0414619065389796 0.966927660902017 "no" NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 0.0314938587304663 1.10152135635934 0.0285912375176794 0.977190600676998 "no" -0.0392658401765049 1.12781459045108 -0.0348158646899577 0.972226570107609 "no" -0.0536806388051385 1.11290602838387 -0.0482346554300655 0.96152923128104 "no" -0.0444020696124091 1.17586933785629 -0.0377610574431323 0.969878193871062 "no"
-"RI" NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
-"RN" NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
-"RP" NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
b
diff -r 97967fbcf6da -r 44b9069775ca test-data/Simple_statistics_on_Community_metrics_cropped.txt
--- a/test-data/Simple_statistics_on_Community_metrics_cropped.txt Mon Jul 27 09:52:47 2020 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
b
b'@@ -1,420 +0,0 @@\n-\n-##################################################\n-Metrics and factors (and possible units/selections):\n-\n- Metrics: species.richness \n-            aggregated per observation units.\n-\n-Analyses factor(s): \n- *  year \n- *  habitat \n- *  site \n- *  \n-\n-########################\n-Base statistics:\n-\n-      Min.    1st Qu.     Median       Mean    3rd Qu.       Max.         sd \n-  1.000000   1.000000   1.000000   1.106892   1.000000   2.000000   0.309200 \n-         N \n-711.000000 \n-\n-#########################################\n-Statistics per combination of factor levels:\n-\n-                                              Min. 1st Qu. Median     Mean\n-2007.Algueraie.Ilot Signal                       1    1.00    1.0 1.000000\n-2007.Algueraie.Radiales Signal laregnere         1    1.00    1.0 1.000000\n-2007.Corail vivant.Ilot Signal                   1    1.00    1.0 1.000000\n-2007.Corail vivant.NA                            1    1.00    1.0 1.000000\n-2007.Corail vivant.Recif Senez                   1    1.00    1.0 1.000000\n-2007.Detritique.Recif Laregnere                  1    1.00    1.0 1.000000\n-2007.Fond lagonaire.Ilot Signal                  1    1.00    1.0 1.000000\n-2007.Herbier.Ilot Signal                         1    1.00    1.0 1.000000\n-2008.Corail vivant.Abore                         1    1.00    1.0 1.000000\n-2008.Corail vivant.Laregnere                     2    2.00    2.0 2.000000\n-2008.Corail vivant.NA                            1    1.00    1.0 1.000000\n-2008.Detritique.Mbe Kouen                        1    1.00    1.0 1.000000\n-2008.Detritique.NA                               1    1.00    1.0 1.000000\n-2008.Detritique.Recif Laregnere                  1    1.00    1.0 1.000000\n-2008.Fond lagonaire.Abore                        1    1.00    1.0 1.000000\n-2008.Fond lagonaire.NA                           1    1.00    1.0 1.000000\n-2008.Herbier.Ilot Signal                         1    1.00    1.0 1.000000\n-2008.Herbier.Radiales Signal laregnere           1    1.00    1.0 1.000000\n-2009.Algueraie.NA                                1    1.00    1.0 1.000000\n-2009.Corail vivant.Abore                         1    1.00    1.0 1.037037\n-2009.Corail vivant.Mbe Kouen                     1    1.00    1.0 1.000000\n-2009.Corail vivant.NA                            1    1.00    1.0 1.125000\n-2009.Corail vivant.Recif Laregnere               1    1.00    1.0 1.000000\n-2009.Detritique.Mbe Kouen                        1    1.00    1.0 1.000000\n-2009.Detritique.NA                               1    1.00    1.0 1.000000\n-2009.Detritique.Recif Laregnere                  1    1.00    1.0 1.000000\n-2009.Fond lagonaire.Mbe Kouen                    1    1.00    1.0 1.000000\n-2009.Fond lagonaire.NA                           1    1.00    1.0 1.000000\n-2009.Fond lagonaire.Radiales Signal laregnere    1    1.00    1.0 1.000000\n-2009.Herbier.Radiales Signal laregnere           1    1.00    1.0 1.000000\n-2010.Corail vivant.Abore                         1    1.00    1.0 1.114286\n-2010.Detritique.Abore                            1    1.00    1.0 1.000000\n-2010.Detritique.Laregnere                        1    1.00    1.0 1.000000\n-2010.Detritique.Mbe Kouen                        1    1.00    1.0 1.000000\n-2010.Detritique.Recif Laregnere                  1    1.00    1.0 1.000000\n-2010.Fond lagonaire.Abore                        1    1.00    1.0 1.000000\n-2010.Fond lagonaire.Laregnere                    1    1.00    1.0 1.000000\n-2010.Fond lagonaire.Mbe Kouen                    1    1.00    1.0 1.000000\n-2010.Herbier.Radiales Signal laregnere           1    1.00    1.0 1.000000\n-2012.Corail vivant.Baie Port Bouquet             1    1.00    1.0 1.000000\n-2012.Corail vivant.Cap Goulvain                  1    1.00    1.0 1.000000\n-2012.Corail vivant.Deva                          1    1.00    1.0 1.000000\n-2012.Corail vivant.Grand recif Ngoe              1    1.00    1.0 1.000000\n-2012.Corail vivant.Ilot de sable                 1    1.00 '..b'       1.00    1 0.0000  2\n-2013.Fond lagonaire.Mbo                          1.00    1     NA  1\n-2013.Fond lagonaire.NA                           1.00    2 0.2422 49\n-2013.Fond lagonaire.Recif Bellona Sud            1.00    1     NA  1\n-2013.Fond lagonaire.Recif Cimenia                1.00    2 0.4082  6\n-2013.Fond lagonaire.Recif Ia                     1.00    1     NA  1\n-2013.Fond lagonaire.Recif Ie                     1.00    1     NA  1\n-2013.Fond lagonaire.Recif Mbe Kouen              1.00    1     NA  1\n-2013.Fond lagonaire.Recif Ndunekunie             1.00    1     NA  1\n-2013.Fond lagonaire.Recif Neokouie               1.00    1 0.0000  2\n-2013.Fond lagonaire.Recif Neokumbi               1.00    1 0.0000  2\n-2013.Fond lagonaire.Recif Nogumatiugi            1.00    1 0.0000  5\n-2013.Fond lagonaire.Recif Puakue                 1.00    1     NA  1\n-2013.Fond lagonaire.Recif Purembi                1.00    1     NA  1\n-2013.Fond lagonaire.Recif Senez                  1.00    1     NA  1\n-2013.Fond lagonaire.Recif Umbei                  1.00    1     NA  1\n-2013.Fond lagonaire.Seche Croissant              1.00    1     NA  1\n-2013.Herbier.Ilot Signal                         1.00    1     NA  1\n-2013.Herbier.Laregnere                           1.00    1     NA  1\n-2014.Corail vivant.Baie Xepenehe                 1.00    2 0.3631 14\n-2014.Corail vivant.Grand Astrolabe               1.00    1 0.0000  4\n-2014.Corail vivant.Jinek                         2.00    2 0.5270  9\n-2014.Corail vivant.Petit Astrolabe               1.50    2 0.4671 11\n-2014.Corail vivant.Petrie                        1.25    2 0.5000  4\n-2014.Corail vivant.Pointe Easo                   1.75    2 0.7071  2\n-2014.Corail vivant.Recif Jinek                   1.00    1 0.0000  2\n-2014.Corail vivant.Walpole                       1.00    1     NA  1\n-2014.Detritique.Baie Xepenehe                    1.00    1 0.0000  2\n-2014.Detritique.Grand Astrolabe                  1.00    1     NA  1\n-2014.Detritique.Hunter                           1.00    1 0.0000  2\n-2014.Detritique.Jinek                            1.50    2 0.5774  3\n-2014.Detritique.Petrie                           1.00    1 0.0000  2\n-2014.Fond lagonaire.Baie Xepenehe                1.00    1     NA  1\n-2014.Fond lagonaire.Grand Astrolabe              1.00    1     NA  1\n-2014.Fond lagonaire.Jinek                        1.75    2 0.7071  2\n-2015.Corail vivant.Grand Guilbert                2.00    2     NA  1\n-2015.Corail vivant.Huon                          1.00    2 0.3416 16\n-2015.Corail vivant.Merite                        1.00    1     NA  1\n-2015.Corail vivant.Pelotas                       2.00    2 0.5000  4\n-2015.Corail vivant.Petit Guilbert                1.00    1     NA  1\n-2015.Corail vivant.Portail                       1.50    2 0.5774  3\n-2015.Corail vivant.Surprise                      1.00    1 0.0000  7\n-2015.Detritique.Huon                             2.00    2 0.0000  2\n-2015.Detritique.Portail                          1.00    1 0.0000  2\n-2015.Fond lagonaire.Huon                         1.00    1     NA  1\n-2015.Fond lagonaire.Portail                      1.00    1     NA  1\n-2017.Corail vivant.Grand Astrolabe               2.00    2 0.5774  4\n-2017.Corail vivant.Petit Astrolabe               1.00    1 0.0000  2\n-2017.Corail vivant.Petrie                        2.00    2 0.5477  5\n-2017.Detritique.Grand Astrolabe                  2.00    2 0.5164 10\n-2017.Detritique.Petit Astrolabe                  2.00    2 0.4924 12\n-2017.Detritique.Petrie                           1.00    2 0.4082  6\n-2017.Fond lagonaire.Grand Astrolabe              1.00    1     NA  1\n-2017.Fond lagonaire.Petit Astrolabe              1.00    1 0.0000  2\n-2017.Fond lagonaire.Petrie                       1.00    1     NA  1\n-\n-######################################### \n-Fitted model:\n-\tspecies.richness ~ year + habitat + (1 | site)\n-\n-\n-Family :  poisson \n-Response :  species.richness\n\\ No newline at end of file\n'