Plotting holocentric chromosomes

Fernando Roa

18 08 2019

This guide shows the files to plot idiograms of karyotypes of holocentrics and optionally marks.

0. Load package

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

#load package
library(idiogramFISH) 

1. Get your chromosome size data

Initially you have to open your chromosome data as a dataframe.

From scratch:

OTU chrName chrSize
Species one 1 6.5
Species one 2 5.0
Species one 3 4.0
Species one X 3.0

or loading saved data:

Initially, if you use RStudio, use menu “Session”, “Set working directory” for choosing your desired folder or:

setwd("~/folder/subfolder")

Open your chromosome data dataframe 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")

2. Get marks general data

Open or make your mark data as a dataframe. This dataframe has the marks present in all karyotypes with color and style, without position info.

# From scratch:
mydfMarkColor<-read.table(text=
"  markName markColor  style
1       5S       red   dots
2      45S     green square
3     DAPI      blue square
4      CMA    yellow square"  ,  header=TRUE, stringsAsFactors=FALSE,fill=TRUE)

knitr::kable(mydfMarkColor) 
markName markColor style
5S red dots
45S green square
DAPI blue square
CMA yellow square

For fixing column names use:

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

3. Get marks positions data

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

# We will use column OTU if dataframe because chromosome size df has it
mydfMarkPosHolo<-read.table(text=
"             OTU  chrName markName markPos markSize
1 \"Species one\"       3       5S     1.0      0.5
2 \"Species one\"       3     DAPI     2.0      0.5
3 \"Species one\"       1      45S     2.0      0.5
4 \"Species one\"       2     DAPI     2.0      0.5
5 \"Species one\"       4      CMA     2.0      0.5
6 \"Species one\"       4       5S     0.5      0.5"  ,  header=TRUE, stringsAsFactors=FALSE,fill=TRUE)

knitr::kable(mydfMarkPosHolo) 
OTU chrName markName markPos markSize
Species one 3 5S 1.0 0.5
Species one 3 DAPI 2.0 0.5
Species one 1 45S 2.0 0.5
Species one 2 DAPI 2.0 0.5
Species one 4 CMA 2.0 0.5
Species one 4 5S 0.5 0.5

For fixing column names use something like:

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

4. Plotting

You can plot without marks (passing only 1st dataframe), but we will use all 4 dataframes created:

# library(idiogramFISH)
par(mar=c(1,4,1,1)) # bottom left top right
plotIdiogramsHolo(mydfChrSizeHolo, mydfMarkColor, mydfMarkPosHolo, 
                        dotRoundCorr=2,
                        chrWidth = 2, chrSpacing = 2,
                        indexIdTextSize=1, OTUTextSize=1, karHeight = 1.4,
                        legend="aside" ,markLabelSize=1,
                        addOTUName=FALSE,
                        rulerNumberSize=1, rulerPos=-2.2,ruler.tck=-0.03,rulerNumberPos=.9,
                        xlimLeftMod=2.2,  xlimRightMod=10, ylimBotMod=.1
                        )

5. Example with several species (OTUs)

To illustrate this, we will load some dataframes from the package

OTU chrName chrSize
species one 1 3
species one 2 4
species one 3 2
species one 4 5
species two 1 3
species two 2 4
species two 3 2
species two 4 5
species three 1 3
species three 2 4
species three 3 2
species three 4 5
markName markColor style
5S red dots
45S green square
DAPI blue square
CMA yellow square
OTU chrName markName markPos markSize
species two 3 5S 1.0 0.5
species two 3 DAPI 2.0 0.5
species two 1 45S 2.0 0.5
species two 2 DAPI 2.0 0.5
species two 4 CMA 2.0 0.5
species two 4 5S 0.5 0.5

Plotting

6. Using Mb instead of micrometers

Create some data in millions:

# using previous dataframes
bigdfChrSizeHolo$chrSize<-bigdfChrSizeHolo$chrSize*980000
bigdfMarkPosHolo$markPos<-bigdfMarkPosHolo$markPos*980000
bigdfMarkPosHolo$markSize<-bigdfMarkPosHolo$markSize*980000

Plotting

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

More details

Check the help to see all possible arguments ?idiogramFISH (click Index below)