Skip to content

Instantly share code, notes, and snippets.

Zuguang Gu jokergoo

Block or report user

Report or block jokergoo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ComplexHeatmap_logo.R
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
View giggle_analysis.R
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")
View bioc_download.pl
#!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
View gist:a4b262985abfb5cdca03c0f1dbecfe23
Path of SRA files:
http://sra-download.ncbi.nlm.nih.gov/srapub/SRR\\d+
View webmail_filter.js
var unread = new Array();
var checked = new Array();
var from = new Array();
var subject = new Array();
var rows = new Array();
load_all = function() {
rows = document.getElementsByClassName("lvm")[0].lastChild.childNodes;
View is_abs_unit.R
is_abs_unit <- function(x) UseMethod("is_abs_unit")
is_abs_unit.unit = function(x) {
unit = attr(x, "valid.unit")
if(unit %in% c(1:4, 7:24)) {
return(TRUE)
} else {
return(FALSE)
}
View module.R
set_module = function(module) {
assign("__module__", module, envir = parent.frame())
}
load_module = function(file) {
e = new.env()
source(file, local = e, verbose = FALSE)
module = get("__module__", envir = e)
rm(e)
View gist:8789282
bedtools = function(cmd, envir = parent.frame()) {
gr = gsub("^.*@\\{(.*?)\\}.*$", "\\1", cmd)
gr = get(gr, envir = envir)
file = tempfile(fileext = ".bed")
write.table(gr, file = file, sep = "\t", quote = FALSE, row.names = FALSE, col.names = FALSE)
cmd = gsub("@\\{.*?\\}", file, cmd)
try(tb <- read.table(pipe(cmd), stringsAsFactors = FALSE))
file.remove(file)
return(tb)
}
View build.position.index.R
build.position.index = function(x, by = 5) {
segment = round((x/(10^by)))*10^by
se = unique(segment)
mat = matrix(nrow = length(se), ncol = 2)
for(i in seq_along(se)) {
mat[i, ] = range(which(segment == se[i]))
}
list(mat = mat, segment = se, by = 10^by)
}
View assigement.R
assignment = function(x, k = 4) {
names(x) = seq_along(x)
y = vector("list", k)
ysum = sapply(y, function(x) 0)
flag = 0
while(length(x)) {
if(flag) {
You can’t perform that action at this time.