Introduction

The goal of idiogramFISH functions or the shiny-app is to plot karyotypes, plasmids and circular chr. having a set of data.frames for chromosome data and optionally marks’ data (Roa and PC Telles, 2021). Karyotypes can also be plotted in concentric circles.

It is possible to calculate also chromosome and karyotype indexes (Romero-Zarco, 1986; Watanabe et al., 1999) and classify chromosome morphology in the categories of Levan (1964), and Guerra (1986).

Six styles of marks are available: square (and squareLeft), dots, cM (cMLeft), cenStyle, upArrow (downArrow), exProtein (inProtein) (in column style in dfMarkColor data.frame); its legend (label) (parameter legend) can be drawn inline or to the right (aside) of karyotypes. Three styles of centromere are available: rounded, triangle and inProtein (cenFormat parameter). Chromosome regions (column chrRegion in dfMarkPos data.frame) for monocentrics are p (short), q (long), cen, pcen, qcen. The last three cannot accommodate most mark styles, but can be colored. The region w (whole) can be used both in monocentrics and holocentrics.

IdiogramFISH was written in R (R Core Team, 2019) and also uses crayon (Csárdi, 2017), tidyr (Wickham and Henry, 2020), plyr (Wickham, 2011) and dplyr packages (Wickham et al., 2019). Documentation was written with R-packages roxygen2 (Wickham et al., 2018), usethis (Wickham and Bryan, 2019), bookdown (Xie, 2016), knitr (Xie, 2015), pkgdown (Wickham and Hesselberth, 2019), Rmarkdown (Xie et al., 2018), rvcheck (Yu, 2019a), badger (Yu, 2019b), kableExtra (Zhu, 2019), rmdformats (Barnier, 2020) and RCurl (Temple Lang and CRAN team, 2019). For some vignette figures, packages rentrez (Winter, 2017), phytools (Revell, 2012), ggtree (Yu et al., 2018), ggplot2 (Wickham, 2016) and ggpubr (Kassambara, 2019) were used.

In addition, the shiny app runBoard() uses shiny (Chang et al., 2021), shinydashboard (Chang and Borges Ribeiro, 2018), rhandsontable (Owen, 2018), gtools (Warnes et al., 2020) and rclipboard (Bihorel, 2021).

Run the Shiny app with docker

  • No need to install R
  • Install docker on your system
  • Make sure you can run a docker example image, i.e. ubuntu, in the console (system terminal)
docker pull fercyto/idiogramfish

# Run the image
docker run -d -p 8080:8080 fercyto/idiogramfish

In your internet browser go to http://localhost:8080

# Stop the container
docker ps
docker stop {container id}

Installation instructions

CRAN repo https://doi.org/10.5281/zenodo.3579417

You can install idiogramFISH from CRAN with:

install.packages("idiogramFISH")

Windows users: To avoid installation of R-packages in OneDrive

.libPaths()          # read library location
.libPaths("D:R/lib") # set

To do that permanently: Search (magnifier) “environment variables” and set R_LIBS_USER to D:\R\lib (example)

Other option: something in the line of this link

Releases

NEWS

archive

downloads

Need help?

Manual in Bookdown style

https://ferroao.gitlab.io/manualidiogramfish

Documentation in Pkgdown style

https://ferroao.gitlab.io/idiogramFISH/articles/index.html

Vignettes

Online:

https://ferroao.gitlab.io/idiogramfishhelppages

Launch vignettes from R for the installed version:

library(idiogramFISH)
packageVersion("idiogramFISH")
browseVignettes("idiogramFISH")

Citation

To cite idiogramFISH in publications, please use:

Roa F, Telles M. idiogramFISH: Shiny app. Idiograms with Marks and Karyotype Indices. doi: 10.5281/zenodo.3579417

To write citation to file:

sink("idiogramFISH.bib")
toBibtex(citation("idiogramFISH"))
sink()

1 Working online

Shiny App in the cloud availability:
shinyapps.io

Each chapter has a jupyter version. A jupyter notebook seems an interactive vignette.

They are hosted in github

They can be accessed with google colab to work online.

Open in ColabOpen in Colab  Github  
3 Minimal examples link Raw
4 Plotting chromosomes link Raw
5 Multiple OTUs link Raw
6 Changing units link Raw
7 GISH link Raw
8 Groups link Raw
9 Circular Plots link Raw
10 Plotting alongside phylogeny link Raw
11 Citrus link Raw
12 Human Karyotype link Raw

Chapters can be accessed locally in your jupyter-lab or jupyter notebook

After installing jupyter, you can install the R kernel with:

install.packages("IRkernel")
IRkernel::installspec()

2 Shiny App

Attention Windows users, might require the last R version to plot correctly.

library(idiogramFISH)
runBoard()

Shiny App in the cloud availability:
shinyapps.io

3 Minimal examples

Jupyter interactive version:
Open in ColabOpen in Colab   Github   Raw

3.1 Monocentrics

Define your plotting window size with something like par(pin = c(10, 6)), or with svg(), png(), etc. Add chromosome morphology according to Guerra (1986) or (Levan et al., 1964)

library(idiogramFISH)

data(dfOfChrSize) # chromosome data
data(dfMarkColor) # mark general data
data(dfOfMarks2)  # mark position data (inc. cen.)

# column Mbp not for plotting purposes
dfOfChrSize$Mbp <- (dfOfChrSize$shortArmSize + dfOfChrSize$longArmSize) * 100

svg("dfOfChrSize.svg", width = 10, height = 6)
# png("dfOfChrSize.png", width = 500, height = 400)
plotIdiograms(dfChrSize  = dfOfChrSize,  # data.frame of chr. size
  dfMarkColor = dfMarkColor,  # d.f of mark style <- Optional
  dfMarkPos = dfOfMarks2,     # d.f of mark positions (includes cen. marks)

  karHeight = 5,              # kar. height
  chrWidth = 1.2,             # chr. width
  chrSpacing = 1,             # space among chr.

  morpho = "Guerra",          # chr. morpho. classif. (Guerra, Levan, both, "" ) ver. >= 1.12 only
  chrIndex = "CI",            # cen. pos. (CI, AR, both, "" ) ver. >= 1.12 only
  chrSize = TRUE,             # add chr. sizes under chr.
  chrSizeMbp = TRUE,          # add Mbp sizes under chr. (see above)

  rulerPos = 0,               # position of ruler
  ruler.tck = -0.01,          # size and orientation of ruler ticks
  rulerNumberSize = .8        # font size of rulers
  , xPosRulerTitle = 3        # pos of ruler title

  , legendWidth = 1          # width of legend items
  , fixCenBorder = TRUE      # use chrColor as border color of cen. or cen. marks
  , distTextChr = 1.2        # chr. text separation

  , xlimLeftMod = 0          # xlim left param.
  , xlimRightMod = 3         # xlim right param.
  , ylimBotMod = 0           # modify ylim bottom argument
  , ylimTopMod = 0           # modify ylim top argument
)
dev.off() # close svg()

Let’s explore the data.frames for monocentrics:

If only one species, column OTU is optional

dfOfChrSize
chrName shortArmSize longArmSize Mbp
1 3 4 700
2 4 5 900
3 2 3 500
X 1 2 300
dfMarkColor
markName markColor style
5S red dots
45S chartreuse3 square
DAPI blue square
CMA darkgoldenrod1 square

p, q and w marks can have empty columns markDistCen and markSize since v. 1.9.1 to plot whole arms (p, q) and whole chr. w.

# mark position data (inc. cen.) 
dfOfMarks2
chrName markName chrRegion markSize markDistCen
1 5S p 1 0.5
1 45S q 1 0.5
X 45S p NA NA
3 DAPI q 1 1.0
1 DAPI cen NA NA
X CMA cen NA NA

3.2 Holocentrics

library(idiogramFISH)

# load some package data.frames - optional
data(dfChrSizeHolo, dfMarkColor, dfMarkPosHolo)

# column Mbp not for plotting purposes
dfChrSizeHolo$Mbp <- dfChrSizeHolo$chrSize * 100

# svg("testing.svg",width = 14, height = 8 )
par(mar = c(0, 0, 0, 0), omi = rep(0, 4))

plotIdiograms(dfChrSize  = dfChrSizeHolo, # data.frame of chr. size
  dfMarkColor = dfMarkColor,   # df of mark style
  dfMarkPos  = dfMarkPosHolo,  # df of mark positions

  addOTUName = FALSE,        # do not add OTU names
  distTextChr = 1,           # chr. name distance to chr.
  chrSize = TRUE,            # show chr. size under chr.
  chrSizeMbp = TRUE,         # show chr. size in Mbp under chr. requires Mbp column

  rulerPos = -0.1,           # position of ruler
  rulerNumberPos = .9        # position of numbers of rulers
  , xPosRulerTitle = 3       # pos. of ruler title (units)

  , xlimLeftMod = 2           # modify xlim left argument of plot
  , ylimBotMod = .2           # modify ylim bottom argument of plot
  , legendHeight = .5         # height of legend labels
  , legendWidth = 1.2         # width of legend labels
  , xModifier = 20            # separ. among chromatids
)

# dev.off() # close svg()

Let’s explore the data.frames for holocentrics:

  • chromosome data, if only 1 species, column OTU is optional
dfChrSizeHolo
chrName chrSize Mbp
1 3 300
2 4 400
3 2 200
4 5 500
  • mark general data
dfMarkColor
markName markColor style
5S red dots
45S chartreuse3 square
DAPI blue square
CMA darkgoldenrod1 square
  • mark position data, if only 1 species, column OTU is optional (mandatory if in d.f of Chr. Size)
dfMarkPosHolo
chrName markName markPos markSize
3 5S 1.0 0.5
3 DAPI 1.5 0.5
1 45S 2.0 0.5
2 DAPI 2.0 0.5
4 CMA 2.0 0.5
4 5S 0.5 0.5

3.3 Plotting both mono. and holo.

Merge data.frames with plyr (Wickham, 2011)

# chromosome data, if only 1 species, column OTU is optional
require(plyr)
dfOfChrSize$OTU   <- "Species mono"
dfChrSizeHolo$OTU <- "Species holo"

monoholoCS <- plyr::rbind.fill(dfOfChrSize, dfChrSizeHolo)

dfOfMarks2$OTU     <- "Species mono"
dfOfMarks2[which(dfOfMarks2$markName == "5S"), ]$markSize <- .7
dfMarkPosHolo$OTU <- "Species holo"

monoholoMarks <- plyr::rbind.fill(dfOfMarks2, dfMarkPosHolo)

Plot

library(idiogramFISH)

# svg("testing.svg",width = 14, height = 10 )
png("monoholoCS.png", width = 700, height = 600)
par(mar = rep(0, 4))
plotIdiograms(dfChrSize   = monoholoCS,   # data.frame of chr. size
  dfMarkColor = dfMarkColor,   # df of mark style
  dfMarkPos   = monoholoMarks, # df of mark positions, includes cen. marks

  chrSize     = TRUE,         # show chr. size under chr.

  squareness  = 4,            # vertices squareness
  addOTUName  = TRUE,         # add OTU names
  OTUTextSize = .7,           # font size of OTU
  distTextChr = .5,           # separ. among chr. and text and among chr. name and indices

  karHeiSpace = 4,            # karyotype height inc. spacing
  karIndexPos = .2,           # move karyotype index

  legendHeight = 1,            # height of legend labels
  legendWidth = 1,             # width of legend labels
  fixCenBorder = TRUE,         # use chrColor as border color of cen. or cen. marks

  rulerPos    = 0,             # position of ruler
  ruler.tck   = -0.02,         # size and orientation of ruler ticks
  rulerNumberPos = .9,         # position of numbers of rulers
  xPosRulerTitle = 3.5,        # ruler title (units) position

  xlimLeftMod = 1,             # modify xlim left argument of plot
  xlimRightMod = 3,            # modify xlim right argument of plot
  ylimBotMod = 0.2             # modify ylim bottom argument of plot

  , chromatids = FALSE         # do not show separ. chromatids

  # ,useOneDot = TRUE

  # ,circularPlot = TRUE       # circularPlot
  # ,shrinkFactor = .9         # percentage 1 = 100% of circle with chr.
  # ,circleCenter = 3          # X coordinate of circleCenter (affects legend pos.)
  # ,chrLabelSpacing = .9      # chr. names spacing

  # ,OTUsrt = 0                # angle for OTU name (or number)
  # ,OTUplacing = "number"     # Use number and legend instead of name
  # ,OTULabelSpacerx = -0.6    # modify position of OTU label, when OTUplacing = "number" or "simple"
  # ,OTUlegendHeight = 1.5     # space among OTU names when in legend - OTUplacing
  # ,separFactor = 0.75        # alter separ. of kar.
)
dev.off() # close png

4 Plotting chromosomes

Jupyter interactive version:
Open in ColabOpen in Colab   Github   Raw

This guide shows how to plot idiograms of measured karyotypes and optionally marks.

4.1 Load package

Visit the Introduction for installation instructions

library(idiogramFISH) 

4.2 Plot monocentrics

Initially you have to put chromosome data in data.frames.

Main three data.frames:

  • One for chr. sizes (parameter dfChrSize)
  • One for marks’ positions (parameter dfMarkPos)
  • One (optional) for mark style (parameter dfMarkColor)

For a way to start with only one data.frame of chr. size and marks’ pos., see Chapter 8.

data.frame of chr. size

# Example data.frame to write in R, use: (column OTU is optional if only 1 OTU)
mydfChrSize <- read.table(text =
  "            OTU chrName shortArmSize longArmSize
  \"Species one\"   1     1.5         2.0
  \"Species one\"   2     2.0         2.5
  \"Species one\"   3     1.0         1.5
  \"Species one\"   B     2.0         3.5",  header = TRUE, stringsAsFactors = FALSE, fill = TRUE)
OTU chrName shortArmSize longArmSize
Species one 1 1.5 2.0
Species one 2 2.0 2.5
Species one 3 1.0 1.5
Species one B 2.0 3.5

loading saved data:

If you use RStudio, in the menu “Session”, use “Set working directory” for choosing your desired folder or:

setwd("~/folder/subfolder")

Open your chromosome data data.frame importing it from a .csv (read.csv) or .xls file (readxl).

mydfChrSize<-read.csv("somefile.csv")

Editing a data.frame:

bigdfOfChrSize <- edit(bigdfOfChrSize, edit.row.names = FALSE)

For fixing column names use:

colnames(mydfChrSize)<-c("OTU", "chrName","shortArmSize","longArmSize")

Marks’ position data

Open or write your mark positions in a data.frame. This data.frame has the marks present in all karyotypes with position info. This data.frame has also the centromeric marks present in all karyotypes.

Column chrRegion defines the arm or region of occurrence (p, q, w, cen). Distance to centromere is defined in markDistCen.

# We will use column OTU if data.frame because chromosome size df has it
mydfOfMarks <- read.table(text =
  "            OTU chrName markName chrRegion markSize markDistCen
\"Species one\"      1      45S       p       NA         NA     # no measure (NA) means whole arm
\"Species one\"      1       5S       q      0.5         0.5
\"Species one\"      B  \"B mark\"    w       NA         NA     # w for whole chromosome
\"Species one\"      B  \"cB mark\"   q       NA         1.0
\"Species one\"      2    cgene4      p        1         1.0
\"Species one\"      2    cgene1      q        1         1
\"Species one\"      2    cgene2      q      0.5         2.0
\"Species one\"      3     DAPI       q       NA         1
\"Species one\"      3    cgene3      p       NA         0.5
\"Species one\"      1     DAPI       pcen
\"Species one\"      3      CMA       qcen
\"Species one\"      2      CMA       cen", header = TRUE, stringsAsFactors = FALSE, fill = TRUE)
OTU chrName markName chrRegion markSize markDistCen
Species one 1 45S p NA NA
Species one 1 5S q 0.5 0.5
Species one B B mark w NA NA
Species one B cB mark q NA 1.0
Species one 2 cgene4 p 1.0 1.0
Species one 2 cgene1 q 1.0 1.0
Species one 2 cgene2 q 0.5 2.0
Species one 3 DAPI q NA 1.0
Species one 3 cgene3 p NA 0.5
Species one 1 DAPI pcen NA NA
Species one 3 CMA qcen NA NA
Species one 2 CMA cen NA NA

For fixing column names use something like:

colnames(mydfMarkColor)<-c("OTU", "chrName","markName","chrRegion","markSize","markDistCen") 

Marks’ general data

This data.frame is optional. It has the marks present in all karyotypes without position info.

It includes color and style. If the style column is not present, param. defaultStyleMark = "square" will be used during plotting.

Note the cenStyle to make constrictions, mimicking centromeres.

