Skip to content

Instantly share code, notes, and snippets.

View Buttonwood's full-sized avatar

Buttonwood Buttonwood

View GitHub Profile
# Transforming a color scale
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("ggplot2", "RColorBrewer", "scales")
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Generate some data
nn <- 10000
myData <- data.frame(X = rnorm(nn),
@Buttonwood
Buttonwood / barplot_with_pareto.R
Created March 28, 2014 05:34
Some Useful Rscripts
#=============================================================================
# FileName: plot.R
# Desc: A short script for hist barplot and pareto cumulated frequency.
# Author: tanhao
# Email: tanhao2013@gmail.com
# HomePage: http://buttonwood.github.io
# Version: 0.0.1
# LastChange: 2014-03-20 14:35:48
# History:
#=============================================================================
@Buttonwood
Buttonwood / parser_m8_solar.py
Last active August 29, 2015 13:57
Parsing blast default output to a table file.
#!/usr/bin/env python
'''
#=============================================================================
# FileName: parser_m8_solar.py
# Desc: A script for parsering a blast m8 file to solared blocks;
# Author: tanhao
# Email: tanhao2013@gmail.com
# HomePage: http://buttonwood.github.io
# Version: a.0.1
# LastChange: 2014-03-19 09:22:07
@Buttonwood
Buttonwood / gridExtra.R
Last active August 29, 2015 13:58
R multiplot
library(gridExtra)
a <- qplot(TMPRSS4, ECADHERIN, data=spear)
b <- qplot(TMPRSS4, ECADHERIN, data=spear, geom="jitter")
grid.arrange(a,b,ncol=2)
@Buttonwood
Buttonwood / fastqc.cpp
Last active March 29, 2016 14:20
fastqc
// #=============================================================================
// # FileName: fastqc.cpp
// # Desc: A program for fastqc stat files;
// # Author: tanhao
// # Email: tanhao2013@gmail.com
// # HomePage: http://buttonwood.github.io
// # Version: 0.0.1
// # LastChange: 2014-04-10 16:27:55
// # History:
// #=============================================================================
#=============================================================================
# FileName: plot-maf.pl
# Desc: A short script for using a maf tab file to draw a alignment block
# graph.
# Author: tanhao
# Email: tanhao2013@gmail.com
# HomePage: http://buttonwood.github.io
# Version: 0.0.1
# LastChange: 2014-04-21 15:31:28
# History:
@Buttonwood
Buttonwood / kmer.R
Last active March 29, 2016 14:19
lastz.sh
a <- read.table("./MMJ.freq.stat", skip = 8, sep = "\t", nrows = 254)
png("./kmer.png",type="cairo")
head(a)
plot(a[,1], a[,3]*100,
xlim = c(0,200),
ylim = c(0,5),
col = "darkblue",
type = "l",
lty = 1,
xlab = "Sequencing Depth (X)",
#=============================================================================
# FileName: add_taxonomy_info.pl
# Desc: Add taxonomy information for a blast nt/nr table file.
# Author: tanhao
# Email: tanhao2013@gmail.com
# HomePage: http://buttonwood.github.io
# Version: 0.0.1
# LastChange: 2013-05-05 11:35:12
# History:
#=============================================================================
@Buttonwood
Buttonwood / cog_db_clean.pl
Last active February 21, 2022 06:45
Filter genes in cog database which can't correspond to any COG ID.
#=============================================================================
# FileName: clean_cog_db.pl
# Desc: Filter genes in cog database which can't correspond to any COG ID.
# Author: tanhao
# Email: tanhao2013@gmail.com
# HomePage: http://buttonwood.github.io
# Version: 0.0.1
# LastChange: 2014-05-09 11:19:35
# History:
#=============================================================================
@Buttonwood
Buttonwood / stat_func.pl
Created May 13, 2014 03:17
A short script for function annotation table statistics!
#=============================================================================
# FileName: stat_func.pl
# Desc:
# Author: tanhao
# Email: tanhao2013@gmail.com
# HomePage: http://buttonwood.github.io
# Version: 0.0.1
# LastChange: 2014-05-13 10:06:14
# History:
#=============================================================================