TITLE: ARMS-MBON 18S rRNA and COI gene metabarcoding: scanning for non-indigenous species 
AUTHORS: Nauras Daraghmeh

[DESCRIPTION]
This workflow details how COI and 18S rRNA gene raw amplicon sequencing data from the European ARMS programme (ARMS-MBON) can be processed bioinformatically to generate read count and taxonomy tables of molecular operational taxonomic units (mOTUs) for the identification of (marine) non-indigenuous species (NIS). However, the end products may also be used for any other diversity analyses that suit the user. The pipeline may also be adjusted to work with amplicon sequence variants (ASVs) instead of mOTU by omitting and ajdusting certain steps.

The data used here comprise all publicly available COI and 18S sequencing data from ARMS-MBON as of February 2024. 

Processes described in this pipeline were executed on Unix and Windows OS. Certain steps (especially software installations etc.) may differ when run on different operating systems. Some computationally intensive steps were run on a high-performance computing cluster. This is noted in the respective section of this workflow.

Note that in this workflow, separate directories were created for each marker gene. Make sure that the input files required (i.e., the files produced in the correspoding preceding step) are in the respective directory.

References to all data, software, packages and databases used in this workflow (please cite any of the tools used in your analysis):


ARMS-MBON (Obst et al., 2020)

R v4.1.0 and v4.3.1 (R Core Team, 2021, 2023) (v4.3.1 was used for dada2 processing and COI numt-removal) 

RStudio 2022.07.1 (RStudio Team, 2022)

cutadapt v4.5 (Martin, 2011) 

Git v2.37.3 (Chacon & Straub, 2014)

Python v3.11.4 (Van Rossum & Drake, 2009)

MACSE v2.05 (Ranwez et al., 2018)

swarm v3.0.0 (Mahé et al., 2015)

NCBI BLAST (Johnson et al., 2008)

BLAST+ release 2.11.0 (Camacho et al., 2009)

BOLD (Ratnasingham & Hebert, 2007)

BOLDigger-commandline v2.2.1 (Buchner & Leese, 2020)

SeqKit v2.5.1 (Shen et al., 2016)

MIDORI2 (Leray et al., 2022)

MIDORI2 webserver (Leray et al., 2018)

GenBank release 257 (Benson et al., 2012)

RDP classifier (Wang et al., 2007)

Silva taxonomic training data formatted for DADA2 (Callahan, 2018) (Silva v132; Quast et al., 2013)

SILVA v128 and v132 dada2 formatted 18s 'train sets' (Morien & Parfrey, 2018) (Silva v128 and v132; Quast et al., 2013)

Protist Ribosomal Reference database (PR2) v5.0.0 (Guillou et al., 2013)

World Register of Marine Species (WoRMS) (Ahyong et al., 2023)

World Register of Introduced Marine Species (WRiMS) (Rius et al., 2023)

Microsoft Excel 2016 (Microsoft Corporation, 2016) 


R packages:

argparse v2.2.2 (Davis, 2023)

dada2 v1.28.0 (Callahan et al., 2016)

ShortRead v1.58.0 (Morgan et al., 2009)

Biostrings v2.68.1 (Pagés et al., 2020)

ggplot2 v3.4.2 and v3.4.3 (Wickham, 2016) (v3.4.3 was used in the dada2 workflow to plot read quality profiles)

ensembleTax v1.2.2 (Catlett et al., 2023)

tidyr v1.3.0 (Wickham et al., 2023)

dplyr v1.0.9 and v1.1.3 (Wickham et al., 2022, 2023) (v1.1.3 was used during COI numt-removal)

stringr v1.5.0 (Wickham, 2022)

devtools v2.4.3 (Wickham et al., 2021)

hiReadsProcessor v1.29.1 and v1.36.0 (Malani, 2021) (v1.36.0 was used during COI numt-removal)

seqinr v4.2.30 (Charif & Lobry, 2007)

remotes v2.4.2 (Csárdi et al., 2021)

LULU v0.1.0 (Frøslev et al., 2017)

readxl v1.4.0 (Wickham & Bryan, 2022)

phyloseq v1.36.0 (McMurdie & Holmes, 2013)

vegan v2.6.2 (Oksanen et al., 2023)

ggpubr v0.4.0 (Kassambara, 2020)

data.table v1.14.2 (Dowle & Srinivasan, 2021)

xlsx v0.6.5 (Dragulescu & Arendt, 2020)

plyr v1.8.7 (Wickham, 2011)

geosphere v1.5.18 (Hijmans 2022)


Bibliography:

Ahyong, S., Boyko, C. B., Bailly, N., Bernot, J., Bieler, R., Brandão, S. N., Daly, M., De Grave, S., Gofas, S., Hernandez, F., Hughes, L., Neubauer, T. A., Paulay, G., Boydens, B., Decock, W., Dekeyzer, S., Vandepitte, L., Vanhoorne, B., Adlard, R., … Zullini, A. (2023). World Register of Marine Species (WoRMS). WoRMS Editorial Board. https://www.marinespecies.org

Benson, D. A., Cavanaugh, M., Clark, K., Karsch-Mizrachi, I., Lipman, D. J., Ostell, J., & Sayers, E. W. (2012). GenBank. Nucleic Acids Research, 41(D1), D36–D42. https://doi.org/10.1093/nar/gks1195

Buchner, D., & Leese, F. (2020). BOLDigger – a Python package to identify and organise sequences with the Barcode of Life Data systems. Metabarcoding and Metagenomics 4: E53535, 4, e53535-. https://doi.org/10.3897/MBMG.4.53535

Callahan, B. (2018). Silva taxonomic training data formatted for DADA2 (Silva version 132). Zenodo. https://doi.org/10.5281/zenodo.1172783

Callahan, B. J., McMurdie, P. J., Rosen, M. J., Han, A. W., Johnson, A. J. A., & Holmes, S. P. (2016). DADA2: High-resolution sample inference from Illumina amplicon data. Nature Methods 2016 13:7, 13(7), 581–583. https://doi.org/10.1038/nmeth.3869

Camacho, C., Coulouris, G., Avagyan, V., Ma, N., Papadopoulos, J., Bealer, K., & Madden, T. L. (2009). BLAST+: Architecture and applications. BMC Bioinformatics, 10(1), 1–9. https://doi.org/10.1186/1471-2105-10-421/FIGURES/4

Catlett, D., Son, K., & Liang, C. (2023). ensembleTax: Ensemble Taxonomic Assignments of Amplicon Sequencing Data.

Chacon, S., & Straub, B. (2014). Pro git. Apress.

Charif, D., & Lobry, J. R. (2007). SeqinR 1.0-2: a contributed package to the R project for statistical computing devoted to biological sequences retrieval and analysis. In U. Bastolla, M. Porto, H. E. Roman, & M. Vendruscolo (Eds.), Structural
approaches to sequence evolution: Molecules, networks, populations (pp. 207–232). Springer Verlag.

Csárdi, G., Hester, J., Wickham, H., Chang, W., Morgan, M., & Tenenbaum, D. (2021). remotes: R Package Installation from Remote Repositories, Including “GitHub.” https://cran.r-project.org/package=remotes

Davis, T. L. (2023). argparse: Command Line Optional and Positional Argument Parser. 
https://cran.r-project.org/package=argparse