# From scratch:
mydfMarkColor <- read.table(text =
  " markName      markColor      style
        5S      red            dots
       45S      chartreuse3    square
    cgene1      chocolate      upArrow
    cgene2      salmon         downArrow
    cgene3      \"#056522\"    cMLeft
      DAPI      dodgerblue     cM
\"cB mark\"     black          cenStyle
       CMA      darkgoldenrod1 square
\"B mark\"      black          square
    cgene4      cornflowerblue exProtein",  header = TRUE, stringsAsFactors = FALSE, fill = TRUE)
markName markColor style
5S red dots
45S chartreuse3 square
cgene1 chocolate upArrow
cgene2 salmon downArrow
cgene3 #056522 cMLeft
DAPI dodgerblue cM
cB mark black cenStyle
CMA darkgoldenrod1 square
B mark black square
cgene4 cornflowerblue exProtein

For fixing column names use:

colnames(mydfMarkColor)<-c("markName", "markColor","style") 
# if style column is not present it will be filled with "square"

Add some text to the right

We will use column note to add a note to the right of the karyotype of the specified OTU (see column OTU)

notesdf<-read.table(text=
"            OTU    note
\"Species one\"   \"Author notes\"  ", header = TRUE, stringsAsFactors = FALSE, fill = TRUE)

For adding just the OTU name (from column OTU of data.frame of chr. size) to the right, use OTUasNote = TRUE

Plotting

You can plot without marks (use only 1st data.frame), but we will use all 4 data.frames created. By default the function will calculate indices (Romero-Zarco, 1986; Watanabe et al., 1999) and morphological categories of Guerra (1986) and Levan (1964). Use parameters chrIndex and morpho of the function plotIdiograms to modify that. See ?plotIdiograms.

The cM style of mark always adds the name as if legend = "inline", even when legend = "aside" (default).

# svg("mydfChrSize.svg",width = 12, height = 6 )

par(mar = c(0, 0, 0, 0))

plotIdiograms(dfChrSize = mydfChrSize,     # chr. size data.frame
  dfMarkPos = mydfOfMarks,     # mark position data.frame (inc. cen.)
  dfMarkColor = mydfMarkColor, # mark style d.f.

  chrSpacing = .6,              # separ. among chr.
  distTextChr = .7,             # separation among text and chr. names and ind.
  orderChr = "name",            # order chr. by name
  karHeiSpace = 2               # vertical size of karyotype including spacer

  , arrowhead = .5             # proportion of head of arrow

  , fixCenBorder = TRUE        # use chrColor as border color of cen. or cen. marks
  , legendWidth = .8           # legend item width
  , legendHeight = .5          # legend item height
  , markLabelSpacer = 2        # legend spacer
  , lwd.mimicCen = 2.5         # constric. mark line width

  , rulerPos = 0               # ruler position
  , ruler.tck = -0.01          # ticks of ruler size and orientation
  , xPosRulerTitle = 2.5       # ruler units pos.

  , markPer = "45S"            # show mark % of chr.  under kar.
  , showMarkPos = TRUE         # show position of marks under kar. See bToRemove
  , bToRemove = c("B mark", "cB mark") # bands to remove from pos. calc. See showMarkPos

  , notes = notesdf              # data.frame with notes
  , notesTextSize = 1.3        # font size of notes
  , notesPosX = .2             # space from chr. (right) to note

  , ylimBotMod = 2             # modify ylim bottom argument
  , ylimTopMod = 0             # modify ylim top argument
  , xlimLeftMod = 2            # modify left xlim
  , xlimRightMod = 3           # modify right xlim
  , lwd.cM = 2                 # thickness of cM marks
  , pattern = "^c"             # regex pattern to remove from mark names
  , remSimiMarkLeg = TRUE      # remove pseudoduplicated mark names from legend (same after pattern removal)
  , legendYcoord = -1.2
  # ,legend = "inline"          # legend next to chr.
  , bannedMarkName = c("B mark", "cB mark")  # remove from legends
) # ;  dev.off() # close .svg

Vertices when centromereSize = 0 are rounded:

png("mydfChrSize2.png", width = 550, height = 550)
par(mar = c(0, 0, 0, 0))
plotIdiograms(dfChrSize   = bigdfOfChrSize[1:8, ],  # chr. size data.frame
  dfMarkColor = mydfMarkColor, # mark style df
  dfMarkPos   = bigdfOfMarks,  # mark position df

  centromereSize = 0,         # <- HERE

  squareness = 3,             # vertices squareness
  chrSpacing = .7,            # space among chr.
  karHeight = 2,              # karyotype rel. height
  karHeiSpace = 4,            # vertical size of karyotype including spacer
  amoSepar = 2.5,             # separation among karyotype

  indexIdTextSize = .8,       # font size of chr. name and indices
  karIndexPos = .1,           # position of kar. index
  markLabelSize = .7,         # font size of mark legends
  fixCenBorder = FALSE,       # do not use chrColor as border color of cen. or cen. marks
  distTextChr = .8,           # separation among chr. and ind.

  rulerPos = 0,               # ruler position
  ruler.tck = -0.01,          # ticks of ruler size and orientation
  xPosRulerTitle = 2.6,       # ruler units pos.

  xlimLeftMod = 2,            # modify xlim left argument
  ylimBotMod = 0.4,           # modify ylim bottom argument
  ylimTopMod = 0              # modify ylim top argument
  , lwd.cM = 2                # thickness of cM marks
)
dev.off()

There is no need to add dfMarkColor and you can also use the parameter mycolors (optional too), to establish marks’ colors. Colors are assigned depending on the order of marks, i.e.:

unique(mydfOfMarks$markName) 

Let’s use the cM style of marks. A protruding line.

cM style does not apply to centromere marks. To make something similar, use centromereSize = 0, legend = "inline" and fixCenBorder = FALSE.

charVectorCol <- c("tomato3", "darkolivegreen4", "dfsd", "dodgerblue", "chartreuse3")

# Modify size of kar. to use rulerInterval and ceilingFactor (>= 1.13)
quo <- 9
dfOfChrSize2 <- dfOfChrSize
dfOfChrSize2$shortArmSize <- dfOfChrSize$shortArmSize / quo
dfOfChrSize2$longArmSize <- dfOfChrSize$longArmSize / quo
dfOfMarks2b <- dfOfMarks2
dfOfMarks2b$markSize <- dfOfMarks2$markSize / quo
dfOfMarks2b$markDistCen <- dfOfMarks2$markDistCen / quo

png("dfOfChrSizeVector.png", width = 1000, height = 450)
par(mar = rep(0, 4))
plotIdiograms(dfChrSize = dfOfChrSize2,    # d.f. of chr. sizes
  dfMarkPos = dfOfMarks2b,     # d.f. of marks' positions
  defaultStyleMark = "cM",     # forces "cM" style in d.f dfMarkColor (exc. 5S)

  mycolors = charVectorCol,    # colors to use

  distTextChr = 0.5,           # separ. text and chr.

  markLabelSize = .7,            # font size for labels (legend)
  lwd.cM = 2,                    # width of cM marks
  legendWidth = 0.9,             # legend item width
  legendHeight = .5,

  rulerPos = 0,                  # ruler position
  ruler.tck = -0.01,             # ruler tick orientation and length
  rulerNumberSize = .5           # ruler font size
  , xPosRulerTitle = 2.8         # ruler units pos.

  , xlimRightMod = 1             # modify xlim right arg.
)
dev.off() # close png

4.3 Plot holocentrics

Initially you have to put your chromosome data in data.frames.

Main three data.frames:

  • One for chr. sizes (parameter dfChrSize)
  • One for marks’ positions (parameter dfMarkPos)
  • One (optional) for mark style (parameter dfMarkColor)

For simplicity, I call a holocen. any karyotype without centromeres.

Accordingly, they lack the columns: shortArmSize and longArmSize.

From scratch:

# Example data.frame written in R, use: (column OTU is optional if only 1 OTU)
mydfChrSizeHolo <- read.table(text =
  "            OTU chrName chrSize
\"Species one\"   1     6.5
\"Species one\"   2     5.0
\"Species one\"   3     4.0
\"Species one\"   4     4.0
\"Species one\"   X     3.0    ",  header = TRUE, stringsAsFactors = FALSE, fill = TRUE)
OTU chrName chrSize
Species one 1 6.5
Species one 2 5.0
Species one 3 4.0
Species one 4 4.0
Species one X 3.0

or loading saved data:

If you use RStudio, in menu “Session”, open “Set working directory” for choosing your desired folder or:

setwd("~/folder/subfolder")

Open your chromosome data as data.frame importing it from a .csv (read.csv) or .xls file (readxl).

mydfChrSize<-read.csv("somefile.csv")

For fixing column names use:

colnames(mydfChrSize)<-c("OTU", "chrName","chrSize")

Get marks general data

Put your mark data in a data.frame. This data.frame has the marks present in all karyotypes without position info. If the style column is not present, param. defaultStyleMark = "square" will be used during plotting.

# From scratch:
mydfMarkColorHolo <- read.table(text =
  "  markName    markColor      style
     5S        red            dots
     45S       chartreuse3    square
     gene2     salmon         downArrow
     gene3     \"#056522\"    cMLeft
     gene4     darkmagenta    cM
     DAPI      dodgerblue     square
     protein   cornflowerblue exProtein
     B         black          square
     gene1     chocolate      upArrow
     CMA       darkgoldenrod1 square",  header = TRUE, stringsAsFactors = FALSE, fill = TRUE)
markName markColor style
5S red dots
45S chartreuse3 square
gene2 salmon downArrow
gene3 #056522 cMLeft
gene4 darkmagenta cM
DAPI dodgerblue square
protein cornflowerblue exProtein
B black square
gene1 chocolate upArrow
CMA darkgoldenrod1 square

For fixing column names use:

colnames(mydfMarkColorHolo) <- c("markName", "markColor","style") 
# if style column not present it will be filled with "square"

Get marks positions data

Open or write your mark positions in a data.frame. This data.frame has the marks present in all karyotypes with position info.

For holocentrics, position is defined with column markPos, while in monocentrics it is markDistCen.

Column chrRegion can be absent for holocentrics.

# We will use column OTU if data.frame because chromosome size df has it
mydfMarkPosHolo <- read.table(text =
  "          OTU  chrName markName markPos markSize chrRegion
\"Species one\"       4        B      NA       NA        w    # w = whole chromosome mark
\"Species one\"       3     DAPI     2.0      0.5
\"Species one\"       1      45S     2.0      0.5
\"Species one\"       2     protein  3.5      1.5
\"Species one\"       2     gene1    1.0      0.5
\"Species one\"       1     gene2    1.0      0.5
\"Species one\"       4     gene3    3.0      0.5
\"Species one\"       3     gene4    1.0      0.5
\"Species one\"       X      CMA     2.0      0.5
\"Species one\"       X       5S     0.5      0.5
\"Species one\"       X       5S     0.5      0.5",  header = TRUE, stringsAsFactors = FALSE, fill = TRUE)
OTU chrName markName markPos markSize chrRegion
Species one 4 B NA NA w
Species one 3 DAPI 2.0 0.5
Species one 1 45S 2.0 0.5
Species one 2 protein 3.5 1.5
Species one 2 gene1 1.0 0.5
Species one 1 gene2 1.0 0.5
Species one 4 gene3 3.0 0.5
Species one 3 gene4 1.0 0.5
Species one X CMA 2.0 0.5
Species one X 5S 0.5 0.5
Species one X 5S 0.5 0.5

For fixing column names use something like:

colnames(mydfMarkPosHolo)<-c("OTU", "chrName","markName","markPos","markSize") 

Plotting

You can plot without marks (passing only 1st data.frame), but we will use all 4 data.frames created:

# library(idiogramFISH)
# svg("mydfChrSizeHolo.svg",width = 13.5, height = 6 )
# png("mydChrSizeHolo.png", width = 600, height = 300)

par(mar = c(0, 0, 0, 1)) # bottom left top right

plotIdiograms(dfChrSize  = mydfChrSizeHolo,    # data.frame of chr. sizes
  dfMarkColor = mydfMarkColorHolo,  # df of mark style
  dfMarkPos  = mydfMarkPosHolo,     # df of mark positions
  chrSpacing = 1,
  addOTUName = FALSE,           # add OTU names

  xlimLeftMod = 2,              # modify xlim left argument
  ylimTopMod = -1,              # modify ylim top argument
  ylimBotMod = -2               # modify ylim bottom argument
  , rulerPos = 0                # ruler position
  , ruler.tck = -0.01           # ruler ticks size and orient.
  , xPosRulerTitle = 2.6,
  legendWidth = 1               # width of legend
  , legendHeight = .5           # height of legend item
  , xModifier = 50              # separation among chromatids
)

# dev.off() # closes png or svg

It is not mandatory to use dfMarkColor and you can also use the parameter mycolors (optional too), to establish marks’ colors. When using mycolors, colors are assigned depending on the order of marks, i.e.:

unique(dfMarkPosHolo$markName)
# [1] "5S"   "DAPI" "45S"  "CMA"

par(mar = rep(0, 4))

plotIdiograms(dfChrSize = dfChrSizeHolo,  # d.f. of chr. size
  dfMarkPos = dfMarkPosHolo,  # d.f. of marks' positions

  mycolors   = c("red", "dodgerblue", "fdsjkfds", "chartreuse3", "darkgoldenrod1"),  # colors for marks

  addOTUName = FALSE,           # do not add OTU name
  ruler = FALSE,                # do not add ruler
  xlimLeftMod = 1,              # modify left xlim arg.
  xlimRightMod = 3,             # modify right xlim arg.
  ylimBotMod = .2               # modify bottom ylim
  , chromatids = FALSE          # do not show separ. chromatids
)

4.4 ggplot holocentrics

With function mapGGChrMark and the data.frames of chr. (dfChrSizeHolo) and marks’ position (dfMarkPosHolo) for one OTU, you get a list of data.frames for ggplot (Wickham et al., 2020)


chrAndMarksMap <- mapGGChrMark(dfChrSizeHolo, dfMarkPosHolo, chrSpacing = .5)

require(ggplot2)

myColors <- c("chartreuse3", "red", "darkgoldenrod1", "dodgerblue")
names(myColors) <- c("45S", "5S", "CMA", "DAPI")

ggplot() +
  geom_polygon(aes(x = x,
    y = y,
    group = Chr
  ),
  data = chrAndMarksMap$dataChr,
  color = "gray",
  fill = "gray"
  ) +
  geom_polygon(aes(x = x, y = y,
    group = id,
    color = markName,
    fill = markName
  ),
  data = chrAndMarksMap$dataMark
  ) +
  theme_classic() +
  scale_color_manual(
    values = myColors
  ) +
  scale_fill_manual(
    values = myColors
  ) +
  scale_x_continuous(breaks = seq(1, nrow(dfChrSizeHolo), 1)
  ) +
  scale_y_continuous(breaks = seq(0, 5, 0.5)
  ) +
  geom_segment(aes(y = 0, yend = 5, x = -Inf, xend = -Inf)
  ) +
  theme(axis.line   = element_blank(),
    axis.ticks.x = element_blank(),
    axis.title  = element_blank(),
    title      = element_blank()
  )

require(svglite)
ggsave(file = "ggplot.svg", width = 6, height = 4)

4.5 Plot holo. and mono. in the same karyotype

To accomplish this, we will use cenStyle marks in a “holocen.” karyotype. The ruler is continuous as in holocen.

# mark general characteristics' data.frame:

mydfMarkColorHolo2 <- read.table(text =
  "  markName    markColor      style
     5S        red            dots
     45S       chartreuse3    square
     gene2     salmon         downArrow
     gene3     \"#056522\"    cMLeft
     gene4     darkmagenta    cM
     DAPI      dodgerblue     square
     protein   cornflowerblue exProtein
     B         black          square
     gene1     chocolate      upArrow
     CMA       darkgoldenrod1 square
     c45S      chartreuse3    cenStyle    # <- simulate Cen.
     myCen2    red            cenStyle
     myCen     chartreuse2    cenStyle
     constr    NA             cenStyle",  header = TRUE, stringsAsFactors = FALSE, fill = TRUE)


# add new cenStyle marks to data.frame of marks' position, created above

mydfMarkPosHolo2 <- plyr::rbind.fill(mydfMarkPosHolo,
  data.frame(OTU = "Species one",
    chrName = c(1:3, "X"),
    markName = c("c45S", "myCen2", "constr", "myCen"), # <- use new mark
    markPos = c(rep(2.5, 3), 1),
    markSize = NA
  )
)

# png("mydChrSizeHolo.png", width = 600, height = 300)
par(mar = c(0, 0, 0, 1)) # bottom left top right

plotIdiograms(dfChrSize  = mydfChrSizeHolo,     # data.frame of chr. sizes
  dfMarkColor = mydfMarkColorHolo2, # df of mark style
  dfMarkPos = mydfMarkPosHolo2,     # df of mark positions
  addOTUName = FALSE,               # add OTU names

  xlimLeftMod = 2,              # modify xlim left argument
  ylimTopMod = -1,              # modify ylim top argument
  ylimBotMod = -2               # modify ylim bottom argument
  , rulerPos = 0,
  ruler.tck = -0.01,
  xPosRulerTitle = 2.6,
  legendWidth = 1               # width of legend
  , legendHeight = .5           # height of legend item
  , lwd.mimicCen = 2.5          # line width of const. mark
  , pattern = "^c"              # regex pattern to remove from mark names
  , remSimiMarkLeg = TRUE       # remove pseudoduplicated mark names (got equal after pattern removal)
  , bannedMarkName = c("myCen", "myCen2", "B") # hide label
  # ,legend = "inline"           # legends inline
) # ; dev.off() closes png

5 Multiple OTUs

Jupyter interactive version:
Open in ColabOpen in Colab   Github   Raw

5.1 Example with several species (OTUs) - mono.

To illustrate this, we will load some data.frames from the package

  • Chromosome sizes
require(idiogramFISH)
head(bigdfOfChrSize, 15)
OTU chrName shortArmSize longArmSize
Species 1 1 1.5 2.0
Species 1 2 2.0 2.5
Species 1 3 1.0 2.0
Species 2 1 3.0 4.0
Species 2 2 4.0 5.0
Species 2 3 2.0 3.0
Species 2 X 1.0 2.0
Species 2 4 3.0 4.0
Species 3 1 3.2 4.0
Species 3 2 4.5 5.0
Species 3 3 2.0 3.0
Species 3 4 1.5 2.0
Species 3 5 4.8 6.0
Species 3 6 6.1 7.0
Species 4 1 1.5 2.0
  • Mark characteristics, does not require OTU
  • df optional for ver > 1.0.0
data("dfMarkColor")
markName markColor style
5S red dots
45S chartreuse3 square
DAPI blue square
CMA darkgoldenrod1 square
  • Mark position
data("bigdfOfMarks")
OTU chrName markName chrRegion markDistCen markSize
Species 1 1 5S p 0.5 1
Species 1 1 45S q 0.5 1
Species 1 2 45S p 1.0 1
Species 1 3 DAPI q 1.0 1
Species 3 3 5S p 1.0 1
Species 3 3 DAPI q 1.0 1
Species 3 4 45S p NA NA
Species 3 4 DAPI q 1.0 1
Species 3 5 CMA q 2.0 1
Species 3 6 5S q 0.5 1
Species 2 1 DAPI cen NA NA
Species 2 4 CMA cen NA NA

Plotting

# png("bigdfOfChrSize.png", width = 650, height = 1300)
par(mar = c(0, 0, 0, 0))
plotIdiograms(dfChrSize  = bigdfOfChrSize, # chr. sizes
  dfMarkColor = dfMarkColor,  # mark characteristics, optional in dev version. see above.
  dfMarkPos  = bigdfOfMarks,  # mark positions (inc. cen. marks)

  karHeight = 2.5,           # karyotype rel. height
  karHeiSpace = 6,           # karyotype vertical size with spacing
  chrWidth = .35,            # chr. width
  amoSepar = 2,              # Vertical separation of kar. when karSepar = TRUE

  squareness = 4,            # squareness of chr. vertices
  distTextChr = .8,          # distance of chr. to text
  chrIndex = "AR",           # add arm ratio only. For v. >=1.12
  nameChrIndexPos = 3,
  morpho = "Guerra",           # add chr. morphology by Guerra, see above. For v. >=1.12
  indexIdTextSize = .6,        # font size of indices and chr. name
  OTUTextSize = .9,            # font size of OTU names

  markLabelSize = .7,          # font size of legend
  fixCenBorder = TRUE,         # use chrColor as border color of cen. or cen. marks
  legendHeight = 2,            # height of labels

  rulerPos = -1,               # position of ruler
  ruler.tck = -0.004,          # size and orient. of ticks in ruler
  rulerNumberPos = .4,         # position of numbers of ruler
  rulerNumberSize = .4,        # font size of ruler
  xPosRulerTitle = 5,          # ruler units pos.
  rulerTitleSize = .5,         # ruler font size of units (title)

  xlimRightMod = 3,          # modify xlim left argument
  xlimLeftMod = 2,           # modify xlim left argument
  ylimBotMod = 0,            # modify ylim bottom argument
  ylimTopMod = -.3           # modify ylim top argument
)

# dev.off() # for png()

5.2 Example with several species (OTUs) - holo.

To illustrate this, we will load some data.frames from the package

  • Chromosome sizes
data(bigdfChrSizeHolo)
OTU chrName chrSize
species one 1 5.1
species one 2 5.0
species one 3 4.9
species one 4 5.2
species two 1 3.0
species two 2 4.0
species two 3 2.0
species two 4 5.0
species three 1 1.5
species three 2 2.0
species three 3 6.0
species three 4 8.0
  • Mark characteristics, does not require OTU
  • d.f optional for ver. > 1.0.0
data(dfMarkColorIn) 
markName markColor style
5S red dots
45S chartreuse3 square
DAPI blue square
CMA darkgoldenrod1 square
proteinD darkgreen inProtein
  • Mark position
data(bigdfMarkPosHolo2)
OTU chrName markName markPos markSize chrRegion
species two 3 5S 1.0 0.5 NA
species two 3 DAPI 1.5 0.5 NA
species two 1 45S 2.0 0.5 NA
species two 2 DAPI 2.0 0.5 NA
species two 4 CMA 2.0 0.5 NA
species two 4 5S 0.5 0.5 NA
species one 1 proteinD NA NA w
species one 2 proteinD NA NA w
species one 3 proteinD NA NA w
species one 4 proteinD NA NA w
species two 1 proteinD NA NA w
species two 2 proteinD NA NA w
species two 3 proteinD NA NA w
species two 4 proteinD NA NA w
species three 1 proteinD NA NA w
species three 2 proteinD NA NA w
species three 3 proteinD NA NA w
species three 4 proteinD NA NA w

Plotting

library(idiogramFISH)

# fig.width = 6, fig.height = 6
png("bigdfChrSizeHolo.png", width = 600, height = 600)
par(mar = rep(0, 4))

plotIdiograms(dfChrSize = bigdfChrSizeHolo, # chr. size data.frame
  dfMarkColor = dfMarkColorIn,   # df of mark style
  dfMarkPos = bigdfMarkPosHolo2, # df of marks' position

  markDistType = "cen",         # measure towards center of mark
  squareness = 6,               # vertices squareness of chr. and marks

  karHeiSpace = 4,            # karyotype height including spacing
  karSepar = TRUE,            # reduce vertical space among karyotypes
  amoSepar = 1,               # separation among karyotypes
  distTextChr = .5,           # distance text to chr.

  legendWidth = 1             # width of legend labels

  , chrId = "simple",           # numbering of chr., not using "original" name

  indexIdTextSize = .9,         # font size of chr names and indices
  markLabelSize = .9,           # font size of legends

  rulerPos = 0,                 # position of ruler
  rulerNumberSize = .9,         # font size of ruler
  ruler.tck = -.004,            # tick length and orient.
  xPosRulerTitle = 3,           # position of ruler units (title)

  ylimBotMod = .4               # modify ylim bottom argument
  , xModifier = 50              # separation among chromatids
)
dev.off()

6 Changing Units

Jupyter interactive version:
Open in ColabOpen in Colab   Github   Raw

6.1 Using bases instead of micrometers - no. cen.

Create some data in millions of bases:

require(idiogramFISH)
# transform data.frames for simplicity
bigdfChrSizeHoloMb <- bigdfChrSizeHolo # included in idiogramFISH
bigdfChrSizeHoloMb$chrSize <- bigdfChrSizeHoloMb$chrSize * 98000000
bigdfMarkPosHoloMb <- bigdfMarkPosHolo
bigdfMarkPosHoloMb$markPos <- bigdfMarkPosHoloMb$markPos * 98000000
bigdfMarkPosHoloMb$markSize <- bigdfMarkPosHoloMb$markSize * 98000000

Plotting

In the plot length is shown in Mb

png("bigdfChrSizeHolo2.png", width = 700, height = 600)
# par(mar = c(1, 1,1, 1))
par(mar = rep(0, 4))

plotIdiograms(dfChrSize = bigdfChrSizeHoloMb,  # chr. size data.frame
  dfMarkColor = dfMarkColor,       # df of mark style
  dfMarkPos = bigdfMarkPosHoloMb,  # df of mark positions

  markDistType = "cen",            # distance to mark is to its center
  squareness = 4,                  # vertices squareness of chr. and marks
  distTextChr = .5,                # separ. chr. to text

  karHeight = 2,                 # rel. karyotype height
  karHeiSpace = 4,               # karyotype height including spacing
  karSepar = TRUE,               # reduce spacing among karyotypes
  amoSepar = 1,                  # depends on karSepar, amount of sep.

  chrId = "simple",                # chr. names not "original"
  chrSize = TRUE,                  # show chr. size under chr.
  indexIdTextSize = .9,            # font size of chr names and indices
  karIndex = FALSE,                # do not add karyotype asymmetry index

  rulerNumberSize = .9,            # font size of ruler
  rulerPos = 0,                    # position of ruler
  ruler.tck = -.004,               # ruler tick length and orient.
  xPosRulerTitle = 3.5,            # modifies position of ruler title (Mb)

  markLabelSize = .9,              # font size of legend
  legendWidth = 1.2,               # width of legends

  xlimLeftMod = 1,                 # modify left argument of xlim
  ylimBotMod = .4                  # modify bottom argument of ylim
  , chromatids = FALSE             # do not show chromatids
  , OTUfont = 3                    # italics
)
dev.off()

For another example see: https://stackoverflow.com/questions/33727432/how-to-plot-positions-along-a-chromosome-graphic/57153497#57153497

6.2 Using threshold to fix scale

The default value of 35 for threshold may shrink one of the OTUs of this example more than expected. In this case threshold must be bigger.

# fig.width = 7, fig.height = 7
bigdfOfChrSize3_100Mb <- bigdfOfChrSize3Mb
bigdfOfChrSize3_100Mb$chrSize <- bigdfOfChrSize3Mb$chrSize * 33

bigdfOfMarks3_100Mb <- bigdfOfMarks3Mb
bigdfOfMarks3_100Mb$markPos <- bigdfOfMarks3_100Mb$markPos * 33
bigdfOfMarks3_100Mb$markSize <- bigdfOfMarks3_100Mb$markSize * 33

par(mar = rep(0, 4))
plotIdiograms(dfChrSize   = bigdfOfChrSize3_100Mb,  # chr. size data.frame
  dfMarkPos   = bigdfOfMarks3_100Mb,    # mark position df

  chrWidth = .6,              # width of chr.
  chrSpacing = .6,            # space among chr.
  karHeight = 3,              # kar. height without interspace
  karHeiSpace = 5,            # vertical size of karyotype including spacer
  amoSepar = 2,               # separ. among kar.

  indexIdTextSize = .6,       # font size of chr. name and indices
  markLabelSize = .7,         # font size of mark legends
  distTextChr = .65,          # separation among chr. names and indices

  fixCenBorder = TRUE         # use chrColor as border color of cen. or cen. marks
  , legendWidth = 1.5         # legend items width

  , xPosRulerTitle = 3.5      # position of Mb (title) in ruler
  , rulerPos = 0,             # ruler position
  ruler.tck = -0.005,         # ticks of ruler size and orientation
  rulerNumberPos = .7,        # position of numbers in ruler
  rulerNumberSize = .7,       # font size of ruler numbers
  rulerInterval = 1.5,        # ruler interval for micrometeres
  rulerIntervalMb = 50,       # ruler interval for Mb

  ylimBotMod = 0.4,           # modify ylim bottom argument
  ylimTopMod = 0              # modify ylim top argument
  , chromatids = FALSE        # do not show chromatids

  ####  NEW    #####
  , threshold = 90            # this will allow to not to shrink data greater than 350 Mb
)

6.3 Plot data in micrometers and bases

Info in number of bases can be combined in the same plot with info. in micrometers.

Here the new mark style cenStyle is used to add centromeres to “holocen.” (genomes).

To make the rules fit better, having less excess of length over chr., use ceilingFactor.

# fig.width = 10, fig.height = 10
# modify data in millions to hundreds of millions of Mb
bigdfOfChrSize3_100Mb <- bigdfOfChrSize3Mb[1:8, ]
bigdfOfChrSize3_100Mb$chrSize <- bigdfOfChrSize3_100Mb$chrSize * 100

bigdfOfMarks3_100Mb <- bigdfOfMarks3Mb
bigdfOfMarks3_100Mb$markPos <- bigdfOfMarks3_100Mb$markPos * 100
bigdfOfMarks3_100Mb$markSize <- bigdfOfMarks3_100Mb$markSize * 100

# merge data.frames in micrometers and number of bases
mixedThreeSpChrSize <- plyr::rbind.fill(bigdfOfChrSize[1:8, ], bigdfOfChrSize3_100Mb)
# sort by OTU name
mixedThreeSpChrSize <- mixedThreeSpChrSize[order(mixedThreeSpChrSize$OTU), ]

# add cenStyle marks to simulate centromeres in karyo. in Mb (holocen.)
# compare rulers
bigdfSimCenMarks <- bigdfOfChrSize3_100Mb
bigdfSimCenMarks$markPos <- bigdfSimCenMarks$chrSize / 2

bigdfSimCenMarks$markName <- "sim. cen."
bigdfSimCenMarks$chrSize <- NULL

# merge marks in micrometers and bases
mixedThreeSpMarks <- plyr::rbind.fill(bigdfOfMarks, bigdfOfMarks3_100Mb, bigdfSimCenMarks)

# remove cenStyle mark info.
mixedThreeSpMarks <- mixedThreeSpMarks[which(!(mixedThreeSpMarks$OTU %in% "Species 2 genome" &
  mixedThreeSpMarks$chrName %in% c(1, 4) &
  mixedThreeSpMarks$markName %in% "sim. cen.")), ]

# constric. marks
mixedThreeSpMarks[which(mixedThreeSpMarks$OTU %in% "Species 2 genome" &
  mixedThreeSpMarks$chrName %in% c(1, 4)), ]$markName <- c("cDAPI", "cCMA")

# add arrow mark
mixedThreeSpMarks <- dplyr::bind_rows(mixedThreeSpMarks, mixedThreeSpMarks[nrow(mixedThreeSpMarks), ])
mixedThreeSpMarks[nrow(mixedThreeSpMarks), ]$markName <- "S58A"
mixedThreeSpMarks[nrow(mixedThreeSpMarks), ]$markPos <- .7e+08
mixedThreeSpMarks[nrow(mixedThreeSpMarks), ]$markSize <- .7e+08

dfMarkColorAndStyle <- makedfMarkColorMycolors(unique(mixedThreeSpMarks$markName),
  c("red", "chartreuse3", "dodgerblue", "darkgoldenrod1", "dodgerblue", "darkgoldenrod1", "black")
)

# d.f. of marks'styles

dfMarkColorAndStyle$style[5:7] <- "cenStyle"
dfMarkColorAndStyle$markColor[7] <- NA
dfMarkColorAndStyle$style[8] <- "upArrow"

dfMarkColorAndStyle
#    markName      markColor    style
# 1        5S            red     dots
# 2       45S    chartreuse3   square
# 3      DAPI     dodgerblue   square
# 4       CMA darkgoldenrod1   square
# 5     cDAPI     dodgerblue cenStyle
# 6      cCMA darkgoldenrod1 cenStyle
# 7 sim. cen.           <NA> cenStyle
# 8      S58A            red  upArrow

par(mar = rep(0, 4))
plotIdiograms(dfChrSize   = mixedThreeSpChrSize,  # chr. size data.frame
  dfMarkPos   = mixedThreeSpMarks,    # mark position df
  dfMarkColor = dfMarkColorAndStyle,

  chrWidth = .6,              # width of chr.
  chrSpacing = .6,            # space among chr.
  karHeight = 3,              # kar. height without interspace
  karHeiSpace = 5,            # vertical size of karyotype including spacer
  amoSepar = 2,               # separ. among kar.

  indexIdTextSize = .6,       # font size of chr. name and indices
  markLabelSize = .7,         # font size of mark legends
  distTextChr = .65,          # separation among chr. names and indices
  lwd.mimicCen = 1.5,         # constric. line width

  legendWidth = 1.5,          # legend items width
  fixCenBorder = TRUE,        # use chrColor as border color of cen. or cen. marks

  xPosRulerTitle = 3.7,       # position of Mb (title) in ruler
  rulerPos = 0,               # ruler position
  ruler.tck = -0.005,         # ticks of ruler size and orientation
  rulerNumberPos = .7,        # position of numbers in ruler
  rulerNumberSize = .7,       # font size of ruler numbers
  rulerInterval = 1.5,        # ruler interval for micrometeres
  rulerIntervalMb = 150,      # ruler interval for Mb
  ceilingFactor = 1,          # affects rounding for ruler max. value

  ylimBotMod = 0.4,           # modify ylim bottom argument
  ylimTopMod = 0              # modify ylim top argument
  , holocenNotAsChromatids = TRUE # do not use chromatids in holocen.
  , pattern = "^c"             # regex pattern to remove from mark names
  , remSimiMarkLeg = TRUE      # remove pseudoduplicate names arising from pattern removal
)

Let’s explore those data.frames

head(mixedThreeSpChrSize, 6)
OTU chrName shortArmSize longArmSize chrSize
1 Species 1 1 1.5 2.0 NA
2 Species 1 2 2.0 2.5 NA
3 Species 1 3 1.0 2.0 NA
9 Species 1 genome 1 NA NA 3.5e+08
10 Species 1 genome 2 NA NA 4.5e+08
11 Species 1 genome 3 NA NA 2.5e+08
mixedThreeSpMarks[which(mixedThreeSpMarks$OTU %in% c("Species 1","Species 1 genome") ),] 
OTU chrName markName chrRegion markDistCen markSize markPos
1 Species 1 1 5S p 0.5 1 NA
2 Species 1 1 45S q 0.5 1 NA
3 Species 1 2 45S p 1.0 1 NA
4 Species 1 3 DAPI q 1.0 1 NA
13 Species 1 genome 1 5S NA NA 100000000 250000000
14 Species 1 genome 1 45S NA NA 100000000 50000000
15 Species 1 genome 2 45S NA NA 100000000 350000000
16 Species 1 genome 3 DAPI NA NA 100000000 0
25 Species 1 genome 1 sim. cen. NA NA NA 175000000
26 Species 1 genome 2 sim. cen. NA NA NA 225000000
27 Species 1 genome 3 sim. cen. NA NA NA 125000000

6.4 Use cM as units

Info in cM can be combined in the same plot with info. in micrometers.

To make the rules fit better, having less excess of length over chr., use ceilingFactor.

# fig.width = 10, fig.height = 10
# merge data.frames in micrometers and cM
bigdfOfChrSize3cM <- bigdfOfChrSize3Mb[1:8, ]
bigdfOfChrSize3cM$chrSize <- bigdfOfChrSize3cM$chrSize / 100000
mixedThreeSpChrSize2 <- plyr::rbind.fill(bigdfOfChrSize[1:8, ], bigdfOfChrSize3cM)

# sort by OTU name
mixedThreeSpChrSize2 <- mixedThreeSpChrSize2[order(mixedThreeSpChrSize2$OTU), ]

# create data with cM. markSize col. is not necessary because style is cM
bigdfOfMarks3cM <- bigdfOfMarks3Mb
bigdfOfMarks3cM$markPos <- bigdfOfMarks3Mb$markPos / 100000
bigdfOfMarks3cM$markSize <- NA
# As we want only the cM idiograms to be plotted as cM (lines), change mark names
bigdfOfMarks3cM$markName <- paste0("cM", bigdfOfMarks3cM$markName)

# d.f of all marks
mixedThreeSpMarks2 <- plyr::rbind.fill(bigdfOfMarks, bigdfOfMarks3cM)

# create a data.frame with mark characteristics
mixedDfMarkStyle  <- makedfMarkColorMycolors(unique(mixedThreeSpMarks2$markName),
  c("red", "chartreuse3", "dodgerblue", "darkgoldenrod1")
)

# mark names of cM marks with "cM" style (lines): not dots, not squares
mixedDfMarkStyle[which(mixedDfMarkStyle$markName %in%
  grep("cM", mixedDfMarkStyle$markName, value = TRUE)), ]$style <- "cM"

par(mar = rep(0, 4))
plotIdiograms(dfChrSize   = mixedThreeSpChrSize2,  # chr. size data.frame
  dfMarkPos   = mixedThreeSpMarks2,    # mark position data.frame
  dfMarkColor = mixedDfMarkStyle,     # mark style data.frame

  chrWidth = .6,                # width of chr.
  chrSpacing = .7,            # space among chr.

  specialOTUNames = bigdfOfMarks3cM$OTU, # OTUs in this object will have different ruler units
  specialyTitle = "cM",       # ruler title for specialOTUNames
  specialChrWidth = .2,       # modify chr width of OTUs in specialOTUNames
  specialChrSpacing = 1.1,    # modify chr spacing of OTUs in specialOTUNames

  karHeight = 3,              # kar. height without interspace
  karHeiSpace = 6,            # vertical size of karyotype including spacer
  amoSepar = 3,               # separ. among kar.

  chrSize = TRUE,             # show chr. size under chr.
  indexIdTextSize = .6,       # font size of chr. name and indices
  distTextChr = .85,          # separation among chr. names and indices

  protruding = 1,             # extension of cM mark type
  pattern = "cM",             # regex pattern to remove from mark names
  markLabelSize = .7          # font size of mark legends
  , legendWidth = 2           # legend items width
  , fixCenBorder = TRUE       # use chrColor as border color of cen. or cen. marks
  , lwd.cM = 2                # thickness of cM marks
  , holocenNotAsChromatids = TRUE # do not use chromatids in holocen. kar.

  , xPosRulerTitle = 3.2       # position of Mb or cM (title) in ruler
  , rulerPos = 0,              # ruler position
  ruler.tck = -0.005,          # ticks of ruler size and orientation
  rulerNumberPos = .7,         # position of numbers in ruler
  rulerNumberSize = 0.7,       # font size of ruler numbers
  rulerIntervalcM = 12,        # ruler interval for OTU in specialOTUnames and MbThreshold not met
  ceilingFactor = 1,           # affects max. value in ruler. See also rulerInterval

  ylimBotMod = 0.4,           # modify ylim bottom argument
  ylimTopMod = 0              # modify ylim top argument
)

7 GISH

Jupyter interactive version:
Open in ColabOpen in Colab   Github   Raw

7.1 GISH of monocentric chromosomes

You need the data.frame of chr. sizes, and a d.f. of marks

Chr. sizes:

parentalAndHybChrSize
OTU chrName shortArmSize longArmSize
1 Parental 1 1 3.2 4
2 Parental 1 4 1.5 2
3 Parental 1 5 4.8 6
4 Parental 1 6 6.1 7
8 Allopolyploid 1 3.2 4
9 Allopolyploid 2 4.5 5
10 Allopolyploid 3 2.0 3
11 Allopolyploid 4 1.5 2
12 Allopolyploid 5 4.8 6
13 Allopolyploid 6 6.1 7
5 Parental 2 1 3.2 4
6 Parental 2 2 4.5 5
7 Parental 2 3 2.0 3

Marks’ positions data

dfAlloParentMarks
OTU chrName markName chrRegion
1 Allopolyploid 1 Parental 2 qcen
17 Allopolyploid 1 Parental 1 pcen
16 Allopolyploid 1 Parental 1 p
2 Allopolyploid 1 Parental 2 q
4 Allopolyploid 2 Parental 2 w
5 Allopolyploid 3 Parental 2 w
6 Allopolyploid 4 Parental 1 w
7 Allopolyploid 5 Parental 1 w
8 Allopolyploid 6 Parental 1 w
9 Parental 1 6 Parental 1 w
10 Parental 1 5 Parental 1 w
11 Parental 1 1 Parental 1 w
12 Parental 1 4 Parental 1 w
13 Parental 2 2 Parental 2 w
14 Parental 2 1 Parental 2 w
15 Parental 2 3 Parental 2 w

We will use column note to add a note to the right of the karyotype of the OTU (column)

notesdf2<-read.table(text=
"           OTU                note
\"Parental 1\"     \"Parental One\"  
\"Parental 2\"     \"Parental Two\"  
\"Allopolyploid\"  Allopolyploid  ", header = TRUE, stringsAsFactors = FALSE, fill = TRUE)

7.1.1 Plotting

# svg("gish.svg",width = 7, height = 9 )
# png("parentalAndHybChrSize.png", width = 700, height = 900)

# REORDER OTUs

parentalAndHybChrSize$OTU <- factor(parentalAndHybChrSize$OTU, levels = c("Parental 1", "Allopolyploid", "Parental 2"))
parentalAndHybChrSize <- parentalAndHybChrSize[order(parentalAndHybChrSize$OTU), ]


par(mar = rep(0, 4))
plotIdiograms(dfChrSize = parentalAndHybChrSize,  # d.f. of chr. sizes
  dfMarkPos = dfAlloParentMarks, # d.f. of marks' positions
  cenColor  = NULL,              # no cen. color for GISH

  karHeiSpace = 5,               # karyotype height including spacing
  karSepar = FALSE,              # equally sized (height) karyotypes

  legend = ""                    # no legend

  , notes = notesdf2             # data.frame with notes NEW
  # ,OTUasNote = TRUE              # TRY THIS (OTU name to the right)
  , notesTextSize = 1.3,
  notesPosX = 1.5               # space from chr. (right) to note
  , ruler = FALSE,
  moveKarHor = "Allopolyploid"  # OTU to move to the right
  , mkhValue = 7                # amount to move to right
  , anchor = TRUE               # show anchor for moveKarHor OTUs
  , moveAnchorV = 4             # modify anchor Vertical portion position
  , moveAnchorH = -1.5          # modify anchor Horizon. portion position

  , ylimBotMod = 1              # ylim bottom argument mod.
  , xlimRightMod = 4
)

# dev.off()

7.2 GISH of holocentric chromosomes

You need the data.frame of chr. sizes, and a d.f. of marks

Chr. sizes:

parentalAndHybHoloChrSize
OTU chrName chrSize
Parental 1 7 4
Parental 1 4 2
Parental 1 5 6
Parental 1 6 7
Parental 2 1 4
Parental 2 2 5
Parental 2 3 3
Allopolyploid 7 4
Allopolyploid 2 5
Allopolyploid 3 3
Allopolyploid 4 2
Allopolyploid 5 6
Allopolyploid 6 7

Marks’ positions data

dfAlloParentMarksHolo
OTU chrName markName chrRegion
1 Allopolyploid 7 Parental 1 w
4 Allopolyploid 2 Parental 2 w
5 Allopolyploid 3 Parental 2 w
6 Allopolyploid 4 Parental 1 w
7 Allopolyploid 5 Parental 1 w
8 Allopolyploid 6 Parental 1 w
9 Parental 1 6 Parental 1 w
10 Parental 1 5 Parental 1 w
11 Parental 1 7 Parental 1 w
12 Parental 1 4 Parental 1 w
13 Parental 2 2 Parental 2 w
14 Parental 2 1 Parental 2 w
15 Parental 2 3 Parental 2 w

Plotting

# svg("gish.svg",width = 8, height = 7 )
par(mar = c(0, 0, 0, 0))
plotIdiograms(dfChrSize = parentalAndHybHoloChrSize,  # d.f. of chr. sizes
  dfMarkPos = dfAlloParentMarksHolo,      # d.f. of marks' positions
  chrColor  = "gray",        # chr. color
  cenColor  = NULL,            # cen. color when GISH

  karHeight = 3,               # karyotype height without spacing
  karHeiSpace = 5,             # karyotype height including spacing
  distTextChr = 0.8            # separation among chr. and text

  , ruler = FALSE              # no ruler
  , legend = ""                # no legend

  , xlimRightMod = 0           # xlim right arg. modif.
  , xModifier = 100            # separ. among chromatids
)

# dev.off()

7.3 GISH of Citrus as Yasuda et al. (2010)

For more details on the use of Citrus functions go to chapter Citrus

Parental C. schweinfurthii: 14D + 4F (using Guerra nomenclature).

{
  #
  # c. schweinfurthii chr sizes d.f.
  #

  cschweinformula <- "14D + 4F"
  require(idiogramFISH)

  citrusschwein <- citrusSize(D = 14,
    F = 4,
    OTU = "C. schweinfurthii",
    longArm = 1.2)

  #
  # c. schweinfurthii CMA and GISH marks
  #

  citrusschweinMarkPosDF <- citrusMarkPos(citrusschwein)

  #
  #   data.frame of genomic marks
  #
  citrusschweinMarkPosDF2 <- data.frame(chrName = c(paste0("D_", 1:7), paste0("F_", 1:2)),
    chrRegion = "w",
    markName = "schweingenome",
    OTU = unique(citrusschwein$OTU)
  )

  #
  #   merge marks pos.
  #

  citrusschweinMarkPosDF <- dplyr::bind_rows(citrusschweinMarkPosDF2, citrusschweinMarkPosDF)

  #
  #   Inversion of some chr. (D marks up)
  #

  csSwap <- swapChrRegionDfSizeAndMarks(citrusschwein, citrusschweinMarkPosDF, c(paste0("D_", 1:14)))
  citrusschwein         <- csSwap$dfChrSize
  citrusschweinMarkPosDF <- csSwap$dfMarkPos

  #
  #   mark style
  #

  unique(citrusschweinMarkPosDF$markName)
  {
    markStyleschweinDF   <- makedfMarkColorMycolors(
      unique(citrusschweinMarkPosDF$markName), c("chartreuse3", "darkgoldenrod1"))
  }

  #
  #   d.f. of notes
  #

  leftNotesschwein  <- data.frame(OTU = unique(citrusschwein$OTU), note = paste0("Female gamete: 7D + 2E"))
  leftNotesschweinUp <- data.frame(OTU = unique(citrusschwein$OTU), note = paste0(unique(citrusschwein$OTU), " (", cschweinformula, ")"))
  notesschwein <- data.frame(OTU = unique(citrusschwein$OTU), note = "Yasuda et al. (2010)")
}


Parental ‘Nanpu’ tangor

{

  cnanpuformula <- "1A + 4C + 5D + 8F" # Guerra nom.

  #
  # 'Nanpu' tangor chr. sizes
  #

  citrusnanpu <- citrusSize(A = 1, C = 4, D = 5, F = 8 #
    , OTU = "nanpu tangor",
    longArm = 1.2)
  #
  # c. nanpu CMA marks
  #

  citrusnanpuMarkPosDF <- citrusMarkPos(citrusnanpu)

  #
  #   d.f. of genomic marks
  #

  citrusnanpuMarkPosDF2 <- data.frame(chrName = c("A", "C_1", paste0("D_", 1:4), paste0("F_", 1:3)),
    chrRegion = "w",
    markName = "nanpugenome",
    OTU = unique(citrusnanpu$OTU)
  )

  #
  #   merge marks pos.
  #

  citrusnanpuMarkPosDF <- dplyr::bind_rows(citrusnanpuMarkPosDF2, citrusnanpuMarkPosDF)

  #
  #   mark style d.f.
  #

  unique(citrusnanpuMarkPosDF$markName)
  {
    markStylenanpuDF   <- makedfMarkColorMycolors(
      unique(citrusnanpuMarkPosDF$markName), c("chocolate", "darkgoldenrod1"))
  }

  #
  #   invert some chr.
  #

  csSwap <- swapChrRegionDfSizeAndMarks(citrusnanpu, citrusnanpuMarkPosDF, c(paste0("D_", 1:5)))
  citrusnanpu          <- csSwap$dfChrSize
  citrusnanpuMarkPosDF <- csSwap$dfMarkPos

  #
  #   notes data.frames
  #

  leftNotesnanpu  <- data.frame(OTU = unique(citrusnanpu$OTU), note = paste0("Male gamete: 1A + 1C + 4D + 3E"))
  leftNotesnanpuUp <- data.frame(OTU = unique(citrusnanpu$OTU), note = paste0("'Nanpu' tangor (", cnanpuformula, ")"))

  notesnanpu <- data.frame(OTU = unique(citrusnanpu$OTU), note = "Yasuda et al. (2010)")

}


Merge data.frames from parentals

{
  bothParentalsChr   <- dplyr::bind_rows(citrusnanpu, citrusschwein)

  bothParentalsMarks <- dplyr::bind_rows(citrusschweinMarkPosDF, citrusnanpuMarkPosDF)

  bothPmarkStyle     <- unique(dplyr::bind_rows(markStyleschweinDF, markStylenanpuDF))

  bothPleftNotesUp   <- dplyr::bind_rows(leftNotesschweinUp, leftNotesnanpuUp)

  bothPleftNotes     <- dplyr::bind_rows(leftNotesschwein, leftNotesnanpu)
}


data.frames of the hybrid

{
  cschnanpuformula <- "1A + 1C + 11D + 5F"

  require(idiogramFISH)

  #
  #   hybrid chr. size
  #

  citrusschnanpu <- citrusSize(A = 1, C = 1, D = 11, F = 5 #
    , OTU = "schweinfurthii + nanpu",
    longArm = 1.2)
  #
  # hybrid CMA marks
  #

  citrusschnanpuMarkPosDF <- citrusMarkPos(citrusschnanpu)

  #
  #    invert some chr.
  #

  csSwap <- swapChrRegionDfSizeAndMarks(citrusschnanpu, citrusschnanpuMarkPosDF, c(paste0("D_", 1:11)))
  citrusschnanpu         <- csSwap$dfChrSize
  citrusschnanpuMarkPosDF <- csSwap$dfMarkPos

  #
  #   d.f. of gish marks
  #

  citrusschnanpuMarkPosDF2 <- data.frame(chrName = c(paste0("D_", 5:11), paste0("F_", 1:2)),
    chrRegion = "w",
    markName = "schweingenome",
    OTU = unique(citrusschnanpu$OTU)
  )

  citrusschnanpuMarkPosDF3 <- data.frame(chrName = c("A", "C", paste0("D_", 1:4), paste0("F_", 3:5)),
    chrRegion = "w",
    markName = "nanpugenome",
    OTU = unique(citrusschnanpu$OTU)
  )

  #
  #   merge marks
  #

  citrusschnanpuMarkPosDF <- dplyr::bind_rows(citrusschnanpuMarkPosDF2, citrusschnanpuMarkPosDF3, citrusschnanpuMarkPosDF)

  #
  #   style of marks d.f.
  #

  unique(citrusschnanpuMarkPosDF$markName)
  {
    markStyleschnanpuDF   <- makedfMarkColorMycolors(
      unique(citrusschnanpuMarkPosDF$markName), c("chartreuse3", "chocolate", "darkgoldenrod1"))
  }

  #
  #   notes for hybrid
  #
  # italics!       #  rest: \"                 to                           \"
  name <-  paste0("italic('C. schweinfurthii'),      \" × 'Nanpu' tangor (CN3) (", cschnanpuformula, ")\"")
  # to parse italics, use parseStr2lang = TRUE

  leftNotesschnanpuUp <- data.frame(OTU = unique(citrusschnanpu$OTU), note = name)
  notesschnanpu       <- data.frame(OTU = unique(citrusschnanpu$OTU), note = "'Yasuda et al. (2010)'")
}


Plot

#
#   plot of parentals only
#

{
  par(mar = rep(0, 4), oma = rep(0, 4))
  plotIdiograms(callPlot = TRUE,
    dfChrSize = bothParentalsChr,   # chr. size data.frame
    dfMarkPos = bothParentalsMarks, # mark position data.frame
    dfMarkColor = bothPmarkStyle,   # mark style d.f.

    orderChr = "original"      # order of chr. as in d.f.

    , chrWidth = .5            # chr. width
    , chrSpacing = .5          # separ. among chr.
    , karHeight = 4            # kar. height
    , karHeiSpace = 5          # anchor height

    , chromatids = FALSE       # don't use chromatids
    , chrColor = "white"     # chr. color

    , ruler = FALSE            # don't use ruler
    , chrId = ""               # don't use chr. name
    , chrIndex = ""            # don't use chr. indices
    , morpho = ""              # don't use morphology
    , karIndex = FALSE         # don't use kar. indices
    , colorBorderMark = "black" # color of border of marks
    , addOTUName = FALSE       # do not add OTU names

    , lwd.chr = 1.6            # border width
    , lwd.marks = 1            # border width marks
    , gishCenBorder = TRUE     # cen. border of gish as mark color
    , hideCenLines = 1.75      # hide cen. border

    , legend = ""              # no legend for marks

    , leftNotes  =  bothPleftNotes    # data.frame with left notes
    , leftNotesUp =  bothPleftNotesUp # data.frame with Up left notes
    , leftNoteFontUp = 3      # italics

    , leftNotesTextSize = 1.3     # font size of notes
    , leftNotesUpTextSize = 1.3   # font size of notes

    , leftNotesPosX = 0      # horizontal pos. of left notes
    , leftNotesPosY = 0      # vertical pos. of left down notes

    , leftNotesUpPosX = 0    # horizontal pos. of left up notes
    , leftNotesUpPosY = 2    # vertical pos. of left up notes

    , verticalPlot = FALSE     # horizontal plot
    , karSpaceHor = 3          # horizontal spacing among kar.

    , karAnchorLeft = "C. schweinfurthii" # anchor to the left of
    , anchor = TRUE            # add anchor

    , ylimBotMod = 1         # modify ylim bottom argument
    , ylimTopMod = 0         # modify ylim top argument
    , xlimLeftMod = 0        # modify left xlim
    , xlimRightMod = 2       # modify right xlim

  )
}

#  add plot of hybrid over parents plot

{
  plotIdiograms(callPlot = FALSE,                     # plot over previous plot
    dfChrSize = citrusschnanpu,          # chr. size data.frame
    dfMarkPos = citrusschnanpuMarkPosDF, # mark position data.frame
    dfMarkColor = markStyleschnanpuDF,    # mark style d.f.

    orderChr = "original",  # order of chr. as in d.f.

    chrWidth = .5,          # chr. width
    chrSpacing = .5,        # separ. among chr.
    karHeight = 4           # kar. height
    , chromatids = FALSE    # don't use chromatids
    , chrColor = "white"    # chr. color

    , ruler = FALSE            # don't use ruler
    , chrId = ""               # don't use chr. name
    , chrIndex = ""            # don't use chr. indices
    , morpho = ""              # don't use morphology
    , karIndex = FALSE         # don't use kar. indices
    , colorBorderMark = "black" # color of border of marks
    , addOTUName = FALSE       # don't add OTU name

    , lwd.chr = 1.6            # border width
    , lwd.marks = 1            # border width marks

    , leftNotesUp = leftNotesschnanpuUp # up notes: name of hybrid
    , parseStr2lang = TRUE   # for italics, see notes data.frame
    , notesTextSize = 1.3    # font size of notes
    , leftNotesUpTextSize = 1.3   # font size of notes

    , leftNotesPosX = 0      # horizontal pos. of notes
    , leftNotesUpPosY = 2    # vertical pos. left up notes
    , notes = notesschnanpu  # right notes - authors
    , notesPosX = 3          # notes hor. pos

    , ylimBotMod = 1         # modify ylim bottom argument
    , ylimTopMod = -5        # modify ylim top argument
    , xlimLeftMod = 0        # modify left xlim
    , xlimRightMod = 2       # modify right xlim

    , gishCenBorder = TRUE     # cen. border as mark color
    , legend = ""              # no legend for marks
    , hideCenLines = 1.75      # hide cen. lines
    , moveAllKarValueHor = 9.5 # move kar. to right
    , moveAllKarValueY = -10   # move kar. down
  )
} # hybrid

8 Groups

Jupyter interactive version:
Open in ColabOpen in Colab   Github   Raw

8.1 monocentrics

Adding the column group

Open your chromosome data - Chr. size - as data.frame and add column

# Example data.frame written in R, use
dfwithgroups <- read.table(text = "
      chrName shortArmSize longArmSize group
1        1            3           5     1
2        1            3.2         5.5   1
3        1            3.5         4.8   1
4        4            1           3     NA
5        5            3           5     NA
6        X            4           6     NA", header = TRUE, stringsAsFactors = FALSE)
chrName shortArmSize longArmSize group
1 3.0 5.0 1
1 3.2 5.5 1
1 3.5 4.8 1
4 1.0 3.0 NA
5 3.0 5.0 NA
X 4.0 6.0 NA

Heteromorphic pairs

It can be used to plot heteromorphic pairs, see pair 1
dfwithHetero <- read.table(text = "
       chrName shortArmSize longArmSize group
1        1A           3           5     1
2        1B           3           5     1
4        2            1           3     NA
5        3            3           5     NA
6        4            4           6     NA", header = TRUE, stringsAsFactors = FALSE)
chrName shortArmSize longArmSize group
1 1A 3 5 1
2 1B 3 5 1
4 2 1 3 NA
5 3 3 5 NA
6 4 4 6 NA
Open or write your mark positions as a data.frame. This data.frame has the marks present in all karyotypes with position info.
dfOfMarksHetero <- read.table(text =
  "     chrName markName chrRegion markSize markDistCen
1       1A       5S       p        1         0.9
2       1B      45S       p        1         0.9
3       2       CMA       q        1         1.0
4       3      DAPI       q        1         1.0", header = TRUE, stringsAsFactors = FALSE)
chrName markName chrRegion markSize markDistCen
1A 5S p 1 0.9
1B 45S p 1 0.9
2 CMA q 1 1.0
3 DAPI q 1 1.0

Plot

require(idiogramFISH)
# svg("dfwithHetero.svg",width = 13.5, height = 8 )
par(mar = rep(0, 4))

dfwithHetero$OTU <- "hetero"
dfwithgroups$OTU <- "first"
both <- plyr::rbind.fill(dfwithHetero, dfwithgroups)
dfOfMarksHetero$OTU <- "hetero"
plotIdiograms(dfChrSize = both,    # chr. sizes
  dfMarkPos = dfOfMarksHetero, # position of marks
  karHeiSpace = 4,

  chrId = "original",        # chr. name in df.
  chrIndex = "",             # do not add chr. indices
  morpho = "",               # do not add chr. morphologies
  karIndex = FALSE,          # do not add karyotype indices
  distTextChr = .8,          # distance from text to chr.

  markDistType = "cen",      # mark position measured to center of mark
  orderChr = "name",         # order chr. by name

  ruler = FALSE              # do not plot ruler

  , ylimBotMod = 1           # modify ylim bottom argument
  , legendWidth = 1          # width of legend
)

# dev.off()

8.2 Holocentrics

Let’s modify some data.frames to add a group

data("dfChrSizeHolo")
data("dfMarkPosHolo")
dfMarkPosHoloHetero <- dfMarkPosHolo
dfMarkPosHoloHetero$chrName <- c(3, 3, "1A", 2, "1B", "1B")
dfMarkPosHoloHetero$OTU <- "heteromorphic"

dfChrSizeHoloHetero <- dfChrSizeHolo
dfChrSizeHoloHetero$chrName <- c("1A", "1B", 2, 3)
dfChrSizeHoloHetero$OTU <- "heteromorphic"

# Adding the group column
dfChrSizeHoloHetero$group <- c(1, 1, NA, NA)

Creating a new data.frame for holocentrics

dfChrSizeHoloGroup <- data.frame(OTU = "Species name",
  chrName = c(1, 1, 1, 1, 2, 3, 4),
  chrSize = c(3.1, 3.2, 3.3, 3.4, 4, 5, 6),
  group = c(1, 1, 1, 1, NA, NA, NA)
)
OTU chrName chrSize group
Species name 1 3.1 1
Species name 1 3.2 1
Species name 1 3.3 1
Species name 1 3.4 1
Species name 2 4.0 NA
Species name 3 5.0 NA
Species name 4 6.0 NA
par(mar = rep(0, 4))
mergedChrSize <- plyr::rbind.fill(dfChrSizeHoloGroup, dfChrSizeHoloHetero)

plotIdiograms(dfChrSize = mergedChrSize,      # data.frame of chr. sizes
  dfMarkPos = dfMarkPosHoloHetero, # d.f. of marks
  orderChr = "name",            # order chr. by name
  karIndex = FALSE,             # do not add karyotype indices
  addOTUName = TRUE,            # add OTU name
  karHeiSpace = 4,              # height of kar. with spacing

  ruler = FALSE,                  # no ruler

  xlimLeftMod = -1,               # modify left argument of xlim
  xlimRightMod = 0,               # modify right argument of xlim
  ylimBotMod = 1.3                # modify bottom argument of ylim
  , xModifier = 100               # separ. among chromatids
)

9 Circular Plots

Jupyter interactive version:
Open in ColabOpen in Colab   Github   Raw

visit gitlab for installation instructions https://gitlab.com/ferroao/idiogramFISH

9.1 Example with monocen. and holocen.

{
  require(idiogramFISH)
  require(plyr)
  dfOfChrSize$OTU <- "Species mono"
  dfChrSizeHolo$OTU <- "Species holo"

  monoholoCS <- plyr::rbind.fill(dfOfChrSize, dfChrSizeHolo)

  dfOfMarks2$OTU <- "Species mono"
  dfMarkPosHolo$OTU <- "Species holo"

  monoholoMarks <- plyr::rbind.fill(dfOfMarks2, dfMarkPosHolo)
  monoholoMarks[which(monoholoMarks$markName == "5S"), ]$markSize <- .5

  monoholoMarks[10, ]$markName <- "prot"
  monoholoMarks[10, ]$markSize <- 1
  dfMarkColor <- rbind(dfMarkColor, c("prot", "black", "exProtein"))
}

plotIdiograms(dfChrSize  = monoholoCS,   # data.frame of chr. size
  dfMarkColor = dfMarkColor,  # df of mark style
  dfMarkPos = monoholoMarks,  # df of mark positions, includes cen. marks

  squareness = 5,             # vertices squareness
  addOTUName = TRUE,          # add OTU names
  distTextChr = .5,           # separ. among chr. and text and among chr. name and indices

  chrId = "original",         # use original name of chr.
  OTUTextSize = .7,           # size of OTU name

  legendHeight = 1,           # height of legend labels
  legendWidth = 1,            # width of legend labels
  # ,legend = "inline"
  fixCenBorder = TRUE,        # use chrColor as border color of cen. or cen. marks

  xlimLeftMod = 1,            # modify xlim left argument of plot
  xlimRightMod = 2,           # modify xlim right argument of plot
  ylimBotMod = .2             # modify ylim bottom argument of plot

  , useOneDot = FALSE

  # GRAPHICAL PARAMETERS FOR CIRCULAR PLOT

  , circularPlot = TRUE       # circularPlot
  , shrinkFactor = .9         # percentage 1 = 100% of circle with chr.
  , circleCenter = 3          # X coordinate of circleCenter (affects legend pos.)
  , chrLabelSpacing = .9      # chr. names spacing

  , OTUsrt = 0                # angle for OTU name (or number)
  , OTUplacing = "number"     # Use number and legend instead of name. See OTUcentered
  , OTUjustif = 0             # OTU names justif. left.
  , OTULabelSpacerx = -0.5    # modify position of OTU label, when OTUplacing = "number" or "simple"
  , OTUlegendHeight = 1.5     # space among OTU names when in legend - OTUplacing
  , separFactor = 0.75
)

9.2 Recreating circular karyotype of (Golczyk et al., 2005)

# First swap short and long arms to show the same rotation of the article

listradfs <- swapChrRegionDfSizeAndMarks(traspadf, traspaMarks, c("3", "6", "7", "9", "12"))

# Create marks' characteristics

dfMarkColor5S25S <- read.table(text = "    markName markColor  style
        5S       black dots
       25S       white dots",  header = TRUE, stringsAsFactors = FALSE, fill = TRUE)

plotIdiograms(dfChrSize = listradfs$dfChrSize,  # d.f. of chr. sizes
  dfMarkPos = listradfs$dfMarkPos,  # d.f. of marks' positions
  dfMarkColor = dfMarkColor5S25S,   # d.f. of mark characteristics
  cenColor  = "black",            # cen. color
  squareness = 5,                   # corner squareness
  chrWidth = 1,                     # chr. width
  orderChr = "name"                 # order chr. by name

  , addOTUName = FALSE               # do not add OTU name
  , legendHeight = 3                 # labels separ. y axis

  # circular plot parameters
  , circularPlot = TRUE,
  radius = 5                         # basic radius
  , useOneDot = FALSE                # use two dots in dot marks
  , chrLabelSpacing = 1              # chr. name spacing
  , rotation = 0.1                   # anti-clockwise start site in x*pi radians, from top (0)
  , shrinkFactor = .95               # % of circle use
)

9.3 Plasmid data from genBank

Using upArrow and downArrow styles, clockwise and anti-clockwise, respectively.


# data from: https://www.ncbi.nlm.nih.gov/nuccore/NZ_CP009939.1

# install.packages("rentrez")
library(rentrez)
# search string
bcereus <- "Bacillus cereus strain 03BB87 plasmid pBCN, complete sequence"
bcereus_search <- rentrez::entrez_search(db = "nuccore", term = bcereus)
# get summaries
esummaries <- rentrez::entrez_summary(db = "nuccore", id = bcereus_search$ids)

# download plasmid data
# From the entrez formats:
# https://www.ncbi.nlm.nih.gov/books/NBK25499/table/chapter4.T._valid_values_of__retmode_and/
# idiogramFISH can read only:
rentrezDownloadPlas  <- rentrez::entrez_fetch(db = "nuccore",
  id = bcereus_search$ids[1],
  rettype = "gbwithparts",
  retmode = "text")

mylist <- genBankReadIF(rentrezDownloadPlas)

# data.frames in mylist
names(mylist)
# [1] "gbdfMain"         "gbdfAssemblyMeta" "source"           "gene"            
# [5] "CDS"

# mylist$source
# View(mylist$gbdfMain)
# View(mylist$gbdfAssemblyMeta)
# mylist$gbdfAnnoMeta
# View(mylist$CDS)
# View(mylist$gene)

# Authors of plasmid sequence
paste(mylist$gbdfMain[which(mylist$gbdfMain$field == "AUTHORS"), ][1, 2])
# [1] "Johnson,S.L., Minogue,T.D., Teshima,H., Davenport,K.W., Shea,A.A.,; Miner,H.L., Wolcott,M.J. and Chain,P.S."

# create plasmid size data data.frame
{
  myPlasmiddf <- data.frame(chrName = 1, chrSize = mylist$source$end)
  myPlasmiddf$OTU <- mylist$gbdfMain[which(mylist$gbdfMain$field == "DEFINITION"), ]$value
  myPlasmiddf$OTU <- gsub(", complete sequence.", "", myPlasmiddf$OTU)

  # Creating mark info data.frame

  mylistSel <- mylist[which(names(mylist) %in% "gene")]
  mylistSelDF <- dplyr::bind_rows(mylistSel, .id = "feature")

  mylistSelDF$markPos <- pmin(as.numeric(mylistSelDF$begin), as.numeric(mylistSelDF$end))
  mylistSelDF$markSize <- abs(as.numeric(mylistSelDF$end) - as.numeric(mylistSelDF$begin))
  mylistSelDF$markName <- mylistSelDF$locus_tag

  # orientation of arrows
  mylistSelDF$style <- ifelse(mylistSelDF$isComplement, "downArrow", "upArrow")

  # Replace codes with names
  mylistSelDF[which(!is.na(mylistSelDF$gene)), ]$markName <-
    mylistSelDF[which(!is.na(mylistSelDF$gene)), ]$gene

  # subset columns
  marksDfPlas <- mylistSelDF[, c("markName", "markPos", "markSize", "style"), ]

  # add OTU name
  marksDfPlas$OTU <- myPlasmiddf$OTU

  # add mandatory column
  marksDfPlas$chrName <- myPlasmiddf$chrName

  # organize inner arrows (downArrow) in two columns avoiding overlap

  protVal <- .5     # this values (and others) must be the same
  circVal <- TRUE   # in plotIdiograms function
  rotaVal <- 0

  marksDfPlasCols <- namesToColumns(marksDfPlas, myPlasmiddf,
    markType = c("downArrow"),
    amountofSpaces = 10, colNumber = 2,
    protrudingInt = 1.3, protruding = protVal,
    circularPlot = circVal,
    rotation = rotaVal
  )


  # add marker for start pos.
  colnames(marksDfPlasCols)
  marksDfPlasCols <- rbind(marksDfPlasCols, c(paste0("START", paste0(rep(" ", 0), collapse = "")), 1, NA, "square", myPlasmiddf$OTU, 1, NA))

  # create mark general data data.frame
  markStyle   <- makedfMarkColorMycolors(
    unique(marksDfPlasCols$markName), c("black", "forestgreen", "cornflowerblue"))

  # arrows
  markStyle$style      <- marksDfPlasCols$style[match(markStyle$markName, marksDfPlasCols$markName)]
  markStyle$protruding <- marksDfPlasCols$protruding[match(markStyle$markName, marksDfPlasCols$markName)]

  # prefix to remove from marks
  mypattern <- sub("([[:alnum:]]+_).*", "\\1", trimws(marksDfPlas$markName[1]))
}
library(idiogramFISH)
par(mar = rep(0, 4), oma = rep(0, 4))

plotIdiograms(dfChrSize = myPlasmiddf,  # plasmid size d.f.
  dfMarkPos = marksDfPlasCols,  # mark pos d.f.
  dfMarkColor = markStyle,      # mark style d.f.

  chromatids = FALSE,

  squareness = 21,          # corners not rounded
  chrWidth = 0.5,           # chr. width
  chrId = "",               # no chr. name

  markLabelSize = .7,       # font size of labels
  pattern = mypattern,      # remove pattern from mark names
  cMBeginCenter = TRUE,
  legend = "inline",
  protruding = protVal,

  ylimBotMod = 0,           # modify plot size
  ylimTopMod = 0,
  xlimLeftMod = 2,

  # circular params.
  circularPlot = circVal,   # circular
  rotation = rotaVal,       # begin plasmid in top

  radius = 2.5,
  shrinkFactor = 1,         # use 100% of circle
  labelSpacing = 1.7,       # label spacing from chr.
  labelOutwards = TRUE,     # label projected based on mark angle

  OTUjustif = 0.5,          # OTU name justif. centered.
  OTUplacing = "simple"     # plasmid name place. See OTUcentered
  , OTUTextSize = .8        # font size of OTU name
)

9.4 Prokaryote chromosome from genBank

# Option 1: Download prokaryote genome data from:
# https://www.ncbi.nlm.nih.gov/nuccore/NC_014248.1
# Choose Customize View -> Basic Features -> genes, CDS
# Send To -> File -> Create File

# Use your file name:
dataChr.gb <- "nostoc.gb" # 5 Mbytes

# Option 2: Download with rentrez package

library(rentrez)
# search string
nostoc <- "'Nostoc azollae' 0708, complete"
nostoc_search <- rentrez::entrez_search(db = "nuccore", term = nostoc)
# get summaries
esummariesNostoc <- rentrez::entrez_summary(db = "nuccore", id = nostoc_search$ids)
# select only perfect matches
select <- numeric()
for (i in seq_along(esummariesNostoc)) {
  print(esummariesNostoc[[i]]$title)
  if (esummariesNostoc[[i]]$title %in% grep(nostoc, esummariesNostoc[[i]]$title, value = TRUE)) {
    select <- c(select, i)
  }
}
select
# 3 8

# download chr. data
dataChr.gb  <- rentrez::entrez_fetch(db = "nuccore",
  id = nostoc_search$ids[select][1],
  rettype = "gbwithparts",
  retmode = "text")
# START:
library(idiogramFISH)
mylistChr <- genBankReadIF(dataChr.gb) # 9 seconds
names(mylistChr)
# "gbdfMain"     "gbdfAnnoMeta" "source"       "gene"         "CDS"          "tRNA"
# "regulatory"   "ncRNA"        "rRNA"         "misc_feature" "tmRNA"

# Authors of sequence
paste(mylistChr$gbdfMain[which(mylistChr$gbdfMain$field == "AUTHORS"), ][1, 2])
# [1] "Ran, L., Larsson, J., Vigil-Stenman, T., Nylander, J.A., Ininbergs, K.,;
# Zheng, W.W., Lapidus, A., Lowry, S., Haselkorn, R. and Bergman, B."

# create chr. size data data.frame
# columns chrName and chrSize
myProkaryotedf <- data.frame(chrName = 1, chrSize = mylistChr$source$end)
# column with OTU name
myProkaryotedf$OTU <- mylistChr$gbdfMain[which(mylistChr$gbdfMain$field == "DEFINITION"), ]$value
myProkaryotedf$OTU <- gsub(", complete genome.", "", myProkaryotedf$OTU)

# Creating mark info data.frame excluding some features
mylistChrSel  <- mylistChr[which(names(mylistChr) %in%
  setdiff(names(mylistChr), c("gbdfMain", "gbdfAnnoMeta", "source", "CDS")))]
# or:
# mylistSel<- mylistChr[which(names(mylistChr) %in% "CDS")]

# transform list into data.frame
mylistChrDF <- dplyr::bind_rows(mylistChrSel, .id = "feature")
# add necessary columns
mylistChrDF$markPos <- pmin(as.numeric(mylistChrDF$begin), as.numeric(mylistChrDF$end))
mylistChrDF$markSize <- abs(as.numeric(mylistChrDF$end) - as.numeric(mylistChrDF$begin))
mylistChrDF$markName <- mylistChrDF$locus_tag

# Replace codes with genes, and replace NAs in markNames (locus_tag)
mylistChrDF[which(!is.na(mylistChrDF$gene)), ]$markName <-
  mylistChrDF[which(!is.na(mylistChrDF$gene)), ]$gene

mylistChrDF[which(!is.na(mylistChrDF$regulatory_class)), ]$markName <-
  mylistChrDF[which(!is.na(mylistChrDF$regulatory_class)), ]$regulatory_class

# make unique names, otherwise some marks may share style and color
mylistChrDF$markName <- make.uniqueIF(mylistChrDF$markName)

# when no markName and note available:
mylistChrDF[which(is.na(mylistChrDF$markName)), ]$markName <-
  sub("([[:alpha:] ]+);.*", "\\1", mylistChrDF[which(is.na(mylistChrDF$markName)), ]$note)

# orientation of arrows
mylistChrDF$style <- ifelse(mylistChrDF$isComplement, "downArrow", "upArrow")

# select main columns for data.frame of marks' positions
marksDfChr <- mylistChrDF[, c("markName", "markPos", "markSize", "feature", "isJoin", "style"), ]

marksDfChr$OTU <- myProkaryotedf$OTU
# add mandatory column
marksDfChr$chrName <- myProkaryotedf$chrName

# Organize mark names in columns to avoid overlap
rotaVal <- 0
marksDfChrCols <- namesToColumns(marksDfChr, myProkaryotedf,
  markType = c("downArrow", "upArrow"),
  amountofSpaces = 13, colNumber = 4,
  protrudingInt = 0.5,
  rotation = rotaVal)

{
  # add marker for start pos.
  colnames(marksDfChrCols)
  marksDfChrCols <- rbind(marksDfChrCols,
    c("                                                           START", 1, NA,
      "start", FALSE, "square", myProkaryotedf$OTU, 1, NA)
  )

  # unique(marksDfChrCols$markName)

  # create mark general data data.frame
  markStyleNostoc   <- makedfMarkColorMycolors(
    unique(marksDfChrCols$markName), c("black", "forestgreen", "cornflowerblue"))

  unique(marksDfChrCols$feature)
  # [1] "gene"         "tRNA"         "regulatory"   "ncRNA"        "rRNA"       "tmRNA"        "start"
  unique(marksDfChrCols$isJoin)
  # [1] "FALSE"

  # change some colors depending on feature
  markStyleNostoc[which(markStyleNostoc$markName %in%
    marksDfChrCols[which(marksDfChrCols$feature %in% c("tRNA", "tmRNA")), ]$markName
  ), ]$markColor <- "magenta"

  markStyleNostoc[which(markStyleNostoc$markName %in%
    marksDfChrCols[which(marksDfChrCols$feature %in% c("regulatory", "ncRNA")), ]$markName
  ), ]$markColor <- "tomato3"

  markStyleNostoc[which(markStyleNostoc$markName %in%
    marksDfChrCols[which(marksDfChrCols$feature %in% "rRNA"), ]$markName
  ), ]$markColor <- "red2"

  markStyleNostoc[which(markStyleNostoc$markName %in%
    marksDfChrCols[which(marksDfChrCols$feature %in% c("misc_binding", "misc_feature")), ]$markName
  ), ]$markColor <- "lightsalmon"

  # or:
  # When isJoin is TRUE (CDS feature included)
  # markStyleNostoc[which(markStyleNostoc$markName %in%
  #                   marksDfChrCols[which(marksDfChrCols$isJoin==TRUE),]$markName
  # ),]$markColor<-"red"

  # arrows info. to d.f. of charac.
  markStyleNostoc$style      <- marksDfChrCols$style[match(markStyleNostoc$markName, marksDfChrCols$markName)]
  markStyleNostoc$protruding <- marksDfChrCols$protruding[match(markStyleNostoc$markName, marksDfChrCols$markName)]

  mypattern <- sub("([[:alnum:]]+_).*", "\\1", trimws(marksDfChrCols$markName[1]))
}

png("NOSTOC.png", width = 2795, height = 2795) # 2.7 Mb increase size to increase resolution
# pdf("NOSTOC.pdf",   width = 2795/80,  height = 2795/80)
# svg("NOSTOC.svg",   width = 2795/80,  height = 2795/80)  # 42 Mb vectorized

par(mar = rep(0, 4))

plotIdiograms(dfChrSize = myProkaryotedf,   # chr. data d.f.
  dfMarkPos = marksDfChrCols,    # mark pos d.f.
  dfMarkColor = markStyleNostoc, # mark style d.f. style

  squareness = 21,            # corners not rounded
  n = 150,                    # number of vertices in rounded items.
  markN = 2,
  chromatids = FALSE,

  chrWidth = 4,               # chr. width
  lwd.chr  = 0.1,
  chrId = "none",             # no chr. name
  legend = "inline",          # for arrows, this mimics cM and cMLeft marks
  #
  markLabelSize = 0.25,       # font size of labels
  pattern = mypattern,        # remove pattern from mark names
  #
  ylimBotMod = 5,             # modify plot size
  ylimTopMod = 5,
  xlimLeftMod = 5,
  xlimRightMod = 5,
  #
  # # circular plot params.
  circularPlot = TRUE,      # circular
  shrinkFactor = 1,         # use 100% of circle
  labelSpacing = 1,         # label spacing from chr.
  rotation = rotaVal,       # begin chr. in top
  labelOutwards = TRUE      # label projected based on mark angle
  #
  , OTUjustif = 0.5          # OTU name centered
  , OTUplacing = "simple"    # location of OTU name, see OTUcentered
  , radius = 8               # radius of circle
  , OTUTextSize = 3          # font size of OTU name
  , cMBeginCenter = TRUE     # label of arrows (inline) start in the middle
)
dev.off()

10 Plotting alongside phylogeny

Jupyter interactive version:
Open in ColabOpen in Colab   Github   Raw

This guide shows the files to plot idiograms alongside a phylogeny

10.1 Load package

visit gitlab for installation instructions https://gitlab.com/ferroao/idiogramFISH

#load package
library(idiogramFISH) 

10.2 ggtree of iqtree and monocentrics

idiogramFISH comes with two trees and data.frames with chr. and marks’ data for the correspondent OTUs, first we will plot a tree produced with iqtree (Nguyen et al., 2015)

Load the iqtree:

We will use phytools for that (Revell, 2012)

require(ggplot2)
require(phytools)
require(ggpubr)
require(grid)   # pushViewport
require(ggtree)
# list.files(system.file('extdata', package = 'my_package') )

# find path of iqtree file
iqtreeFile    <- system.file("extdata", "eightSpIqtree.treefile", package = "idiogramFISH")

# load file as phylo object
iqtreephylo   <- read.newick(iqtreeFile) # phytools

# transform tree
iqtreephyloUM <- force.ultrametric(iqtreephylo, method = "extend") # phytools

Make a ggtree (Yu et al., 2018)

ggtreeOf8 <- ggtree(iqtreephyloUM) + geom_tiplab(size = 6)

Modify optionally graphical parameters with ggplot and ggpubr: (Wickham, 2016; Kassambara, 2019)

gbuil2      <-  ggplot_build(ggtreeOf8)       # get ggplot_built
gtgbuild    <-  ggplot_gtable(gbuil2)         # get gtable from ggplot_built
gtgbuild$layout$clip[gtgbuild$layout$name == "panel"] <- "off"                # modify gtable
ggtreeOf8b   <- as_ggplot(gtgbuild)            # back to ggplot
gtgbuildgg2 <- ggtreeOf8b +  theme(plot.margin = unit(c(1, 9.5, 3, 1.5), "cm")) # top right bottom left - modify margins

Order OTUs in data.frame of chr. data

Apply order of phylogeny to the data.frame

# Let's get the order of species in tree
ggtreeOf8TIPS <- ggtreeOf8$data[which(ggtreeOf8$data$isTip), ]
desiredOrder  <- rev(ggtreeOf8TIPS[order(ggtreeOf8TIPS$y), ]$label)

# make a vector without missing OTUs
desiredFiltered <- intersect(desiredOrder, allChrSizeSample$OTU)

# establish desired order
allChrSizeSample$OTU <- factor(allChrSizeSample$OTU, levels = desiredFiltered)

# order
allChrSizeSample     <- allChrSizeSample[order(allChrSizeSample$OTU), ]


Now we have to establish where are the OTUs in the tree, that don’t have chr. data

# Establish position of OTUs before missing data OTUs
matchres <- match(desiredOrder, desiredFiltered)
matchres[is.na(matchres)] <- "R"
reps     <- rle(matchres)
posOTUsBeforeMissing      <- as.numeric(matchres[which(matchres == "R") - 1][which(matchres[which(matchres == "R") - 1] != "R")])

# This are the OTUs that come before missing chr. data OTUs
BeforeMissing             <- desiredFiltered[posOTUsBeforeMissing]

# This is the amount of missing OTUs, spaces to add (ghost karyotypes)
valuesOfMissRepsBefore    <- reps$lengths[which(reps$values == "R")]

Plotting

Now we are ready to plot adding those arguments for addMissingOTUAfter and missOTUspacings

# plot to png file
png(file = "firstplot.png", width = 962, height = 962)

par(omi = rep(0, 4),
  mar = c(0, 1, 2, 1),
  mfrow = c(1, 2))   # one row two columns

par(fig = c(0, .3, 0, 1)) # location of left ghost plot

plot.new()           # ghost plot to the left
par(fig = c(.3, 1, 0, 1)) # location of right plot

plotIdiograms(dfChrSize = allChrSizeSample,    # data.frame of Chr. Sizes
  dfMarkPos = allMarksSample,      # d.f. of Marks (inc. cen. marks)
  dfMarkColor =  mydfMaColor,      # d.f. of mark characteristics

  squareness = 4,                  # squareness of vertices
  lwd.chr = .5,                    # width of lines
  orderChr = "name",               # order chr. by name
  centromereSize = 1.3,            # apparent cen. size
  chrWidth = .75,                  # width of chr.
  chrSpacing = .25,                # horizontal spacing of chr.
  indexIdTextSize = .4,            # font size of indices and chr. names

  karHeight = 4.8,                 # karyotype vertical relative size without spacing
  karHeiSpace = 6.5,               # karyotype vertical relative size with spacing

  nameChrIndexPos = 4,             # move the name of chr. indexes to left
  morpho = "both",                 # add chr. morphology
  chrIndex = "both",               # add chr. indices
  karIndex = TRUE,                 # add karyotype indices
  yTitle = "",                     # remove units title of ruler

  markLabelSpacer = 0              # spaces from rightmost chr. to legend

  , ylimTopMod = -.1                # modify ylim top margin
  , ylimBotMod = 2.6                # modify ylim bottom margin

  , rulerPos = -0.5                 # position of rulers
  , rulerNumberSize = .35           # font size of ruler number
  , rulerNumberPos = .4             # position of ruler numbers
  , ruler.tck = -.004               # tick size and orient.

  , addMissingOTUAfter = BeforeMissing          # OTUs after which there are ghost karyotypes - empty spaces
  , missOTUspacings    = valuesOfMissRepsBefore # number of ghost karyotypes
)

# plot to the left the ggtree
pushViewport(viewport(layout = grid.layout(1, 2)))
pushViewport(viewport(layout.pos.col = 1, layout.pos.row = 1))
print(gtgbuildgg2, newpage = FALSE)

# close png
dev.off()

10.3 plot of revBayes tree and holocentrics

Now we are going to plot a tree from revBayes (Höhna et al., 2017)

First, load the revBayes tree:

require(ggplot2)
require(phytools)
require(ggpubr)
require(grid)   # pushViewport
require(ggtree)
require(treeio)

# find path of iqtree file
revBayesFile    <- system.file("extdata", "revBayesTutorial.tree", package = "idiogramFISH")

# load file as phylo object
revBayesPhylo   <- read.beast(revBayesFile) # ggtree or treeio

# transform tree
revBayesPhyloUM <- force.ultrametric(revBayesPhylo@phylo, method = "extend") # phytools

Order OTUs in data.frame of chr. data

# Get order of OTUs in tree
is_tip           <- revBayesPhyloUM$edge[, 2] <= length(revBayesPhyloUM$tip.label)
ordered_tips     <- revBayesPhyloUM$edge[is_tip, 2]
desiredorderRevB <- rev(revBayesPhyloUM$tip.label[ordered_tips])

# Ceate some holocentrics' data

allChrSizeSampleHolo <- allChrSizeSample
allChrSizeSampleHolo <- allChrSizeSampleHolo[, c("OTU", "chrName", "longArmSize")]
colnames(allChrSizeSampleHolo)[which(names(allChrSizeSampleHolo) == "longArmSize")] <- "chrSize"

allMarksSampleHolo   <- allMarksSample
allMarksSampleHolo   <- allMarksSampleHolo[which(allMarksSampleHolo$chrRegion != "cen"), ]
allMarksSampleHolo   <- allMarksSampleHolo[c("OTU", "chrName", "markName", "markDistCen", "markSize")]
colnames(allMarksSampleHolo)[which(names(allMarksSampleHolo) == "markDistCen")] <- "markPos"
allMarksSampleHolo[which(allMarksSampleHolo$markName == "5S"), ]$markSize <- .5

# Apply order of phylogeny to data.frame

# make a vector without missing OTUs
desiredFiltered <- intersect(desiredorderRevB, allChrSizeSampleHolo$OTU)

# establish desired order
allChrSizeSampleHolo$OTU <- factor(allChrSizeSampleHolo$OTU, levels = desiredFiltered)

# order
allChrSizeSampleHolo <- allChrSizeSampleHolo[order(allChrSizeSampleHolo$OTU), ]


Now we have to establish where are the OTUs in the tree, that don’t have chr. data

# Establish position of OTUs before missing data OTUs
matchres <- match(desiredorderRevB, desiredFiltered)
matchres[is.na(matchres)]   <- "R"
reps     <- rle(matchres)
posOTUsBeforeMissing        <- as.numeric(matchres[which(matchres == "R") - 1][which(matchres[which(matchres == "R") - 1] != "R")])

# This are the OTUs that come before missing chr. data OTUs
BeforeMissingPlot2          <- desiredFiltered[posOTUsBeforeMissing]

# This is the amount of missing OTUs, spaces to add (ghost karyotypes)
valuesOfMissRepsBeforePlot2 <- reps$lengths[which(reps$values == "R")]

Plotting

Now we are ready to plot adding those arguments for addMissingOTUAfter and missOTUspacings

# plot to png file
png(file = paste0("secondplot.png"), width = 962, height = 700)

{
  par(omi = rep(0, 4), mar = c(0, 0, 0, 0), mfrow = c(1, 2))
  par(fig = c(0, .27, 0, 1))
  par(mar = c(2, 0, 2, 0)) # b l t r

  plot(revBayesPhyloUM)
  par(fig = c(0.27, 1, 0, 1), new = TRUE)
  par(mar = c(0, 0, 0, 0)) # b l t r

  plotIdiograms(allChrSizeSampleHolo,   # chr. size data.frame
    dfMarkPos = allMarksSampleHolo,     # data.frame of marks' positions
    dfMarkColor =  mydfMaColor,         # d.f. of mark characteristics

    squareness = 4,                     # vertices squareness
    karHeight = 2.8,                    # karyotype height
    karHeiSpace = 4.5,                  # vertical size of kar. including spacing
    yTitle = "",

    karIndex = TRUE,                    # add karyotype index
    indexIdTextSize = .4                # font size of indices and chr. names

    , addMissingOTUAfter = BeforeMissingPlot2           # add ghost OTUs after these names
    , missOTUspacings    = valuesOfMissRepsBeforePlot2  # how many ghosts, respectively
    , lwd.chr = .5                       # line width

    , markLabelSpacer = 0                # dist. of legend to rightmost chr.
    , legendWidth = 2.3                  # width of square or dots of legend

    , rulerPos = -0.5                    # position of ruler
    , rulerNumberSize = .35              # font size of number of ruler
    , rulerNumberPos = .4                # position of ruler number
    , ruler.tck = -.004                  # tick of ruler size and orient.

    , ylimTopMod = -4                    # modify ylim of top
    , ylimBotMod = -4                    # modify ylim of bottom
    , xlimRightMod = 3                   # modify xlim right argument
    , xModifier = 100                    # separ. among chromatids
  )
}

# close png
dev.off()

10.4 plot of revBayes tree and holocentrics and monocentrics

Create data.frames with both types of karyotypes (Wickham, 2011)

require(plyr)
# Select this OTU from the monocen.
monosel <- c("Species_F", "Species_C", "Species_A")
# chr.
allChrSizeSampleSel  <- allChrSizeSample [which(allChrSizeSample$OTU  %in% monosel), ]
# marks
allMarksSampleSel    <- allMarksSample   [which(allMarksSample$OTU    %in% monosel), ]

# Select the others from the holocen.
holosel    <- setdiff(unique(allChrSizeSampleHolo$OTU), monosel)
# chr.
allChrSizeSampleHoloSel <- allChrSizeSampleHolo[which(allChrSizeSampleHolo$OTU %in% holosel), ]
# marks
allMarksSampleHoloSel   <- allMarksSampleHolo  [which(allMarksSampleHolo$OTU   %in% holosel), ]

# merge chr d.fs
mixChrSize <- plyr::rbind.fill(allChrSizeSampleSel, allChrSizeSampleHoloSel)

# merge marks' d.fs
mixMarks   <- plyr::rbind.fill(allMarksSampleSel, allMarksSampleHoloSel)


Order data.frame and determine missing karyotypes

# make a vector without missing OTUs
desiredFiltered <- intersect(desiredorderRevB, mixChrSize$OTU)

# establish desired order
mixChrSize$OTU <- factor(mixChrSize$OTU, levels = desiredFiltered)

# order data.frame
mixChrSize <- mixChrSize[order(mixChrSize$OTU), ]

# Establish position of OTUs before missing data OTUs
matchres <- match(desiredorderRevB, desiredFiltered)
matchres[is.na(matchres)]   <- "R"
reps     <- rle(matchres)
posOTUsBeforeMissing        <- as.numeric(matchres[which(matchres == "R") - 1][which(matchres[which(matchres == "R") - 1] != "R")])

# This are the OTUs that come before missing chr. data OTUs
BeforeMissingPlot2          <- desiredFiltered[posOTUsBeforeMissing]

# This is the amount of missing OTUs, spaces to add (ghost karyotypes)
valuesOfMissRepsBeforePlot2 <- reps$lengths[which(reps$values == "R")]

Plotting

Now we are ready to plot adding those arguments for addMissingOTUAfter and missOTUspacings

# plot to png file
png(file = paste0("thirdplot.png"), width = 1100, height = 1000)
{
  par(omi = rep(0, 4), mar = c(0, 0, 0, 0), mfrow = c(1, 2))
  par(fig = c(0, .25, 0, 1))
  par(mar = c(1, 0, 0, 0))

  plot(revBayesPhyloUM)
  par(fig = c(0.25, 1, 0, 1), new = TRUE)
  par(mar = c(0, 0, 0, 0))

  plotIdiograms(mixChrSize,             # chr. size data.frame
    dfMarkPos = mixMarks,               # data.frame of marks' positions (inc. cen. marks)
    dfMarkColor = mydfMaColor,          # d.f. of mark characteristics

    origin = "b",                       # position measured from bottom of chr.

    karHeight = 2.8,                    # vertical size of kar. including spacing
    karHeiSpace = 4.5,                  # vertical size of kar. including spacing
    squareness = 5,                     # vertices squareness
    chrSpacing = .25,                   # horizontal spacing among chr.
    yTitle = "",

    karIndex = TRUE                     # add karyotype index
    , indexIdTextSize = .4              # font size of indices and chr. names
    , distTextChr = 0.7                 # dist. among chr. and chr. name

    , addMissingOTUAfter = BeforeMissingPlot2           # add ghost OTUs after these names
    , missOTUspacings    = valuesOfMissRepsBeforePlot2  # how many ghosts, respectively
    , lwd.chr = .5                       # line width

    , markLabelSpacer = 0                # dist. of legend to rightmost chr.
    , legendWidth = 2                    # width of square or dots of legend

    , ylimTopMod = -2                    # modify ylim of top
    , ylimBotMod = -2                    # modify ylim of bottom

    , rulerPos = -0.5                    # position of ruler
    , rulerNumberSize = .35              # font size of number of ruler
    , rulerNumberPos = .4                # position of ruler number
    , ruler.tck = -.004                  # ruler tick size and orient.
    , OTUfont = 3                        # italics
    , OTUfamily = "Courier New"          # for OTU name

    , xModMonoHoloRate = 5               # factor (quotient) to shrink separation of chromatids of holocen.

  )
}
# close png
dev.off()

11 Citrus

Jupyter interactive version:
Open in ColabOpen in Colab   Github   Raw

11.1 C. maxima as da-Costa-Silva et al. (2019)

master data.frame of chr. size and marks

From this special data.frame citrusMaximaChrMark we will get two of the three canonical data.frames:

  • One for chr. sizes (parameter dfChrSize)
  • One for marks’ positions (parameter dfMarkPos)
  • One (optional) for mark style (parameter dfMarkColor)

Column chrNameUp will be used in this case for unifying the chr. names (chrName) in the 1st and 2nd data.frames.

# C. maxima 'pink'
# 4A 2C 4D 6F 2FL

{
  citrusMaximaChrMark <- read.table(text = "
chrName chrNameUp shortArmSize  longArmSize markName    chrRegion   markDistCen markSize
FL 1    67  97  24c13   p   52  10
D  2    62  75  21L13   q   35  8
D  2    62  75  CMA     q   43  32
A  3    70  103 45S     p   6   16
A  3    70  103 14A12   p   32  8
A  3    70  103 CMA     p   40  30
A  3    70  103 28A07   q   54  10
A  3    70  103 CMA     q   64  39
D  4    59  84  02C12   p   31  10
D  4    59  84  20C13   q   32  9
D  4    59  84  cma     q   48  36
F  5    52  74  5s      p   18  10
C  6    62  86  28A05   p   22  9
C  6    62  86  cma     p   40  22
C  6    62  86  cma     q   61  25
A  7    57  96  45S     p    6  18
A  7    57  96  cma     p   38  19
A  7    57  96  cma     q   62  34
F  8    41  72  01b09   q   47  8
F  9    40  72  55b01/59C23   q 24  13", header = TRUE)
}

data.frame of chr. sizes

Main columns: chrName, shortArmSize, longArmSize, OTU (optional when only one OTU), group (optional)

Column chrNameUp will be used in this case for unifying the chr. names (chrName) between data.frames.

{
  require(idiogramFISH)

  # column and row subset
  citrusMaxima <- citrusMaximaChrMark[, 1:4][!duplicated(citrusMaximaChrMark[, 1:4]), ]

  # chr. name change (unique)
  citrusMaxima$chrName <- make.uniqueIF(citrusMaxima$chrName)

  # chr. size in pixels
  chrSizes <- citrusMaxima$shortArmSize + citrusMaxima$longArmSize

  # max. size in μm.
  maxSize <- 3.6
  maxPixel <- max(chrSizes)

  # pixel to microm.
  citrusMaxima$shortArmSize <- citrusMaxima$shortArmSize / (maxPixel / maxSize)
  citrusMaxima$longArmSize <- citrusMaxima$longArmSize / (maxPixel / maxSize)

  citrusMaxima$OTU <- "C. maxima 'Pink'"

  # add groups (pairs)
  citrusMaxima$group <- 1:9
}

data.frame of marks’ positions

Main columns: chrName, markName, chrRegion (arm), markDistCen (mark distance to centr.), markSize

Column chrNameUp will be used in this case for unifying the chr. names (chrName) between data.frames.

Column OTU is mandatory because is present in first data.frame (citrusMaxima)

{
  # Select columns
  citrusMaximaMarkPos <- citrusMaximaChrMark[, c(1:2, 5:8)][!duplicated(citrusMaximaChrMark[, c(1:2, 5:8)]), ]

  # transcribe chr.names - changed above. needs common column (i.e. chrNameUp)
  citrusMaximaMarkPos$chrName <- citrusMaxima$chrName[match(citrusMaximaMarkPos$chrNameUp, citrusMaxima$chrNameUp)]

  # pixel to μm.
  citrusMaximaMarkPos$markDistCen <- citrusMaximaMarkPos$markDistCen / (maxPixel / maxSize)
  citrusMaximaMarkPos$markSize <- citrusMaximaMarkPos$markSize / (maxPixel / maxSize)

  # OTU column
  citrusMaximaMarkPos$OTU <- unique(citrusMaxima$OTU)

  # fix case
  citrusMaximaMarkPos$markName <- toupper(citrusMaximaMarkPos$markName)
}

data.frame of marks’ style

Optional data.frame. Add color and style for marks present in citrusMaximaMarkPos

{
  unique(citrusMaximaMarkPos$markName)
  # "24C13" "21L13" "CMA" "45S" "14A12"   "28A07" "02C12"   "20C13" "5S"  "28A05" "01B09" "55B01/59C23"

  # make d.f. of styles of marks
  markStyleDF   <- makedfMarkColorMycolors(
    unique(citrusMaximaMarkPos$markName),
    c("chocolate", "chocolate", "darkgoldenrod1", "chartreuse3", rep("chocolate", 4), "red", rep("chocolate", 3))
  )

}

Notes and plot

Two optional data.frames for adding notes to plot with columns OTU and note.

Parameters: leftNotes and notes

# notes
{
  # formula
  maxima <- "4A + 2C + 4D + 6F + 2FL [4A/45S, 2F/5S]"
  leftNotesdf <- data.frame(OTU = unique(citrusMaxima$OTU), note = maxima)

  # authors
  notesdf <- data.frame(OTU = unique(citrusMaxima$OTU), note = "da-Costa-Silva et al. 2019")
}

# add group column to show that each one is a pair
{
  par(mar = rep(0, 4), oma = rep(0, 4))
  plotIdiograms(dfChrSize = citrusMaxima,        # chr. size data.frame
    dfMarkPos = citrusMaximaMarkPos,  # mark position data.frame
    dfMarkColor = markStyleDF,        # mark style d.f.

    orderChr = "original",    # order of chr. as in d.f.
    chrIdPatternRem = "_.*",  # regex pattern to remove from chr. names
    classChrName = "Type",    # chr. names title
    chrWidth = 0.3,           # chr. width
    chrSpacing = 0.40,        # separ. among chr.
    groupSepar = 1            # factor to multiply chr. spacing among groups
    , chromatids = FALSE      # don't use chromatids
    , chrColor = "white"    # chr. color
    , classGroupName = "Pair" # groups title
    , chrBorderColor = "black" # border color
    , lwd.chr = 0.5           # border width

    , legend = "inline"        # label location
    , bannedMarkName = c("CMA", "45S", "5S") # don't show this (inline)
    , bMarkNameAside = TRUE    # show banned marks "aside"
    , legendHeight = 1.7       # height of labels (aside)
    , colorBorderMark = "black" # color of border of marks

    , markNewLine = "/"        # split mark name to new line

    , ruler = FALSE            # don't use ruler
    , threshold = 40           # fix scale, when too much shrinking

    , distTextChr = .7         # distance text to chr.
    , chrIndex = ""            # don't use chr. indices
    , morpho = ""              # don't use morphology
    , karIndex = FALSE         # don't use kar. indices

    , OTUfont = 3              # OTU name in italics

    , leftNotesTextSize = 1.3  # font size of notes
    , notesTextSize = 1.3      # font size of notes

    , leftNotes = leftNotesdf  # data.frame with left notes
    , leftNotesPosX = 0        # horizontal pos. of formula
    , leftNotesPosY = 0.5,
    notes = notesdf          # right notes - authors

    , ylimBotMod = 1         # modify ylim bottom argument
    , ylimTopMod = 0         # modify ylim top argument
    , xlimLeftMod = 2        # modify left xlim
    , xlimRightMod = 3       # modify right xlim
  )
}

11.2 C. reticulata as da-Costa-Silva et al. (2015)

Chr. size data.frame


#
#   chr. size - arms in pixels
#

{
  citrusReticulata <- read.table(text = "
chrName shortArmSize longArmSize totalMicro  Mbp   group
f       67            91          2.65       50.96 1
d       61            77          2.32       44.60 2
c       59            78          2.18       41.81 3
d       61            83          2.49       47.75 4
d       34            63          1.87       35.90 5
d       34            63          1.87       35.90 5
d       50            66          1.93       37    6
d       50            83          2.28       43.72 7
f       42            77          2.02       38.78 8
f       28            67          1.70       32.57 9", header = TRUE)

  citrusReticulata$pixeltotal <- citrusReticulata$shortArmSize + citrusReticulata$longArmSize

  # pixel to micrometers
  citrusReticulata$shortArmSize <- citrusReticulata$shortArmSize / (citrusReticulata$pixeltotal / citrusReticulata$totalMicro)
  citrusReticulata$longArmSize <- citrusReticulata$longArmSize / (citrusReticulata$pixeltotal / citrusReticulata$totalMicro)

  # change chr. names avoiding duplicates
  citrusReticulata$chrName <- toupper(citrusReticulata$chrName)
  citrusReticulata$chrName <- make.uniqueIF(citrusReticulata$chrName)

  # add OTU
  citrusReticulata$OTU <- "C. reticulata 'Cravo'"

  # replicate name for plotting it over chrs.
  citrusReticulata$chrNameUp <- citrusReticulata$chrName
}

Marks

citrusReticulataMarkPosDF <-  read.table(text = "
chrName chrRegion markName markDistCen markSize
     F_1      p    24C13   0.87  0.12
       C      p      CMA   0.64  0.30
       C      q      CMA   0.84  0.40
       C      p     14A12  0.48  0.11
       C      q    28A07   0.77  0.14
       C      p      45S   0.00  0.10
     D_1      q      CMA   0.54  0.75
     D_1      p    21L13   0.67  0.14
     D_2      q      CMA   0.88  0.55
     D_2      p    02C12   0.5   0.14
     D_2      q    20C13   0.42  0.14
     D_3      p      CMA   0.35  0.30
     D_3      p     c45S   0.35  0.35
     D_3      p      CMA   0.8   0.15
     D_3      p     c45S   0.8   0.15
     D_4      p      CMA   0.35  0.30
     D_4      p      45S   0.35  0.30
     D_5      p    28A05   0.66  0.14
     D_5      q      CMA   0.50  0.60
     D_6      q      CMA   0.72  0.70
     F_2      q    01B09   0.8   0.14
     F_3      q    55B01   0.3   0.18
     F_3      q    59C23   0.3   0.18", header = TRUE, stringsAsFactors = FALSE)

# marks' style data.frame
unique(citrusReticulataMarkPosDF$markName)
#  [1] "24C13" "CMA"   "14A12" "28A07" "45S"   "21L13" "02C12" "20C13" "c45S" 
# [10] "28A05" "01B09" "55B01" "59C23"

markStyleDF   <- makedfMarkColorMycolors(
  unique(citrusReticulataMarkPosDF$markName),
  c("chocolate", "darkgoldenrod1", "chocolate", "chocolate", "chartreuse3", rep("chocolate", 3), "chartreuse3", rep("chocolate", 4))
)

# square mark with label to the left (squareLeft style)
markStyleDF[which(markStyleDF$markName == "59C23"), ]$style <- "squareLeft"

# add OTU!
citrusReticulataMarkPosDF$OTU <- unique(citrusReticulata$OTU)

Plotting


# notes to the left
reticulata <- "2C + 10D + 6F [2C/45S, 2D/45S]"

leftNotesdf <- data.frame(OTU = unique(citrusReticulata$OTU), note = reticulata)

# authors in notes (right side)
notesdf <- data.frame(OTU = unique(citrusReticulata$OTU), note = "da-Costa-Silva et al. (2015)")

par(mar = rep(0, 4), oma = rep(0, 4))

{
  require(idiogramFISH)
  plotIdiograms(dfChrSize = citrusReticulata,         # chr. size data.frame
    dfMarkPos = citrusReticulataMarkPosDF, # mark position data.frame (inc. cen.)
    dfMarkColor = markStyleDF, # mark style d.f.

    orderChr = "original",    # order of chr. as in d.f.
    chrIdPatternRem = "_.*",  # pattern to remove from chr. names

    chrColor = "white"       # color of chr.
    , chrBorderColor = "black" # borders

    , chrIndex = "AR"        # add index r
    , morpho = ""            # don't add morphology cat.
    , karIndex = FALSE       # don't add kar. indeex
    , chrNameUp = TRUE       # add. info. of col. chrNameUp over kar.

    , centromereSize = 0     # size of cen.
    , colorBorderMark = "black" # color of border of marks
    , lwd.chr = 1            # border width

    , OTUfont = 3            # OTU name in italics

    , leftNotes = leftNotesdf # data.frame with notes
    , leftNotesTextSize = 1  # font size of notes
    , notesTextSize = 1      # font size of notes

    , leftNotesPosX = 0      # horizontal pos. of formula- left notes
    , leftNotesPosY = 1.9    # y pos. of left notes

    , notes = notesdf        # authors in notes (right)
    , notesPosX = 1          # move right notes to right

    , rulerInterval = .5     # ruler label int.
    , ruler.tck = -.01       # ruler ticks
    , rulerPos = -0.5        # ruler pos.
    , xPosRulerTitle = 7     # move title (units) of ruler, beginning in 1st chr.

    , ylimBotMod = 2         # modify ylim bottom argument
    , ylimTopMod = 1         # modify ylim top argument
    , xlimLeftMod = 1        # modify left xlim
    , xlimRightMod = 2       # modify right xlim

    , chromatids = FALSE     # do not plot chromatids
    , squareness = 2         # corners rounded
    , useMinorTicks = TRUE   # ruler minor ticks
    , miniTickFactor = 5     # number of small ticks per big ticks
    , distTextChr = .7       # distance indices to chr.

    , chrId = ""             # don't add chr. names (below)
    , chrSize = TRUE         # add chr. size
    , chrSizeMbp = TRUE      # add info of col. Mbp
    , nsmall = 2             # significative digits for indices

    , markPer = "CMA"        # calculate % of chr. for this mark
    , showMarkPos = TRUE     # show mark. position as fraction, under kar.
    , bToRemove = c("CMA", "45S", "c45S")   # do not use these in showMarkPos

    , legend = "inline"         # labels inline
    , legendHeight = 1.5        # legend height (right)
    , bannedMarkName = "CMA"    # do not add label of this mark
    , bMarkNameAside = TRUE     # add banned mark aside
    , forbiddenMark = "c45S"    # do not add this mark label

    , groupSepar = 1.8       # separation among groups, see col. group (x chrSpacing)
    , chrSpacing = .20       # separ. among chr.
    , chrWidth = .20         # chr. width
    , nameChrIndexPos = 4    # move name of indices to the left
  )
}

Download Citrus scripts from: https://ferroao.gitlab.io/idiogramfishhelppages/citrushelp.R{target = “_blank”}

11.3 Exploring Citrus functions

Details of functions can be found with:

?citrusSize 
?citrusMarkPos 
?markOverCMA

Or in: https://ferroao.gitlab.io/idiogramFISH/reference/citrusSize.html{target = “_blank”}

Published by Carvalho et al. (2005)

C. jambhiri/ C. volkameriana

1B + 11D + 4F + 2FL0

Create data.frame of chr. size

{
  library(idiogramFISH)

  citrusSizeDF <- citrusSize(B = 1, D = 11, F = 4, FL0 = 2,
    OTU = "C. jambhiri")

  # add simple secondary names
  citrusSizeDF$chrNameUp <- seq_len(nrow(citrusSizeDF))

  head(citrusSizeDF, 3)
  tail(citrusSizeDF, 3)

  # Editing data.frame:
  # citrusSizeDF <- edit(citrusSizeDF)

  # Initial plot, only sizes:
  par(mar = rep(0, 4), oma = rep(0, 4))
  plotIdiograms(dfChrSize = citrusSizeDF,      # chr. size data.frame
    orderChr = "original",        # order of chr.
    ruler = FALSE,
    ylimBotMod = 2,               # modify bottom margin
    ylimTopMod = 1,

    chrNameUp = TRUE,             # use col. chrNameUp
    classChrName = "Type",        # change default title of inferior name
    classChrNameUp = "Chr."       # change default title of upper name
  )
}

Use the group column to define pairs

citrusSizeDF$chrName
 [1] "B"     "D_1"   "D_2"   "D_3"   "D_4"   "D_5"   "D_6"   "D_7"   "D_8"  
[10] "D_9"   "D_10"  "D_11"  "F_1"   "F_2"   "F_3"   "F_4"   "FL0_1" "FL0_2"

# " "B" "D_1" "D_2" "D_3" "D_4" "D_5" "D_6" "D_7" "D_8"   "D_9"  "D_10"  "D_11"  "F_1"   "F_2"   "F_3"   "F_4"   "FL0_1" "FL0_2"
#   -------   ---------   ---------   ---------   -----------    ------------    -----------    ------------     -------------
# "     1          2           3           4            5              6              7               8                9

citrusSizeDF$group <- unlist(lapply(1:9, function(x) rep(x, 2)))
citrusSizeDF$group
 [1] 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9

# make secondary names
citrusSizeDF$chrNameUp <- unlist(lapply(1:9, function(x) rep(x, 2)))
citrusSizeDF$chrNameUp <- make.uniqueIF(citrusSizeDF$chrNameUp, sep = "", letter = TRUE)

data.frame of marks’ position


# CMA bands
citrusMarkPosDF <- citrusMarkPos(citrusSizeDF)
head(citrusMarkPosDF, 3)
#   chrName chrRegion markName markDistCen markSize         OTU
# 1       B         p      CMA        0.00     0.35 C. jambhiri
# 2       B         q      CMA        1.35     0.35 C. jambhiri
# 3     D_1         q      CMA        1.35     0.35 C. jambhiri
tail(citrusMarkPosDF, 3)
#    chrName chrRegion markName markDistCen markSize         OTU
# 11     D_7         q      CMA        1.35     0.35 C. jambhiri
# 12     D_8         q      CMA        1.35     0.35 C. jambhiri
# 13     D_9         q      CMA        1.35     0.35 C. jambhiri

# marks with overlap with CMA

# add mark of 45S rDNA in B, short arm (p)
citrusMarkPosDF45S <- markOverCMA(citrusMarkPosDF, # d.f. of CMA bands
  chrType = "B",       # chr. of new mark
  chrRegion = "p",     # arm of new mark
  markName = "45S")    # name of mark

# add 45S in D (D_1) long arm
citrusMarkPosDF45S <- markOverCMA(citrusMarkPosDF45S, # d.f. including CMA bands
  chrName = "D_1",
  chrRegion = "q",
  markName = "45S")

# creating additional data.frames of marks (non-CMA overlap)

citrusMarkPosDF45S_D11 <- data.frame(chrName = "D_11", # cr.
  chrRegion = "q",  # arm
  markName = "45S",
  markDistCen = 1,  # dist. to centrom.
  markSize = 0.2,   # mark size
  OTU = "C. jambhiri")

citrusMarkPosDF45S_F4  <- data.frame(chrName = "F_4",
  chrRegion = "q",
  markName = "45S",
  markDistCen = 1,
  markSize = 0.2,
  OTU = "C. jambhiri")

# fuse data.frames
citrusMarkPosDF45S <- dplyr::bind_rows(citrusMarkPosDF45S,     # CMA marks and overlapped
  citrusMarkPosDF45S_D11, # 45S in D (no overlap)
  citrusMarkPosDF45S_F4)  # 45S in F (no overlap)

data.frame of mark style

# current marks
unique(citrusMarkPosDF45S$markName)
## [1] "CMA" "45S"

markStyleDF   <- makedfMarkColorMycolors(
  unique(citrusMarkPosDF45S$markName), c("darkgoldenrod1", "chartreuse3"))

# modify styles
markStyleDF$style <- c("square", "dots")

Add karyotype formulas

notesdf<- data.frame(OTU = unique(citrusSizeDF$OTU), note = "1B + 11D + 4F + 2FL0") # spacing matters

Plot

par(mar = rep(0, 4), oma = rep(0, 4))
library(idiogramFISH)
plotIdiograms(dfChrSize = citrusSizeDF,      # chr. size data.frame
  dfMarkPos = citrusMarkPosDF45S, # mark position data.frame (inc. cen.)
  dfMarkColor = markStyleDF,      # mark style d.f.

  orderChr = "original",        # preserve order of chr. of d.f.

  # chrId = "",                 # remove name of chr.
  chrIdPatternRem = "_.*",      # regex pattern for removal of names of chr.
  chrSpacing = 0.2,             # separ. among chr.
  chrColor = "dodgerblue",

  chrNameUp = TRUE,             # use col. chrNameUp
  classChrName = "Type",        # change default title of inferior name
  classChrNameUp = "Chr."       # change default title of upper name

  , legendWidth = .8             # legend item width
  , legendHeight = 3             # legend item height
  , markLabelSpacer = 2          # legend spacer
  , ruler = FALSE                # no ruler
  , chrIndex = ""                # no chr. index
  , morpho = ""                  # no morpho.
  , karIndex = FALSE             # no kar. ind.

  , leftNotes = notesdf          # data.frame with notes
  , leftNotesTextSize = 1.3      # font size of notes
  , leftNotesPosX = 10.2         # pos. formula x axis
  , leftNotesPosY = 0            # pos. formula y axis

  , ylimBotMod = 1               # modify ylim bottom argument
  , xlimRightMod = 4             # modify right xlim
)

11.4 Representing only one chromosome per pair

As in the article (Carvalho et al., 2005)

C. jambhiri/ C. volkameriana

1B + 11D + 4F + 2FL0

{
  # data.frame of  chr. sizes
  citrusSizeDF_2 <- citrusSize(B = 1, D = 8, F = 3, FL0 = 1, # MODIFIED, SEE ABOVE
    OTU = "C. jambhiri_2")
  head(citrusSizeDF_2)

  # data.frame of CMA band pos.
  citrusMarkPosDF_2 <- citrusMarkPos(citrusSizeDF_2)
  head(citrusMarkPosDF_2)

  # marks with overlap with CMA

  # 45S in B, short arm
  citrusMarkPosDF45S_2 <- markOverCMA(citrusMarkPosDF_2,
    chrType = "B",
    chrRegion = "p",
    markName = "45S")

  # 45S in D (D_1), long arm
  citrusMarkPosDF45S_2 <- markOverCMA(citrusMarkPosDF45S_2,
    chrName = "D_1",
    chrRegion = "q",
    markName = "45S")

  # add mark from scratch (no overlap with CMA)

  citrusMarkPosDF45S_D8  <- data.frame(chrName = "D_8", # name of chr.
    chrRegion = "q", # arm
    markName = "45S", #
    markDistCen = 1, # dist. to centrom.
    markSize = 0.2,  # mark size
    OTU = "C. jambhiri_2")

  citrusMarkPosDF45S_F3  <- data.frame(chrName = "F_3",
    chrRegion = "q",
    markName = "45S",
    markDistCen = 1,
    markSize = 0.2,
    OTU = "C. jambhiri_2")
  # fuse data.frames
  citrusMarkPosDF45S_2 <- dplyr::bind_rows(citrusMarkPosDF45S_2,
    citrusMarkPosDF45S_D8,
    citrusMarkPosDF45S_F3
  )

  # current marks
  unique(citrusMarkPosDF45S_2$markName)

  # data.frame of mark style
  markStyleDF   <- makedfMarkColorMycolors(
    unique(citrusMarkPosDF45S_2$markName), c("darkgoldenrod1", "chartreuse3"))

  # modify styles
  markStyleDF$style <- c("square", "dots")

  # organize pairs, group

  citrusSizeDF_2$chrName
  # "B"   "D_1"  "D_2" "D_3" "D_4" "D_5" "D_6" "D_7" "D_8" "F_1" "F_2" "F_3" "FL0"
  #  ________    ____   ___   ________   ____   _________   ____   ________   ___
  #     1          2     3       4         5        6         7        8       9

  citrusSizeDF_2$group <- c(1, 1, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9)

  # add names over chr.
  citrusSizeDF_2$chrNameUp <- citrusSizeDF_2$group
  citrusSizeDF_2$chrNameUp <- make.uniqueIF(citrusSizeDF_2$chrNameUp, sep = "", letter = TRUE)

  # formula
  notesdf <- data.frame(OTU = unique(citrusSizeDF_2$OTU), note = "1B + 11D + 4F + 2FL0") # keep spacing
}

par(mar = c(0, 0, 0, 0), oma = rep(0, 4))
library(idiogramFISH)
plotIdiograms(dfChrSize = citrusSizeDF_2,      # d.f. of chr. size
  dfMarkPos = citrusMarkPosDF45S_2, # d.f. of mark pos
  dfMarkColor = markStyleDF,        # d.f. of mark style
  orderChr = "original",          # chr. order as in d.f.
  chrIdPatternRem = "_.*",        # modif name of chr. removing this pattern
  chrSpacing = .20,               # separ. among chr.
  chrColor = "dodgerblue",
  legendWidth = .8            # legend item width
  , legendHeight = 2.5        # legend item height
  , markLabelSpacer = 2       # legend spacer
  , ruler = FALSE,
  chrIndex = "",
  morpho = "",
  karIndex = FALSE,
  chrNameUp = TRUE           # use col. chrNameUp
  , classChrName = "Type"    # change default title of inferior name
  , classChrNameUp = "Chr."  # change default title of upper name
  , classGroupName = "Pair"  # name for groups

  , leftNotes = notesdf        # data.frame with notes
  , leftNotesTextSize = 1.3    # font size of notes
  , leftNotesPosX = 10.2       # formula horiz. pos.
  , leftNotesPosY = 0,
  ylimBotMod = 1               # modify ylim bottom argument
  , ylimTopMod = 0             # modify ylim top argument
  , xlimLeftMod = 2            # modify left xlim
  , xlimRightMod = 3           # modify right xlim
)

11.5 Several karyotypes per plot

Column OTU is mandatory for several OTU.

# data.frames of size - merge
bothSize    <- dplyr::bind_rows(citrusSizeDF, citrusSizeDF_2)

# data.frames of band pos. merge
bothMarkPos <- dplyr::bind_rows(citrusMarkPosDF45S, citrusMarkPosDF45S_2)

# formulas

notesdf <- data.frame(OTU = unique(bothSize$OTU), note = "1B + 11D + 4F + 2FL0")

par(mar = rep(0, 4), oma = rep(0, 4))

plotIdiograms(dfChrSize = bothSize,    # chr. size data.frame
  dfMarkPos = bothMarkPos,   # mark position data.frame (inc. cen.)
  dfMarkColor = markStyleDF, # mark style d.f.

  orderChr = "original",   # order of chr. as in d.f.
  chrIdPatternRem = "_.*", # pattern to remove from chr. names
  karHeight = 2,           # karyotype height
  karHeiSpace = 5,         # height + separ. among karyot.

  chrSpacing = .20,         # separ. among chr.
  chrColor = "dodgerblue",
  distTextChr = .9          # distance text to chr.

  , legendWidth = .8       # legend item width
  , legendHeight = 3       # legend item height
  , markLabelSpacer = 2    # legend spacer
  , ruler = FALSE,
  chrIndex = "",
  morpho = "",
  karIndex = FALSE
  # ,colorBorderMark = "black"# color of border of marks
  , lwd.chr = 1            # border width

  , chrNameUp = TRUE       # use col. chrNameUp
  , classChrName = "Type"  # change default title of inferior name
  , classChrNameUp = "Chr." # change default title of upper name
  , groupName = FALSE      # don't show group names

  , OTUfont = 3            # OTU name in italics

  , leftNotes = notesdf    # data.frame with notes
  , leftNotesTextSize = 1.3 # font size of notes
  , leftNotesPosX = 10.2   # horizontal pos. of formula
  , leftNotesPosY = 0,
  ylimBotMod = 1           # modify ylim bottom argument
  , ylimTopMod = 0         # modify ylim top argument
  , xlimLeftMod = 2        # modify left xlim
  , xlimRightMod = 3       # modify right xlim
)

11.6 C. leiocarpa as Yi et al. (2018)


#
# create data.frame of chr.
#

cleiocarpaChr <- citrusSize(A = 1, C = 1, D = 10, F = 6, # Using Guerra nom.
  OTU = "C. leiocarpa",
  shortArm = 1.7
)

#
# add groups
#

cleiocarpaChr$group <- gsub("_.*", "", cleiocarpaChr$chrName)

#
# marks data.frame
#

# CMA
cleiocarpaMarks <- citrusMarkPos(cleiocarpaChr)

# marks with overlap with CMA

# add mark of 45S rDNA in A, short arm (p)
cleiocarpaMarks <- markOverCMA(cleiocarpaMarks, # d.f. of CMA bands
  chrType = "A",       # chr. of new mark
  chrRegion = "p",     # arm of new mark
  markName = "45S",    # name of mark
  shrinkMark = TRUE
)
# add 45S in Ds
cleiocarpaMarks <-  markOverCMA(cleiocarpaMarks, # d.f. including CMA bands
  chrName = paste0("D_", 1:4),
  chrRegion = "q",
  markName = "45S",
  shrinkMark = TRUE
)

# creating additional data.frames of marks (non-CMA overlap)

cleiocarpaMarks_D3 <- data.frame(chrName = c("D_3", "D_4"), # cr.
  chrRegion = "q",   # arm
  markName = "5S",
  markDistCen = 1.1, # dist. to centrom.
  markSize = 0.2,    # mark size
  OTU = "C. leiocarpa")

#
# merge marks d.fs
#

cleiocarpaMarks <- dplyr::bind_rows(cleiocarpaMarks,    # CMA marks and overlapped 45S
  cleiocarpaMarks_D3, # 5S in D (no overlap)
)
#
# mark style data.frame
#

# current marks
unique(cleiocarpaMarks$markName)
# [1] "CMA" "45S" "5S"

markStyleDF   <- makedfMarkColorMycolors(
  unique(cleiocarpaMarks$markName), c("darkgoldenrod1", "chartreuse3", "red")
)

# modify styles
markStyleDF$style <- c("square", "dots", "dots")

#
# swap chromosome arms of Ds (CMA marks originally in long arm)
#

dflist <- swapChrRegionDfSizeAndMarks(cleiocarpaChr,
  cleiocarpaMarks,
  paste0("D_", 1:10)
)
cleiocarpaChr   <- dflist$dfChrSize
cleiocarpaMarks <- dflist$dfMarkPos

#
# Left notes Up data.frame
#

notesdf <- data.frame(OTU = unique(cleiocarpaChr$OTU),
  note = "italic('Citrus leiocarpa'),' Hort. ex Tan.' " # use with parseStr2lang
)

par(mar = rep(0, 4), oma = rep(0, 4))

plotIdiograms(dfChrSize = cleiocarpaChr,     # chr. size data.frame
  dfMarkPos = cleiocarpaMarks,   # mark position data.frame
  dfMarkColor = markStyleDF,     # mark style d.f.

  orderChr = "original",        # preserve order of chr. of d.f.
  chrId = "",                   # do not add chr. names

  addOTUName = FALSE,           # remove name of OTU
  chrIdPatternRem = "_.*",      # regex pattern for removal of names of chr.
  chrSpacing = 0.2,             # separ. among chr.
  chrColor = "dodgerblue",      # chr. color
  chromatids = FALSE,           # do not use separ. chromatids

  dotsAsOval = TRUE              # use oval shape instead of dots marks
  , legendWidth = .8             # legend item width
  , legendHeight = 3             # legend item height
  , markLabelSpacer = 2          # legend spacer
  , ruler = FALSE                # no ruler
  , chrIndex = ""                # no chr. index
  , morpho = ""                  # no morpho.
  , karIndex = FALSE             # no kar. ind.

  , leftNotesUp = notesdf        # data.frame with notes
  , parseStr2lang = TRUE         # use italics, see notesdf above
  , leftNotesUpTextSize = 1.3    # font size of notes
  , leftNotesUpPosX = 0          # pos. left notes x axis
  , leftNotesUpPosY = 1          # pos. left notes y axis

  , ylimBotMod = 0               # modify ylim bottom argument
  , xlimRightMod = 4             # modify right xlim
)

11.7 Citrus limon origin

With data from da-Costa-Silva et al. (2015), Mendes et al. (2016) and Carvalho et al. (2005)

11.7.1 Citrus reticulata (Parental 1)

data.frame of chr. sizes


# c. reticulata ----X---- c. aurantium
#                   |
#                c. limon


# c. reticulata

#
#   chr. size - arms in pixels
#

{
  citrusReticulata <- read.table(text = "
chrName shortArmSize longArmSize totalTrue
f 67 91  2.65
d 61 77  2.32
c 59 78  2.18
d 61 83  2.49
d 34 63  1.87
d 50 66  1.93
d 50 83  2.28
f 42 77  2.02
f 28 67  1.70", header = TRUE)

  citrusReticulata$pseudototal <- citrusReticulata$shortArmSize + citrusReticulata$longArmSize

  # pixel to micrometers
  citrusReticulata$shortArmSize <- citrusReticulata$shortArmSize / (citrusReticulata$pseudototal / citrusReticulata$totalTrue)
  citrusReticulata$longArmSize <- citrusReticulata$longArmSize / (citrusReticulata$pseudototal / citrusReticulata$totalTrue)

  citrusReticulata$chrName <- toupper(citrusReticulata$chrName)
  citrusReticulata$chrName <- make.uniqueIF(citrusReticulata$chrName)
  citrusReticulata$OTU <- "C. reticulata 'Cravo'"

}


Sort chromosomes


# sort chr. by name
citrusReticulata <- citrusReticulata[order(citrusReticulata$chrName), ]

# sort Ds by size
Ds <- citrusReticulata[which(citrusReticulata$chrName %in% grep("D", citrusReticulata$chrName, value = TRUE)
), ]
citrusReticulata[which(citrusReticulata$chrName %in% grep("D", citrusReticulata$chrName, value = TRUE)
), ] <- Ds[order(Ds$shortArmSize + Ds$longArmSize), ]

# sort Fs by size
Fs <- citrusReticulata[which(citrusReticulata$chrName %in% grep("F", citrusReticulata$chrName, value = TRUE)
), ]

citrusReticulata[which(citrusReticulata$chrName %in% grep("F", citrusReticulata$chrName, value = TRUE)), ] <-
  Fs[order(Fs$shortArmSize + Fs$longArmSize), ]

# add group column to show that each one is a pair
citrusReticulata$group <- 1:9


data.frame of bands


#
# c. reticulata bands
#

{
  citrusReticulataMarkPosDF <- citrusMarkPos(citrusReticulata)

  # remove CMA terminal from D
  citrusReticulataMarkPosDF <- citrusReticulataMarkPosDF[-which(citrusReticulataMarkPosDF$chrName == "D_3" &
    citrusReticulataMarkPosDF$markName == "CMA"
  ), ]

  # add marks in short arm of D

  Sr_D_3 <- citrusReticulata[which(citrusReticulata$chrName == "D_3"), ]$shortArmSize
  # 45S
  citrusReticulataMarkPosDF_D45S  <- data.frame(chrName = "D_3",
    chrRegion = "p",
    markName = "45S",
    markDistCen = Sr_D_3 - (.15 + .15 / 2),
    markSize = 0.15,
    OTU = unique(citrusReticulata$OTU)
  )

  # CMA
  citrusReticulataMarkPosDF_DCMA  <- data.frame(chrName = "D_3",
    chrRegion = "p",
    markName = "CMA",
    markDistCen = Sr_D_3 - .3,
    markSize = 0.3,
    OTU = unique(citrusReticulata$OTU)
  )

  # add 45S rDNA mark in short arm  of C
  citrusReticulataMarkPosDF_C45S  <- data.frame(chrName = "C",
    chrRegion = "p",
    markName = "45S",
    markDistCen = 0,
    markSize = 0.1,
    OTU = unique(citrusReticulata$OTU)
  )

  # fuse marks
  citrusReticulataMarkPosDF <- dplyr::bind_rows(citrusReticulataMarkPosDF,
    citrusReticulataMarkPosDF_D45S,
    citrusReticulataMarkPosDF_DCMA,
    citrusReticulataMarkPosDF_C45S
  )

  # change band sizes

  # D_1
  citrusReticulataMarkPosDF[which(citrusReticulataMarkPosDF$chrName == "D_1"), ]$markSize <- .75
  LAD_1 <- citrusReticulata[which(citrusReticulata$chrName == "D_1"), ]$longArmSize
  citrusReticulataMarkPosDF[which(citrusReticulataMarkPosDF$chrName == "D_1"), ]$markDistCen <-
    LAD_1 - .75

  # C short arm
  citrusReticulataMarkPosDF[which(citrusReticulataMarkPosDF$chrName == "C" &
    citrusReticulataMarkPosDF$markName == "CMA" &
    citrusReticulataMarkPosDF$chrRegion == "p"), ]$markSize <- .3

  SAC <- citrusReticulata[which(citrusReticulata$chrName == "C"), ]$shortArmSize

  citrusReticulataMarkPosDF[which(citrusReticulataMarkPosDF$chrName == "C" &
    citrusReticulataMarkPosDF$markName == "CMA" &
    citrusReticulataMarkPosDF$chrRegion == "p"
  ), ]$markDistCen <- SAC - .3

  # C LONG ARM
  citrusReticulataMarkPosDF[which(citrusReticulataMarkPosDF$chrName == "C" &
    citrusReticulataMarkPosDF$markName == "CMA" &
    citrusReticulataMarkPosDF$chrRegion == "q"), ]$markSize <- .4

  LAC <- citrusReticulata[which(citrusReticulata$chrName == "C"), ]$longArmSize

  citrusReticulataMarkPosDF[which(citrusReticulataMarkPosDF$chrName == "C" &
    citrusReticulataMarkPosDF$markName == "CMA" &
    citrusReticulataMarkPosDF$chrRegion == "q"
  ), ]$markDistCen <- LAC - .4


  # D_2
  citrusReticulataMarkPosDF[which(citrusReticulataMarkPosDF$chrName == "D_2"), ]$markSize <- .55
  LAD_2 <- citrusReticulata[which(citrusReticulata$chrName == "D_2"), ]$longArmSize
  citrusReticulataMarkPosDF[which(citrusReticulataMarkPosDF$chrName == "D_2"), ]$markDistCen <-
    LAD_2 - .55

  # D_4
  citrusReticulataMarkPosDF[which(citrusReticulataMarkPosDF$chrName == "D_4"), ]$markSize <- .6
  LAD_4 <- citrusReticulata[which(citrusReticulata$chrName == "D_4"), ]$longArmSize
  citrusReticulataMarkPosDF[which(citrusReticulataMarkPosDF$chrName == "D_4"), ]$markDistCen <-
    LAD_4 - .6

  # D_5
  citrusReticulataMarkPosDF[which(citrusReticulataMarkPosDF$chrName == "D_5"), ]$markSize <- .7
  LAD_5 <- citrusReticulata[which(citrusReticulata$chrName == "D_5"), ]$longArmSize
  citrusReticulataMarkPosDF[which(citrusReticulataMarkPosDF$chrName == "D_5"), ]$markDistCen <-
    LAD_5 - .7
}

11.7.2 C. aurantium ‘common’ (Parental 2)

data.frame of chr. sizes


# From Mendes et al. 2016

# 1a + 1b + 1C + 8D + 7F

{
  #
  # chr .sizes
  #

  citrusaurantium <- read.table(text = "
chrName shortArmSize longArmSize
f   1.43333333333333    2.06666666666667
f   1.36666666666667    1.83333333333333
d   1.3 1.66666666666667
d   1.13333333333333    1.46666666666667
d   1   1.6
a   1.3 2
d   1.36666666666667    1.8
d   1.06666666666667    1.63333333333333
d   0.733333333333333   1.36666666666667
f   0.833333333333333   1.36666666666667
d   1.13333333333333    1.33333333333333
c   1.16666666666667    1.66666666666667
d   1.06666666666667    1.8
b   1   1.83333333333333
f   0.966666666666667   1.6
f   0.8 1.36666666666667
f   0.633333333333333   1.43333333333333
f   0.733333333333333   1.3
", header = TRUE)

  # modify chr. names
  citrusaurantium$chrName <- toupper(citrusaurantium$chrName)
  citrusaurantium$chrName <- make.uniqueIF(citrusaurantium$chrName)

  # add column
  citrusaurantium$OTU <- "C. aurantium 'common'"

}


Order pairs based in BAC markers (not shown here - different to 45S / 5S rDNA )


{
  # confirmed pairs
  customOrder <- c("A", "D_3", "C", "D_7")

  customOrder <- c(customOrder, sort(setdiff(citrusaurantium$chrName, customOrder)))

  # sort
  citrusaurantium$chrName <- factor(citrusaurantium$chrName, levels = customOrder)
  citrusaurantium <- citrusaurantium[order(citrusaurantium$chrName), ]


  # sort Ds by size

  Ds <- citrusaurantium[which(citrusaurantium$chrName %in% grep("D", citrusaurantium$chrName, value = TRUE) &
    !citrusaurantium$chrName %in% c("D_3", "D_7")), ]
  citrusaurantium[which(citrusaurantium$chrName %in% grep("D", citrusaurantium$chrName, value = TRUE) &
    !citrusaurantium$chrName %in% c("D_3", "D_7")), ] <- Ds[order(Ds$shortArmSize + Ds$longArmSize), ]

  # sort Fs by size
  Fs <- citrusaurantium[which(citrusaurantium$chrName %in% grep("F", citrusaurantium$chrName, value = TRUE)
  ), ]
  citrusaurantium[which(citrusaurantium$chrName %in% grep("F", citrusaurantium$chrName, value = TRUE)), ] <-
    Fs[order(Fs$shortArmSize + Fs$longArmSize), ]

  # pairs:

  groups <- c(1, 1, 2, 2)
  citrusaurantium$group <- c(groups, rep(NA, 18 - length(groups)))

  # secondary name
  citrusaurantium$chrNameUp <- 1:18

}


data.frame of bands

Option 1. Write from scratch:

{
  citrusaurantiumMarkPosDF <- read.table(text = "
  chrName chrRegion markName markDistCen markSize
  A           p      CMA   0.73    0.570
  A           p      CMA   0.00    0.350
  A           q      CMA   1.23    0.770
  B           p      CMA   0.00    0.350
  B           q      CMA   0.86    0.970
  C           p      CMA   0.74    0.430
  C           q      CMA   1.07    0.600
  D_1         q      CMA   0.60    1.070
  D_2         q      CMA   0.84    0.630
  D_3         q      CMA   1.07    0.530
  D_4         q      CMA   1.07    0.730
  D_5         q      CMA   0.86    0.770
  D_7         q      CMA   0.46    0.870
  D_8         q      CMA   0.90    0.900
  B           p      45S   0.09    0.175
  A           p      45S   0.09    0.175
  D_6         p      45S   0.58    0.100
  D_6         p      CMA   0.53    0.200
  ", header = TRUE)

  citrusaurantiumMarkPosDF$OTU <- "C. aurantium 'common'"
}
# this is equivalent to the following section


Option 2. Use functions:

{
  #
  # CMA bands
  #
  citrusaurantiumMarkPosDF <- citrusMarkPos(citrusaurantium)

  # add 45S in B
  citrusaurantiumMarkPosDF <- markOverCMA(citrusaurantiumMarkPosDF,
    chrType = "B",
    chrRegion = "p",
    markName = "45S")

  # add 45S in A p prox
  citrusaurantiumMarkPosDF <- markOverCMA(citrusaurantiumMarkPosDF,
    chrType = "A",
    chrRegion = "p",
    markName = "45S")


  # D_6

  # change D (D_6) band from long to short
  SA_D_6 <- citrusaurantium[which(citrusaurantium$chrName == "D_6"), ]$shortArmSize

  # 45S in short
  citrusaurantiumMarkPosDF_D45S  <- data.frame(chrName = "D_6",
    chrRegion = "p",
    markName = "45S",
    markDistCen = SA_D_6 - .15,
    markSize = 0.1,
    OTU = unique(citrusaurantium$OTU)
  )

  # CMA in short
  citrusaurantiumMarkPosDF_DCMA  <- data.frame(chrName = "D_6",
    chrRegion = "p",
    markName = "CMA",
    markDistCen = SA_D_6 - .2,
    markSize = 0.2,
    OTU = unique(citrusaurantium$OTU)
  )

  # remove CMA terminal from D_6 long
  citrusaurantiumMarkPosDF <- citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName != "D_6"), ]

  # change mark sizes according to publication

  # D_1 band

  # change mark size
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "D_1"), ]$markSize <- 1.07

  # arm size
  LAD_1 <- citrusaurantium[which(citrusaurantium$chrName == "D_1"), ]$longArmSize

  # change mark dist. to cen.
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "D_1"), ]$markDistCen <-
    LAD_1 - 1.07

  # D_2
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "D_2"), ]$markSize <- 0.63
  LAD_2 <- citrusaurantium[which(citrusaurantium$chrName == "D_2"), ]$longArmSize
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "D_2"), ]$markDistCen <-
    LAD_2 - .63

  # D_3
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "D_3"), ]$markSize <- 0.53
  LAD_3 <- citrusaurantium[which(citrusaurantium$chrName == "D_3"), ]$longArmSize
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "D_3"), ]$markDistCen <-
    LAD_3 - .53

  # A p ter
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "A" &
    citrusaurantiumMarkPosDF$markDistCen == 1.05), ]$markSize <- 0.57
  SAA <- citrusaurantium[which(citrusaurantium$chrName == "A"), ]$shortArmSize

  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "A" &
    citrusaurantiumMarkPosDF$markDistCen == 1.05), ]$markDistCen <-
    SAA - .57

  # A q
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "A" &
    citrusaurantiumMarkPosDF$chrRegion == "q"), ]$markSize <- 0.77
  LAA <- citrusaurantium[which(citrusaurantium$chrName == "A"), ]$longArmSize

  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "A" &
    citrusaurantiumMarkPosDF$chrRegion == "q"), ]$markDistCen <-
    LAA - .77

  # D_4
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "D_4"), ]$markSize <- 0.73
  LAD_4 <- citrusaurantium[which(citrusaurantium$chrName == "D_4"), ]$longArmSize
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "D_4"), ]$markDistCen <-
    LAD_4 - .73

  # D_5
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "D_5"), ]$markSize <- 0.77
  LAD_5 <- citrusaurantium[which(citrusaurantium$chrName == "D_5"), ]$longArmSize
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "D_5"), ]$markDistCen <-
    LAD_5 - .77

  # D_7
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "D_7"), ]$markSize <- 0.87
  LAD_7 <- citrusaurantium[which(citrusaurantium$chrName == "D_7"), ]$longArmSize
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "D_7"), ]$markDistCen <-
    LAD_7 - .87

  # C p
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "C" &
    citrusaurantiumMarkPosDF$chrRegion == "p"), ]$markSize <- .43
  SAC <- citrusaurantium[which(citrusaurantium$chrName == "C"), ]$shortArmSize
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "C" &
    citrusaurantiumMarkPosDF$chrRegion == "p"), ]$markDistCen <-
    SAC - .43

  # C q
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "C" &
    citrusaurantiumMarkPosDF$chrRegion == "q"), ]$markSize <- .6
  LAC <- citrusaurantium[which(citrusaurantium$chrName == "C"), ]$longArmSize
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "C" &
    citrusaurantiumMarkPosDF$chrRegion == "q"), ]$markDistCen <-
    LAC - .6

  # D_8
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "D_8"), ]$markSize <- 0.9
  LAD_8 <- citrusaurantium[which(citrusaurantium$chrName == "D_8"), ]$longArmSize
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "D_8"), ]$markDistCen <-
    LAD_8 - .9

  # B q
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "B" &
    citrusaurantiumMarkPosDF$chrRegion == "q"), ]$markSize <- .97
  LAB <- citrusaurantium[which(citrusaurantium$chrName == "B"), ]$longArmSize
  citrusaurantiumMarkPosDF[which(citrusaurantiumMarkPosDF$chrName == "B" &
    citrusaurantiumMarkPosDF$chrRegion == "q"), ]$markDistCen <-
    LAB - .97

  # fuse marks
  citrusaurantiumMarkPosDF <- dplyr::bind_rows(citrusaurantiumMarkPosDF,
    citrusaurantiumMarkPosDF_D45S,
    citrusaurantiumMarkPosDF_DCMA
  )
}

