Chapter 8 Groups


Jupyter interactive version:

Colab (online) Github   Raw
8 Groups link 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=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

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
)