Skip to content

Latest commit

 

History

History
104 lines (82 loc) · 3.06 KB

README.md

File metadata and controls

104 lines (82 loc) · 3.06 KB

stana

R-CMD-check

Metagenotyping analysis in R. Import and analyse, visualize the metagenotyping output of the software like MIDAS, MIDAS2, metaSNV v1 and metaSNV v2, and inStrain. In general the metagenotyping software produces the allelic count information and gene copy number tables and the package utilizes these information to analyze the intra-species diversity.

The detailed usage is available at https://noriakis.github.io/software/stana, using bookdown.

Installation

Using devtools:

devtools::install_github("noriakis/stana")

Pipeline

Examples

## Using example data
library(stana)
library(phangorn)
load(system.file("extdata", "sysdata.rda", package = "stana"))

stana
#> # A stana: MIDAS2
#> # Database: uhgg
#> # Loaded directory: midas2_sample_merge_uhgg
#> # Species number: 1
#> # Group info (list): Group1/Group2
#> # Loaded SNV table: 1 ID: 100003
#> # Loaded gene table: 1 ID: 100003
#> # Loaded KO table: 1 ID: 100003
#> # Size: 7623792 B
getID(stana)
#> [1] "100003"

## Make example metadata
samples <- getSlot(stana, "snps")[[1]] |> colnames()
metadata <- data.frame(
    row.names=samples,
    treatment=factor(sample(1:3, length(samples), replace=TRUE)),
    marker=runif(length(samples))
)


## Set metadata
stana <- setMetadata(stana, metadata)

## Call consensus sequence
## Infer and plot tree based on metadata
stana <- stana |>
  consensusSeq(argList=list(site_prev=0.95)) |>
  inferAndPlotTree(meta=c("treatment","marker"))
#> # Beginning calling for 100003
#> # Original Site number: 5019
#> #  Profiled samples: 11
#> #  Included samples: 11
getFasta(stana)[[1]]
#> 11 sequences with 896 character and 625 different site patterns.
#> The states are a c g t
getTree(stana)[[1]]
#> 
#> Phylogenetic tree with 11 tips and 10 internal nodes.
#> 
#> Tip labels:
#>   ERR1711593, ERR1711594, ERR1711596, ERR1711598, ERR1711603, ERR1711605, ...
#> 
#> Rooted; includes branch lengths.
getTreePlot(stana)[[1]]

If the gene copy number table is available like in MIDAS series and inStrain, one can compare the functional implications of these gene contents. The details are described in the documentation.

Interactive inspection

The users can inspect metagenotyping results interactively using Shiny based on the variables such as disease conditions (exportInteractive()). One can publish the results in the hosting services for sharing the research findings.