Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/chromatin_states_transitions.R
Generate transition matrix from chromHMM results
1 2 | make_transition_matrix_from_chromHMM(gr_list_1, gr_list_2, sample_id_1, sample_id_2,
window = NULL, min_1 = 0.5, min_2 = 0.5, meth_diff = 0, chromosome = paste0("chr", 1:22))
|
gr_list_1 |
a list of |
gr_list_2 |
a list of |
sample_id_1 |
if |
sample_id_2 |
similar as |
window |
window size which was used to do chromHMM states segmentation If it is not specified, the greatest common divisor of the width of all regions is used. |
min_1 |
If there are multiple samples in the group, it is possible that a segment has more than one states asigned to it. If the recurrency of each state is relatively low, it means there is no one dominant state for this segment and it should be removed. This argument controls the minimal value for the recurrency of states in a given segment. The value is a percent. |
min_2 |
same as |
meth_diff |
If methylation dataset is provided, the segments for which the methylation difference between two groups is less than this value are removed. |
chromosome |
subset of chromosomes |
For a segment in the genome, the chromatin state may be different in different subgroups. This is called chromatin state transistion. This function visualize such kind of genome-wide transitions.
The whole genome is segmentated by window
and states with highest occurence among samples (and pass min_1
and min_2
) are assigned to segments.
To make the function run successfully, number of segments (after binned by window
) in all samples
should be all the same and there should be no gaps between segments. If the segmentation data is directly imported from
chromHMM results, you dont need to worry anything.
A transition matrix in which values represent total width of segments that transite from one state to the other in the two groups. Rows correspond to group 1 and columns correspond to group 2.
If methylation dataset is provided, the mean methylation for each state in each group is attached, which will be used to calculate
mean methylation difference in chromatin_states_transition_chord_diagram
.
Subsetting and transpotation can be applied on the matrix so that the order of chromatin states can be adjusted to the matrix. If methylation data is provided, corresponding methylation difference matrix will be adjusted as well.
Zuguang Gu <z.gu@dkfz.de>
The matrix can be sent to chromatin_states_transition_chord_diagram
to visualize.
1 2 3 4 5 6 7 8 9 10 11 12 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.