Dowle, M., & Srinivasan, A. (2021). data.table: Extension of `data.frame`. https://cran.r-project.org/package=data.table

Dragulescu, A., & Arendt, C. (2020). xlsx: Read, Write, Format Excel 2007 and Excel 97/2000/XP/2003 Files. 
https://cran.r-project.org/package=xlsx

Frøslev, T. G., Kjøller, R., Bruun, H. H., Ejrnæs, R., Brunbjerg, A. K., Pietroni, C., & Hansen, A. J. (2017). Algorithm for post-clustering curation of DNA amplicon data yields reliable biodiversity estimates. Nature Communications 2017 8:1, 8(1),
1–11. https://doi.org/10.1038/s41467-017-01312-x

Guillou, L., Bachar, D., Audic, S., Bass, D., Berney, C., Bittner, L., Boutte, C., Burgaud, G., De Vargas, C., Decelle, J., Del Campo, J., Dolan, J. R., Dunthorn, M., Edvardsen, B., Holzmann, M., Kooistra, W. H. C. F., Lara, E., Le Bescot, N., Logares, R., …Christen, R. (2013). The Protist Ribosomal Reference database (PR2): a catalog of unicellular eukaryote Small Sub-Unit rRNA sequences with curated taxonomy. Nucleic Acids Research, 41(D1), D597–D604. https://doi.org/10.1093/NAR/GKS1160

Hijmans, R. J. (2022). geosphere: Spherical Trigonometry. https://cran.r-project.org/package=geosphere

Johnson, M., Zaretskaya, I., Raytselis, Y., Merezhuk, Y., McGinnis, S., & Madden, T. L. (2008). NCBI BLAST: a better web interface. Nucleic Acids Research, 36(Web Server), W5–W9. https://doi.org/10.1093/nar/gkn201

Kassambara, A. (2020). ggpubr:
“ggplot2” Based Publication Ready Plots. R package version 0.4.0. https://cran.r-project.org/package=ggpubr

Leray, M., Ho, S. L., Lin, I. J., & Machida, R. J. (2018). MIDORI server: a webserver for taxonomic assignment of unknown metazoan mitochondrial-encoded sequences using a curated database. Bioinformatics, 34(21), 3753–3754.
https://doi.org/10.1093/BIOINFORMATICS/BTY454

Leray, M., Knowlton, N., & Machida, R. J. (2022). MIDORI2: A collection of quality controlled, preformatted, and regularly updated reference databases for taxonomic assignment of eukaryotic mitochondrial sequences. Environmental DNA, 4(4), 894–907. https://doi.org/10.1002/EDN3.303

Mahé, F., Rognes, T., Quince, C., de Vargas, C., & Dunthorn, M. (2015). Swarmv2: Highly-scalable and high-resolution amplicon clustering. PeerJ, 2015(12), e1420. https://doi.org/10.7717/PEERJ.1420/SUPP-1

Malani, N. V. (2021). hiReadsProcessor: Functions to process LM-PCR reads from 454/Illumina data.

Martin, M. (2011). Cutadapt removes adapter sequences from high-throughput sequencing reads. EMBnet.Journal, 17(1), 10–12. https://doi.org/10.14806/ej.17.1.200

McMurdie, P. J., & Holmes, S. (2013). phyloseq: An R Package for Reproducible Interactive Analysis and Graphics of Microbiome Census Data. PLOS ONE, 8(4), e61217. https://doi.org/10.1371/JOURNAL.PONE.0061217

Microsoft Corporation (2016). Microsoft Excel, Available at: https://office.microsoft.com/excel

Morgan, M., Anders, S., Lawrence, M., Aboyoun, P., Pagès, H., & Gentleman, R. (2009). ShortRead: a Bioconductor package for input, quality assessment and exploration of high-throughput sequence data. Bioinformatics, 25, 2607–2608.
https://doi.org/10.1093/bioinformatics/btp450

Morien, E., & Parfrey, L. W. (2018). SILVA v128 and v132 dada2 formatted 18s “train sets.” Zenodo. https://doi.org/10.5281/zenodo.1447330

Obst, M., Exter, K., Allcock, A. L., Arvanitidis, C., Axberg, A., Bustamante, M., Cancio, I., Carreira-Flores, D., Chatzinikolaou, E., Chatzigeorgiou, G., Chrismas, N., Clark, M. S., Comtet, T., Dailianis, T., Davies, N., Deneudt, K., de Cerio, O. D., Fortič, A., Gerovasileiou, V., … Pavloudi, C. (2020). A Marine Biodiversity Observation Network for Genetic Monitoring of Hard-Bottom Communities (ARMS-MBON). Frontiers in Marine Science, 7, 1031. https://doi.org/10.3389/FMARS.2020.572680/BIBTEX

Pagès, H., Aboyoun, P., Gentleman, R., & DebRoy, S. (2020). Biostrings: Efficient manipulation of biological strings. https://bioconductor.org/packages/Biostrings

Quast, C., Pruesse, E., Yilmaz, P., Gerken, J., Schweer, T., Yarza, P., Peplies, J., & Glöckner, F. O. (2013). The SILVA ribosomal RNA gene database project: improved data processing and web-based tools. Nucleic Acids Research, 41(D1), D590–D596. https://doi.org/10.1093/NAR/GKS1219

R Core Team. (2020, 2021). R: A language and environment for statistical computing. R Foundation for Statistical Computing. https://www.r-project.org/

Ranwez, V., Douzery, E. J. P., Cambon, C., Chantret, N., & Delsuc, F. (2018). MACSE v2: Toolkit for the Alignment of Coding Sequences Accounting for Frameshifts and Stop Codons. Molecular Biology and Evolution, 35(10), 2582–2584.
https://doi.org/10.1093/MOLBEV/MSY159

