Skip to content

Instantly share code, notes, and snippets.

View crazyhottommy's full-sized avatar
🎯
Focusing

Ming Tang crazyhottommy

🎯
Focusing
View GitHub Profile
#! /bin/bash
set -e
set -u
set -o pipefail
#### Author: Ming Tang (Tommy)
#### Date 09/29/2016
#### I got the idea from this stackOverflow post http://stackoverflow.com/questions/11098189/awk-extract-columns-from-file-based-on-header-selected-from-2nd-file

A dummy example for testing

cat DATA.tsv 
ID	head1	head2	head3	head4
1	25.5	1364.0	22.5	13.2
2	10.1	215.56	1.15	22.2

cat LIST.TXT 
ID
### Define intronic, exonic and intergenic regions
```{r}
library(AnnotationHub)
library(dplyr) ## for %>%
ah = AnnotationHub()
possibleDates(ah)
AnnotationHub::query(ah, c("gtf", "Homo_sapiens", "GRCh37"))
GRCh37.gtf<- ah[['AH10684']]
```r
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
UCSC.hg19<- TxDb.Hsapiens.UCSC.hg19.knownGene
hg19.genes<- genes(UCSC.hg19)
transcriptsBy(UCSC.hg19, "gene")
library("org.Hs.eg.db")
## note that dplyr and AnnotationDbi both have a function called select
## use dplyr::select when use dplyr
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
#!/bin/sh
## orginal from https://gist.github.com/lazywei/12bc1669dc7739dccef1
## author Ming Tang (Tommy)
## 2016-11-20
set -e
set -u
set -o pipefail
#!/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

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())

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)
@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))
}