Use the latest version of Circos and read Circos best practices—these list recent important changes and identify sources of common problems.
If you are having trouble, post your issue to the Circos Google Group and include all files and detailed error logs. Please do not email me directly unless it is urgent—you are much more likely to receive a timely reply from the group.
Don't know what question to ask? Read Points of View: Visualizing Biological Data by Bang Wong, myself and invited authors from the Points of View series.
Rules can be used to adjust the text of the label. This is done by setting the "value" value in the rule. The rule below sets all labels to "X", regardless of their original text.
<rule> importance = 110 condition = 1 value = X </rule>
You can combine this with other rules. For example, if the text is sequence, you can set the color of the character based on its identity and then change it to another value. The color rules must have flow=continue to allow the downstream label-changing rule to also be evaluated (recall that without this flow=continue statement, triggered rules terminate the rule chain).
# first change color <rule> importance = 90 condition = eval( _LABEL_ eq "A") color = red flow = continue </rule> <rule> importance = 85 condition = eval( _LABEL_ eq "T") color = blue flow = continue </rule> <rule> importance = 80 condition = eval( _LABEL_ eq "C") color = green flow = continue </rule> # then change label text <rule> importance = 70 condition = 1 value = X </rule>
You can turn a text track into a glyph track by changing the font and adjusting the text label to the desired glyph. For example, using the wingding font (fonts/wingding.ttf, defined as "glyph" in etc/fonts.conf), you can obtain square glyphs like so
<plot> label_font = glyph <rules> ... <rule> importance = 70 condition = 1 value = eval("\x6E") </rule> ... </rules>
In the wingding font, the square is ASCII 110 (hex 6E). To change the label to this character, you must use eval(), such as eval("\110") or eval("\x6E").
By adjusting the padding more tightly, you can pack the square glyphs to touch. By adjusting the color and glyph shape, you can create attractive tracks.
Modifying labels into symbols is ideal for making a general glyph tracks. For example, consider a list of genes (data/6/genes.glyph.txt).
... hs12 56428271 56432431 CDK4_cancer hs12 64504506 64595566 HMGA2_cancer hs12 64504506 64638901 P52926_cancer ... hs10 108323411 108914282 SORCS1_omim hs10 111614513 111673192 XPNPEP1_omim hs10 111755715 111885310 ADD3_omim ... hs7 139864688 139948811 DENND2A_other hs7 140019421 140041377 ADCK2_other hs7 140042949 140052913 NDUFB2_other ...
I've added _cancer to those genes that are in the Cancer Census, _omim to any others that are in the OMIM list (disease-related), and _other to the remaining. Using the rules below, genes become glyphs
<rules> <rule> importance = 90 condition = eval( _LABEL_ =~ /cancer/) color = red # diamond value = eval("\x75") </rule> <rule> importance = 85 condition = eval( _LABEL_ =~ /omim/) color = orange # square value = eval("\x6E") </rule> <rule> importance = 80 condition = eval( _LABEL_ =~ /other/) color = green # circle value = eval("\x6C") </rule> </rules>
Individual gene groups (cancer, omim, other) can be split into multiple tracks by setting a rule to hide all genes except one. For example, this track shows only the cancer genes outside the circle
<plot> ... r0 = 1r+10p r1 = 1r+200p color = red ... <rules> <rule> importance = 100 condition = eval( _LABEL_ !~ /cancer/ ) # hide anything that doesn't match "cancer" show = no </rule> <rule> importance = 70 condition = 1 # circle value = eval("\x6C") </rule> </rules> </plot>
Finally, let's look at an example where the size of the glyph encodes density of data points. While Circos won't calculate the density for you, you can pre-process your data and encode the density as the label size.
In the data/6/gene.density.txt file, the number of gene entries for each of cancer, omim and other groups (per Mb) is reported as the label_size.
... hs1 3000000 3000000 cancer label_size=1p hs1 6000000 6000000 cancer label_size=2p ... hs1 1000000 1000000 omim label_size=9p hs1 2000000 2000000 omim label_size=14p ... hs1 1000000 1000000 other label_size=26p hs1 2000000 2000000 other label_size=10p ...
Using a rule, you can remap the label_size to another value. The original label_size values range from 1p to 42p.
# linear remap to [6,50] label_size = eval( 6+50*(_LABEL_SIZE_/42) . "p") # ... with shallower increase label_size = eval( 6+50*sqrt(_LABEL_SIZE_/42) . "p") # ... with steeper increase label_size = eval( 6+50*(_LABEL_SIZE_/42)**2 . "p")