Ratnasingham, S., & Hebert, P. D. N. (2007). bold: The Barcode of Life Data System (http://www.barcodinglife.org). Molecular Ecology Notes, 7(3), 355–364. https://doi.org/10.1111/J.1471-8286.2007.01678.X

Rius, M., Ahyong, S., Bieler, R., Boudouresque, C., Costello, M. J., Downey, R., Galil, B. S., Gollasch, S., Hutchings, P., Kamburska, L., Katsanevakis, S., Kupriyanova, E., Lejeusne, C., Marchini, A., Occhipinti, A., Pagad, S., Panov, V. E., Poore, G.
C. B., Robinson, T. B., … Zhan, A. (2023). World Register of Introduced Marine Species (WRiMS). WoRMS Editorial Board. https://www.marinespecies.org/introduced

RStudio Team. (2022). RStudio: Integrated Development Environment for R. RStudio, PBC. http://www.rstudio.com/

Shen, W., Le, S., Li, Y., & Hu, F. (2016). SeqKit: A Cross-Platform and Ultrafast Toolkit for FASTA/Q File Manipulation. PLOS ONE, 11(10), e0163962. https://doi.org/10.1371/journal.pone.0163962

Van Rossum, G., & Drake, F. L. (2009). Python 3 Reference Manual. CreateSpace.

Wang, Q., Garrity, G. M., Tiedje, J. M., & Cole, J. R. (2007). Naïve Bayesian classifier for rapid assignment of rRNA sequences into the new bacterial taxonomy. Applied and Environmental Microbiology, 73(16), 5261–5267.
https://doi.org/10.1128/AEM.00062-07/SUPPL_FILE/SUMMARY_BYHIERARCHY.ZIP

Wickham, H. (2011). The Split-Apply-Combine Strategy for Data Analysis. Journal of Statistical Software, 40(1), 1–29. https://www.jstatsoft.org/v40/i01/

Wickham, H. (2016). ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. https://ggplot2.tidyverse.org

Wickham, H. (2022). stringr: Simple, Consistent Wrappers for Common String Operations.
https://cran.r-project.org/package=stringr

Wickham, H., & Bryan, J. (2022). readxl: Read Excel Files. https://cran.r-project.org/package=readxl

Wickham, H., François, R., Henry, L., & Müller, K. (2022, 2023). dplyr: A Grammar of Data Manipulation. R package version 1.1.2. https://cran.r-project.org/package=dplyr

Wickham, H., Hester, J., Chang, W., & Bryan, J. (2021). devtools: Tools to Make Developing R Packages Easier. https://cran.r-project.org/package=devtools

Wickham, H., Vaughan, D., & Girlich, M. (2023). tidyr: Tidy Messy Data. https://cran.r-project.org/package=tidyr



[STEPS]
SECTION: Primer trimming and amplicon sequence variant (ASV) inference using cutadapt and dada2
2. The downloaded fastq.gz files contain reads which were demultiplexed with two different strategies after MiSeq sequencing. The combined_OmicsData.csv file provided above holds information on this in the Gene_COI_demultiplexed and Gene_18S_demultiplexed columns. Sequencing reads of some runs were demultiplexed based on the Illumina MiSeq library indices, while others were demultiplexed based on these indices as well as with cutadapt based on the respective PCR primers sequences. In the former case, reads still contain the PCR primer sequences, while in the latter case, reads are already devoid of these sequences. See the table below for information on which demultiplexing strategy was applied on the reads of each sequencing run. Note *: according to the combined_OmicsData.csv file, 18S reads of Run_1 and Run_3 were demultiplexed based on MiSeq indices as well as PCR primer sequences. However, after checking these reads, they still contained primer sequences in certain orientations. So reads of those runs were considered as being demultiplexed based on MiSeq indices only.

 

Subsequently, the directories containing the downloaded fastq.gz files of each marker gene were placed in separate directories based on the demultiplexing applied (i.e., fastqs_normal and fastqs_cutadapt).

We ran a pipeline using cutadapt and dada2 in R on an HPC cluster for primer trimming (or length-filtering of reads previously demultiplexed with cutadapt) and read filtering, denoising, merging, chimera & singleton removal and taxonomy assignment (for 18S ASVs, COI ASVs were not classified using dada2). It should also be feasible to run the pipeline on a personal machine with a good amount of RAM, although multithreading for certain steps is not enabled in dada2 for Windows OS and the pipeline will take a while to run. The 18S and COI data sets were processed separately. We mainly followed the publicly available dada2 workflows, with some alterations. See here: 

https://benjjneb.github.io/dada2/tutorial.html
https://benjjneb.github.io/dada2/ITS_workflow.html (for a workflow incorporating cutadapt)

Cutadapt needs to be installed on your system prior running the R workflow, see cutadapt documentation https://cutadapt.readthedocs.io/en/stable/index.html. 

To avoid potentially resulting biases during dada2's error model estimation, sequence reads were processed separately per sequencing run up until (and including) the merging of paired reads. Subsequently, inferred amplicon sequence variants (ASVs) from all sequencing runs were merged prior to chimera removal. 

For reads which still contained primer sequences, cutadapt was first applied with maximum mismatch of 1 and 2 bp (i.e., a maximum error rate of e = 0.05 and e = 0.1) for 18S and COI reads, respectively. A higher mismatch was allowed for COI reads due to the longer primer sequences compared to 18S and the fact that COI is a more variable protein-coding gene. Given the expected length of the COI amplicons (313 bp), primers were only trimmed from the forward and reverse reads when being present at the 5'-end of the reads in their forward orientation. Given the length variability of the 18S amplicons and potential read-through during sequencing, primers were trimmed from the forward and reverse reads when being present in their forward orientation, as well as when being present in their reverse-complement orientation. Untrimmed reads were discarded. For reads which were already demultiplexed with cutadapt and therefore did not contain any primer sequences, cutadapt was only applied to filter out reads with a length of zero bp (can occur during demultiplexing when a read was only made up of its primer sequence and was fully trimmed to zero bp).

Quality profiles were generated for a maximum of (randomly chosen) 20 samples of each sequencing  run. For dada2's filterAndTrim function, maxEE was set to 2 for forward and 4 for reverse reads for all sequencing datasets. Based on the quality profiles, COI reads were trimmed with truncLen to a length of 200 and 130 bp (forward and reverse reads, respectively) to on average retain base calls with a minimum Phred quality score of 30. Note that the truncLen needs to be set to values so that the minimum overlap during the merging of paired reads further down the pipleine is still possible. No truncating was applied for 18S due to the length variation of amplicons of this marker gene. 

10^8 bp were used for error model calculation (default value, fewer bp were used automatically if a dataset did consist of fewer than 10^8 bp in total). An overlap of 10 bp with a maximum mismatch of 1 bp was applied during merging of paired reads. The amount of reads which "survived" each step of the pipleine was recorded for each sequencing run. For all randomized steps,  R's base function set.seed was applied to allow for reproducibility (see scripts). 

Below are several example scripts. For both COI and 18S, there are examples for the processing of sequencing runs with "regular" reads which still have primer sequences present (Run_1 example for 18S and COI). This script was applied for all sequencing runs with this kind of reads (see table above). When running this script for other runs, just change the name of the respective runs in the script accordingly. For COI and 18S, there also examples below for the processing of sequencing runs which are already devoid of primer sequences (see example Run_3 for COI and example Run_4 for 18S). This script was applied for all sequencing runs with this kind of reads (see table above). When running this script for other runs, just change the name of the respective runs in the script accordingly. To summarise, the following table shows which example script was applied for each run:

 

 

 

 

 

Subsequently, individual ASV tables of each sequencing run were merged (COI ASVs were additionally subjected to a stringent length filtering to only retain sequences with a length of of 310, 313 or 316 bp (so the expected length of 313 bp ± one codon triplet); this was not done for 18S due to the length variation of amplicons of this marker gene) and chimeric and singleton sequences were removed. For COI, a .fasta file containing the non-singleton ASV sequences with corresponding headers, as well as an ASV count table (read abundances per sample) were generated. Taxonomy was assigned later on in the workflow (see sections below). For 18S, ASVs were classified with dada2's assignTaxonomy function using three different reference sets (with varying taxonomic ranks) formatted for use in dada2: a) official Silva v132 containing prokayrote and eukaryote sequences (silva_nr_v132_train_set.fa.gz, https://zenodo.org/record/1172783); b) a subset of Silva v132 containing eukaryote sequences clustered at 99% similarity only (silva_132.18s.99_rep_set.dada2.fa.gz, https://zenodo.org/record/1447330); and c) PR2 v5.0.0 (pr2_version_5.0.0_SSU_dada2.fasta.gz, https://github.com/pr2database/pr2database/releases). A minimum bootstrap threshold of 70 was applied. An ensemble taxonomy, ASV fasta file and ASV count table for 18S ASVs were generated in the next section of the workflow (see below). For both COI and 18S, a final read tracking table was generated showing the amount of reads (total and as percentage compared to initial input) "surviving" each step of the cutadapt-dada2-pipeline. The following scripts were executed in R:


 

 


SECTION: Clustering ASVs into Molecular Operational Taxonomic Units (MOTUs) using swarm
7. Install the most recent version of swarm on your system. See here: https://github.com/torognes/swarm. We used swarm v3.0.0. A note on this part: downloading the installation folder of a corresponding release will provide you with a bin folder containing a swarm.exe file (at least this was the case for the Windows version). This made a more complicated installation via compilation unnecessary. According to the developers, this file is provided for convenience and can just be executed as is. 

The previously generated fasta files containing the blank-corrected ASVs needs to be dereplicated (total read abundances neet to be added to the ASV headers as _XXX) to be used for clustering with swarm. Run the following script in R / RStudio to generate a file with the appropriate ASV header format:
 


Replace the headers in the fasta files containing the blank-corrected ASVs with the dereplicated headers. Run the following in command line:
 


Then run the swarm.exe file. Something like the following will pop up, swarm is now waiting for data input.
 


This window should not be closed, swarm is now waiting for data input. We then ran the actual swarm algorithm from comand line. -d sets the most important parameter, the number of differences allowed between ASVs to be grouped into the same molecular operational taxonomic unit (MOTU). -i, -o, -s and -u allow us to write certain information and statistics to files specified by the corresponding file names. -w and the following specified fasta file name determine that a fasta file with the representative sequences of each MOTU is written (headers show which ASV was determined as representative and the total number of reads of the corresponding MOTU), the ultimate file name specifies the input fasta file for the clustering procedure. For COI, d = 13 was applied, while for 18S, d was set to 1 and the fastidious option was enabled (-f, only available for d = 1):
 


SECTION: Tracking ASVs and MOTUs through the pipeline and manually curate identified NIS
14. All occurrences of NIS were carefully curated manually based on this two-step approach:

a) Taxonomic classification of short amplicons from DNA metabarcoding data sets is challenging and species level assignments may lack a certain confidence for closely related taxa. All ASVs ending up in MOTUs identified as NIS were manually classified again using BOLD (COI) or NCBI's GenBank (18S, and in some rare cases COI) to assess confidence of taxonomic assignments. 
b) Based on a literature search (i.e., checking sources mentioned in WRiMS for each respective species and performing additional web-based literature search) it was assessed if occurrences of MOTUs identified as NIS could actually be considered as being outside of their native range.

