---
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 inseparte 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 taxanomic group or id list, can return either taxonomic, sequences information, or both. 

### Selecting taxonomic information
```{r}
select(demoMgDb, type = "taxa",
                keys = c("Vibrio", "Salmonella"),
                keytype = "Genus")
```

### Selecting sequence information
```{r}
select(demoMgDb, type = "seq",
                keys = c("Vibrio", "Salmonella"),
                keytype = "Genus")
```



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


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

