Hi, your input data is more or less correct, but I admit that it can take a while (1 day) to get the formatting correct for CIRCOS.
Here is my own test data (antibody fragments with numbers of recombination events identified between them):
SS3VHFamily.txt
VH1 VH3 VH4 VH5 VH6
JH1 88 273 10 0 0
JH2 43 113 153 0 50
JH3 226 432 355 25 77
JH4 1051 4717 2131 110 28
JH5 215 482 649 20 10
JH6 576 467 20 18 0
To then generate the CIRCOS plot that you want:
df <- read.table("SS3VHFamily.txt", sep="\t", header=TRUE, stringsAsFactors=FALSE)
rownames(df) <- df[,1]
df <- t(df[,2:ncol(df)])
df <- data.frame(from=rep(rownames(df), times=ncol(df)), to=rep(colnames(df), each=nrow(df)), value=as.vector(df), stringsAsFactors=FALSE)
names <- c(sort(unique(df[,1])), sort(unique(df[,2])))
colours <- c(VH1="darkgoldenrod1", VH3="chartreuse4", VH4="royalblue", VH5="darkred", VH6="darkorchid1", JH1="black", JH2="black", JH3="black", JH4="black", JH5="black", JH6="black")
pdf("Plots/SS3VHFamily.pdf", width=10, height=10)
{
circos.par(gap.degree=c(rep(2, length(unique(df[[1]]))-1), 10, rep(2, length(unique(df[[2]]))-1), 10))
chordDiagram(df, grid.col=colours, transparency=0.55, directional=-1, diffHeight=0.04)
circos.clear()
}
dev.off()
-------------------------------
Hopefully you can modify this for your own example. You will probably want to edit the label sizes.
Kevin
Thanks for the script. I wanted to plot multiple hits scenarios, where single reference fragment/block is mapped to multiple locations in target. As shown above, h1 fragments have multiple hits on q1 and q2.
I tried with your suggested script, but fail miserably :(
Yes, my script should do this. On which part are you having problems?
If you follow my code, what is the output of yuor df object?
I am just wondering, how to say: JH4:1-1000 is mapped to VH4 and JH4:400-1000 mapped to VH3 in our input file?
There will not be any overlapping, at least not in my data. My data is the number of reads for each pairwise connection between a V and J fragment. The reads can be calculated from the scale around the circumference of the outer circle.
What does your data represent?
Hi again BioGeek, I can see from your custom diagram that h1 maps to both g1 and g2. If you use my code, the Circos plot will be drawn but the base for h1 will be larger than in your diagram in order to accomodate both connections.
For example, if we have
Then, the h1 arc will be of length 25.
If you look closely at my diagram, you will see this.