As a first step, the fate of ASVs (i.e., which MOTU they ultimately ended up in) was tracked throughout the entire pipeline using the previously generated files resulting from swarm clustering, LULU curation, merging of same-species MOTUs and mapping of MOTUs to their representative ASVs. Subsequently, this information was subset to ASVs belonging to NIS MOTUs to obtain their respective sequences and read counts per ARMS sampling event. See below for the script executed in R / RStudio:
 

The output of this step are tables (NIS_MOTU_ASV_counts.txt; one each for COI and 18S) containing info on MOTUs identified as NIS, their species assignment, the ASVs they contain plus the respective ASV read counts for each ARMS sampling event. We only considered ASV occurrences with at least 5 reads per sample (other occurrences were set to zero and ASVs now left with zero occurrences only were discarded). In addition, the sequence headers of those ASVs were written to file, as well as a mapping file to replace the ASV headers with "MOTUyz_ASVxy". Using the commands below in Git BASH, the initial fasta files (dada2 output) were subset to the ASVs found in NIS MOTUs and the sequence headers were replaced with the aforementioned "MOTUyz_ASVxy" pattern with SeqKit:
 

We re-did the previous steps briefly to check if more NIS would be detected without the minimum threshold of 5 reads per ASV and sample. 
 
We then also generated fasta files again for these two data sets (COI and 18S) as described above to check taxonomy of these sequences (see below). However, these two data sets without any minimum read threshold for NIS ASVs were not further consiered in the analysis. The steps detailed below were performed for the data sets excluding ASV occurrences of less than 5 reads.

All COI sequences were then classified again manually using BOLD's Identification Engine with the Public Record Barcode Database (https://v3.boldsystems.org/index.php/IDS_OpenIdEngine). This was done in batches, as classification of a maximum of 50 sequences can be performed at a time. Where there was no match in BOLD for COI, sequences were manually classified using the NCBI blastn suite (https://blast.ncbi.nlm.nih.gov/Blast.cgi?PROGRAM=blastn&PAGE_TYPE=BlastSearch&LINK_LOC=blasthome) with default settings. The sequences of the 18S NIS data set were also manually classified again using the NCBI blastn suite.  If there was no hit for 18S sequences on NCBI with a query cover of 100% and similarity >98%, ASVs were manually queried against PR2 using its web service (https://app.pr2-database.org/pr2-database/, go to Query on the top of the page). BOLD gives information on the confidence of a species level assignment for each sequence and notes if an assignment has a high confidence, a sequence may belong to a particular set of taxa or what the nearest match is. NCBI's web service states similarity, query cover and E value for assignments. PR2 states percentage identity, mismatches and gaps of query alignments.

A literature search based on the sources stated in WRiMS / WoRMS for each respective taxon and further scientific and public literature was performed to assess if the occurrences at a given location in the data set may be considered outside of the respective native range. 

In Excel, the NIS_MOTU_ASV_counts_COI.txt and NIS_MOTU_ASV_counts_18S.txt files were then curated manually. This curation was done as follows:

COI ASVs or their occurrences at certain locations were removed if...

...there was no match in BOLD and where for these ASVs the classification with NCBI's blastn had no hits with a query cover of 100% and similarity >98% for the MOTU's species assignment
...a species level match could not be made according to BOLD and one of the likely species assignments given by BOLD was potentially a native species
...the presence of the respective taxon was unlikely at the given location (e.g. occurrences in the Baltic Sea of species requiring a higher salinity than present there, etc.)
...this ASV and all other ASVs of this MOTU only occurred at locations where the respective species is native. This means the curated data set still contained occurrences of MOTUs where they are native, as long as they occurred at least at one location where they are not native
...there was no clear indication based on literature search that a taxon is actually considered as a putative NIS at any of the locations of occurrence

18S ASVs or their occurrences at certain locations were removed if...

...the highest valued match (based on E value) in NCBI's blastn had no hits with a query cover of 100% and similarity >98% for the MOTU's species assignment and there was no top hit for this assignment in PR2 with similarity >98%
...the top hits in NCBI's blastn with a query cover of 100% and similarity >98% with the highest E value represented several taxa and based on its geographic occurrence and the scientific literature it could not be determined if the sequence likely belonged to the respective NIS
...the presence of the respective taxon was unlikely at the given location (e.g. occurrences in the Baltic Sea of species requiring a higher salinity than present there, etc.)
...this ASV and all other ASVs of this MOTU only occurred at locations where the respective species is native. This means the curated data set still contained occurrences of MOTUs where they are native, as long as they occurred at least at one location where they are not native
...there was no clear indication based on literature search that a taxon is actually considered as a putative NIS at any of the locations of occurrence

