---
title: "Exploring a MgDb Object"
author: "Nathan D. Olson"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Vignette Title}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

The MgDb Class in the metagenomeFeatures package includes the sequences and taxonomic information for a 16S database.  The following vignette demonstrates the class methods for exploring and subsetting a `MgDb-class` object using the `gg85` included in the `metagenomeFeatures` package. `MgDb-class` object with full databases are in separate packages such as the `greengenes13.5MgDb` package.

## Demonstration `MgDb-class` Object
```{r}
library(metagenomeFeatures)
gg85 <- get_gg13.8_85MgDb()
gg85
```


## MgDb Methods
taxa_keytypes
```{r}
taxa_keytypes(gg85)
```


```{r}
taxa_columns(gg85)
```

```{r}
head(taxa_keys(gg85, keytype = c("Kingdom")))
```


## Select Methods
Used to retrieve db entries for a specified taxonomic group or id list, can return either taxonomic, sequences information, or both.

### Selecting taxonomic information
```{r}
mgDb_select(gg85, type = "taxa",
            keys = c("Vibrionaceae", "Enterobacteriaceae"),
            keytype = "Family")
```

### Selecting sequence information
```{r}
mgDb_select(gg85, type = "seq",
            keys = c("Vibrionaceae", "Enterobacteriaceae"),
            keytype = "Family")
```



### Selecting all
```{r}
mgDb_select(gg85, type = "all",
                keys = c("Vibrio", "Salmonella"),
                keytype = "Genus")
```


```{r}
sessionInfo()
```
