chromatin_states_transition_chord_diagram: Chord diagram for visualizing chromatin states transitions

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/chromatin_states_transitions.R

Description

Chord diagram for visualizing chromatin states transitions

Usage

1
2
chromatin_states_transition_chord_diagram(mat, group_names = NULL, max_mat = mat,
    remove_unchanged_transition = TRUE, state_col = NULL, legend_position = NULL, ...)

Arguments

mat

the transition matrix. It should be a square matrix in which row names and column names should be all the same. If it is not, the function will try to re-format it. If the matrix is from make_transition_matrix_from_chromHMM with methylation dataset, there will be additional tracks showing methylation difference between two groups.

group_names

name for the two groups under comparison. You also add it afterwards by using text

max_mat

if there are several transition matrix to be compared, set it to the matrix with maximum absolute and it will make scales of all matrix the same and comparable.

remove_unchanged_transition

whether to remove transitions that states are not changed (set the values in diagonal to 0)

state_col

color for states. It should be a vector of which names correspond to states.

legend_position

positions of legends. Possible values are "bottomleft", "bottomright", "topright" and "topleft". If the value is specified as vector with length larger than two, the legend will be split into several parts. Set the value to NULL to suppress legends.

...

pass to chordDiagram

Details

Rows of mat locate at the bottom of the circle by default. You can transpose the matrix to move rows to the top of the circle.

The chord diagram visualizes how much chromatin states change. In the diagram, width of each link represents the total width of segments in a certain chromatin state in group 1 that transite to other chromatin state in group 2. The width of each grid represents total width of segments in a certain chromatin in group 1 that transite to all states in group 2.

If methylation dataset is provided when making the transistion matrix by using make_transition_matrix_from_chromHMM, there will be extra tracks on the outside of the circlie to represenst the mean methylation difference in two groups.

Chord diagram is implemented in base graphic system, which means, you can add titles or other graphics by base graphic functions (e.g. title, text, ...)

If you want to adjust order of states in the chord diagram, directly change row and column order of the matrix. If the matrix is from make_transition_matrix_from_chromHMM, use state_names to retrieved or modify chromatin state names.

Value

No value is returned.

Author(s)

Zuguang Gu <z.gu@dkfz.de>

See Also

make_transition_matrix_from_chromHMM which generates transition matrix directly from chromHMM results.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
set.seed(123)
gr_list_1 = lapply(1:5, function(i) {
	pos = sort(c(0, sample(1:9999, 99), 10000))*200
	GRanges(seqnames = "chr1", ranges = IRanges(pos[-101] + 1, pos[-1]), 
	    states = paste0("state_", sample(1:9, 100, replace = TRUE)))
})
gr_list_2 = lapply(1:5, function(i) {
	pos = sort(c(0, sample(1:9999, 99), 10000))*200
	GRanges(seqnames = "chr1", ranges = IRanges(pos[-101] + 1, pos[-1]), 
	    states = paste0("state_", sample(1:9, 100, replace = TRUE)))
})
mat = make_transition_matrix_from_chromHMM(gr_list_1, gr_list_2)
chromatin_states_transition_chord_diagram(mat, legend_position = "bottomleft")

jokergoo/epik documentation built on Sept. 28, 2019, 9:20 a.m.