11.7.3 C. limon


# from: Carvalho 2005

# C. limon - 1B(45Sprox) + 1C + 8D + 1D(45S) + 5F + 1FL0 + 1FL+

{
  # data.frame of  chr. sizes

  citruslimon <- citrusSize(B = 1, C = 1, D = 9, F = 5, FL0 = 1, FL = 1,
    OTU = "C. limon")
  citruslimon

  # modify sizes

  citruslimon$shortArmSize[3] <- 1.1
  citruslimon$longArmSize[3] <- 1.5

  citruslimon$shortArmSize[4:5] <- 1.15
  citruslimon$longArmSize[4:5] <- 1.6

  citruslimon$shortArmSize[6:7] <- 1.1
  citruslimon$longArmSize[6:7] <- 1.6

  citruslimon$shortArmSize[8:9] <- 1.15
  citruslimon$longArmSize[8:9] <- 1.65

  citruslimon$shortArmSize[2] <- 1
  citruslimon$longArmSize[2] <- 1.6

  citruslimon$shortArmSize[12] <- 1
  citruslimon$longArmSize[12] <- 1.5

  citruslimon$shortArmSize[10:11] <- .95
  citruslimon$longArmSize[10:11] <- 1.4

  citruslimon$shortArmSize[13:14] <- 1
  citruslimon$longArmSize[13:14] <- 1.5

  citruslimon$shortArmSize[15:16] <- .95
  citruslimon$longArmSize[15:16] <- 1.3

  # sort Ds by size

  Ds <- citruslimon[which(citruslimon$chrName %in% grep("D", citruslimon$chrName, value = TRUE)
  ), ]

  citruslimon[which(citruslimon$chrName %in% grep("D", citruslimon$chrName, value = TRUE)
  ), ] <- Ds[order(Ds$shortArmSize + Ds$longArmSize), ]

  # sort Fs by size
  Fs <- citruslimon[which(citruslimon$chrName %in% grep("F", citruslimon$chrName, value = TRUE)
  ), ]

  citruslimon[which(citruslimon$chrName %in% grep("F", citruslimon$chrName, value = TRUE)), ] <-
    Fs[order(Fs$shortArmSize + Fs$longArmSize), ]


  # secondary chr. name
  citruslimon$chrNameUp <- 1:18

  #
  # data.frame of CMA band pos.
  #

  citruslimonMarkPosDF <- citrusMarkPos(citruslimon)
  head(citruslimonMarkPosDF)

  # marks with overlap with CMA
  # 45S in B, short arm

  citruslimonMarkPosDF <- markOverCMA(citruslimonMarkPosDF,
    chrType = "B",
    chrRegion = "p",
    markName = "45S")

  # 45S in D (D_1), long arm
  citruslimonMarkPosDF <- markOverCMA(citruslimonMarkPosDF,
    chrName = "D_1",
    chrRegion = "q",
    markName = "45S")

  # add mark from scratch (no overlap with CMA)

}