In some cases, the appropriate taxonomic assignment for certain ASVs and/or MOTUs was manually set as follows:

Some ASVs had multiple likely assignments, but based on literature and known distribution, the correct assignment could be inferred and was decided on. 
Where all ASVs of the same MOTU had multiple likely species assignments, and all of these where putative NIS and belonged to the same genus, we adjusted the taxonomy of this MOTU to the genus level (i.e., genus X sp.).
Where some ASVs within the same MOTU had a clear species classification belonging to a NIS, while some ASVs in this MOTU had several likely species assignments and it could not be established based on literature what the likely assignment was, the latter were removed to not have a mix of species and genus level assignments within the same MOTU.


The curated data sets were saved as NIS_MOTU_ASV_counts_COI_curated.txt and NIS_MOTU_ASV_counts_18S_curated.txt, respectively. 

These files are processed in R / RStudio to aggregate all remaining MOTU/ASVs and occurrences for each MOTU per ARMS samplig event to create a final NIS presence-absence table for each marker gene. These tables of each marker gene are ultimately merged to obtain a final data set of NIS presence-absence per ARMS sampling event. A second table is created linking ARMS sampling events to the respective coordinates of ARMS. The coordinates for each ARMS unit were obtained from the respective metadata file provided on the ARMS-MBON GitHub page (see above) are can be found in the file below (this file contains coordinates for all ARMS units deployed by ARMS-MBON members to date, and therefore also for ARMS units not part of this present data set): 

  

The final steps were run in R / RStudio, see below:
 

For further downstream processing, the NIS_MOTU_ASV_counts_COI_curated.txt and NIS_MOTU_ASV_counts_18S_curated.txt files were additionally manually filtered in Excel. These files still contain occurrences of species where they are native, as long as they occurred at least at one location where they are not native. Two new files were generated containing ONLY NIS occurrences at locations where they could be considered as NIS. All other occurrences were set to zero. These new files are called NIS_MOTU_ASV_counts_COI_curated_filtered.txt and NIS_MOTU_ASV_counts_18S_curated_filtered.txt, respectively. 

SECTION: LULU curation
8. The clustered MOTUs were curated using LULU  v0.1.0 (Frøslev et al., 2017) in R / RStudio. For details on LULU curation, see https://github.com/tobiasgf/lulu.

First, we generated MOTU tables based on the ASV read count tables resulting from blank correction (see above) and the swarm output files. See the following R script:
 


To obtain identical MOTU IDs in the MOTU tables and the fasta files with cluster representative sequences obtained from swarm, we removed the MOTU read abundance strings from the sequence headers in the latter from command line:
 
Match lists meeting LULU's requirements were generated using BLASTn. For this, BLAST+ was installed as standalone version for Windows by downloading the corresponding win64.exe file from ftp://ftp.ncbi.nlm.nih.gov/blast/executables/LATEST (release 2.11.0 in this case). Please note that downloading via Mozilla lead to files being corrupted and not executable for some reason, this was not the case when using Chrome as browser. For each marker gene, a blastdatabase was then produced, followed by blasting the MOTUs against this database. We executed the following in command line (note that for the perc_identity parameter, different values were applied for COI and 18S):
 


We then ran the actual LULU curation in R / RStudio with a minimium sequence similarity threshold of 0.84 for COI and 0.90 for 18S (this value has to be equal or above the perc_identity parameter used during the match list creation) and minimum co-occurrence rate of 0.95. For 18S, we changed the minimum_ratio to 100, from the default of 1. Curated MOTU tables as well as mapping files were generated, see the following script:
 


We then subset the representative sequences of MOTUs remaining after LULU curation from command line: 
 

SECTION: Negative control correction
6. After nuMT filtering for COI, we removed 18S and COI ASVs for which the read count in negative control samples exceeded 10% of their total read count. This was done in R / RStudio using the following script: 
 


We then subset the ASVs remaining after correction in command line:
 

SECTION: Subset taxonomy of 18S MOTUs and taxonomy assignment for COI MOTUs
9. Taxonomy has previously been assigned to 18S ASVs (see above). With the R script below, the respective taxonomy of the representative ASV sequences of LULU-curated MOTUs will be subset from the initial taxonomy table:
 

