This file contains 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 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 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 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 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 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 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 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", |
This file contains 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) | |
par(mfrow = c(2, 2)) | |
circos.initialize(c("a"), xlim = c(0, 1)) | |
circos.track(ylim = c(0, 1), track.height = 0.7, bg.border = NA, | |
panel.fun = function(x, y) { | |
circos.lines(CELL_META$cell.xlim, rep(CELL_META$cell.ylim[1], 2), col = "#CCCCCC") | |
circos.lines(CELL_META$cell.xlim, rep(CELL_META$cell.ylim[2], 2), col = "#CCCCCC") | |
x0 = runif(1000) |
This file contains 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
gsub_eval = function(pattern, replacement, x, ignore.case = FALSE, perl = FALSE, | |
fixed = FALSE, useBytes = FALSE, envir = parent.frame()) { | |
txt = gsub( | |
pattern = pattern, | |
replacement = replacement, | |
x = x, | |
ignore.case = ignore.case, | |
perl = perl, | |
fixed = fixed, | |
useBytes = useBytes |