
## `assembly_stats` - Assembly statistics



```{r assembly_stats, echo = F, message = F, warning = F, error = T}

#setwd("~/comparem2")

#assembly_stats_df = read_tsv(glob$assembly_stats) 
assembly_stats_df = read_tsv(glob_list$assembly_stats) 
        

assembly_stats_df_plot = metadata_translate %>%
    select(sample, file_long) %>%
    left_join(assembly_stats_df, by = c("file_long" = "filename")) %>%
    select(sample, everything(), -file_long, -N50n, -N70, -N70n, -N90n) 

assembly_stats_df_plot %>% 
    custom_dt("assembly_stats", dom = "Blfrtip", save = F) %>% 
    formatStyle(
        'total_length',
        background = styleColorBar(c(0, max(assembly_stats_df_plot$total_length)), rgb(186/255, 226/255, 220/255, )),
        backgroundSize = '100% 80%',
        backgroundRepeat = 'no-repeat',
        backgroundPosition = 'center') %>% 
    formatStyle(
        'mean_length',
        background = styleColorBar(c(0, max(assembly_stats_df_plot$mean_length)), rgb(186/255, 220/255, 226/255, )),
        backgroundSize = '100% 80%',
        backgroundRepeat = 'no-repeat',
        backgroundPosition = 'center') %>% 
    formatStyle(
        'N50',
        background = styleColorBar(c(0, max(assembly_stats_df_plot$N50)), "#C6DDF0"),
        backgroundSize = '100% 80%',
        backgroundRepeat = 'no-repeat',
        backgroundPosition = 'center')
    
    
    
    # formatStyle(
    # "total_length",
    # background = styleColorBar(range(out$total_length) + c( -1000, 1000), 'lightblue'),
    # backgroundSize = "100% 90%",
    # backgroundRepeat = "no-repeat",
    # backgroundPosition = "center")


```

*Table `r tableno()`: Assembly statistics is provided by [assembly-stats](https://github.com/sanger-pathogens/assembly-stats#assembly-stats). N50 indicates the length of the smallest contig that (together with the longer contigs) covers at least half of the genome.*

---