Skip to content

Instantly share code, notes, and snippets.

👶
Elternzeit

Zuguang Gu jokergoo

👶
Elternzeit
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 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) {
View simple_template.R
# == title
# Simple template for text interpolation
#
# == description
# I like text interpolation in Perl. But in R, if you want to connect plain text and variables,
# you need to use `paste` or functions in `stringr`. However, if there are so many variables or
# or many quotes in the string you want to construct, it would be a little terrible.
# So, this function allows you to construct strings as Perl style.
#
# == param
You can’t perform that action at this time.