Skip to content

Instantly share code, notes, and snippets.

View crazyhottommy's full-sized avatar
🎯
Focusing

Ming Tang crazyhottommy

🎯
Focusing
View GitHub Profile

use diffbind to get diff sites

library(DiffBind)
UCI.H3K27ac.dba<- dba(sampleSheet="H3K27ac_diffbind.csv", scoreCol= 7, filter=80, peakFormat = "macs")

UCI_H3K27ac_RPKM<- dba.count(UCI.H3K27ac.dba, minOverlap=2, 
                      fragmentSize = 200, bParallel = T,
                      score = DBA_SCORE_RPKM)
@crazyhottommy
crazyhottommy / maf_legacy.R
Created February 22, 2017 15:39 — forked from tiagochst/maf_legacy.R
Get MAF files aligned against hg19
query.maf.hg19 <- GDCquery(project = "TCGA-COAD",
data.category = "Simple nucleotide variation",
data.type = "Simple somatic mutation",
access = "open",
legacy = TRUE)
# Check maf availables
knitr::kable(getResults(query.maf.hg19)[,c("created_datetime","file_name")])
query.maf.hg19 <- GDCquery(project = "TCGA-COAD",
data.category = "Simple nucleotide variation",
@crazyhottommy
crazyhottommy / bkup_dotfiles_configs.md
Last active November 27, 2022 07:31 — forked from sbamin/bkup_dotfiles_configs.md
How to rsync dot files and directories of remote server

backup dotfiles

  • Following will copy all of dot ~/. files and directories (including its contents) directly underneath home directory.
  • To avoid copying cache and other local configs, e.g., that of web browser, java apps, etc., preferably query directory size tool under entire home $HOME/, using ncdu $HOME of similar tool.
  • Exclude all those large directories using rsync --exclude=.local --exclude=.cache format
  • Avoid rsync password, ssh keys, .bash_history, etc. if you are uploading to github, etc.
  • rsync home dotfiles and configs as follows:
# in your local machine
library(tidyverse)

## read in the mutect files
mix.files<- as.list(dir(".", pattern= "*.tsv"))

## need to add the file name into a column
mix_mutect_datlist <- lapply(mix.files, function(f) {
        dat = read.table(f, header =T, sep ="\t", quote = "\"")
@crazyhottommy
crazyhottommy / character_df_to_heatmap.md
Created January 9, 2017 23:03
character_df_to_heatmap
colors = structure(circlize::rand_color(4), names = c("a", "b", "c", "d"))
discrete_mat = matrix(sample(letters[1:4], 100, replace = TRUE), 10, 10)



cell_fun = function(j, i, x, y, width, height, fill) {
	grid.rect(x = x *0.6, y = y, width = width * 0.6, height = height, 
		gp = gpar(col = "grey", fill = fill))
}

Pathway analysis using GREAT

rGREAT is an R client written by the same author of ComplexHeatmap for the web GREAT Tool


#library(devtools)
#install_github("jokergoo/rGREAT")
library(rGREAT)

From David Robinson:

A tidyverse approach to ROC curves #rstats pic.twitter.com/buizc7U9ns

— David Robinson (@drob) November 29, 2016
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
library(tidyverse)
theme_set(theme_minimal())
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# original from https://gist.github.com/smsharma/0003b61a571cab63ad80
# exit on error
set -e
#!/bin/sh
## orginal from https://gist.github.com/lazywei/12bc1669dc7739dccef1
## author Ming Tang (Tommy)
## 2016-11-20
set -e
set -u
set -o pipefail
export VEP_PATH=$HOME/vep
export VEP_DATA=$HOME/.vep

mkdir $VEP_PATH $VEP_DATA; cd $VEP_PATH
curl -LO https://github.com/Ensembl/ensembl-tools/archive/release/86.tar.gz
/usr/local/Cellar/gnu-tar/1.29_1/bin/tar -zxf 86.tar.gz --starting-file variant_effect_predictor --transform='s|.*/|./|g'

rsync -zvh rsync://ftp.ensembl.org/ensembl/pub/release-86/variation/VEP/homo_sapiens_vep_86_GRCh37.tar.gz $VEP_DATA