
################################################################
#
# This is a fairly complicated configuration file. Take your time in
# experimenting and adjust one thing at a time :)
#
################################################################

max_col_num = 200
max_row_num = 200

# skip this many rows before reading in header and data
skip_rows        = 0

# is there a header line that identifies the columns?
header           = yes

# is there a row that specifies the order of columns in the image?
# - if so, this must be the first line of the header
# - if the line exists (col_order_row=yes), employ the use_col_order_row to toggle whether it is used
col_order_row     = no
use_col_order_row = no

# is there a row that specifies the size of columns in the image?
# - if so, this must be the next line of the header
# - if the line exists (col_size_row=yes), employ the use_col_size_row to toggle whether it is used
col_size_row     = no
use_col_size_row = no

# is there a row that specifies the color of each column segment in the image?
# - if so, this must be the next line of the header
# - if the line exists (col_color_row=yes), employ the use_col_color_row to toggle whether it is used
col_color_row     = no
use_col_color_row = no

# is there a column that specifies the order of rows in the image?
# - if so, this must be the first column
# - if the line exists (row_order_col=yes), employ the use_row_order_col to toggle whether it is used
row_order_col     = no
use_row_order_col = no

# is there a column that specifies the color of each row segment in the image?
# - if so, this must be the second column
# - if the line exists (row_color_col=yes), employ the use_row_color_col to toggle whether it is used
row_color_col     = no
use_row_color_col = no

# if you do not have a column/row that explicitly defines order
# of segments in the image, you can set this here. Use one (or more) of 
# these values to specify how segments should be ordered.
# - row_major (row segments first, then column)
# - col_major (col segments first, then row)
# - ascii     (asciibetic order)
# - row_size  (total of rows for the segment - useful if the segment has both row and column contributions)
# - col_size  (total of colums for the segment - useful if the segment has both row and column contributions)
# - row_to_col_ratio (ratio of total of rows to columns for the segment)
# - col_to_row_ratio (ratio of total of rows to columns for the segment)
# - size_asc  (size, in ascending order)
# - size_desc (size, in descending order)

#segment_order = row_to_col_ratio,size_desc # col_major,size_desc
segment_order  = ascii
#segment_order = ascii
#segment_order = file:etc/order-by-table-remapped.txt
#segment_order  = size_desc,row_to_col_ratio
segment_color_order = size_desc

# values for segments can be normalized if the use_segment_normalization is set to yes
use_segment_normalization = no

# the normalization function can be one of the following, and is applied to
# all values that correspond to the segment's label
# total - sum of cell values for the segment label (row and col)
# average - average of cell values for the segment label (row and col)
# row_total, row_average - sum or average for cell values for the segment row
# col_total, col_average - sum or average for cell values for the segment col
# row_size, col_size, total_size - based on the optional size column (see col_size_row and row_size_col above)
# VALUE - segments are scaled to a constant VALUE (e.g. 1000)
segment_normalization_function = 1000

# normalization can be performed by either altering the actual data values or
# by applying a visual scaling of the segments. When 'value' is used, the data
# is changed. When 'visual' is used, then a chromosomes_scale line is reported
# by this script which you must include in circos.conf for the scaling to be applied
segment_normalization_scheme   = value

################################################################
# placement of cell ribbons on row/column segments
# 
# for segments that share both column and row ribbons, the
# order of ribbon position can be adjusted with placement_order

placement_order = row,col # col,row or row,col

# within the row/column ribbon bundle for each segment, 
# ribbon_bundle_order determines how the ribbons will be
# ordered
# - size_asc  - by value of the cell, ascending
# - size_desc - by value of the cell, descending
# - ascii     - sorted by destination label, ascending
# - native    - sorted by order of destination segment

ribbon_bundle_order = size_desc # size, ascii, native

# reverse the position of links in table/row segments?

reverse_rows    = no
reverse_columns = no

# values for cells with the same row/column name can be treated
# independently. You can
# show - show these cells and not filter them at all
# hide - hide these cells from the image, but not resize the row/columns
# remove - entirely remove these cells from the data set (equivalent to setting cells to missing value)
intra_cell_handling = show

# ribbon layering - order in which the ribbons are drawn on the image
# size_asc  - ascending by ribbon size (small ribbons drawn first, therefore large ribbons will be at front)
# size_desc - descending by ribbon size (large ribbons drawn first, therefore small ribbons will be at front)

ribbon_layer_order = size_asc

# if both (A,B)=x and (B,A)=y cells exist, you can choose to have the ribbon
# ends sized variably so that ribbon at A has width x and at B has width y

ribbon_variable = no
ribbon_variable_intra_collapse = yes

################################################################
# cell value mapping allows you to remap the cell values using
# any Perl expression that uses X as the cell value. For example,
#
# cell_remap_formula = log(X)
#                    = sqrt(X)
#                    = X/10
#                    = X ? log(X) : 0
#
# This remapping takes place before any filters or scaling is applied. Its effect
# is the same as remapping the cell values in the input file.

use_cell_remap     = no
cell_remap_formula = round(10*X)

################################################################
# scale your values with a power rule (useful if the range of values
# is very large) to
# - atten_large: attenuate large values and maintain visibility
#   of ribbons corresponding to small values, or
# - atten_small: attenuate small values to increase visibility
#   of ribbons corresponding to large values
#
# given a value, v, and a maximum, m
#
# atten_small:
#
# v_new = m * ( exp(scale_factor * v / m) - 1 ) / ( exp(scale_factor) - 1 )
#
# atten_large:
#
# v_new = m * ( log(scale_factor * v ) ) / ( log(scale_factor * m ) )
# 
# essentially the values are remapped to a log-type scale 
# with the range 0..m

use_scaling    = no
scaling_type   = atten_large
scale_factor   = 1

