---
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 `demoMgDb` 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)
demoMgDb <- get_demoMgDb()
demoMgDb
```


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


```{r}
taxa_columns(demoMgDb)
```

```{r}
head(taxa_keys(demoMgDb, 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(demoMgDb, type = "taxa",
            keys = c("Vibrionaceae", "Enterobacteriaceae"),
            keytype = "Family")
```

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



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


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