# BioIndex

**BioIndex** supports the standardized analysis of MEDITS trawl survey data and the calculation of biological indicators for selected species and population components. The package provides functions to estimate abundance and biomass indices, analyse size structure and length frequency distributions, derive sex ratio and maturity related metrics, explore spatial patterns, and assess temporal trends across surveys. 

Developed for integration within the RDBFIS framework, it is intended to work on quality checked input data (via the **RoME** package) and to produce reproducible outputs that can support monitoring, comparative analyses among GSAs and countries, and fishery management.

The package allows to perform the analysis at GSA level or country level, estimating the time series and the spatial distribution of a wide pool of population state-indicators. It also offers statistical trend analysis of both abundance and biomass time series based on the Hotelling-Pabst test (Cotter, 2009) and spatial analysis using the 0.5*0.5° GFCM grid or bubble plots.

# Shiny Application

BioIndex includes an embedded Shiny application providing a user-friendly graphical interface for all analyses. To launch the application, use:

```r
library(BioIndex)
run_BioIndex_app()
```

# Installation

Install the latest BioIndex release from CRAN (when available):

```r
install.packages("BioIndex")
```

Or install the development version from GitHub:

```r
# install.packages("devtools")
devtools::install_github("COISPA/BioIndex")
```

# Use

The main function `BioIndex()` can be used to launch a complete analysis:

```r
BioIndex(ta=TA, tb=TB, tc=TC, sspp="MERLMER",rec_threshold=200,
         spaw_threshold=210,sexes="all", depth=c(10,800), GSA=10, 
         country="all", map_lim=c(13.3,15.2,39.9,41.3),
         depth_lines=c(50,200,800), strata=BioIndex::strata_scheme, 
         stratification_tab = BioIndex::stratification, resolution=1, 
         buffer=0.1, wd=tempdir(), zip=FALSE, save=FALSE, verbose=TRUE)
```