Taxonomy was assigned to COI MOTUs using two assignment tools and reference databases. The Barcode Of Life Data System (i.e., BOLD) database was used via the Python tool BOLDigger-commandline (see https://github.com/DominikBuchner/BOLDigger-commandline and https://github.com/DominikBuchner/BOLDigger for details). This tool requires a BOLDSYSTEMS user account (https://v3.boldsystems.org/) and Python v3.6 or higher. In addition, taxonomy was assigned to the COI dataset using the MIDORI2 database via its web server tool (https://reference-midori.info/server.php; based on GenBank release 257 at the time of usage). Results from both databases were then compared and final classification determined as described below. 

For MIDORI2, we uploaded the LULU-curated fasta file to the web server (http://reference-midori.info/server.php). Because the web server allows a maximum of 10,000 sequences to be classified in one job and our LULU-curated fasta file contained more sequences, we simply split the fasta file into two files in R/RStudio using the commands below:
 
Note: It seems that if the number of sequences in the input fasta file is odd-numbered, splitting into two files will create two new equally-sized fasta files containing the same even number of sequence) and a third fasta file with the final remaining sequence. you can just manually add this final sequence to the second fasta file and remove the third file.

We then simply ran two jobs on the server using the two fasta files as input. As Program, we used the "RDP classifier". As Database, we chose "Unique" and "COI". We applied a confidence cut-off of 0.7 with the output format "allrank" in the Parameters section. While there is an output format "filterbyconf" which automatically provides classification for each taxonomic level when the confidence threshold is met (and otherwise sets it as "unclassified"), it does not provide species level classification for some reason. Therefore, we ran classification with aforementioned "allrank" format and subsequently filtered the taxonomic classification to remove information with a classification confidence of below 0.7. Classification via the MIDORI2 webserver results in two files being provided via e-mail: ...hier_outfile.txt and ...usga_classified.txt. We used the ...usga_classified.txt files of the two jobs (re-named to midori2_GB_257_1.txt and midori2_GB_257_2.txt with 257 being the respective GenBank version which MIDORI2 applies at the time of usage) for threshold application. In a few cases, information is missing on some taxonomic levels while it is available on lower levels, which shifts the entries within the results table. This made it necessary to format the result files and subsequently merge both files. This was done in R / RStudio using the commands below: 
 
The final filtering to remove taxonomic information with a classification confidence of below 0.7 at the respective level from the formatted table (midori_pre_70.txt) was done in Excel. In order to do this, he column giving the confidence values for phylum level assignments was first sorted from highest to lowest. All assignments with a confidence value below our chosen threshold of 0.7 were set to NA (This was done for the phylum level confidence column, the two columns left of it and all columns right of it. The procedure was then repeated for all confidence value columns down to species level). The resulting file was saved as midori_70.txt (70 = confidence threshold of 0.7). 

For BOLDigger, we ran a four-step protocol via its command line tool with the commands below (the non-commandline tool has more extensive documentation: https://github.com/DominikBuchner/BOLDigger):

Taxonomy assignment with the fasta file containing the curated MOTUs using the BOLD identification engine with the COI database and a batch size of 50. It may happen that reaching BOLD fails with high batch sizes, try batch sizes of 5 or 10 in this case. Log in details for BOLD user account need to be provided (account can be created via BOLD's website prior to this).
Searching for additional data with the BOLDresults file generated in step 1. 
Add a list of top hits with BOLDigger method.
BOLD API verification. "This option scans the BOLDigger top hits for hits with high similarity (>= 98%) and missing species-level assignment. This can happen, if the top 20 hits are populated with high similarity hits and missing species-level assignment "hide" away better hits." (from: https://github.com/DominikBuchner/BOLDigger)
 
The classification step of BOLDigger-commandline may terminate with an error for sequences where entries in BOLD produce a database error on the BOLD website (see https://github.com/DominikBuchner/BOLDigger/issues/24 and https://github.com/DominikBuchner/BOLDigger/issues/14, for example). This happened twice with our fatsa file (for ASV858 and ASV7885). When this happened, we executed the classification step again with a batch_size of 1 until the script got terminated again. We then manually removed the sequence following the last classified sequence from the fasta file and executed the command again with a batch_size of 50 until the next error occurred. After the BOLDigger-commandline procedure, we manually added these two sequences to the BOLDigger hit - API corrected sheet of the resulting .xlsx file and set all rank assignments for these two cases as No Match. 

We compared taxonomy resulting from MIDORI2 and BOLDigger and created a final taxonomy table. For MOTUs where MIDORI2 and BOLDigger agreed at the respective level, this information was kept. For levels of a MOTU where the two disagreed, the information of "BOLDigger hit - API corrected" was kept at Phylum, Class or Order level if the similarity was above 85, at Family level if similarity was above 90, at Genus level if similarity was above 95, and at Species level if similarity was above 98. Where BOLDigger had NA entries and MIDORI2 non-NA entries, MIDORI2 classification was kept for the respective level of a MOTU. Where the two disagreed but BOLDigger did not meet the threshold for the respective level of a MOTU, entries were set as NA. These steps were performed in R / RStudio with the following commands:
 


SECTION: Merging same-species MOTUs
10. MOTUs which could be classified down to species level and which displayed the same species level assignment were merged. Here, read counts of corresponding same-species MOTUs were summed up and the representative sequence of the most abundant MOTU prior to merging was kept. The following script was executed in R / RStudio: 
 

SECTION: Removing nuclear mitochondrial DNA pseudogenes (nuMTs) for COI using MACSE
5. Download latest release of MACSE from here: https://bioweb.supagro.inra.fr/macse/index.php?menu=releases. We used MACSE v2.05.

To identify putative numts, we aligned our COI non-singleton ASVs generated with dada2 against a pre-aligned set of COI sequences. The developers of MACSE have generated alignments of COI sequences derived from the BOLD database for particular taxonomic groups. To create overall reference alignments for marine taxa with amino acid translations corresponding to the NCBI genetic codes (see https://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi), we downloaded these alignment fasta files for the reference sequence alignments (ref.Align fasta files) of most groups known to include marine taxa from here https://bioweb.supagro.inra.fr/macse/index.php?menu=download_Barcoding (save target as...). The refAlign.fasta files are curated alignments of reference sequences which represent the sequence diversity of the respective taxonomic group. The refAlign.fasta files for the following taxonomic groups were downloaded (refSeq.fasta for groups lackign a refAlign.fasta):
 
 

Subsequently, the alignments of the various taxonomic groups were merged based on their respective genetic code. We used MACSE's alignTwoProfiles function for this. After executing the macse_vX.XX.jar file downloaded as detailed above (Java needs to be installed on your machine to run MACSE), a GUI opens up. Navigate to Programs and choose alignTwoProfiles. Under ALL OPTIONS, set the respective genetic code for gc_def (not necessary for Tunicata, genetic code 13: only one taxonomic group with one refAlign.fasta):
 
 

Then choose two of the refAlign.fasta files for p1 and p2. We didn't change the other default settings. Then, execute run alignTwoProfiles. As an example, for NCBI genetic code 2 (vertebrates), we ran the procedure with the files Actinopterygii_BOLD_COI_final_align_NT.aln and Chondrichthyes_BOLD_COI_final_align_NT.aln as p1 and p2. This resulted in two alignment files, one on nucleotide and one on amino acid level:  

Actinopterygii_BOLD_COI_final_align_Chondrichthyes_BOLD_COI_final_align_AA.fasta
Actinopterygii_BOLD_COI_final_align_Chondrichthyes_BOLD_COI_final_align_NT.fasta

Subsequently, the next refAlign.fasta was added to the previously generated _NT.fasta file by running alignTwoProfiles again. This time, the _NT.fasta was used as p1 and e.g. the Sarcopterygii_BOLD_COI_final_align_NT.aln file as p2. The next refAlign.fasta file was added again to the resulting _NT.fasta with the same procedure, and so on. This was continued until an overall alignment for the respective taxonomic group belonging to a particular genetic code was achieved (not necessary for Tunicata, genetic code 13: only one taxonomic group with one refAlig.fasta). Resulting alignment files were named MACSE_BOLD_gcXX_marine_taxa_aligned_NT.fasta and can be found below:

  
  
  
  
  

To align our ASVs against these reference alignments using MACSE's enrichAlignment function, we ran MACSE from within R. The script below was run on an HPC cluster. A directory called pseudo containing the directories gc2, gc4, gc5, gc9 and gc13 was created prior to running the R script. In this script, the input fasta containing the ASVs was first split into smaller fractions to enable alignment computation. The process was first completed for genetic code 5, as most of the ASVs most likely represented invertebrate taxa.
 

 
The final gc13_pseudo.fasta contains the overall putative numt-ASV set after running MACSE with five translations (one for each genetic code). The resulting nonpseudo.combined.names.txt file contains the non-numt ASVs (in ">ASVxy" format). 

Non-numt ASVs were then subset from the COI_nochim_nosingle.fa file (resulting from the dada2 workflow, see above) by running the following in command line:
 

SECTION: Linearization of fasta files and problems with files in DOS CRLF format
4. For all downstream steps, please make sure all fasta files used as input are linearized, i.e., sequences are stored in a single line below a header, not in multiple lines. 

If this is not the case for any of the fasta files, run the following in command line:
 

In case you are working with Windows OS and the result of any of the downstream command line operations is an empty fasta file, one of the input files may be formatted in Windows DOS CRLF format. Check if this is the case by opening the file using Editor (or any other text editing tools), then check at the bottom. You may convert the respective file to Unix LF format in command line as shown below: 
 

SECTION: Obtain ARMS-MBON 18S and COI metabarcoding data
1. Information on all 18S and COI sequencing data of ARMS MBON available as of February 2024 were obtained from the respective files of the ARMS MBON data_workspace GitHub repo:

https://github.com/arms-mbon/data_workspace/blob/main/qualitycontrolled_data/combined/combined_OmicsData.csv
https://github.com/arms-mbon/data_workspace/blob/main/qualitycontrolled_data/combined/combined_SamplingEventData.csv
https://github.com/arms-mbon/data_workspace/blob/main/qualitycontrolled_data/combined/demultiplexing_details_OmicsData.csv

The accession numbers for genetic data deposited on the European Nucleotide Archive (ENA) are found in the Gene_COI and Gene_18S columns of the combined_Omicsdata.csv file. Accession numbers of negative control samples for each sequencing run are found in columns Gene_COI_negative_control and Gene_18S_negative_control. Info on which accession stems from which sequencing run and how samples where demultiplexed post-sequencing are found in demultiplexing_details_OmicsData.csv. Based on these files, separate files for COI and 18S were generated containing all accession numbers of each marker gene, separated by sequencing runs. The COI and 18S files containing the respective ENA numbers are found below. As ENA accession numbers of Run_7 (i.e., the sequencing batch of August 2023) contained eight digits instead of seven digits as was the case for all previous sequencing runs, two separate files were generated for each gene:

  
  
  
  

All fastq.gz files were downloaded from ENA in February 2024. For runs listed in the XX_ENA_accessions.txt file (i.e., for accessions with seven digits), the R script below (ENADownload.R) was executed via command line using the .txt files as input :

 

For sequencing runs listed in the XX_ENA_accessions_8digits.txt file (i.e., for accessions with eight digits), the R script below (ENADownload_8digits.R) was executed via command line using the _8digits.txt files as input :
 

When running the download scripts via command line, -f points to file containing the ENA accession numbers separated by sequencing run and -d sets the directory path the fastq files will be downloaded to (create the fastq_files directories prior to this; the sub-directories for the fastq files of each sequencing run will be created automatically within the fastq_files directories):
 

In case of problems, the download script will terminate with an error message. This was also case here. Sometimes, this is caused by issues when files on ENA are generated based on the originally submitted ones (see the different files available for each accession number under Submitted files: FTP and Generated FASTQ files: FTP). For us, this was the case for the 18S accession ERR7125542 (problem persisted as of February 2024, and it is not clear when ENA will fix this). There were no files under Generated FASTQ files: FTP for this accession. We removed this accession from 18S_ENA_accessions.txt (this accession is still included in the file provided above) and ran the download script again for 18S. Then, we manually downloaded the forward and reverse read files provided under Submitted files: FTP of this accession (https://www.ebi.ac.uk/ena/browser/view/ERR7125542). The downloaded files were renamed to ERR7125542_1.fastq.gz and ERR7125542_2.fastq.gz and placed in the respective directory with the other downloaded files of this sequencing run. 
There also seemed to be an incorrect read pairing in all of the 18S Generated FASTQ files (as of February 2024) of Run_1 (sequencing run July 2019). This became clear later on in the pipeline during primer removal using cutadapt (see below). We removed these files, manually downloaded all files of this run provided under Submitted files: FTP and manually renamed them with their accession numbers as described above for the other problematic 18S accession. The submitted files did not show the read-pairing issue.

SECTION: Generate fasta file, count table and ensemble taxonomy for 18S ASVs
3. Taxonomy has been assigned to 18S ASVs in the previous step within the dada2 pipeline in R. For this, contributed dada2-formatted reference files of PR2 v5.0.0, Silva v132, and a specific Silva v132 Eukaryote set were used. 

The R script below generates an ASV fasta file, an ASV count table and an ensemble taxonomy table based on the previous assignments of the three reference sets. To merge the different taxonomy assignments, we applied certain functions of the ensembleTax package and parts of its recommended pipeline (see https://github.com/dcat4/ensembleTax for more details).

Please note that resolving eukaryote taxonomy homogeneously according to clear rank hierarchy can be challenging. In addition, different reference sets use different taxonomic ranks and/or synonomous terms at a given rank for the same taxa. The ensemble taxonomy for 18S ASVs  resulting from the script below contains the following ranks: Domain, Supergroup, Division, Subdivision, Phylum, Class_X, Class_Order_Family, Order_Family_X, Genus, Species. Especially rank assignments between Subdivision and Order_Family_X should be treated with caution. Depending on the reference set or taxa, these can be actual subdivisions, phyla, classes, order or families, or any of their super, sub, or infra groups. The names of these ranks define that the majority of assignments correspond to this rank. So for example, most assignments in Class_Order_Family represent one of these three ranks. However, in some cases, this does not hold true. For example, the assignment of Class_X may actually be a sub phylum or an order level assignment, etc.
 

SECTION: Data processing and cleaning with phyloseq etc.
12. Further data processing and cleaning was done in R / RStudio using mainly the phyloseq package (and other packages, see script below). The COI and 18S data sets were processed separately. Below are the metadata files used as sample_data in the respective phyloseq objects (the information was taken from the respective files available on the ARMS-MBON GitHub repository: https://github.com/arms-mbon/data_workspace/blob/main/qualitycontrolled_data/combined/combined_ObservatoryData.csv, https://github.com/arms-mbon/data_workspace/blob/main/qualitycontrolled_data/combined/combined_SamplingEventData.csv and https://github.com/arms-mbon/data_workspace/blob/main/qualitycontrolled_data/combined/combined_OmicsData.csv):

  
      

The following steps were carried out for both data sets:

Create phyloseq objects based on the count and taxonomy tables created during the merging of same-species MOTUs in the previous section, as well as a table containing metadata for the samples (see above).
The MOTUs are still named by their representative ASV sequences. They will be renamed to MOTUxy and a mapping file is created to link each MOTU name to its representative ASV sequence.
Check and plot sample-wise sequencing depth (i.e., read numbers) for each sequencing run.
Removal of certain sample types: blank / negative control samples; sediment / plankton samples which were sequenced as a trial during the initial phase of the ARMS MBON program; and any samples without any reads remaining after all previous pipeline steps. This is now the most unfiltered data set  for each marker gene which will be saved!
 

 


SECTION: Identify non-indigenous species based on WRiMS
13. Putative non-indigenous species (NIS) were identified from the MOTUs which could be classified to species level. 

Species listed in the World Register of Introduced Marine Species (WRiMS) were obtained for the regions corresponding to the ARMS locations. WRiMS' Distributions browser was used for this (https://www.marinespecies.org/introduced/aphia.php?p=checklist). Multiple searches were performed with default settings and the respective region specified in the field Geonuit (see image below).

 
To keep the search standardized, it was carried out considering IHO Sea Areas if possible. However, there were no entries for some IHO Areas, e.g. the IHO Sea Area Skagerrak was not listed in WRiMS. Hence, in such cases Marine Regions were selected for the search instead. For the case of Skagerrak, this was the Marine Region Swedish part of the Skagerrak for example. In other cases, the IHO Areas comprised too large a geographical area (e.g., North Atlantic Ocean) containing regions irrelevant for this study. Therefore, the search was performed for subordinate IHO Sea Areas or, alternatively, Marine Regions within the respective region. WRiMS only allows downloads of files with a maximum of 1,000 entries. The IHO Sea Area Mediterranean Sea - Eastern Basin had more than 1,000 entries, so subordinate regions had to be selected for separate search queries (Adriatic Sea and Aegean Sea in this case). The table below shows the regions and their PlaceType according to Marine Regions (https://www.marineregions.org/) for which the taxa listed in WRiMS were obtained.  

 


The results for each search were downloaded as .xlsx files (with the pre-selected default columns included). See images below.

 
 
 
The downloaded results were then combined in R / RStudio to an overall list of taxa listed in WRiMS for the study regions. See the script below:
 
The result of this was the following file:

   

The 18S and COI MOTUs which could be classified to species level were then scanned for taxa found in the WRiMS list. This was done for the phyloseq data sets created in the previous section. The taxa names in the reference sets used for taxonomic classification do not always equal the accepted names in WRiMS / WoRMS. Therefore, the species-level assignments in the 18S and COI data sets were first matched against the WoRMS database to obtain the respective accepted names for the taxa. LifeWatch Belgium's web services were used for the taxon matching (see https://www.lifewatch.be/data-services/). These web services actually include a taxon match service for WRiMS, but is was not functional at the time of usage. This may have been fixed by the time of publication of this protocol. First, a .txt file fulfilling the input requirements of the web service (i.e., MOTU IDs and the respective species names) was generated in R / RStudio for each marker gene. See script below:
 

To run LifeWatch Belgium's e-Lab services, an account is required. Under "Run Services", the files just created were used as input and the service "Taxon match services" -> "Taxon match World Register of Marine Species (WoRMS)" was applied. The results were downloaded and then used to scan the phyloseq data sets in R / RStudio for taxa found in the WRiMS list. See script below:
 
The results of this script are count tables of MOTUs with species assignments (one each for COI and 18S) for taxa listed in WRiMS for the ARMS locations. Counts are given per ARMS sampling event (so all fraction samples were merged for each single ARMS deployment).  

SECTION: Creating data sets suitable for comparison of NIS prevalence
15. The previously created data sets represent the most unfiltered MOTU data sets for each marker gene. To be able to assess the prevalence of NIS a) among deployment sites, and b) among types of deployment sites (i.e., marinas/ports/harbours vs. all other types), we created comparable data sets of equal sampling and sequencing effort for each gene. The following steps are performed for each gene's data set in the R scripts found below:

The starting point are the previously created unfiltered MOTU phyloseq objects, which are read into R.
In August 2023, some material samples were re-sequenced due to initially poor read yield. In most of those cases, two genetic samples for the respective MaterialSampleID are therefore present in the data set. Based on assessment of rarefaction curves, OTU counts and taxonomy profiles for each of these sample pairs, the sample with lower diversity or taxonomic resolution will be removed.
As a trial during the initial phase of the ARMS MBON program, some samples were preserved in DESS/DMSO as well as ethanol. Where both replicates remain in the data set, the sample preserved in ethanol will be removed. Where samples have been preserved in ethanol only or where only the enthanol replicate remained in the data set, those will be kept. 
There are a couple of samples from Roscoff, France, which have been processed as duplicates. The replicate showing higher read counts and MOTU richness based on rarefaction curves will be kept.
Samples with less than 10,000 reads remaining are removed. 
Samples are rarefied to 10,000 reads to achieve even sequencing depth. This is now the cleaned and rarefied data set which will be saved!
The previous step created a rarefied MOTU data set. However, we also need to rarefy the initial ASV data set (product of blank correction, see above) because we previously checked ASV occurrences within MOTUs to see if a NIS occurrence can actually be considered as such. So the blank-corrected ASV data sets will be subset to the samples remaining in the rarefied MOTU data sets and then rarefied to an equal sequencing depth of 10,000 reads.
The curated and filtered NIS count tables (see section above) are read into R and subset to the MOTUs and ASVs remaining after the rarefaction procedures. Occurrences of NIS MOTUs which are now left with less than 10 reads per sampling event (because ASVs got removed) are set to zero.
Phyloseq objects containing just the NIS MOTUs and their curated and filtered occurrences as NIS in the samples remaining after rarefaction are generated.
Statistical tests are performed to assess differences in NIS richness between samples of marina / harbour/ port sites and all remaining sites.
Info on deployment duration in days is added to the phyloseq objects. In Addition, info on whether samples of all three size or both motile fractions remained for each ARMS unit is added. Five NIS MOTU phyloseq objects are generated with ARMS units for which the samples of a) all three fractions; b) both motile fractions; c) the sessile fraction; d) the motile 100um fraction; e) the motile 500um fraction is/are remaining. 
Some ARMS units have been deployed for multiple, consecutive periods at the same spot (i.e., same ARMS ID, different sampling events). This will of course be the norm as the ARMS-MBON project progresses. However, as the samples processed here stem from the initial years of this monitoring network, some sites contain ARMS units which were only deployed once. Hence, to achieve similar sampling effort among sites for downstream analysis, the sampling events will be assessed visually and the data sets subset to keep only the samples of one sampling event per ARMS. For each of the five phyloseq objects (see 11.) only one sampling event is kept for each ARMS ID. The following procedure is applied for selecting sampling events: a) keep the sampling event that temporally overlaps with most of the sampling events of other ARMS, b) within a site = Field_Replicate group with multiple field replicates, keep the sampling events that temporally overlap even if that means some ARMS units will be removed as long as two ARMS units remain within this site = Field_Replicate group. The minimum number of two units is enforced because in the next step two ARMS units are randomly selected for each site = Field_Replicate group to achieve similar sampling effort (this number was chosen after assessing the remaining number of ARMS units for all site = Field_Replicate groups and determining that most sites had two or more units remaining). 
Randomly select two ARMS units for each for site = Field_Replicate group to achieve similar sampling effort. For site = Field_Replicate groups with only one ARMS remaining, this unit is kept. These five phyloseq objects ( ARMS with samples of a) all three fractions; b) both motile fractions; c) the sessile fraction; d) the motile 100um fraction; e) the motile 500um fraction remaining) will be saved for each marker gene. 
For each gene, an.xslx file is written. It contains two sheets for each of the five phyloseq objects. One sheet giving the number of NIS found at each site = Field_Replicate group and if this group had one or two ARMS replicates in the curated data set had remaining. The second sheet contains the full taxonomy of each NIS and a table showing presence-absence occurrences for each site = Field_Replicate group. 

All steps described above are performed in R / RStudio with the script below:
 

 

SECTION: Determining sites / groups of field replicates
11. ARMS-MBON consists of observatories regularly deploying ARMS at one to seven sights each. Within an observatory, sites are locations with one or more ARMS being deplyoed with a certain distance from each other. However, during the initial phase of ARMS-MBON, there was no clear definition for what requirements define a group of ARMS units as field replicates. 

For downstream analysis purposes, we consider ARMS units deployed with a distance of maximum 20 km from each other as one site = one Field_Replicate group. We took information on coordinates of each deployed ARMS unit from the https://github.com/arms-mbon/data_workspace/blob/main/qualitycontrolled_data/combined/combined_ObservatoryData.csv file from the ARMS-MBON GitHub repository. 

The follwoing script calculates distances in km in R/RStudio for each ARMS unit combination:
 

The resulting file is a distance matrix and contains more ARMS then present in the data set processed here, as there are more observatories in ARMS-MBON than data was available for at this time. We manually checked the distances between the ARMS units which are part of our data set and manually added the column Field_Replicate to the XX_sample_data.txt files used in the next section (see below). In this column, we defined a code for each site = Field_Replicate group an ARMS unit belongs to.