Vignette 2. Circular Plots
Vignette 3. Phylogeny
Vignette 4. Human karyotype
Vignette 5. Credits
1 Plotting chromosomes
This guide shows the files to plot idiograms of measured karyotypes and optionally marks.
1.1 Load package
visit gitlab for installation instructions https://gitlab.com/ferroao/idiogramFISH
1.2 Plot monocentrics
Initially you have to put your chromosome data in a data.frame.
From scratch:
# 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:
Open your chromosome data data.frame importing it from a .csv (read.csv) or .xls file (readxl).
Editing a data.frame:
For fixing column names use:
Get marks general data
This data.frame is optional.
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.
Note the cenStyle
to make constrictions, mimicking centromeres, and upArrow
and downArrow
styles.
# From scratch:
mydfMarkColor<-read.table(text=
" markName markColor style
5S red dots
45S green square
gene1 orange upArrow
gene2 salmon downArrow
gene3 \"#056522\" cMLeft
DAPI blue cM
\"cB mark\" black cenStyle
CMA yellow square
\"B mark\" black square" , header=TRUE, stringsAsFactors=FALSE,fill=TRUE)
markName | markColor | style |
---|---|---|
5S | red | dots |
45S | green | square |
gene1 | orange | upArrow |
gene2 | salmon | downArrow |
gene3 | #056522 | cMLeft |
DAPI | blue | cM |
cB mark | black | cenStyle |
CMA | yellow | square |
B mark | black | square |
For fixing column names use:
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. This data.frame has also the centromeric marks present in all karyotypes.
# 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 means whole arm for square marks
\"Species one\" 1 5S q 0.5 0.5
\"Species one\" B \"B mark\" w NA NA # w for whole chromosome for square marks
\"Species one\" B \"cB mark\" q NA 1.0
\"Species one\" 2 45S p 1 1.0
\"Species one\" 2 gene1 q 0.5 1.0
\"Species one\" 2 gene2 q 0.5 2.0
\"Species one\" 3 DAPI q NA 1
\"Species one\" 3 gene3 p NA .5
\"Species one\" 1 DAPI cen
\"Species one\" 3 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 | 45S | p | 1.0 | 1.0 |
Species one | 2 | gene1 | q | 0.5 | 1.0 |
Species one | 2 | gene2 | q | 0.5 | 2.0 |
Species one | 3 | DAPI | q | NA | 1.0 |
Species one | 3 | gene3 | p | NA | 0.5 |
Species one | 1 | DAPI | cen | NA | NA |
Species one | 3 | CMA | cen | NA | NA |
For fixing column names use something like:
Add some text to the right
For ver. > 1.7
# We will use column note to add a note to the right of the karyotype of the OTU in 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.
distTextChr = .7, # separation among text and chr names and ind.
orderBySize = FALSE, # do not order chr. by size
karHeiSpace=1.6, # vertical size of karyotype including spacer
chrSpacing=.6
,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
,ylabline = -6 # ruler units pos.
,notes=notesdf # data.frame with notes NEW
,notesTextSize = 1.3 # font size of notes
,notesPos = .2 # space from chr. (right) to note
,ylimBotMod = 1 # 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)
# ,legend="inline" # legend next to chr.
# ,bannedMarkName = "cB mark" # remove from legends
)
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
ylabline = -3, # 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.:
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","blue","green")
# 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 = .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
,ylabline = -8 # ruler units pos.
,xlimRightMod = 1 # modify xlim right arg.
)
dev.off() # close png
1.3 Plot holocentrics
Initially you have to put your chromosome data in a data.frame. For simplicity, I call a holocen. karyotype anything without centromeres. This is recognized by the absence of columns: “shortArmSize”, etc.
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:
Open your chromosome data as data.frame importing it from a .csv (read.csv) or .xls file (readxl).
For fixing column names use:
Get marks general data
This data.frame is optional for ver. > 1.0.0
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:
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)
markName | markColor | style |
---|---|---|
5S | red | dots |
45S | green | square |
DAPI | blue | square |
CMA | yellow | square |
For fixing column names use:
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.
# 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 # whole chromosome mark, use 'w' in col. chrRegion
\"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\" 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 | DAPI | 2.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:
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,4,0,1)) # bottom left top right
plotIdiograms(dfChrSize = mydfChrSizeHolo,# data.frame of chr. sizes
dfMarkColor= mydfMarkColor, # df of mark style
dfMarkPos = mydfMarkPosHolo,# df of mark positions
addOTUName=FALSE, # add OTU names
xlimLeftMod= 1, # 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.
,legendWidth=1 # width of legend
,legendHeight=.7 # height of legend item
,xModifier=0.01 # separation among chromatids
)
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("green","yellow","blue","red"), # 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
)
1.4 Plot holo. and mono. in the same karyotype
To accomplish this, we will use cenStyle
marks in a (modified) holocen. karyotype. The ruler is continuous as in holocen.
# mark general characteristics' data.frame:
mydfMarkColor2<-read.table(text=
" markName markColor style
1 5S red dots
2 45S green square
3 DAPI blue square
4 CMA yellow square
5 c45S green cenStyle # <- simulate Cen.
6 c5S red cenStyle
7 cB black cenStyle
8 constr NA cenStyle
9 B black square" , header=TRUE, stringsAsFactors=FALSE,fill=TRUE)
# add new marks to data.frame of marks' position
mydfMarkPosHolo2<-plyr::rbind.fill(mydfMarkPosHolo,data.frame(OTU="Species one",
chrName=1:4,
markName=c("c45S","c5S","constr","cB"), # <- use new mark
markPos=2.5,
markSize=NA
)
)
# png("mydChrSizeHolo.png", width=600, height=300)
par(mar=c(0,4,0,1)) # bottom left top right
plotIdiograms(dfChrSize = mydfChrSizeHolo,# data.frame of chr. sizes
dfMarkColor= mydfMarkColor2, # df of mark style
dfMarkPos = mydfMarkPosHolo2,# df of mark positions
addOTUName=FALSE, # add OTU names
xlimLeftMod= 1, # modify xlim left argument
ylimTopMod= -1, # modify ylim top argument
ylimBotMod= -2 # modify ylim bottom argument
,rulerPos = 0
,ruler.tck = -0.01
,legendWidth=1 # width of legend
,legendHeight=.7 # 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)
# ,legend="inline" # legends inline
# ,bannedMarkName = c("c45S","cB") # do not use this names from labels
)
1.5 Example with several species (OTUs) - mono.
To illustrate this, we will load some data.frames from the package
- Chromosome sizes
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
markName | markColor | style |
---|---|---|
5S | red | dots |
45S | green | square |
DAPI | blue | square |
CMA | yellow | square |
- Mark position
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 = 10, # 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
# rulerPosMod=3, # modify 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
ylabline = -1, # 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
#,asp=1 # y x aspect ratio
)
1.6 Example with several species (OTUs) - holo.
To illustrate this, we will load some data.frames from the package
- Chromosome sizes
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
markName | markColor | style |
---|---|---|
5S | red | dots |
45S | green | square |
DAPI | blue | square |
CMA | yellow | square |
- Mark position
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
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=dfMarkColor, # df of mark style
dfMarkPos=bigdfMarkPosHolo, # 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.
ylabline = -3, # position of ruler units (title)
ylimBotMod=.4 # modify ylim bottom argument
,xModifier=0.01 # separation among chromatids
)
dev.off()
1.7 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 |
---|---|---|---|
Parental 1 | 1 | 3.2 | 4 |
Parental 1 | 4 | 1.5 | 2 |
Parental 1 | 5 | 4.8 | 6 |
Parental 1 | 6 | 6.1 | 7 |
Parental 2 | 1 | 3.2 | 4 |
Parental 2 | 2 | 4.5 | 5 |
Parental 2 | 3 | 2.0 | 3 |
Allopolyploid | 1 | 3.2 | 4 |
Allopolyploid | 2 | 4.5 | 5 |
Allopolyploid | 3 | 2.0 | 3 |
Allopolyploid | 4 | 1.5 | 2 |
Allopolyploid | 5 | 4.8 | 6 |
Allopolyploid | 6 | 6.1 | 7 |
Marks’ positions data
dfAlloParentMarks
OTU | chrName | markName | chrRegion |
---|---|---|---|
Allopolyploid | 1 | Parental 1 | p |
Allopolyploid | 1 | Parental 2 | q |
Allopolyploid | 1 | Parental 2 | cen |
Allopolyploid | 2 | Parental 2 | w |
Allopolyploid | 3 | Parental 2 | w |
Allopolyploid | 4 | Parental 1 | w |
Allopolyploid | 5 | Parental 1 | w |
Allopolyploid | 6 | Parental 1 | w |
Parental 1 | 6 | Parental 1 | w |
Parental 1 | 5 | Parental 1 | w |
Parental 1 | 1 | Parental 1 | w |
Parental 1 | 4 | Parental 1 | w |
Parental 2 | 2 | Parental 2 | w |
Parental 2 | 1 | Parental 2 | w |
Parental 2 | 3 | Parental 2 | w |
Plotting
# svg("gish.svg",width=7,height=9 )
#png("parentalAndHybChrSize.png", width=700, height=900)
par(mar=rep(0,4) )
plotIdiograms(dfChrSize = parentalAndHybChrSize, # d.f. of chr. sizes
dfMarkPos = dfAlloParentMarks, # d.f. of marks' positions
cenColor = NULL, # cen. color for GISH
karHeiSpace=5, # karyotype height including spacing
karSepar = FALSE, # equally sized (height) karyotypes
rulerPos=-.7, # ruler position
ruler.tck= -0.006, # ruler tick orientation and length
rulerNumberSize=.4 # ruler font size
,ylabline = -1.5 # ruler units pos.
,legend="" # no legend
,notes=notesdf2 # data.frame with notes NEW
#,OTUasNote=TRUE # TRY THIS (OTU name to the right)
,notesTextSize = 1.3 # font size of notes
,notesPos = 1.5 # space from chr. (right) to note
,ylimBotMod = 1 # ylim bottom argument mod.
)
1.8 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=.005 # separ. among chromatids
)
1.9 Using bases instead of micrometers - no. cen.
Create some data in millions of bases:
# transform previous data.frames for simplicity
bigdfChrSizeHoloMb <- bigdfChrSizeHolo
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"
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.
ylabline = -6, # 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
)
dev.off()
For another example see: https://stackoverflow.com/questions/33727432/how-to-plot-positions-along-a-chromosome-graphic/57153497#57153497
1.10 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
,ylabline = -2 # 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 = 50000000, # 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
)
1.11 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<-idiogramFISH:::makedfMarkColorMycolors(unique(mixedThreeSpMarks$markName),
c("red","green","blue","yellow","blue","yellow","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 green square
# 3 DAPI blue square
# 4 CMA yellow square
# 5 cDAPI blue cenStyle
# 6 cCMA yellow 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
ylabline = -10, # 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 = 150000000,# 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
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 |
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 |
1.12 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
mixedThreeSpChrSize <- plyr::rbind.fill(bigdfOfChrSize[1:8,], bigdfOfChrSize3cM)
# sort by OTU name
mixedThreeSpChrSize <- mixedThreeSpChrSize[order(mixedThreeSpChrSize$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
mixedThreeSpMarks <- plyr::rbind.fill(bigdfOfMarks , bigdfOfMarks3cM)
# create a data.frame with mark characteristics
mixedDfMarkStyle <- idiogramFISH:::makedfMarkColorMycolors(unique(mixedThreeSpMarks$markName),
c("red","green","blue","yellow")
)
# 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 = mixedThreeSpChrSize, # chr. size data.frame
dfMarkPos = mixedThreeSpMarks, # 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 = 5, # vertical size of karyotype including spacer
amoSepar =2, # separ. among kar.
indexIdTextSize=.6, # font size of chr. name and indices
distTextChr = .65, # 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.
,ylabline = -10 # 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
)
1.13 Using groups - mono.
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=F)
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 |
# 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
orderBySize = FALSE, # do not order chr. by size
ruler=FALSE # do not plot ruler
,ylimBotMod = 1 # modify ylim bottom argument
,legendWidth = 1 # width of legend
)
1.14 Holocentrics in groups
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
orderBySize = FALSE, # do not order chr. by size
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=0.005 # separ. among chromatids
)
References
Guerra M. 1986. Reviewing the chromosome nomenclature of Levan et al. Brazilian Journal of Genetics, 9(4): 741–743
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. https://onlinelibrary.wiley.com/doi/abs/10.1111/j.1601-5223.1964.tb01953.x
Romero-Zarco C. 1986. A new method for estimating karyotype asymmetry Taxon, 35(3): 526–530. https://onlinelibrary.wiley.com/doi/abs/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. http://link.springer.com/article/10.1007/PL00013869