11.7.4 Merge data.frames from all OTUs


#
# data.frames of size - merge
#

threeSize    <- dplyr::bind_rows(citrusReticulata, citruslimon, citrusaurantium)

#
# data.frames of band pos. merge
#

threeMarkPos <- dplyr::bind_rows(citruslimonMarkPosDF, citrusaurantiumMarkPosDF, citrusReticulataMarkPosDF)


#
#   leftNotes with formulas
#

# formulas
limon      <- "1B + 1C + 9D + 5F + 1FL0 + 1FL+ [1B/45S, 1D/45S]"
aurantium  <- "1A + 1B + 1C + 8D + 7F [1A/45S, 1B/45S, 1D/45S]"
reticulata <- "2C + 10D + 6F [2C/45S, 2D/45S]"

leftNotesdf <- data.frame(OTU = unique(threeSize$OTU), note = c(reticulata, limon, aurantium))

# authors
notesdf <- data.frame(OTU = unique(threeSize$OTU),
  note = c("da-Costa-Silva et al. (2015)", "Carvalho et al. (2005)", "Mendes et al. (in prep.)")
)

# marks' style data.frame

markStyleDF   <- makedfMarkColorMycolors(
  unique(citrusReticulataMarkPosDF$markName), c("darkgoldenrod1", "chartreuse3")
)

