---
title: idiogramFISH
output: 
  github_document:
    pandoc_args: --lua-filter=refs/multiple-bibliographies.lua

bibliography_normal: [refs/normal.bib]
bibliography_software: [refs/software.bib]
bibliography_docs: [refs/docs.bib]
bibliography_shiny: [refs/shinyApp.bib]

csl: refs/clima5.csl
link-citations: yes
---

<!-- README.md is generated from README.Rmd. Please edit that file -->

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "70%"
)
library(knitr)
```

```{r, echo=F,  results="asis"}
img1_path <- "man/figures/logo.png"
if(file.exists(img1_path)) {
cat(paste0("<img src=",img1_path," align=\"right\" width=\"12%\" hspace=\"50\">") )
}
```

# Shiny App. Idiograms with Marks and Karyotype Indices<br></br><br></br><br></br><br></br>
 
```{r, include = FALSE}
 badge_devel_gitlab<-function(pkg, color){
    v <- rvcheck:::check_github_gitlab(pkg, "gitlab")$latest_version
    url <- paste0("https://gitlab.com/", pkg)
    badger::badge_custom("devel version", v, color, url)
}
```


``` {r, echo=F, message=FALSE, fig.show = "hold", fig.align = "default", results="asis"}
# library(badger)
if (requireNamespace("RCurl", quietly = TRUE)  ) {
cranversion <- "https://www.r-pkg.org/badges/version/idiogramFISH"
cranversion_cont   <- tryCatch(suppressWarnings(RCurl::getURLContent(cranversion)   ), error=function(e) NA )

crandownloads<-"https://cranlogs.r-pkg.org/badges/grand-total/idiogramFISH?color=orange"
crandownloads_cont <- tryCatch(suppressWarnings(RCurl::getURLContent(crandownloads) ), error=function(e) NA )

newdownlink<-tryCatch(suppressWarnings(badger::badge_custom("CRAN",  "downloads","green") ), error=function(e) NA )
if(!is.na(newdownlink)){
svgnewdownlink<-gsub("\\[|\\]|!|\\(|\\)","", newdownlink)
realdo_cont <- tryCatch(suppressWarnings(RCurl::getURLContent(svgnewdownlink) ), error=function(e) NA )
}

doibadge <- "https://zenodo.org/badge/DOI/10.5281/zenodo.3579417.svg"
doibadge_cont      <- tryCatch(suppressWarnings(RCurl::getURLContent(doibadge)      ), error=function(e) NA )
    
  if (!is.na(cranversion_cont)) {
  cranversion_contFile <- "man/figures/cranversion.svg"
  writeLines(cranversion_cont, con = cranversion_contFile)
  cat(paste0("![https://cran.r-project.org/web/packages/idiogramFISH/](",knitr::include_graphics(cranversion_contFile),")" ) )
  }
  
    # if (!is.na(crandownloads_cont)){
      
    if (!is.na(realdo_cont)){
      realdo_contFile <- "man/figures/realdownloads.svg"
      writeLines(realdo_cont, con = realdo_contFile)
                            # message                                              # link
      cat(paste0("&nbsp;[![downloads](",knitr::include_graphics(realdo_contFile),")](https://ferroao.gitlab.io/idiogramfishhelppages/downloads.png)" ) )
    }
    
      if (!is.na(doibadge_cont)){
        cranCranddoi<-TRUE
      doibadge_contFile <- "man/figures/doibadge.svg"
      writeLines(doibadge_cont, con = doibadge_contFile)
      # doibadge_contFile <- normalizePath(doibadge_contFile)
      
       cat(paste0("&nbsp;[![10.5281/zenodo.3579417](",knitr::include_graphics(doibadge_contFile),")](https://doi.org/10.5281/zenodo.3579417)" ) )
      } # doi cont
} # rcurl
```
``` {r, echo=F, message=FALSE, fig.show = "hold", fig.align = "default", results="asis"}
#`r badge_devel_gitlab("ferroao/idiogramFISH", color="green")`
if (requireNamespace("RCurl", quietly = TRUE)  ) {
v<-sub("Version: ","",readLines("DESCRIPTION")[3])
link<-tryCatch(suppressWarnings(badger::badge_custom("devel version", v, "cornflowerblue","?logo=gitlab") ), error=function(e) NA )
if(!is.na(link)){
svglink<-gsub("\\[|\\]|!|\\(|\\)","", link)
gitbadge_cont <- tryCatch(suppressWarnings(RCurl::getURLContent(svglink) ), error=function(e) NA )
if (!is.na(gitbadge_cont)){
gitbadge_contFile <- "man/figures/gitbadge.svg"
writeLines(gitbadge_cont, con = gitbadge_contFile)
cat(paste0("&nbsp;![gitlab.com/ferroao/idiogramFISH](",knitr::include_graphics(gitbadge_contFile)," )" ) )
}
}
} # rcurl
```
``` {r, echo=F, message=FALSE, fig.show = "hold", fig.align = "default", results="asis"}
cat("<br></br><br></br>")
cat("<a href='https://ko-fi.com/X7X71PZZG' target='_blank'><img height='30' style='border:0px;height:30px;' src='man/figures/kofi1.png' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>")
```
<!-- badges: end -->

The left side menu of the shiny app consists of three pages with several tabs:

* data.frame inputs
    + Load example
    + Chr. data data.frame
    + Mark Pos. data d.f.
    + Marks' Style

* Param. & idiogram
    + Parameters
    + Log
    + code
    
* About

The goal of idiogramFISH is to plot idiograms of karyotypes, plasmids and circ. chr. having a set of data.frames for chromosome data
    and optionally marks' data (`plotIdiograms` function) [@Roa2021]. Idiograms can also be plotted in 
    concentric circles. Separated chromatids can be visible when not in a circular plot.<br>
    <br>Six styles of marks are available: square (squareLeft), dots, cM (cMLeft), cenStyle, upArrow (downArrow), exProtein (inProtein); its legend (label) can be drawn inline 
    or to the right of karyotypes. Three styles of centromere are available: rounded, triangular and internal (inProtein). It is possible to calculate
    also chromosome and karyotype indexes [@Watanabe1999;@Zarco1986new] and classify chromosome morphology in the categories of
    Levan [-@Levan1964], and [Guerra](https://ferroao.gitlab.io/guerra1986/Guerra1986.pdf) [-@Guerra1986d].

IdiogramFISH was written in R [@R-base] and also uses crayon [@R-crayon], tidyr [@R-tidyr], plyr [@plyr2011] and dplyr packages [@R-dplyr]. Documentation was written with R-packages roxygen2 [@R-roxygen2], usethis [@R-usethis], bookdown [@bookdown2016], knitr [@Xie2015], pkgdown [@R-pkgdown], Rmarkdown [@rmarkdown2018], rvcheck [@R-rvcheck], badger [@R-badger], kableExtra [@R-kableExtra], rmdformats [@R-rmdformats] and RCurl [@R-RCurl]. For some vignette figures, packages rentrez [@rentrez2017], phytools [@phytools2012], ggtree [@ggtree2018], ggplot2 [@ggplot22016] and ggpubr [@R-ggpubr] were used.

In addition, the shiny app `runBoard()` uses shiny [@R-shiny], shinydashboard [@R-shinydashboard], rhandsontable [@R-rhandsontable], gtools [@R-gtools], rclipboard [@R-rclipboard] and bib2df [@R-bib2df].

<!-- badger -->

## Releases

[News](https://gitlab.com/ferroao/idiogramFISH/blob/master/NEWS.md)  

[CRAN archive](https://cran.r-project.org/src/contrib/Archive/idiogramFISH/)

[Download history](https://ferroao.gitlab.io/idiogramfishhelppages/downloads.png)

## Need help?

#### Manual in Bookdown style

``` {r, echo=F, message=FALSE, fig.show = "hold", fig.align = "default", results="asis"}
if (requireNamespace("RCurl", quietly = TRUE)  ) {
# version of manual
# v<-tryCatch(suppressWarnings(rvcheck:::check_github_gitlab("ferroao/idiogramFISH", "gitlab")$latest_version), error=function(e) NA )
#cran version
v<-tryCatch(suppressWarnings(rvcheck::check_cran("idiogramFISH")$latest_version), error=function(e) NA )

pkg<-"idiogramFISH"
link<-tryCatch(suppressWarnings(badger::badge_custom("bookdown", paste(pkg,v), "orange") ), error=function(e) NA )
  if(!is.na(link)){
  svglink<-gsub("\\[|\\]|!|\\(|\\)","", link)
  manual_cont <- tryCatch(suppressWarnings(RCurl::getURLContent(svglink) ), error=function(e) NA )
    if (!is.na(manual_cont)){
    manual_contFile <- "man/figures/cranmanualbookdown.svg"
    writeLines(manual_cont, con = manual_contFile)
    cat(paste0("&nbsp;[![https://ferroao.gitlab.io/manualidiogramfish](",knitr::include_graphics(manual_contFile),")](https://ferroao.gitlab.io/manualidiogramfish/)" ) )
    }
  }
} # rcurl
```

#### Documentation in Pkgdown style

``` {r, echo=F, message=FALSE, fig.show = "hold", fig.align = "default", results="asis"}
if (requireNamespace("RCurl", quietly = TRUE)  ) {
# version of manual
v<-sub("Version: ","",readLines("DESCRIPTION")[3])

pkg<-"idiogramFISH"
pkglink<-tryCatch(suppressWarnings(badger::badge_custom("pkgdown", paste(pkg,v), "cornflowerblue") ), error=function(e) NA )
  if(!is.na(pkglink)){
  pkgsvglink<-gsub("\\[|\\]|!|\\(|\\)","", pkglink)
  develpkgmanual_cont <- tryCatch(suppressWarnings(RCurl::getURLContent(pkgsvglink) ), error=function(e) NA )
    if (!is.na(develpkgmanual_cont)){
    pkgdownmanual_contFile <- "man/figures/pkgdownver.svg"
    writeLines(develpkgmanual_cont, con = pkgdownmanual_contFile)
    cat(paste0("&nbsp;[![https://ferroao.gitlab.io/idiogramFISH](",knitr::include_graphics(pkgdownmanual_contFile)," )](https://ferroao.gitlab.io/idiogramFISH)" ) )
    }
  }
} # rcurl
```


#### Vignettes: {-}

Online:

``` {r, echo=F, message=FALSE, fig.show = "hold", fig.align = "default", results="asis"}
if (requireNamespace("RCurl", quietly = TRUE)  ) {
# version of manual
v<-sub("Version: ","",readLines("DESCRIPTION")[3])

pkg<-"idiogramFISH"
link<-tryCatch(suppressWarnings(badger::badge_custom("vignettes", paste(pkg,v), "cornflowerblue") ), error=function(e) NA )
  if(!is.na(link)){
  svglink<-gsub("\\[|\\]|!|\\(|\\)","", link)
  develmanual_cont <- tryCatch(suppressWarnings(RCurl::getURLContent(svglink) ), error=function(e) NA )
    if (!is.na(develmanual_cont)){
    vignettemanual_contFile <- "man/figures/develmanualvignette.svg"
    writeLines(develmanual_cont, con = vignettemanual_contFile)
    cat(paste0("&nbsp;[![https://ferroao.gitlab.io/idiogramfishhelppages](",knitr::include_graphics(vignettemanual_contFile),")](https://ferroao.gitlab.io/idiogramfishhelppages)" ) )
    }
  }
} # rcurl
```

Launch vignettes from R for the installed version:
``` r
library(idiogramFISH)
packageVersion("idiogramFISH")
browseVignettes("idiogramFISH")
```

## Citation

```{r citation, results='asis', echo=FALSE}
print(citation("idiogramFISH"),bibtex=FALSE)
```

To write citation to file:
```{r, echo=TRUE, results=FALSE, eval=FALSE}
sink("idiogramFISH.bib")
toBibtex(citation("idiogramFISH"))
sink()
```

## Authors

[Fernando Roa](https://ferroao.gitlab.io/curriculumpu/)  
[Mariana PC Telles](http://lattes.cnpq.br/4648436798023532) 

## References

::: {#refs_normal}
:::

## R-packages {-}

::: {#refs_software}
:::

## Shiny App {-}

::: {#refs_shiny}
:::

## Documentation {-}

::: {#refs_docs}
:::
