---
title: " |![](./img/logo.png)|"
date: "<small>`r Sys.Date()`</small>"
output: 
    html_document:
        toc: true
        toc_float: true
---

```{r setup, include=FALSE}
library(knitr)
library(data.table)
library(kableExtra)
library(dplyr)

knitr::opts_chunk$set(echo = TRUE)
```

# *De novo* Assembly of Bacteria Genome Nanopore data

- - -

## Project
<span style="font-size:20px;"> Testing_case </span>

- - -

## Bioinformatics workflow

![](img/BacteriaDeNovoAssembly.png)


- - -


## Nanopore sequencing data QC Report {.tabset}

<a href="../quast_results/latest/report.html" target="_blank"> QC detail </a>

### Summary
```{r qc_nano, echo = FALSE}
qc_table <- read.table("./QC_table.tsv",sep="\t",quot="",header=F)
names(qc_table) <- c(" "," ")
kable(qc_table) %>% kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"), font_size = 14)
```

More detail could be found in `NanoPlot_QC/` folder.

### LengthvsQualityScatterPlot_dot
![](../NanoPlot_QC/LengthvsQualityScatterPlot_dot.png)


### LogTransformed_HistogramReadlength
![](../NanoPlot_QC/LogTransformed_HistogramReadlength.png)

- - -

## Assembly Results {.tabset}

The assembled contigs fasta is `dfast/genome.fna`. <a href="../dfast/genome.fna" download> genome.fna </a>

### Statistics

<a href="../quast_results/latest/report.html" target="_blank">assembly result detail</a>
```{r assemaly_stat, echo = FALSE}
assembled_table <- read.delim("../quast_results/latest/report.tsv", sep="\t",header=T,quote = ",")
assembled_table[,2] <- formatC(assembled_table[,2], big.mark=",",format = "f",digits = 0)
names(assembled_table) <- c(" "," ")
kable(assembled_table,align = 'l') %>% kable_styling(bootstrap_options = c("striped","hover","condensed","responsive"),font_size = 14)
```


### GC content

![](../quast_results/latest/basic_stats/GC_content_plot.png)


### Assembly completeness

```{r completeness, echo = F}
busco_results <- read.table("./busco_table.tsv",sep="\t",header=F, quote=",")
names(busco_results) <- c(" "," ")
kable(busco_results,align = 'l') %>% kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"), font_size = 14)
```


- - -


## ORF/ncRNA Prediction and Annotation 
The annotation detail result is in `dfast/`. 

- `cds.fna` is the CDS sequence. <a href="../dfast/cds.fna" download> cds.fna </a>
- `rna.fna` include the rRNA and tRNA seuqnece.  <a href="../dfast/rna.fna" download> rna.fna </a>
- `protein.faa` is the protein sequence. <a href="../dfast/protein.faa" download> protein.faa </a>
- `genome.gff` is the gene annotation file.  <a href="../dfast/genome.gff" download> genome.gff </a> 
  Please refer this <a href="http://asia.ensembl.org/info/website/upload/gff3.html" target="_blank"> ENSEMBL website </a>  about the GFF format.

```{r gene_prdiction_result, echo=FALSE}
annotate_stat <- read.table("../dfast/statistics.txt",header=F, sep="\t")
annotate_stat[,2] <- formatC(annotate_stat[,2], big.mark = ",", format = 'f', digits =0)
names(annotate_stat) <- c(" ", " ")
kable(annotate_stat,align = 'l' ) %>% kable_styling(bootstrap_options = c("striped","hover","condensed","responsive"))
```

- - -

## Assembly summary for each contig

The assembled contigs fasta is `dfast/genome.fna`. <a href="../dfast/genome.fna" download> genome.fna </a> 

```{r contig_stat, echo=FALSE}
contig_stat <- read.table("./contig_stat.tsv",header=T, sep="\t")
kable(contig_stat,align = 'l' ) %>% kable_styling(bootstrap_options = c("striped","hover","condensed","responsive"))
```

- - -

## Softwares

+ QC
    - [NanoPlot v1.33.0](https://github.com/wdecoster/NanoPlot)

+ Quality filter
    - [nanoq v0.1.1](https://github.com/esteinig/nanoq)

+ Assembly
    - [Flye v2.8.1](https://github.com/fenderglass/Flye)
    
+ Reads-mapping & processing
    - [Minimap2 v2.17 (r941)](https://github.com/lh3/minimap2)
    - [Samtools v1.10](http://www.htslib.org/doc/samtools.html)

+ Polish
	- [racon v1.4.19](https://github.com/isovic/racon)
    
+ Consensus
    - [medaka v1.0.3](https://github.com/nanoporetech/medaka)

+ ORF/tRNA/rRNA prediction and annotation
    - [DFAST v1.2.10](https://github.com/nigyta/dfast_core)
    - [barrnap](https://github.com/tseemann/barrnap)
    - [Aragon](http://130.235.244.92/ARAGORN/)

+ Genome Assembly Completeness assessment
    - [BUSCO v4.1.3](https://gitlab.com/ezlab/busco)

+ Assembly quality assessment
    - [QUAST v5.0.2](http://quast.sourceforge.net/)

+ Data post-processing & Report
    - [R v4.0.0](https://cran.r-project.org/)
    - [R Markdown v2.2](https://rmarkdown.rstudio.com/)
    - [knitr v1.28](https://yihui.name/knitr/)
    - [kableExtra v1.1.0](https://github.com/haozhu233/kableExtra)
    