markStyleDF$style <- c("square", "dots")

11.7.5 Plot

{
  svg("climon.svg", width = 12, height = 10)
  par(mar = rep(0, 4), oma = rep(0, 4))
  plotIdiograms(dfChrSize = threeSize,   # chr. size data.frame
    dfMarkPos = threeMarkPos, # mark position data.frame (inc. cen.)
    dfMarkColor = markStyleDF, # mark style d.f.

    orderChr = "original",   # order of chr. as in d.f.
    chrIdPatternRem = "_.*", # pattern to remove from chr. names
    karHeight = 2,           # karyotype height
    karHeiSpace = 6,         # height + separ. among karyot.

    chrSpacing = .20,       # separ. among chr.
    chrColor = "dodgerblue",
    distTextChr = .9        # distance text to chr.

    , legendWidth = .8       # legend item width
    , legendHeight = 3       # legend item height
    , markLabelSpacer = 2    # legend spacer
    , ruler = FALSE          # do not use ruler
    , chrIndex = ""          # do not print chr. index
    , morpho = ""            # do not print morphology
    , karIndex = FALSE       # do not print kar. index

    # ,colorBorderMark = "black"# color of border of marks
    , lwd.chr = 1             # border width

    , OTUfont = 3             # OTU name in italics

    , leftNotes = leftNotesdf # data.frame with notes (formula)
    , leftNotesTextSize = 1.3 # font size of notes
    , leftNotesPosX = 0      # horizontal pos. of formula
    , leftNotesPosY = 1      # vertical pos. of formula
    , notes = notesdf        # authors

    , classGroupName = "Pair" # name for groups
    , chrNameUp = TRUE        # use col. chrNameUp
    , classChrName = "Type"   # change default title of inferior name
    , classChrNameUp = "Chr." # change default title of upper name

    , ylimBotMod = 1         # modify ylim bottom argument
    , ylimTopMod = 0         # modify ylim top argument
    , xlimLeftMod = 2        # modify left xlim
    , xlimRightMod = 5       # modify right xlim

    , threshold = 40         # fixes shrinking of scale, needed because some chr. greater than 3.5 um
    , moveKarHor = "C. limon" # kar. to move to right
    , mkhValue = 5           # move cariótipo para direita
    , anchor = TRUE          # parental structure
    , moveAnchorV = 1        # move anchor
    , anchorVsizeF = .35     # anchor vertical size factor modifier
    , karSepar = FALSE       # modif. separ de karyo.
  )
  dev.off() # close svg
}