blank_means_missing = no
missing_cell_value = -

################################################################
# Value cutoffs for cell values and ribbon formatting.
#
# You can toggle the visibility of ribbons for cells outside
# a min/max range. You can define one or more of these cutoffs.
# The cutoffs are applied to unscaled cell values.

cell_min_value       = 100
#cell_min_percentile = 10
#cell_max_value      = 100
#cell_max_percentile = 100

# For cell values that do not pass the min/max filters above,
# you can specify whether they are hidden or removed. If the
# parameter is not defined, "hide" will be assumed.
# hide - cell values won't be shown, but row/col will not be resized
# remove - entirely remove these cells from the data set (equivalent to setting cells to missing value)

cutoff_cell_handling = remove

# The color of ribbons is by default the color of the row segment from
# which they originate. The block below allows you to remap the color
# of the ribbons based on cell percentile values. There are two ways
# to remap colors
# 
# - color_remap=yes, color_autoremap=no
#   Uses <percentile> blocks to define the percentile values and associated
#   color/stroke_color characteristics for ribbons. Percentile value defined
#   in the block (e.g. <percentile 55>) is the max percentile value for
#   cells associated with this block.
# - color_remap=yes, color_autoremap=yes
#   Uses colors associated with each percentile window of size
#   percentile_sampling for each cell

<linkcolor>
color_source       = row
percentile_source  = larger
color_transparency = 1
color_remap        = no
color_autoremap    = no

<percentile 50>
color = dgrey
transparency = 5
</percentile>

<percentile 60>
transparency = 5
</percentile>

<percentile 70>
transparency = 4
</percentile>

<percentile 80>
transparency = 3
</percentile>

<percentile 90>
transparency = 2
stroke_color = black
stroke_thickness = 1p
</percentile>

<percentile 100>
transparency = 1
stroke_color = black
stroke_thickness = 3p
</percentile>

</linkcolor>

<linkparam>
color = vdgrey
#stroke_color = black
#stroke_thickness = 1p
</linkparam>

# If you are using color_autoremap=yes above, then
# define the percentile sampling window and 
# the start/end HSV color values. Percentile window
# colors are interpolated between this HSV pair.
#
# HSV = (hue saturation value) 
# hue=(0..360) saturation=(0..1) value=(0..1) 

percentile_sampling = 5

# count - percentile based on counts
# value - percentile based on value

percentile_method = count

# use all values or only unique values when
# calculating percentiles
percentile_unique_only = yes

# use a function, f(X), to remap cell values when calculating percentiles
# for the purpose of color mapping. This allows you to apply a remapping to how
# colors are calculated, without actually changing the values. The remap
# applies only if percentile_method=value

# percentile_remap = sqrt(X)

# Which cell value set to use for percentile color mapping
# raw - original values
# filtered - values that pass min/max filters
# scaled - filtered values that have been scaled if use_scaling is set
percentile_data_domain = raw

<colors>
h0 = 0
s0 = 1
v0 = 1
h1 = 300
s1 = 1
v1 = 1
</colors>

# You can control the color and stroke of ribbons for each
# quartile (q1, q2, q3, q4). Any values defined here will
# overwrite colors determined by remapping. 
#
# For example, if you have a lot of cells and wish to attenuate
# the visibility of ribbons associated with small values, you can
# set cell_q1_color=vvlgrey,cell_q1_nostroke=yes to fade the
# ribbons into the background.

#cell_q1_color    = vvlgrey
#cell_q2_color    = vlgrey
#cell_q3_color    = lgrey
#cell_q4_color    = red
#cell_q1_nostroke = yes
#cell_q2_nostroke = yes
#cell_q3_nostroke = yes
#cell_q4_nostroke = yes

# cell value multiplier, required when all data is small (e.g. <1), in which
# case set the multiplier to something like 1000 because Circos
# works only with integer scales

data_mult = 1

################################################################
# Segment labels can be optionally set to a size that is
# proportional to the size of the segment. Set min/max size
# values here. If this line is commented out, then the label
# size is determined by the circos.conf file used to draw the image

#segment_label_size_range       = 60,60

# progression controls how fast the label size changes from
# min to max (larger value of progression means values close to max
# are achieved for smaller segments)

segment_label_size_progression = 4

segment_label_uppercase = no

################################################################
# Segment colors can be specified in the data file (in this
# case use row_color_col and col_color_row), otherwise colors
# are interpolated within an HSV range. Color interpolation can be
# done in two ways: based on segment index (interpolation steps through
# colors uniformly for each segment) and total size (interpolation
# steps through colors in proportion to segment size).

<segment_colors>
interpolate_type = count # size or count
h0 = 0
s0 = 0.8
v0 = 0.9
h1 = 300
s1 = 0.8
v1 = 0.9
</segment_colors>

################################################################
# Shorten the labels of segments. Specify whether to do this
# with shorten_text=yes|no parameter and provide regular
# expressions in string_replace which define the text to
# replace. 

shorten_text = no

<string_replace>
chromosome = chr
</string_replace>

# exit on any error
strict_sanity = yes

################################################################
# if the segment_prefix is set, then rows and columns will be
# renamed to internal fields segment_prefix + DIGIT

#segment_prefix  = id
color_prefix = color

# field delimiter regular expression
# if this is not defined, any whitespace will be considered a delimiter
field_delim = \s

# collapse adjacent delimiters?
field_delim_collapse = yes

# remove any leading space in the input file
# by default, this is on - if you set this to "no", make sure that you don't have any leading spaces in your table!
strip_leading_space = yes

# remove quotes and thousand separators - concatenate characters to remove
#
# e.g. to remove characters a b c set remove_cell_rx=abc
# e.g. to remove characters " ' , set remove_cell_rx="',
remove_cell_rx = "',

