Go to 1. Plotting I
Go to 3. Phylogeny Vignette
Go to 4. Human Vignette
Go to 5. Credits
2 Plotting chromosomes II
This guide shows the files to plot idiograms of karyotypes of holocentrics and optionally marks.
2.1 Load package
visit gitlab for installation instructions https://gitlab.com/ferroao/idiogramFISH
2.2 Get your chromosome size data
Initially you have to put your chromosome data in a data.frame.
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:
2.3 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:
2.4 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:
2.5 Plotting
function plotIdiogramsHolo deprecated after ver. > 1.5.1
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
# function `plotIdiogramsHolo` deprecated after ver. > 1.5.1
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.tck = -0.01
,legendWidth=1 # width of legend
,legendHeight=.7 # height of legend item
#,asp=1 # y x aspect
)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.:
# par(mar=c(1,4,1,1))
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
)2.6 Example with several species (OTUs)
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 |
2.6.1 Plotting
library(idiogramFISH)
# fig.width=6, fig.height=6
png("bigdfChrSizeHolo.png", width=600, height=600)
# par(mar=c(1,1,1,1))
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
roundness=6, # vertices roundness 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,
rulerNumberSize=.9, # font size of ruler
ruler.tck= -.004, # tick length and orient.
ylimBotMod=.4 # modify ylim bottom argument
#,asp=1 # y x aspect
)
dev.off()2.7 Using bases instead of micrometers
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 * 98000000Plotting
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
roundness=4, # vertices roundness 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, # <- NEW # 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
# ,asp=1 # y x aspect
)
dev.off()For another example see: https://stackoverflow.com/questions/33727432/how-to-plot-positions-along-a-chromosome-graphic/57153497#57153497
2.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.
#,asp=1 # y x aspect
)2.9 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
)