This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!c:/perl/bin/perl -w | |
| use strict; | |
| use LWP::Simple; | |
| use CGI; | |
| my $package = param("package") | |
| if($package eq "ComplexHeatmap" or | |
| $package eq "EnrichedHeatmap" or |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| giggle_dir = "/icgc/dkfzlsdf/analysis/B080/guz/giggle_test/giggle" | |
| giggle_data_dir = "/icgc/dkfzlsdf/analysis/hipo/hipo_016/analysis/WGBS_final_cohort/giggle_data" | |
| temp_dir = "/icgc/dkfzlsdf/analysis/hipo/hipo_016/analysis/WGBS_final_cohort/temp" | |
| library(GetoptLong) | |
| build_giggle_index = function(gr_list, name = "anno") { | |
| system(qq("mkdir @{giggle_data_dir}/@{name}")) | |
| # write as bed files | |
| for(nm in names(gr_list)) { | |
| qqcat("writing @{nm}.bed\n") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mat = matrix(0, nrow = 10, ncol = 27) | |
| mat[2, c(1, 2, 3, 13, 14, 15, 17, 23, 25)] = 1 | |
| mat[3, c(1, 5, 6, 7, 9, 10, 11, 13, 15, 17, 19, 20, 21, 23, 24, 25)] = 1 | |
| mat[4, c(1, 5, 7, 9, 10, 11, 13, 14, 17, 19, 21, 24)] = 1 | |
| mat[5, c(1, 2, 3, 5, 6, 7, 9, 11, 13, 17, 19, 20, 23, 25)] = 1 | |
| mat[7, c(1, 3, 14, 25, 26, 27)] = 1 | |
| mat[8, c(1, 3, 5, 6, 7, 10, 11, 13, 14, 15, 17, 18, 19, 21, 22, 23, 25, 27)] = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(GenomicInteractions) | |
| data(hic_example_data) | |
| hic_example_data = as.data.frame(hic_example_data) | |
| hic_example_data = hic_example_data[hic_example_data$seqnames1 == hic_example_data$seqnames2, ] | |
| gr1 = hic_example_data[, c("seqnames1", "start1", "end1")] | |
| colnames(gr1) = c("chr", "start", "end") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(ComplexHeatmap) | |
| set.seed(123) | |
| mat = matrix(rnorm(100), 10) | |
| rownames(mat) = letters[1:10] | |
| ht = Heatmap(mat, | |
| column_title = gt_render("Some <span style='color:blue'>blue text **in bold.**</span><br>And *italics text.*<br>And some <span style='font-size:18pt; color:black'>large</span> text.", | |
| r = unit(2, "pt"), | |
| padding = unit(c(2, 2, 2, 2), "pt")), | |
| column_title_gp = gpar(box_fill = "orange"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(circlize) | |
| library(ComplexHeatmap) | |
| mat = matrix(runif(100), 10) | |
| col_fun = colorRamp2(c(0, 0.1, 1), c("blue", "white", "red")) | |
| Heatmap(mat, col = col_fun, cell_fun = function(j, i, x, y, w, h, fill) { | |
| if(mat[i, j] < 0.1) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type = c(rep("Tumor", 10), rep("Control", 10)) | |
| set.seed(888) | |
| ###################################### | |
| # generate methylation matrix | |
| rand_meth = function(k, mean) { | |
| (runif(k) - 0.5)*min(c(1-mean), mean) + mean | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(grid) | |
| word_cloud_grob = function(text, fontsize, | |
| line_space = unit(4, "pt"), word_space = unit(4, "pt"), max_width = unit(80, "mm"), | |
| col = function(fs) circlize::rand_color(length(fs), luminosity = "dark"), | |
| test = FALSE) { # width in mm | |
| if(length(text) != length(fontsize)) { | |
| stop("`text` and `fontsize` should the same length.") | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set.seed(123) | |
| m = matrix(rnorm(100*10), nrow = 100) | |
| # you should clustr the columns before making the heatmap because the column | |
| # ordering will be used in `panel.fun` | |
| column_hclust = hclust(dist(t(m))) | |
| subgroup = sample(letters[1:3], 100, replace = TRUE, prob = c(1, 5, 10)) | |
| rg = range(m) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(circlize) | |
| seed_color = c("1-3" = 2, | |
| "4-6" = 3, | |
| "7-9" = 4, | |
| "10-12" = 5, | |
| "13-16" = 6, | |
| "(Missing)" = "grey") | |
| round_name = c("Champoin", | |
| "Runner-up", | |
| "Final Four", |