For a plot of GISH of Citrus, visit the GISH chapter

12 Human Karyotype

Jupyter interactive version:
Open in ColabOpen in Colab   Github   Raw

12.1 Karyotype of 400 bands

Organize chr. in rows using column OTU. (Adler, 1994)

data.frame of chr. size

library(idiogramFISH)

FstRow <- length(which(humChr$group %in% c("A", "B")))        # groups in 1st row
SndRow <- length(which(humChr$group %in% "C"))               # groups in second row
TrdRow <- length(which(humChr$group %in% c("D", "E")))        # groups in third row
FrtRow <- length(which(humChr$group %in% c("F", "G", "sex")))  # groups in forth row

OTUdf <- data.frame(OTU = c(rep("row1", FstRow),
  rep("row2", SndRow),
  rep("row3", TrdRow),
  rep("row4", FrtRow)
), stringsAsFactors = FALSE
)

OTUdf$chrName <- humChr$chrName

humChr$OTU <- OTUdf$OTU
# Chromosome sizes for human
head(humChr) 
chrName group shortArmSize longArmSize OTU
1 A 5.600 5.890 row1
2 A 4.245 6.715 row1
3 A 4.220 4.720 row1
4 B 2.240 6.165 row1
5 B 2.110 5.920 row1
6 C 2.880 4.835 row2

Add OTU info. to data.frame of marks’ position

humMarkPos$OTU <- OTUdf$OTU[ match(humMarkPos$chrName, OTUdf$chrName) ]
head(humMarkPos)  
chrName markName chrRegion markDistCen markSize OTU
2 1 chr1p36.3 p 5.290 0.310 row1
3 1 chr1p36.2 p 5.100 0.190 row1
4 1 chr1p36.1 p 4.680 0.420 row1
5 1 chr1p35 p 4.435 0.245 row1
6 1 chr1p34.3 p 4.270 0.165 row1
7 1 chr1p34.2 p 4.110 0.160 row1

This is the data.frame of mark characteristics

head(humMarkColor)
markName markColor style
2 chr1p36.3 white square
3 chr1p36.2 black square
4 chr1p36.1 white square
5 chr1p35 black square
6 chr1p34.3 white square
7 chr1p34.2 black square

Plot

# fig.width = 10, fig.height = 28
par(mar = rep(0, 4))
plotIdiograms(humChr,         # data.frame of chromosome size (in package)
  dfMarkPos   = humMarkPos,   # df of mark positions  (in package)
  dfMarkColor = humMarkColor, # df of mark characteristics (in package)

  addOTUName  = FALSE,        # do not add name of OTU
  karHeight   = 6,            # vertical size of kar.
  karHeiSpace = 7,            # vertical spacing among OTU
  chrWidth    = .4,           # chr. width
  chrSpacing  = .6,           # space among chr.
  classChrName = "",          # string for naming chr.
  orderChr    = "group",      # order chr. by group name

  amoSepar    = 2,            # reduce distance among OTUs
  karIndex    = FALSE,        # do not add karyotype indices
  distTextChr = 1.5,          # distance from chr. to text.

  chrColor    = "black",      # chr. color
  chrIndex    = "",           # do not add chromosome indices
  morpho      = "",           # do not add morphological categories

  autoCenSize = FALSE,        # required for centromereSize
  centromereSize = 0,         # apparent centromere size

  squareness  = 10,           # squareness of chr. and marks
  legend      = "inline",     # mark labels next to chr.
  markLabelSize   = .5,       # size of legend font
  colorBorderMark = "black",  # force color of border of marks
  pattern         = "chr[0-9XY]+", # REGEX pattern to remove from name of marks
  indexIdTextSize = 2,         # font size of chr name and indices
  lwd.chr         = .5,        # width of chr and mark borders

  ruler        = FALSE,

  xlimRightMod = 0,           # space to the right of karyotype
  ylimBotMod   = -.6          # modify ylim of bottom
)

12.2 Robertsonian Translocations

This procedure transforms the data of long arms of the chromosomes 13 and 21 from data.frames of chr. and marks in a derivative (Robertson, 1916).

# extract 13 data
humChr13     <- humChr[which(humChr$chrName %in% 13), ]
humMarkPos13 <- humMarkPos[which(humMarkPos$chrName %in% 13), ]

# extract 21 data
humChr21     <- humChr[which(humChr$chrName %in% 21), ]
humMarkPos21 <- humMarkPos[which(humMarkPos$chrName %in% 21), ]

# Making derivative data.frame of Marks

# remove p arm from 21
humMarkPos21Der <- humMarkPos21[humMarkPos21$chrRegion == "q", ]
humMarkPos21Der$chrRegion <- "p"

# remove p arm from 13
humMarkPos13Der <- humMarkPos13[humMarkPos13$chrRegion == "q", ]

# rename fragments
humMarkPos21Der$chrName <- "t(13;21)"
humMarkPos13Der$chrName <- "t(13;21)"

# merge fragments of Marks
humMarkPosDer <- rbind(humMarkPos21Der, humMarkPos13Der)

# Making derivative data.frame of chr. size

humChrDer <- humChr13
humChrDer$shortArmSize <- humChr21$longArmSize
humChrDer$chrName <- "t(13;21)"

# Make data.frame of chr. to plot
humChr1321der <- rbind(humChr13, humChrDer, humChr21)
humChr1321der <- humChr1321der[, c("chrName", "shortArmSize", "longArmSize"), ]

# marks for them, together:
humMarkPos1321Der     <- rbind(humMarkPos13, humMarkPos21, humMarkPosDer)
humMarkPos1321Der$OTU <- NULL

plot of t(13;21)

plotIdiograms(humChr1321der,     # data.frame of size of chr.
  dfMarkPos = humMarkPos1321Der, # d.f of position of marks
  dfMarkColor = humMarkColor,    # d.f of style of marks

  addOTUName = FALSE,          # do not add OTU name

  autoCenSize = FALSE,         # required for centromereSize
  centromereSize = 0,          # apparent size of centromere
  roundness = 5,               # roundness of vertices of chr. and marks
  chrColor = "black",        # chr. color
  classChrName = "",           # string for naming chr.
  karHeight = 4,               # karyotype height without spacing

  chrIndex = "",               # do not add chr. indices
  morpho = "",                 # do not add chr. morphology
  karIndex = FALSE,            # do not add karyotype indices
  distTextChr = 2,             # distance from chr. to text.

  markLabelSize = .5,          # font size of chr. mark labels
  legend = "inline",           # mark labels next to chr.
  pattern = "chr[0-9]+",       # REGEX pattern to remove from mark names
  lwd.chr = .9,                # width of chr and mark borders

  ruler = FALSE,

  ylimBotMod = -.15             # modify ylim bottom argument
  , asp = 1                     # y x aspect ratio
)

12.3 function robert

This procedure transforms the data of long arms of the chromosomes 13 and 14 from data.frames of chr. and marks in a derivative (Robertson, 1916).

We can do any Robertsonian translocation using:

chrt13q14q <- robert(humChr, humMarkPos, 13, 14, "q", "q")

# which produces a list of two data.frames:

# 1. chr. sizes
dfChrSizeDer <- chrt13q14q$dfChrSizeDer
# remove the group column
dfChrSizeDer <- dfChrSizeDer[, !(names(dfChrSizeDer) %in% "group")]

# 2. marks' positions
dfMarkPosDer <- chrt13q14q$dfMarkPosDer

head(dfMarkPosDer)
chrName markName chrRegion markDistCen markSize OTU
613 t(13;14)(q10:q10) chr14q11.1 p 0.000 0.125 row3
713 t(13;14)(q10:q10) chr14q11.2 p 0.125 0.330 row3
813 t(13;14)(q10:q10) chr14q12 p 0.455 0.335 row3
913 t(13;14)(q10:q10) chr14q13 p 0.790 0.305 row3
1013 t(13;14)(q10:q10) chr14q21 p 1.095 0.600 row3
1113 t(13;14)(q10:q10) chr14q22 p 1.695 0.330 row3

plot of t(13;14)

par(mar = c(0, 2, .5, 0))

plotIdiograms(dfChrSizeDer,               # data.frame of chromosome size
  dfMarkPos = dfMarkPosDer,   # df of mark positions
  dfMarkColor = humMarkColor, # df of mark characteristics (in package)

  addOTUName = FALSE,         # do not add name of OTU
  karIndex = FALSE,           # do not add karyotype indices
  morpho = "",                # do not add morphological categories
  chrIndex = "",              # do not add chromosome indices
  classChrName = "",          # string for naming chr.

  chrColor = "black",         # chr. color
  chrWidth = 1,               # chromosome width
  karHeight = 9,              # kar. height without space

  autoCenSize = FALSE,        # required for centromereSize
  centromereSize = 0,         # apparent centromere size
  squareness = 7,             # squareness of chr. and marks

  markLabelSize = .5,         # size of legend font
  legend = "inline",          # mark labels next to chr.
  pattern = "chr[0-9XY]+",    # REGEX pattern to remove from name of marks
  distTextChr = 6,            # distance from chr. to text.
  indexIdTextSize = 2,        # font size of chr name and indices
  lwd.chr = .5,               # width of chr and mark borders
  colorBorderMark = "black",  # force color of border of marks

  ruler = FALSE,
  xlimLeftMod = 4             # space to the right of karyotype
)

13 Functions

Here you will find how to modify the characteristics of your plots. Default values in parentheses

13.1 Function plotIdiograms

Karyotypes

dfChrSize: mandatory data.frame, with columns: OTU (optional), chrName (mandatory), shortArmSize, longArmSize for monocen. or chrSize for holocen.

defaultFontFamily: character. use this as the font family. No default value.

revOTUs: (FALSE) If TRUE, reverses the order of OTUs in data.frame dfChrSize

verticalPlot: boolean, when TRUE karyotypes are plotted vertically, otherwise, horizontally. Defaults to TRUE

karHeight: (2) Vertical size of karyotypes considering only chromosomes. for ex karHeight = 1

karHeiSpace: (2.5) Vertical size of karyotypes including spacer. for ex karHeiSpace = 1.2

karSpaceHor: numeric, separation among horizontal karyotypes. When verticalPlot = FALSE. Defaults to 0

karSepar: (TRUE) If TRUE reduces the space among karyotypes. FALSE = equally sized karyotypes or TRUE = equally spaced karyotypes. Incompatible with addMissingOTUAfter

amoSepar: (9) For karSepar = TRUE, if zero, no space among karyotypes. Amount of separation. if overlap, increase this and karHeiSpace

addMissingOTUAfter: (NA) character vector, Pass to this parameter a vector of OTUs after which empty spaces (ghost karyotypes) must be added. See missOUTspacings and the phylogeny chapter

addMissingOTUBefore: character, when you want to add space (ghost OTUs) before one or several OTUs, pass the names of OTUs after the desired space in a character vector i.e. c("species one","species five")

missOTUspacings: (0) numeric vector. With the same length of addMissingOTUAfter. Pass to this parameter the number of ghost karyotypes following the OTUs passed to addMissingOTUAfter. See the phylogeny chapter

