Question: How to plot overlapping fragments in Circos ?
gravatar for BioGeek
11 days ago by
BioGeek100 wrote:

enter image description here

How to Plot a circular overlapping plots, as shown in pic. ?

I tried following table to plot on

data C D
A 7 18
B 5 15

and it return but it does not support overlaps. Any suggestions ?

overlaps plots circos • 143 views
ADD COMMENTlink modified 11 days ago • written 11 days ago by BioGeek100
gravatar for Kevin Blighe
11 days ago by
Kevin Blighe13k
Kevin Blighe13k wrote:

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):


    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(, 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)




Hopefully you can modify this for your own example. You will probably want to edit the label sizes.


ADD COMMENTlink modified 11 days ago • written 11 days ago by Kevin Blighe13k
gravatar for BioGeek
11 days ago by
BioGeek100 wrote:

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 :(

ADD COMMENTlink written 11 days ago by BioGeek100

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?

ADD REPLYlink written 11 days ago by Kevin Blighe13k
   from  to value
1   VH1 JH1    88
2   VH3 JH1   273
3   VH4 JH1    10
4   VH5 JH1     0
5   VH6 JH1     0
6   VH1 JH2    43
7   VH3 JH2   113
8   VH4 JH2   153
9   VH5 JH2     0
10  VH6 JH2    50
11  VH1 JH3   226
12  VH3 JH3   432
13  VH4 JH3   355
14  VH5 JH3    25
15  VH6 JH3    77
16  VH1 JH4  1051
17  VH3 JH4  4717
18  VH4 JH4  2131
19  VH5 JH4   110
20  VH6 JH4    28
21  VH1 JH5   215
22  VH3 JH5   482
23  VH4 JH5   649
24  VH5 JH5    20
25  VH6 JH5    10
26  VH1 JH6   576
27  VH3 JH6   467
28  VH4 JH6    20
29  VH5 JH6    18
30  VH6 JH6     0

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?

These for example are overlapping:
ADD REPLYlink modified 11 days ago • written 11 days ago by BioGeek100

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?

ADD REPLYlink written 10 days ago by Kevin Blighe13k

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

  • h1 --> g1 = 10
  • h1 --> g2 = 15

Then, the h1 arc will be of length 25.

If you look closely at my diagram, you will see this.

ADD REPLYlink written 9 days ago by Kevin Blighe13k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 696 users visited in the last hour