This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env Rscript | |
data=read.table(pipe("bjobs -u all -w | grep RUN | awk '{print $2\" \"$6}'"),stringsAsFactors = F,col.names = c("username","cpus")) | |
data[,2]=gsub("^cn.+$",1,data[,2]) | |
data[,2]=as.numeric(gsub("^(.+)\\*cn.+$","\\1",data[,2])) | |
res=aggregate(cpus ~ username, data, sum) | |
print(res[order(res$cpus,decreasing = T),],row.names = FALSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env Rscript | |
# With no argument provided, produce a graph since the begining of the year | |
# Argument can be "2016/03/01,2016/12/31" or "2016/03/01," | |
if (!is.na(commandArgs(TRUE)[1])) { | |
time_string=commandArgs(TRUE)[1] | |
} else { | |
time_string=paste(format(Sys.time(), "%Y"),"/01/01,",sep="") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { | |
OFS = "\t"; # tab-delimited output | |
} | |
# Use substr instead of regex to match a starting ">" | |
substr($0, 1, 1) == ">" { | |
if (seqlen) { | |
# Only print info for this sequence if no target was given | |
# or its id matches the target. | |
if (! target || id == target) { | |
print id, seqlen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_info=function(info,field,num=T) { | |
get_single_info=function(single_info,field) { | |
grep_res=grep(paste("^",field,"=",sep=""),unlist(strsplit(single_info,";")),value=T) | |
if (length(grep_res)>0) strsplit(grep_res,"=")[[1]][2] else NA | |
} | |
res=unlist(lapply(info,get_single_info,field)) | |
if (num) as.numeric(res) else res | |
} | |
get_genotype=function(genotype,format,field,num=T) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qq = function(pvector, title="Quantile-quantile plot of p-values",red=NULL) { | |
# adapted from http://www.gettinggeneticsdone.com/2009/11/qq-plots-of-p-values-in-r-using-ggplot2.html | |
pvector[pvector==0]=min(pvector[pvector>0]) | |
obs <- -log10(pvector) | |
N <- length(obs) ## number of p-values | |
null <- -log(1:N/N,10) | |
MAX <- max(c(obs,null)) | |
c95 <- rep(0,N) | |
c05 <- rep(0,N) | |
for(i in 1:N){ |