moveKarHor: character, OTUs’ names of karyotypes that should be moved horizontally. See mkhValue

mkhValue: numeric, value to move kar. hor. See moveKarHor

karAnchorLeft: character, OTUs’ names of karyotypes to the right of your desired anchor. For verticalPlot = FALSE

karAnchorRight: character, OTUs’ add anchor to the right of this OTU (names of karyotypes). For verticalPlot = FALSE

moveAllKarValueHor: numeric, similar to mkhValue, but affects all karyotypes.

moveAllKarValueY: numeric, similar to moveAllKarValueHor, but affects y axis.

n: (50) numeric, number of vertices for the rounded corners

markN: numeric, vertices number for round corners of marks

propWidth: boolean, defaults to FALSE. Diminishes chr. width with increasing number of OTUs. For backwards compatibility

Indices

chrIndex: ("both") character, add arm ratio with "AR" and centromeric index with "CI", or "both" (Default), or "" for none to each chromosome (Levan et al., 1964). See armRatioCIalso.

chrSize: boolean, when TRUE adds total chr size under each chr. Defautls to FALSE

chrNameUp: boolean, when TRUE adds secondary chromosome name from col. chrNameUp over chrs. Defaults to FALSE

nsmall: numeric, rounding decimals for chrSize parameter. Defaults to 1

chrSizeMbp: boolean, when TRUE adds total Mbp chr. size to each chr. provided, there is a Mbp column in dfChrSize data.frame. Defaults to FALSE. If data in columns shortArmSize, or col. chrSize is in millions (“Mbp”). Use chrSize = TRUE not this one (not column Mbp, you don’t need this).

morpho: ("both") character, if "both" (default) prints the Guerra (1986) and Levan (1964) classif. of cen. position. , use also "Guerra" or "Levan" or "" for none. See ?armRatioCI also (function).

nameChrIndexPos: (2) Modify position of name (CI, AR) of chr. indices, numeric value.

karIndex: (TRUE) boolean. Adds karyotype indices A (intra - cen) and A2 (inter - size) (Romero-Zarco, 1986; Watanabe et al., 1999). Disable with karIndex = FALSE

karIndexPos: (0.5) numeric. Modify position of karyotype indices, to the left or right

indexIdTextSize: font size of chr. and kar. indices and chromosome name

distTextChr: Vertical distance from indices (text) to the chromosome.

markPer: character, name of mark to calculate % of mark in chr. and add it to plot. See perAsFraction

perAsFraction: boolean, when TRUE % is shown as fraction. Defaults to FALSE. See markPer

showMarkPos: boolean, adds position of marks under karyotype (fraction 0-1) when TRUE. Defaults to FALSE

bToRemove: character, bands to remove from calc. of pos., when showMarkPos = TRUE

Anchor

anchor: boolean, when TRUE, plots a parent progeny structure in karyotypes in moveKarHor

anchorText: character, text to add to anchor structure near symbol. See anchor. Defaults to ""

anchorTextMoveX: numeric, for vertical plots with anchorText move text in X axis. Defaults to 0.5

anchorTextMoveY: numeric, for horizontal plots with anchorText move text in Y axis. Defaults to 1

anchorTextMParental: character, designed to fill with a character object the space left of a missing parental in the anchor structure.

anchorTextMoveParenX: numeric, for plots with anchorTextMParental move text in X axis. Defaults to 0

anchorTextMoveParenY: numeric, for plots with anchorTextMParental move text in Y axis. Defaults to 0

anchorLineLty: numeric, type of line in anchor, corresponds to lty. Defaults to 1

anchorVsizeF numeric, factor to modify vertical size of anchor 0.5 (default). Size itself is equal to karHeiSpace

anchorHsizeF: numeric, factor to modify horizontal size of anchor 1 (default).

moveAnchorV: numeric, displace anchor vertical portion to right or left. See anchor

moveAnchorH: numeric, displace anchor horizontal portion to right or left. See anchor

pchAnchor: numeric, symbol for anchor, see ?points and anchor

moveKarHor: character, OTUs’ names of karyotypes that should be moved horizontally. See mkhValue

mkhValue: numeric, value to move kar. hor. See moveKarHor

Notes

notes: data.frame or .csv name in quotes with columns OTU and note for adding notes to each OTU, they appear to the right of the karyotype

leftNotes: data.frame or .csv name in quotes with columns OTU and note for adding notes to each OTU, they appear to the left of the karyotype

leftNotesUp: data.frame or .csv name in quotes (to the left), similar to leftNotes, but intended for placement over kar.

notesTextSize: (0.4) numeric, font size of notes, see notes

leftNotesTextSize: numeric, font size of notes, see leftNotes

leftNotesUpTextSize: numeric, font size of notes, see leftNotesUp

notesPosX: (0.5) numeric, moves right notes in the x axis

notesPosY: numeric, move right notes down or up (y axis)

leftNotesPosX: (0.5) numeric, moves left notes in the x axis

leftNotesPosY: numeric, move leftNotes down or up (y axis)

leftNotesUpPosX: numeric, move up left notes to the right or left (x axis)

leftNotesUpPosY: numeric, move leftNotesUp down or up (y axis)

noteFont: numeric 1 for normal, 2 for bold, 3 for italics, 4 for bold-italics. See notes

leftNoteFont: numeric 1 for normal, 2 for bold, 3 for italics, 4 for bold-italics. See leftNotes

leftNoteFontUp: numeric 1 for normal, 2 for bold, 3 for italics, 4 for bold-italics. See leftNotesUp

parseTypes: boolean, parse in notes the Citrus chr. types names. Creates subindex pos. for FL. Defaults to TRUE

parseStr2lang: boolean, parse string in notes with function str2lang(paste0("paste(",note,")") ) for ex: "italic('C. sinensis'), ' Author'". See notes, leftNotes,leftNotesUp.

Units

MbThreshold: (10000) numeric. If chrSize > 10000 will be considered Mb. See MbUnit

threshold: (35) This is the max. value allowed for the main two significative digits, otherwise scale will shrink. For example, after 35 μm (Default), apparent size will be 3.5 (not 35) and scale interval will change. See ceilingFactor: you may have to use -1 for it. Introduced in 1.13

MbUnit: (Mb) character, text of units of title when MbThreshold met and OTU not in specialOTUNames. Introduced in 1.13. See specialyTitle

yTitle: (μm) character, units for common title.

specialyTitle: character, title of ruler if OTU is in specialOTUNames. Will not apply if MbThreshold met. In that case use MbUnit

specialChrWidth numeric, relative chromosome width. Defaults to 0.5 for OTUs in specialOTUNames

specialChrSpacing numeric, horizontal spacing among chromosomes for OTUs in specialOTUNames, see also chrWidth. Defaults to 0.5

specialOTUNames: character vector, normally title of ruler is μm or Mb (big numbers). Use this param. to be able to put a different unit in ruler title. See specialyTitle

classMbName: character, name of “chromosome” when in Mbp. Defaults to "Pm". See MbUnit

classcMName: character, name of “chromosome” when OTU in specialOTUNames. Defaults to "L.G."

classChrName: character, name of “chromosome” when in micrometers (apparently). Defaults to "Chr.". See specialOTUnames, classMbName, classcMName

classChrNameUp: character, name of “chromosome” for col. "chrNameUp". Defaults to "Type"

classGroupName: character, name of groups. Defaults to ""

OTU names

addOTUName: (TRUE) If TRUE adds name of species (OTU) under karyotype

OTUTextSize: (1) font size of OTU names, except when OTUasNote = TRUE see notesTextSize

OTUfont: numeric, 1 for normal, 2 for bold, 3 for italics, 4 for bold-italics

OTUfamily: character, font family for OTU name.

OTUasNote: (FALSE) See also notes. If TRUE OTU name is written to the right, as notes.

OTUasLeftNote: boolean, when TRUE adds OTU (species) name to the left-up

Chromosomes

chrNameUp: boolean, when TRUE adds secondary chromosome name from col. chrNameUp over chrs. Defaults to FALSE

orderBySize: deprecated

roundness: deprecated, See squareness

orderChr: ("size") size sorts chromosomes from the largest to the smallest. Other options: original, name, group (requires group column)

chrId: ("original") If you want to rename chromosomes from 1 to n use chrId = "simple". For original names use chrId = "original". For no names use chrId = ""

chrIdPatternRem: character, regex pattern to remove from chr. names

indexIdTextSize: (1) font size of chr. and kar. indices and chromosome name

distTextChr: (1) Vertical distance from name (text) of chromosome to the chromosome.

chrWidth: (0.5) Determines the width of chromosomes

chrSpacing: (0.5) Determines the horizontal spacing among chromosomes

chrColor: ("gray") Determines the color of chromosomes

squareness: (4) Make squared or rounded vertices for chromosomes. Smaller numbers = more rounded

lwd.chr: (0.5) thickness of border of chr., some marks; ruler. Also thick of cM marks when lwd.cM absent

Groups

groupSepar: numeric, factor for affecting chr. spacing chrSpacing among groups. Defaults to 0.5

groupUp: boolean, when TRUE, when groups present, they appear over the chr. name. Defaults to FALSE

groupName boolean, when TRUE (default), shows group names. When FALSE only line

Centromeres

autoCenSize boolean, when TRUE ignores centromereSize

centromereSize: Apparent size of centromeres. Requires autoCenSize = FALSE

cenColor: Determines the color of centromeres. if GISH use NULL. Defaults to chrColor

collapseCen boolean, avoid spacing in ruler between short arm and long arm.

fixCenBorder: boolean, when TRUE uses chrColor as centromere (and cen. mark) border color. See also cenColor, chrColor, colorBorderMark, borderOfWhiteMarks. No default value.

roundedCen: deprecated, see cenFormat

cenFormat: character, when "triangle", cen. has triangular aspect. When "rounded", it has rounded aspect (Default). "inProtein" for using the mark with style of same name.

cenFactor: numeric, modifies any cen. mark and cen. size. Defaults to 1

Chromatids

chromatids: boolean, when TRUE shows separated chromatids. Defaults to TRUE

arrowsBothChrt: boolean, when TRUE (default) (for chromatids = TRUE) shows upArrow, downArrow styles of marks in both chromatids when arrowsToSide = TRUE.

holocenNotAsChromatids: boolean, when TRUE and chromatids = TRUE does not plot holocen kar. with chromatids. Defaults to FALSE. A value of TRUE modifies excHoloFrArrToSide to TRUE always.

xModifier: numeric, for chromatids = TRUE, separation among chromatids. Quotient for chrWidth. Defaults to 12 : chrWidth/12

xModMonoHoloRate: numeric, factor to shrink xModifier for holocen. 5 means 5 times smaller (quotient).

Marks

dfMarkPos: pass to this argument the name of the data.frame of positions of marks. Currently includes GISH and centromeric marks (cen). See previous chapters. columns: OTU (opt), chrName, markName (name of site), chrRegion (for monocen. and opt for whole arm (w) in holocen.), markDistCen (for monocen.), markPos (for holocen.), markSize; column chrRegion: use p for short arm, q for long arm, cen for centromeric mark and w for whole chr. mark; column markDistCen: use distance from centromere to mark, not necessary for cen. marks (cen), w, p, q (when whole arm). See also param. markDistType

dfMarkColor: pass to this argument the name of the data.frame of marks characteristics, see previous chapters. Not mandatory for plotting marks. Specifying colors and style for marks (sites); columns: markName, markColor, style. style accepts: "square","squareLeft", "dots", "cM", "cMLeft","cenStyle", "upArrow", "downArrow", "exProtein". (if column style missing all (except 5S) are plotted as in param. defaultStyleMark).

roundness: Deprecated.

squareness: (4) Squared or rounded vertices when marks of the “square” style (defined in data.frame passed to dfMarkColor). Affects chromosomes also. Smaller numbers = more rounded

dfCenMarks: Only for centromereSize > 0, pass to this argument the name of data.frame of centromeric marks. Currently included in dfMarkPos. See previous chapters.

defaultStyleMark: character, default style of mark, only used when style column of dfMarkColor data.frame is missing or in absence of this data.frame. Use "square" (default),"squareLeft", "dots", "cM", "cMLeft","cenStyle", "upArrow", "downArrow".

alpha_val: numeric vector, make marks transparent, accepts values from 0 to 1, see scales::alpha

markDistType: ("beg") If you measure your marks to the beginning of mark use markDistType = "beg", if to the center of the mark, use "cen".

origin: ("b") If you measure your mark from the bottom of chromosome use origin = "b", or "t" from top. Applies to holocentrics. (monocentrics marks are measured from centromere)

efZero: numeric, internal, numbers below this one will be considered as zero, for comparison purposes. Defaults to 1e-5

cMBeginCenter: boolean, start position of cM and cMLeft marks. If TRUE, starts in the center (width) of chr. . Defaults to FALSE

protruding: (0.2) numeric, when style of mark is “cM”, “upArrow”, “downArrow” (inline), fraction of chrWidth to stretch marker.

startPos: numeric, factor to increase separation of exProtein marks to chromosome. Defaults to 0

pMarkFac: numeric, fraction of chr. size for exProtein style marks. Defaults to 0.25

dotRoundCorr: numeric, to be deprecated, requires useXYfactor = TRUE corrects roundness of dots and vertices of chromosomes. When style of sites = dots, an increase in this, makes the horizontal radius of the dot smaller. Use asp = 1 instead

useXYfactor : boolean, for backwards compatibility, for using dotRoundCorr. Defaults to FALSE

useOneDot: boolean, use one dot instead of two in style of marks dots. Defaults to FALSE

dotsAsOval: boolean, use oval instead of two dots in style of marks dots. Defaults to FALSE. See useOneDot. Not useful for chromatids = TRUE or circularPlot = TRUE

markN: numeric, vertices number for round corners of marks

Color

mycolors: optional, character vector with colors’ names, which are associated automatically with marks according to their order in the data.frame of position of marks. See this ordering with unique(dfMarkPos$markName). Argument example: mycolors = c("red","chartreuse3","dodgerblue"). Not mandatory for plotting marks, package has default colors.

defCenStyleCol: character, color of outer part of cenStyle marks. Defaults to white

Borders

chrBorderColor: character, color for border of chromosomes, defaults to chrColor

gishCenBorder: boolean, when TRUE, cen. mark border color is the same as mark color, ignoring colorBorderMark. No default.

hideCenLines: numeric, factor to multiply line width (lwd) used for covering cen. border, when chrColor is white or when gishCenBorder = TRUE

borderOfWhiteMarks: (TRUE) boolean, when TRUE uses black border for white marks. See dfMarkColor. Does not apply to marks with cenStyle

colorBorderMark: character, without default, pass a name of a color to use as border of marks. See borderOfWhiteMarks

fixCenBorder: boolean, when TRUE uses chrColor as centromere (and cen. mark) border color. See also cenColor, chrColor, colorBorderMark, borderOfWhiteMarks. No default value.

lwd.chr: (0.5) width of border lines for chr. and marks when related param. absent.

lwd.mimicCen: thickness of lines of cenStyle marks; affects only lateral borders. Defaults to lwd.chr

lwd.marks: thickness of most marks. Except cM marks and centr. related marks. See lwd.chr, lwd.cM

lwd.cM: thickness of cM marks. Defaults to lwd.chr

Arrows

excHoloFrArrToSide: boolean, when arrowsToSide = TRUE, excludes holocen. from this behaviour, plotting a centered arrow only.

arrowhead numeric, proportion of head of arrow (mark styles: upArrow,downArrow). Defaults to 0.3

shrinkArrow numeric, proportion, shrinks body of arrow. Defaults to 0.3333

arrowheadWidthShrink numeric, proportion, shrinks head of arrow. Defaults to 0.1

arrowsToSide boolean, when FALSE use a centered arrow, instead of an arrow next to chr. margins. Defaults to TRUE. See arrowsBothChrt

arrowsBothChrt: boolean, when TRUE (default) (for chromatids = TRUE) shows upArrow, downArrow styles of marks in both chromatids when arrowsToSide = TRUE.

cMBeginCenter: boolean, start position of cM and cMLeft marks. If TRUE, starts in the center (width) of chr. . Defaults to FALSE

protruding: (0.2) numeric, when style of mark is “cM”, “upArrow”, “downArrow” (inline), fraction of chrWidth to stretch marker.

Labels

This parameters have to do with the legends

pattern: ("") REGEX pattern to eliminate from the marks name when plotting. See human karyotype chapter for example.

legend: ("aside") If you wanto to plot the names of marks near each chromosome use legend = "inline", to the right of karyotypes use legend = "aside", otherwise use legend = "" for no legend. See markLabelSpacer

remSimiMarkLeg: boolean, when legend = "aside", if you use the pattern arg., you can get several marks with “same” name. When TRUE this remove this pseudoduplicates from legend. Be sure that this pseudoduplicates have the same color, otherwise you should use FALSE.

bannedMarkName: character, character string or vector with mark names to be removed from plot. Not the marks but the labels. See bMarkNameAside

bMarkNameAside: boolean, when TRUE and legend = "inline", shows marks in bannedMarkName as legend = "aside" would do. See bannedMarkName

forbiddenMark: character, character string or vector with mark names to be removed from plot. Not the marks but the labels.

legendWidth: (1.7) numeric, factor to modify the width of the square and dots of legend. For legend = "aside".

legendHeight: (NA) numeric, factor to modify the height of the square and dots of legend. For legend = "aside".

markLabelSize: (1) Determines the size of text of the legend.

markLabelSpacer: (1) When legend = "aside" determines the separation of legends from the karyotype right side

legendYcoord: numeric, modify Y position of legend when legend = "aside"

markNewLine: character, character to split mark Names into different lines. Applies to square marks. Defaults to NA

mylheight: numeric, for markNewLine!=NA; is equivalent to lheight of par: “The line height multiplier. The height of a line of text (used to vertically space multi-line text) is found by multiplying the character height both by the current character expansion and by the line height multiplier.” Defaults to 0.7.

Rulers

ruler: (TRUE) When TRUE displays ruler to the left of karyotype, when FALSE shows no ruler

rulerPos: (-0.5) Absolute position of ruler, corresponds to “pos” argument of the function axis of R plots

rulerPosMod: Deprecated

ruler.tck: (-0.02) tick size of ruler, corresponds to “tck” argument of axis function

rulerNumberPos: (0.5) numeric, Modify position of numbers of ruler

rulerNumberSize: (1) Size of number’s font in ruler

rulerInterval: numeric, intervals in ruler.

rulerIntervalcM: numeric, intervals in ruler of OTU in specialOTUNames.

rulerIntervalMb: numeric, intervals in ruler of OTU with data in Mb (>MbThreshold) and absent from specialOTUNames.

ceilingFactor: (0) numeric, affects number of decimals for ceiling. Affects max. value of ruler. When threshold is greater than 35 this may have to be negative.

xPosRulerTitle: (2.6) Modifies the horizontal position of the title of rulers (Mb, etc). Moves to left from 1st chr. in chrSpacing times

yPosRulerTitle: numeric, affects vertical position of ruler title. Defaults to 0

rulerTitleSize: Font size of units (title).

useMinorTicks: boolean, display minor ticks between labeled ticks in ruler. See miniTickFactor. Defaults to FALSE. (ticks without label)

miniTickFactor: numeric, number of minor ticks for each labeled tick. See useMinorTicks. Defaults to 10

Margins

You can establish margins with par as in any R plot, and also with this parameters. These works as a quick fix to increase desired size of plot when some elements are outside of margins:

xlimLeftMod: (1) modifies xlim left (first) component of the plot as in any “R-plot”

xlimRightMod: (2) xlim (right) modification by adding space to the right of idiograms

ylimBotMod: (0.2) modify ylim bottom component of plot adding more space

ylimTopMod: (0.2) modify ylim top component of plot adding more space.

callPlot: boolean, create new plot in your device. Defaults to TRUE

asp: numeric, y x aspect of plot. Defautls to 1

… accepts other arguments for the plot. See ?plot

Circular plot

circularPlot: boolean, if TRUE chromosomes are plotted in concentric circles. Defaults to FALSE. See verticalPlot

shrinkFactor: numeric, for circularPlot = TRUE percentage of usage of circle. Defaults to 0.9

separFactor: numeric, for circularPlot = TRUE modify separation of concentric karyotypes. Defaults to 1.5

labelSpacing: numeric, for circularPlot = TRUE. Spacing of mark labels. Defaults to 0.7

labelOutwards: boolean, inline labels projected outwards

chrLabelSpacing: numeric, for circularPlot = TRUE. Spacing of chr. labels. Defaults to 0.5

radius: numeric, for circularPlot = TRUE. Affects radius of karyotypes. Defaults to 0.5

rotation: numeric, anti-clockwise rotation, defaults to 0.5 which rotates first chr. from top to -90 degrees. (-0.5*π = 9 o’clock)

circleCenter: numeric, for circularPlot = TRUE. Affects coordinates of center of circles. Affects legend = "aside" position.

circleCenterY: numeric, for circularPlot = TRUE. Affects coordinates of center of circles. Affects legend = "aside" position.

OTUlabelSpacing: numeric, for circularPlot = TRUE. Spacing for OTU names. Defaults to 0.3

OTUsrt: numeric, for circularPlot = TRUE. Angle to use for OTU names. Defaults to 0. See OTUplacing

OTUplacing: character, for circularPlot = TRUE. location of OTU name. Defaults to "first", which plots name of OTU near first chr. "number" places number near 1st chr. and index and name of OTU to the right or center. "simple" places name of OTU to the right or center without numbering. See also OTUcentered

OTULabelSpacerx: numeric, for circularPlot = TRUE and OTUplacing = "number" or "simple". Modifies x names position

OTULabelSpacery: numeric, for circularPlot = TRUE and OTUplacing = "number" or "simple". Modifies y names position

OTUcentered: boolean, for circularPlot = TRUE and OTUplacing = "number" or "simple". OTU name in center of circle when TRUE, otherwise, to the right.

OTUjustif: numeric, for circularPlot = TRUE and OTUplacing = "number" or "simple". Justification of OTU name. 0 = left (Default); use 0.5 for centered. See ?text -> adj

OTUlegendHeight: numeric, for circularPlot = TRUE and OTUplacing = "number" or "simple". Modifies y names separation

13.2 Function robert

chr1: name of chr. See ?robert

chr2: name of chr. ?robert

arm1: arm of chr1 to be included ?robert

arm2: arm of chr2 to be included ?robert

13.3 Function genBankReadIF

filename.gb: name of file to read, downloaded from genBank, or name of genbank object produced with rentrez::entrez_fetch(db = "nuccore", id = "theID", rettype = "gbwithparts", retmode = "text")

13.4 Function namesToColumns

marksDf: data.frame with columns: markName, style,markPos

dfChrSize: data.frame, size of chr. Same of plot.

markType: (c("downArrow","upArrow","cMLeft","cM")), character, mark to arrange in columns

amountofSpaces: (13) numeric, number of characters for each column

colNumber: (2) numeric, number of columns

protruding: (0.5) numeric, same as plot, minimal protruding for arrow marks, equivalent to cM protruding

protrudingInt: (0.5) numeric, spacing of columns in terms of width of chr. percent 1 = 100%. Defaults to 0.5

circularPlot: (TRUE) boolean, use TRUE for circular plots. Use FALSE otherwise

rotation: (0.5) numeric, same as plot, anti-clockwise rotation, defaults to 0.5 which rotates chr. from top to -90 degrees. (-0.5*π )

defaultStyleMark: ("square") character, if some data in column style missing fill with this one. Defaults to “square”

orderBySize: Deprecated

orderChr: (size) character, when "size", sorts chromosomes by total length from the largest to the smallest. "original": preserves d.f. order. "name": sorts alphabetically; "group": sorts by group name; "chrNameUp": sorts according to column chrNameUp. See chrNameUp

halfModDown: (NA) numeric, for circ. plots, when plotting several chromosomes in a circular plot, using a small value 0.05 corrects for alignment problems of downArrows, cMLeft labels. Defaults to NA

halfModUp: (NA) numeric, for circ. plots, when plotting several chromosomes in a circular plot, using a small value 0.05 corrects for alignment problems of upArrows, cM labels. Defaults to NA

rotatMod: (0) numeric, for circ. plots, when rotation != 0 (diff.), corrects alignment of labels. Defaults to 0

13.5 Function citrusSize

A: number of A to calculate

B: number of B to calculate

C: number of C to calculate

D: number of D to calculate

E: number of E to calculate

F: number of F to calculate

FL: number of FL+ to calculate

FL0: number of FL0 to calculate

G: number of G to calculate

shortArm: for A to G (not FL)

longArm: for A to G (not FL)

shortArmFL: for FL

longArmFL: for FL

OTU: name of species

13.6 Function citrusMarkPos

chrSizeDf: data.frame created with citrusSize function

mSizePter: numeric, default size for P(short) ter (terminal) bands. 0.25 (default)

mSizeQter: numeric, default size for Q(long) ter (terminal) bands. 0.35 (default)

mSizePprox: numeric, default size for P prox (proximal) bands. 0.35 (default)

mOther: numeric, default size for other bands. 0.25 (default)

markName: character, default name of mark “CMA”, or “45S”, respectively. (citrusMarkPos, markOverCMA)

13.7 Function markOverCMA

markName: character, default name of mark “CMA”, or “45S”, respectively.

citrusMarkPosDF: data.frame, with CMA marks (markOverCMA)

chrType: character, defaults to “B”, chr. type to duplicate mark (markOverCMA)

chrName: character, defaults to “B”, chr. name to duplicate mark (markOverCMA)

chrRegion: character, arm, defaults to “p”. for mark duplication (markOverCMA)

13.8 Other functions

Use ?function

armRatioCI(dfChrSize)

swapChrRegionDfSizeAndMarks(dfChrSize, dfMarkPos, chrNamesToSwap)

asymmetry(dfChrSize)

asymmetryA2(dfChrSize)

13.9 helper functions for ggplot

mapChr <- mapGGChr(dfChrSizeHolo)

mapChrMark <- mapGGChrMark(dfChrSizeHolo, dfMarkPosHolo)

14 Datasets

14.1 Chr. basic data Holo.

dfChrSizeHolo: Example data for holocentrics for 1 species

bigdfChrSizeHolo: Example data for holocentrics for several species, OTU

parentalAndHybHoloChrSize: Example data for holocentrics for several species, OTU

bigdfOfChrSize3Mb: Example data in Mb without chr. arms for three species, OTU

Format

data.frame with columns:

OTU grouping OTU (species), optional if only one OTU

chrName name of chromosome

chrSize size of chromosome, micrometers or Mb

group chromosome group, optional

chrNameUp optional name over kar.

Mbp optional name to show size in Mbp under kar., use only when chrSize is not in Mbp. To be used with chrSizeMbp = TRUE

14.2 Chr. basic data Monocen.

dfOfChrSize: Example data for monocentrics

bigdfOfChrSize: Example data for monocentrics for several species, OTU

humChr: Data for human karyotype, measured from Adler (1994)

allChrSizeSample: Example data for monocentrics for several species, OTU

parentalAndHybChrSize: Example data for monocentrics for GISH

traspadf: Example data for Tradescantia (Rhoeo) spathacea (Golczyk et al., 2005)

Format

data.frame with columns:

OTU species, optional if only one OTU (species)

chrName name of chromosome

shortArmSize size of short arm, micrometers

longArmSize size of long arm, micrometers

group chr group, optional

chrNameUp optional name over kar.

Mbp optional name to show size in Mbp, use only when shortArmSize is not in Mbp

14.3 Mark characteristics

Source: R/dfMarkStyle.R

style column does not apply to cen. marks, only color.

dfMarkColor: Example General data for marks NOT position

humMarkColor: human bands’ characteristics, from Adler (1994)

mydfMaColor: mark characteristics used in vignette of phylogeny

Format

dfMarkColor a data.frame with columns:

markName name of mark

markColor use R colors

style character, use square or dots, optional

protruding numeric, modifies aspect of cM/cMLeft marks, see parameter protruding in plotIdiograms, optional

14.4 Mark Positional data - Holocen.

Source: R/markdataholo.R

bigdfMarkPosHolo: Example data for mark position of holocentrics with column OTU

dfMarkPosHolo: Example data for mark position of holocentrics

dfAlloParentMarksHolo: Example data for mark position of GISH

bigdfOfMarks3Mb: Example data for mark position in Mb

Format

data.frame with columns:

OTU OTU, species, optional

chrName name of chromosome

markName name of mark

markPos position from bottom or top (see parameter origin in plotIdiograms)

markSize size of mark in micrometers or Mb

14.5 Mark Positional data - monocentrics

Source: R/markposDFs.R

bigdfOfMarks: Example data for mark position with column OTU

dfOfMarks: Example data for marks’ position

dfOfMarks2: Marks’ position including cen. marks

humMarkPos: human karyotype bands’ (marks) positions, measured from Adler (1994)

allMarksSample: Example data for marks’ position

dfAlloParentMarks: Example data for mark position of GISH of monocen.

traspaMarks: T. spathacea (Rhoeo) marks’ positions, from Golczyk et al. (2005)

Format

bigdfOfMarks a data.frame with columns:

OTU OTU, species, mandatory if in dfChrSize

chrName name of chromosome

markName name of mark

chrRegion use p for short arm, q for long arm, and cen for centromeric

markDistCen distance of mark to centromere (not for cen)

markSize size of mark (not for cen)

14.6 File eightSpIqtree.treefile

See chapter phylogeny (Nguyen et al., 2015)

14.7 File revBayesTutorial.tree

See chapter phylogeny (Höhna et al., 2017)

News

