---
title: "Using the SILVA 16S rRNA Database with MetaScope"
author: "Aubrey Odom"
date: "2024-01-01"
output: html_document
---

# The SILVA database

MetaScope is compatible with the SILVA 16S rRNA Database. At the time of writing, the [most recent update](https://www.arb-silva.de/) to SILVA is version 138.1 (released on August 27, 2020). These notes will supplement the main MetaScope pipeline as illustrated in the [vignette](https://wejlab.github.io/metascope-docs/articles/MetaScope_vignette.html).

# SILVA Indices
Currently, MetaScope is only functional with SILVA when using the premade Bowtie2 indices of SILVA 138.1 available [here](https://rutgers.box.com/s/njq1qc9bzawzs3a6513uihxxwgxu9qc5).
# Accessions
Before running any samples, you'll need to run `download_accessions()` with the argument `silva_taxonomy_database = TRUE`.

# Alignment
You can follow the `align_target_bowtie` usage outlined in the MetaScope tutorial, replacing the `libs` parameter with the SILVA indices.

# Identification
When you reach the `metascope_id()` step, you will need to include the parameter `db = "silva"` in the function call to identify down to the genus level using the SILVA taxonomy identifiers. 

# Condense results
All CSV outputs from `metascope_id()` can be compiled into a single MultiAssayExperiment object with the `convert_animalcules_silva()` function as shown here with false filenames:

```{R, eval = FALSE}
out_res <- convert_animalcules_silva(
  meta_counts = all_files,
  annot_path = "animalcules_metadata.csv",
  which_annot_col = "Filename",
  end_string = ".metascope_id.csv",
  qiime_biom_out = FALSE,
  path_to_write = "."
)

saveRDS(out_res, "silva_consolidated_results.RDS")
```