idiogramFISH 2.0.13.9000

06-06-2024

Docs:

  • Building of the complete version of the vignette requires pandoc 3.2 because .svg embedding is faulty after 3.1.6

idiogramFISH 2.0.13

22-08-2023

Docs:

  • Fix arguments descriptions

idiogramFISH 2.0.12

06-06-2023

Docs:

  • Fix link on DESCRIPTION file

idiogramFISH 2.0.11

05-04-2023

Bug:

  • Fix genBank processing when only one match

idiogramFISH 2.0.10

05-04-2023

param:

  • alpha_val: modify transparency of marks

idiogramFISH 2.0.9

14-09-2022

  • refactoring of code

idiogramFISH 2.0.8

27-12-2021

  • Accepts .csv files to notes parameters
  • circularPlot = TRUE now compatible with chromatids = TRUE showing chromatids in circ. plots
  • centromere is now subtracted from arm, so ruler is continuous in monocen. (collapseCen).
  • new chrRegion possible (column in data.frame dfMarkPos): pcen qcen. It’s behavior is similar to cen

param:

  • dfCenMarks: deprecated
  • collapseCen: boolean, avoid spacing in ruler between short arm and long arm.
  • anchorHsizeF: numeric, factor to modify horizontal size of anchor 1 (default).

Shiny:

  • Change in default values for new data.frames
  • Fixed parsing of yTitle in code tab
  • Download and upload custom presets

idiogramFISH 2.0.6

27-09-2021

  • Added possibility of showing several % (span) of marks, ex. markPer = c("5S","45S")
  • perMark and posCalc functions produce data.frames
  • Added parameters: autoCenSize, leftNotesUpPosX
  • Modified parameters: centromereSize, rulerIntervalMb
  • function asymmetry better dealing with unexpected cases
  • function armRatioCI better dealing with unexpected cases

Shiny:

  • New menu stats to export indices and marks’ stats
  • Several parameters added
  • Several examples added to presets

Bugs:

  • Better dealing with horizontal karyotypes
  • Fixed bug of displaying pos. of bands when showMarkPos= TRUE

param:

  • rulerIntervalMb: Use data in millions
  • leftNotesUpPosX: numeric, move up left notes to the right or left (x axis)
  • autoCenSize boolean, when TRUE ignores centromereSize
  • centromereSize: Apparent size of centromeres. Requires autoCenSize = FALSE
  • showBandList in posCalc function to avoid adding mark names

idiogramFISH 2.0.5

19-05-2021

Shiny:

  • New dependence install options for the shiny app runBoard() function
  • Better dealing with pandoc versions in shiny app

idiogramFISH 2.0.4

23-04-2021

  • Fixed bug of too many fonts (angles) when hundreds of marks for .svg for labelOutwards = TRUE
  • jupyter notebooks for working locally or online in colab

Shiny:
* Some improvements for shiny app runBoard()

idiogramFISH 2.0.3

12-04-2021

  • Improvements in genBankReadIF function

Shiny:

  • Downloading with rentrez package and plotting of chromosomes in shiny app

param:

  • markN numeric, vertices number for round corners of marks

idiogramFISH 2.0.2

02-03-2021

  • Added new style of mark exProtein (param: startPos, pMarkFac) and inProtein for circular plots also.
  • Added new style of centromere inProtein
  • better reading of genBank data by function genBankReadIF
  • changes in dealing with chrWidth and other param. in circular plots
  • Added parameters: startPos, pMarkFac,cenFormat,cenFactor
  • Modified parameters: bannedMarkNameAside, xModifier, roundedCen

param:

  • bannedMarkNameAside renamed to bMarkNameAside
  • startPos numeric, factor to increase separation of exProtein marks to chromosome. Defaults to 0
  • pMarkFac numeric, fraction of chr. size for exProtein style marks. Defaults to 0.25
  • xModifier was modified, now quotient of chrWidth
  • roundedCen: deprecated, see cenFormat
  • cenFormat: character, when "triangle", cen. has triangular aspect. When "rounded", it has rounded aspect (Default). "inProtein" for using the mark with style of same name.
  • cenFactor: numeric, modifies any cen. mark and cen. size. Defaults to 1

Shiny App:

  • Several changes in UI
  • show/hide default values in code tab
  • save data.frames as .rds too
  • better update of log tab

idiogramFISH 2.0.0

05-02-2021

  • Added option to add OTU name as leftNotesUp (OTUasLeftNote)

Shiny:

param:

  • anchorTextMoveParenX numeric, for plots with anchorTextMParental move text in X axis. Defaults to 0
  • anchorTextMoveParenY numeric, for plots with anchorTextMParental move text in Y axis. Defaults to 0
  • OTUasLeftNote boolean, when TRUE adds OTU (species) name to the left-up

idiogramFISH 1.16.8

30-11-2020

  • Added rounded vertices for ggplot related functions
  • Better parsing of FL (chr. name formatting) and similar text in notes
  • Sorting of chr. by chrNameUp column added.

param:

  • leftNotesUpPosY numeric, move up-left-notes leftNotesUp down or up (y axis)

idiogramFISH 1.16.7

15-10-2020

  • Helper functions for simple plots with ggplot mapGGChr and mapGGChrMark
  • Better customization of anchor

param:

  • addMissingOTUBefore: character, when you want to add space (ghost OTUs) before one or several OTUs, pass the names of OTUs after the desired space in a character vector i.e. c("species one","species five")
  • karAnchorRight: character, OTUs’ add anchor to the right of this OTU (names of karyotypes). For verticalPlot = FALSE
  • anchorText: character, text to add to anchor structure near symbol. See anchor. Defaults to ""
  • anchorTextMParental: character, designed to fill with a character object the space left of a missing parental in the anchor structure.
  • anchorTextMoveX: numeric, for vertical plots with anchorText move text in X axis. Defaults to 0.5
  • anchorTextMoveY: numeric, for horizontal plots with anchorText move text in Y axis. Defaults to 1
  • anchorLineLty: numeric, type of line in anchor, corresponds to lty. Defaults to 1

idiogramFISH 1.16.6

16-09-2020

  • Support for F+ chr. types in citrus functions
  • Horizontal arrange introduced verticalPlot = FALSE
  • Horizontal anchor for karyotypes in karAnchorLeft
  • Move all karyotypes moveAllKarValueY, moveAllKarValueHor
  • Introducing more notes, over kar., leftNotesUp
  • dotsAsOval convert dots style to one oval. not for circ. plots.
  • useOneDot now for regular plots (non-circular) also.
  • better plotting of white chr. in circular plots
  • Fixed bug of dots size in circular plots
  • Fixed bug of ruler of long arm.
  • Fixed bug when chr. name FL
  • Fixed bug when calculating mark size when NA - GISH
  • Better plotting of white chr.
  • square marks name splitting

param:

  • verticalPlot: boolean, when TRUE karyotypes are plotted vertically, otherwise, horizontally. Defaults to TRUE
  • karSpaceHor: numeric, separation among horizontal karyotypes. When verticalPlot = FALSE. Defaults to 0
  • karAnchorLeft: character, OTUs’ names of karyotypes to the right of your desired anchor. For verticalPlot = FALSE
  • moveAllKarValueHor: numeric, similar to mkhValue, but affects all karyotypes.
  • moveAllKarValueY: numeric, similar to moveAllKarValueHor, but affects y axis.
  • leftNotesUp: data.frame, (to the left), similar to leftNotes, but intended for placement over kar.
  • leftNotesPosX: (0.5) numeric, moves left notes in the x axis
  • notesPosX: (0.5) numeric, moves right notes in the x axis
  • noteFont: numeric 1 for normal, 2 for bold, 3 for italics, 4 for bold-italics. See notes
  • leftNoteFont: numeric 1 for normal, 2 for bold, 3 for italics, 4 for bold-italics. See leftNotes
  • leftNoteFontUp: numeric 1 for normal, 2 for bold, 3 for italics, 4 for bold-italics. See leftNotesUp
  • parseTypes: boolean, parse in notes the Citrus chr. types names. Creates subindex pos. for FL.
  • parseStr2lang: bolean, parse string in notes with function str2lang(paste0("paste(",note,")") ) for ex: "italic('C. sinensis'), ' Author'". See notes, leftNotes,leftNotesUp.
  • gishCenBorder: boolean, when TRUE, cen. mark border color is the same as mark color, ignoring colorBorderMark. No default.
  • hideCenLines: numeric, factor to multiply line width (lwd) used for covering cen. border, when chrColor is white or when gishCenBorder = TRUE
  • markNewLine, character, character to split mark Names into different text lines. Applies to square marks. Defaults to NA
  • mylheight, numeric, for markNewLine!=NA; is equivalent to lheight of par: “The line height multiplier. The height of a line of text (used to vertically space multi-line text) is found by multiplying the character height both by the current character expansion and by the line height multiplier.” Defaults to 0.7.
  • bannedMarkNameAside: boolean, when TRUE and legend = "inline", shows marks in bannedMarkName as legend = "aside" would do. See bannedMarkName
  • forbiddenMark: character, character string or vector with mark names to be removed from plot. Not the marks but the labels.
  • lwd.marks: thickness of most marks. Except cM marks and centr. related marks. See lwd.chr, lwd.cM
  • dotsAsOval: boolean, use oval instead of two dots in style of marks dots. Defaults to FALSE. See useOneDot. Not useful for chromatids = TRUE or circularPlot = TRUE

idiogramFISH 1.16.1

29-07-2020

  • squareLeft new style of mark. as square but with legend to the left when inline.
  • minor ticks possible
  • add mark % of chr. and position to plot.
  • additional column chrNameUp for name over kar.
  • show chr. sizes in μm and Mbp under kar.
  • when OTUfont = 3 (italics), var. name present inside ' is not shown in italics
  • added anchor structure for progenies, see GISH
  • notesLeft deprecated pass data.frame to leftNotes
  • Better separation of groups
  • FL+ chr. name now corrected in plot, previously FLNA
  • ylabline renamed to xPosRulerTitle

param:

  • groupSepar: numeric, factor for affecting chr. spacing chrSpacing among groups. Defaults to 0.5
  • useMinorTicks: boolean, display minor ticks between labeled ticks in ruler. See miniTickFactor. Defaults to FALSE. (ticks without label)
  • miniTickFactor: numeric, number of minor ticks for each labeled tick. See useMinorTicks. Defaults to 10
  • xPosRulerTitle: (2.6) Modifies the horizontal position of the title of rulers (Mb, etc). Moves to left from 1st chr. in chrSpacing times
  • yPosRulerTitle: numeric, affects vertical position of ruler title. Defaults to 0
  • markPer: character, name of mark to calculate % of mark in chr. and add it to plot. See perAsFraction
  • perAsFraction: boolean, when TRUE % is shown as fraction. Defaults to FALSE. See markPer
  • showMarkPos: boolean, adds position of marks under karyotype (fraction 0-1) when TRUE. Defaults to FALSE
  • bToRemove: character, bands to remove from calc. of pos.
  • chrSize show chr. size under karyo.
  • chrNameUp use col. of the same name to add secondary name over kar.
  • classMbName “chromosome” name when in Mbp
  • classcMName “chromosome” name when in cM
  • classChrName “chromosome” name when in μm
  • classChrNameUp “chromosome” name chrNameUp
  • classGroupName name of title of groups
  • nsmall digits for rounding of chrSize
  • chrSizeMbp show chr. size Mbp requires col. Mbp
  • groupName, hide or show group name
  • leftNotes, similar to notes
  • leftNotesPosX, x
  • leftNotesPosY, y
  • moveKarHor, move kar. to right
  • mkhValue, amount to move to right
  • anchor, display anchor for moveKarHor OTUs
  • anchorVsizeF factor to modify vertical size of anchor
  • moveAnchorV, move anchor vertical portion
  • moveAnchorH, move anchor horizontal portion
  • pchAnchor, symbol in anchor
  • rulerPosMod deprecated

idiogramFISH 1.15.3

01-07-2020

main changes:

  • Better plotting of GISH with chromatids
  • change in messages when missing data
  • chr. in groups are closer
  • parsing of citrus names of chromosomes FL+ and FL0 automatic
  • helper functions for plotting Citrus karyotypes:
    • citrusSize, citrusMarkPos, markOverCMA

param: (plotIdiograms)

  • efZero threshold for checking if != 0
  • orderChr, order of chr. Replaces orderBySize - deprecated. Values = size, original, name, group
  • orderBySize - deprecated
  • notesLeft note position to the left when TRUE
  • notesPosY y axis modify notes position
  • chrIdPatternRem regex pattern to remove from chr. names

idiogramFISH 1.15.1

02-06-2020

  • introducing ‘chromatids’
  • new rounded style of centromere added (default).
  • better naming of w position marks when inline
  • changed logic of cenStyle coloring

param:

  • chromatids show separated chromatids
  • holocenNotAsChromatids do not use chromatids in holocen.
  • arrowsBothChrt prints arrow marks in both chromatids
  • excHoloFrArrToSide excludes holocentrics from arrowsToSide config.
  • xModifier separation among chromatids
  • xModMonoHoloRate shrink holocen. separ among chromatids with this quotient.
  • remSimiMarkLeg remove “duplicated” name of labels when presence of pseudoduplicates arising from pattern
  • bannedMarkName remove this mark name from labels (legends)
  • defCenStyleCol color for external part of marks with cenStyle
  • roundedCen rounded centromere
  • lwd.mimicCen line width for cenStyle marks
  • squareness new name for roundness (deprecated)

idiogramFISH 1.14.11

23-04-2020

  • genBankReadIF function, now allows duplicated field names
  • cMLeft style of mark added
  • cM and cMLeftstyles are used as inline type of legend for arrows (upArrow,downArrow)
  • A new column protruding can be added to dfMarkColor data.frame to define aspect of cM marks
  • namesToColumns new function to avoid overlap of mark names, for holoc. and monoc.

params (namesToColumns):

  • marksDf data.frame of marks
  • dfChrSize data.frame, size of chr. same as plot.
  • markType of type “downArrow”,“upArrow”,“cM”,“cMLeft”
  • amountofSpaces numeric, number of spaces for each column
  • colNumber numeric, number of columns
  • protruding numeric, same as plot, equivalent to cM protruding
  • protrudingInt numeric, spacing of columns in terms of width of chr. percent 1 = 100%.
  • circularPlot same as plot
  • rotation same as plot
  • defaultStyleMark if some data in column style missing fill with this one
  • orderBySize same as in plot.
  • halfModUp when plotting several chromosomes in a circular plot, corrects for alignment problems of “upArrows”, “cM” labels.
  • halfModDown when plotting several chromosomes in a circular plot, corrects for alignment problems of “downArrows”, “cMLeft” labels.
  • rotatMod for circ. plots, when rotation diff. from 0, corrects alignment of labels.

params:

  • cMBeginCenter modifies start position of cM and cMLeft marks
  • arrowsToSide arrows are plotted near chr. margin

idiogramFISH 1.14.7

27-03-2020

  • Compatibility with rentrez downloaded data
  • Better reading of join from genBank data
  • new styles of mark: cenStyle to add constrictions anywhere; upArrow (clockwise in circular plot); downArrow (anti-clockwise in circular plot)
  • fixed bug when legend = "inline" in circular plots

params:

  • rulerTitleSize: Font size of units (title)
  • arrowhead: proportion of head of arrow - length
  • shrinkArrow: proportion to shrink body of arrow - width
  • arrowheadWidthShrink: proportion to shrink arrowhead - width

idiogramFISH 1.14.2

26-02-2020

  • Introducing circular plots circularPlot = TRUE and other params. for circular plot
  • function genBankReadIF to read plasmid or prokaryote data. Uses tidyr.
  • function swapChrRegionDfSizeAndMarks to swap arm size and marks
  • tolerance when column markSize absent

params:

  • legendYcoord: modify mark legend Y pos (for common plot also)
  • callPlot: call plot.new or use your device (when FALSE)

params: (circularPlot = TRUE)

  • shrinkFactor: size of chr. in fraction of circle
  • separFactor: separ among kar.
  • labelSpacing: among label and chr.
  • chrLabelSpacing: chr. label space
  • OTUlabelSpacing: OTU name space
  • radius: radius
  • OTUsrt: angle of OTU name text
  • OTUplacing: add number and legend instead of OTU name
  • useOneDot: one dot instead of two
  • circleCenter: X coordinate
  • circleCenterY: Y coordinate
  • OTULabelSpacerx: modify OTU name pos.
  • OTULabelSpacery: modify OTU name pos.
  • OTUcentered: OTU name centered
  • OTUjustif: OTU name justif.
  • OTUlegendHeight: separ. of OTU names when OTUplacing

idiogramFISH 1.13.8

05-02-2020

  • Fixed bug when plotting several OTU with groups
  • cen. marks allowed also when centromereSize = 0
  • improvement in automatic scale of ruler.
  • Added the “cM” style of mark, with custom protruding
  • centromereSize is automatic (when absent), as well as rulerInterval

params:

  • lwd.cM: thickness of cM marks
  • OTUfont: style of font of OTU name
  • OTUfamily: font family for OTU names
  • lwd.chr: affects ruler too.
  • defaultFontFamily: modify font of texts.
  • Custom default style of mark with defaultStyleMark
  • fixCenBorder affects cen. marks also.
  • chrBorderColor for adding optionally chr. border color.
  • cenColor defaults to chrColor now.
  • colorBorderMark forces custom color in border of marks.
  • borderOfWhiteMarks, if TRUE, when mark is white, its border is black.
  • ceilingFactor number of significative digits to consider when rounding ruler max. value.
  • MbThreshold created (substitutes MbThresholds)
  • added option to modify ruler intervals for Mb, and cM independently with params: rulerIntervalMb, rulerIntervalcM
  • other added parameters: defaultStyleMark, protruding, ceilingFactor, rulerInterval, threshold, MbUnit, specialChrWidth, specialChrSpacing, specialOTUNames, specialyTitle
  • OTUs passed to specialOTUNames, can have special: specialChrWidth, specialChrSpacing, and specialyTitle. Useful for e.g. cM.
  • Allowed customization of ruler (ceilingFactor, rulerInterval)
  • Allowed custom ruler title MbUnit, specialyTitle, yTitle. yTitle is the common (micrometers). specialyTitle is for OTUs in specialOTUNames (e.g. “cM”), and MbUnit when data in millions and OTU is not in specialOTUNames

idiogramFISH 1.12.1

06-01-2020

  • Fixed bug of absence of chr. indices when monocen. and holocen. together
  • Added functionality to print each index separately
  • Added functionality to print groups below chr. name
  • DOI added
  • minor vignette corrections

idiogramFISH 1.11.1

12 12 2019

  • Added functionality for fixing y x aspect ratio (roundness proportion) using asp = 1 only
  • Use of dotRoundCorr discouraged, requires useXYfactor = TRUE
  • Fixed misplacement of marks when origin = "t" or markDistType = "cen"
  • Added functionality for plotting karyotypes in micrometers and bases together, see monocen. vignette

idiogramFISH 1.9.1

29 11 2019

  • Fixed bug when centromere = 0 when several karyotypes
  • Added rounded vertices for centromere > 0
  • Added functionality for plotting GISH.

idiogramFISH 1.8.3

14 11 2019

  • Fixed dependencies
  • Fixed size of dots of legend

idiogramFISH 1.8.1

29 10 2019

  • Added parameters for adding notes to the right of karyotype.
  • Improvement in messages when plotting.

idiogramFISH 1.7.1

20 10 2019

  • Cen. marks don’t need another data.frame. Can be present in main marks data.frame
  • Allowed dup. names for not ordered chr. names (and no marks)

idiogramFISH 1.6.3

13 10 2019

  • More tolerance when allowing duplicated chr. names when no marks.
  • Documentation changes, new examples.

idiogramFISH 1.6.1

02 10 2019

  • Added support to plot monocen. and holocen. together
  • Function plotIdiogramsHolo deprecated

idiogramFISH 1.5.1

27 09 2019

  • Added support to plot alongside phylogenies
  • Allow some karyotypes to appear without indexes when error in long / short classif.
  • Fixed bug in naming of OTUs.
  • Vignettes corrections
  • Fix references of packages in vignettes when package not installed.
  • Added support for vignettes in devel. in R-32 bits

idiogramFISH 1.2.1

17 09 2019

  • Fixed bug in armRatioCI that impacts all other functions.
  • Added support for groups
  • Added human karyotype
  • Added rounded vertices when centromereSize =0
  • You don’t have to use dfMarkColor data.frame, is not mandatory now.
  • You can use (optionally) a character vector to pass colors.
  • Package has default colors now.

References

Adler D. 1994. Idiogram album. http://www.pathology.washington.edu/research/cytopages/idiograms/human/
Carvalho R, Soares Filho WS, Brasileiro-Vidal AC, Guerra M. 2005. The relationships among lemons, limes and citron: A chromosomal comparison Cytogenetic and Genome Research, 109(1-3): 276–282. https://doi.org/10.1159/000082410
da Costa Silva S, Mendes S, Soares Filho W dos S, Pedrosa-Harand A. 2015. Chromosome homologies between Citrus and Poncirus—the comparative cytogenetic map of mandarin (Citrus reticulata) Tree Genetics & Genomes, 11(1): 811. https://doi.org/10.1007/s11295-014-0811-4. http://link.springer.com/10.1007/s11295-014-0811-4
da-Costa-Silva S, Mendes S, Régis T, Sampaio-Passos O, dos-Santos-Soares-Filho W, Pedrosa-Harand A. 2019. Cytogenetic Map of Pummelo and Chromosome Evolution of True Citrus Species and the Hybrid Sweet Orange Journal of Agricultural Science, 11(14): 148. https://doi.org/10.5539/jas.v11n14p148
Golczyk H, Hasterok R, Joachimiak AJ. 2005. FISH-aimed karyotyping and characterization of Renner complexes in permanent heterozygote Rhoeo spathacea Genome, 48(1): 145–153. https://doi.org/10.1139/g04-093
Guerra M. 1986. Reviewing the chromosome nomenclature of Levan et al. Brazilian Journal of Genetics, 9(4): 741–743
Höhna S, Landis MJ, Heath TA. 2017. Phylogenetic inference using RevBayes Current Protocols in Bioinformatics, 2017(March): 6.16.1–6.16.34. https://doi.org/10.1002/cpbi.22
Levan A, Fredga K, Sandberg AA. 1964. Nomenclature for centromeric position on chromosomes Hereditas, 52(2): 201–220. https://doi.org/10.1111/j.1601-5223.1964.tb01953.x
Mendes S. 2016. Variabilidade Cariotípica da laranja-azeda (Citrus aurantium L.) e a origem do seu cariótipo heteromórfico Mapeamento citogenético em citrus: Análises evolutivas e integração com dados genômicos
Nguyen L-T, Schmidt HA, Haeseler A von, Minh BQ. 2015. IQ-TREE: a fast and effective stochastic algorithm for estimating maximum-likelihood phylogenies Molecular biology and evolution, 32(1): 268–274. https://doi.org/10.1093/molbev/msu300. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4271533/
Robertson WRB. 1916. Chromosome studies. I. Taxonomic relationships shown in the chromosomes of tettigidae and acrididae: V-shaped chromosomes and their significance in acrididae, locustidae, and gryllidae: Chromosomes and variation Journal of Morphology, 27(2): 179–331. https://onlinelibrary.wiley.com/doi/abs/10.1002/jmor.1050270202
Romero-Zarco C. 1986. A new method for estimating karyotype asymmetry Taxon, 35(3): 526–530. https://doi.org/10.2307/1221906
Watanabe K, Yahara T, Denda T, Kosuge K. 1999. Chromosomal evolution in the genus Brachyscome (Asteraceae, Astereae): statistical tests regarding correlation between changes in karyotype and habit using phylogenetic information Journal of Plant Research, 112: 145–161. https://link.springer.com/article/10.1007/PL00013869
Yasuda K, Yahata M, Shigyo M, Matsumoto R, Yabuya T, Kunitake H. 2010. Identification of parental chromosomes in sexual intergeneric hybrid progenies between citrus cultivar ’Nanpu’ tangor and Citropsis schweinfurthii in the subfamily aurantioideae Journal of the Japanese Society for Horticultural Science, 79(2): 129–134. https://doi.org/10.2503/jjshs1.79.129
Yi KU, Kim HB, Song KJ. 2018. Karyotype diversity of Korean landrace mandarins by CMA banding pattern and rDNA loci Scientia Horticulturae, 228(July 2017): 26–32. https://doi.org/10.1016/j.scienta.2017.10.001. http://dx.doi.org/10.1016/j.scienta.2017.10.001

R-packages

Csárdi G. 2017. Crayon: Colored terminal output. R package version 1.3.4. https://CRAN.R-project.org/package=crayon
Kassambara A. 2019. Ggpubr: ’ggplot2’ based publication ready plots. R package version 0.2.3. https://CRAN.R-project.org/package=ggpubr
R Core Team. 2019. R: A language and environment for statistical computing R Foundation for Statistical Computing, Vienna, Austria. https://www.R-project.org/
Revell LJ. 2012. Phytools: An r package for phylogenetic comparative biology (and other things). Methods in Ecology and Evolution, 3: 217–223. https://doi.org/10.1111/j.2041-210X.2011.00169.x
Roa F, PC Telles M. 2021. idiogramFISH: Shiny app. Idiograms with marks and karyotype indices Universidade Federal de Goiás, UFG, Goiânia. R-package. version 2.0.0. https://doi.org/10.5281/zenodo.3579417. https://ferroao.gitlab.io/manualidiogramfish/
Wickham H. 2011. The split-apply-combine strategy for data analysis Journal of Statistical Software, 40(1): 1–29. https://www.jstatsoft.org/article/view/v040i01
Wickham H. 2016. ggplot2: Elegant graphics for data analysis Springer-Verlag New York. https://ggplot2.tidyverse.org
Wickham H, Chang W, Henry L, Pedersen TL, Takahashi K, Wilke C, Woo K, Yutani H, Dunnington D. 2020. ggplot2: Create elegant data visualisations using the grammar of graphics. http://ggplot2.tidyverse.org, https://github.com/tidyverse/ggplot2.
Wickham H, François R, Henry L, Müller K. 2019. Dplyr: A grammar of data manipulation. R package version 0.8.3. https://CRAN.R-project.org/package=dplyr
Wickham H, Henry L. 2020. Tidyr: Tidy messy data. R package version 1.0.2. https://CRAN.R-project.org/package=tidyr
Winter DJ. 2017. rentrez: An r package for the NCBI eUtils API The R Journal, 9: 520–526
Yu G, Lam TT-Y, Zhu H, Guan Y. 2018. Two methods for mapping and visualizing associated data on phylogeny using ggtree. Molecular Biology and Evolution, 35: 3041–3043. https://doi.org/10.1093/molbev/msy194. https://doi.org/10.1093/molbev/msy194

Shiny App

Bihorel S. 2021. Rclipboard: Shiny/r wrapper for clipboard.js. R package version 0.1.3. https://github.com/sbihorel/rclipboard/
Chang W, Borges Ribeiro B. 2018. Shinydashboard: Create dashboards with shiny. R package version 0.7.1. http://rstudio.github.io/shinydashboard/
Chang W, Cheng J, Allaire J, Sievert C, Schloerke B, Xie Y, Allen J, McPherson J, Dipert A, Borges B. 2021. Shiny: Web application framework for r. R package version 1.6.0. https://shiny.posit.co/
Owen J. 2018. Rhandsontable: Interface to the handsontable.js library. R package version 0.3.7. http://jrowen.github.io/rhandsontable/
Warnes GR, Bolker B, Lumley T. 2020. Gtools: Various r programming tools. R package version 3.8.2. https://github.com/r-gregmisc/gtools

Documentation

Barnier J. 2020. Rmdformats: HTML output formats and templates for ’rmarkdown’ documents. R package version 0.3.7. https://CRAN.R-project.org/package=rmdformats
Temple Lang D, CRAN team the. 2019. RCurl: General network (HTTP/FTP/...) client interface for r. R package version 1.95-4.12. https://CRAN.R-project.org/package=RCurl
Wickham H, Bryan J. 2019. Usethis: Automate package and project setup. R package version 1.5.1. https://CRAN.R-project.org/package=usethis
Wickham H, Danenberg P, Eugster M. 2018. roxygen2: In-line documentation for r. R package version 6.1.1. https://CRAN.R-project.org/package=roxygen2
Wickham H, Hesselberth J. 2019. Pkgdown: Make static HTML documentation for a package. R package version 1.4.1. https://CRAN.R-project.org/package=pkgdown
Xie Y. 2015. Dynamic documents with R and knitr Chapman; Hall/CRC, Boca Raton, Florida. ISBN 978-1498716963. https://yihui.org/knitr/
Xie Y. 2016. Bookdown: Authoring books and technical documents with R markdown Chapman; Hall/CRC, Boca Raton, Florida. ISBN 978-1138700109. https://github.com/rstudio/bookdown
Xie Y, Allaire JJ, Grolemund G. 2018. R markdown: The definitive guide Chapman; Hall/CRC, Boca Raton, Florida. ISBN 9781138359338. https://bookdown.org/yihui/rmarkdown
Yu G. 2019b. Badger: Badge for r package. R package version 0.0.6. https://CRAN.R-project.org/package=badger
Yu G. 2019a. Rvcheck: R/package version check. R package version 0.1.6. https://CRAN.R-project.org/package=rvcheck
Zhu H. 2019. kableExtra: Construct complex table with ’kable’ and pipe syntax. R package version 1.1.0. https://CRAN.R-project.org/package=kableExtra