Module Expr Str Import alias Import alias Import alias Import alias ImportFrom alias Import alias Import alias Import alias Import alias ImportFrom alias ImportFrom alias Expr Call AttributeLoad NameLoad attr keyword Num keyword Str keyword Str keyword AttributeLoad NameLoad attr keyword Str Assign NameStore Str Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body TryExcept body Assign NameStore Call NameLoad NameLoad Str Assign NameStore Dict For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr TryExcept body Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Index Num Call NameLoad SubscriptLoad NameLoad Index Num handlers ExceptHandler body Pass Expr Call AttributeLoad NameLoad attr handlers ExceptHandler body Assign NameStore Call AttributeLoad NameLoad attr BinOpMod NameLoad NameLoad Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr keyword Str Index Num Assign NameStore Call NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Expr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Str Assign NameStore Dict For NameStore NameLoad body Assign NameStore Call AttributeLoad NameLoad attr TryExcept body Assign SubscriptStore NameLoad Index SubscriptLoad NameLoad Index Num Call NameLoad SubscriptLoad NameLoad Index Num handlers ExceptHandler body Pass Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args defaults body Assign NameStore Str Assign NameStore Str Assign NameStore Call NameLoad keyword Str keyword NameLoad keyword NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str keyword Num Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str keyword Num Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str keyword Num keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str keyword Num keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword NameLoad keyword Str Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If BoolOpAnd CompareNotEq NameLoad Str CompareNotEq NameLoad Str body Print BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr Num Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If CompareEq NameLoad Str body Assign NameStore NameLoad orelse If CompareEq NameLoad Str body Assign NameStore NameLoad orelse If CompareEq NameLoad Str body Assign NameStore Lambda arguments args NameParam defaults SubscriptLoad NameLoad Index Num orelse Print BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr Num Assign NameStore Call NameLoad NameLoad If BoolOpOr CompareLt NameLoad Num UnaryOpNot AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Num If BoolOpAnd AttributeLoad NameLoad attr CompareEq Call NameLoad AttributeLoad NameLoad attr NameLoad body Assign NameStore AttributeLoad NameLoad attr orelse Assign NameStore Call NameLoad Lambda arguments args NameParam defaults Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad If CompareLt AttributeLoad NameLoad attr Num body Expr Call NameLoad Str Expr Call AttributeLoad NameLoad attr Num If CompareLt AttributeLoad NameLoad attr Num body Expr Call NameLoad Str Expr Call AttributeLoad NameLoad attr Num For NameStore NameLoad body If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Expr Call NameLoad BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr Num Assign NameStore Call NameLoad NameLoad NameLoad Expr Call NameLoad BinOpMod Str NameLoad Expr Call NameLoad Str TryExcept body Assign NameStore Call NameLoad AttributeLoad NameLoad attr handlers ExceptHandler body Expr Call NameLoad Str Expr Call AttributeLoad NameLoad attr Num Assign NameStore Dict For NameStore NameLoad body Assign NameStore Call NameLoad ListLoad For NameStore NameLoad body If CompareNotEq Call AttributeLoad NameLoad attr Str Num body Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Str NameLoad attr Num Expr Call AttributeLoad NameLoad attr NameLoad For NameStore NameLoad body Assign SubscriptStore NameLoad Index NameLoad BinOpAdd Call AttributeLoad NameLoad attr NameLoad Num Num Assign NameStore ListLoad For NameStore Call AttributeLoad NameLoad attr body If CompareEq SubscriptLoad NameLoad Index NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call NameLoad BinOpMod Str Call AttributeLoad Str attr NameLoad If AttributeLoad NameLoad attr body Assign NameStore Call NameLoad AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str For NameStore Call NameLoad Call NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad Expr Call AttributeLoad NameLoad attr Num Expr Call NameLoad BinOpMod Str BinOpAdd NameLoad Num Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr keyword NameLoad keyword AttributeLoad NameLoad attr Assign NameStore ListLoad Assign NameStore AttributeLoad NameLoad attr For NameStore NameLoad body Assign NameStore ListLoad Assign NameStore AttributeLoad NameLoad attr TryExcept body Assign NameStore SubscriptLoad NameLoad Index NameLoad handlers ExceptHandler body Expr Call NameLoad BinOpMod Str NameLoad Continue Assign NameStore SubscriptLoad NameLoad Index NameLoad For TupleStore NameStore NameStore AttributeLoad NameLoad attr body If NameLoad body Expr Call NameLoad Call NameLoad NameLoad orelse Expr Call NameLoad NameLoad Expr Call NameLoad Str Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad If SubscriptLoad NameLoad Index Num body Expr Call AttributeLoad NameLoad attr BinOpMod Str SubscriptLoad NameLoad Index Num orelse Expr Call AttributeLoad NameLoad attr Str For NameStore SubscriptLoad NameLoad Slice Num body If NameLoad body Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad orelse Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str For NameStore Call NameLoad BinOpSub NameLoad Num body Expr Call AttributeLoad NameLoad attr BinOpMod Str BinOpAdd NameLoad Num Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr For NameStore Call NameLoad BinOpSub NameLoad Num body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad BinOpAdd NameLoad Num AttributeLoad NameLoad attr BinOpAdd NameLoad Num AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad Str attr Call NameLoad Lambda arguments args NameParam defaults BinOpAdd BinOpAdd Str NameLoad Str NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str orelse Expr Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad Str attr Call NameLoad Lambda arguments args NameParam defaults BinOpAdd BinOpAdd Str NameLoad Str NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr TryExcept body Expr Call AttributeLoad NameLoad attr ListLoad Str AttributeLoad NameLoad attr handlers ExceptHandler body Expr Call NameLoad BinOpMod Str AttributeLoad NameLoad attr orelse Expr Call NameLoad BinOpMod Str BinOpAdd AttributeLoad NameLoad attr Str decorator_list If CompareEq NameLoad Str body TryExcept body Expr Call NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr Num
N/A N/A Description: Draw correlation plot for many wiggle files.

Copyright (c) 2008 Tao Liu <taoliu@jimmy.harvard.edu>

This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file COPYING included with
the distribution).

@status:  experimental
@version: $Revision$
@author:  Tao Liu
@contact: taoliu@jimmy.harvard.edu
 N/A os N/A sys N/A re N/A logging optparse OptionParser N/A urllib2 N/A tempfile N/A gzip N/A subprocess taolib.CoreLib.Parser WiggleIO taolib.CoreLib.BasicStat.Func * N/A N/A N/A logging basicConfig level 20 format %(levelname)-5s @ %(asctime)s: %(message)s  datefmt %a, %d %b %Y %H:%M:%S stream N/A sys stderr filemode w N/A UCSC_chrom_URL http://hgdownload.cse.ucsc.edu/goldenPath/%s/database/chromInfo.txt.gz N/A error N/A logging critical N/A warn N/A logging warning N/A debug N/A logging debug N/A info N/A logging info get_chrom_length N/A N/A dbname N/A N/A N/A N/A N/A fhd N/A open dbname r N/A chrom_len N/A N/A l fhd N/A N/A fs N/A N/A l split N/A N/A N/A N/A chrom_len N/A N/A fs N/A 0 N/A int N/A fs N/A 1 N/A N/A N/A N/A N/A N/A N/A fhd close N/A N/A N/A N/A f N/A N/A urllib2 urlopen N/A UCSC_chrom_URL dbname N/A tmpfname N/A N/A N/A tempfile mkstemp prefix qcmanychip N/A 1 N/A tmpf N/A open tmpfname w N/A N/A N/A tmpf write N/A N/A f read N/A N/A N/A tmpf close N/A N/A f close N/A fhd N/A N/A gzip open tmpfname r N/A chrom_len N/A N/A l fhd N/A N/A fs N/A N/A l split N/A N/A N/A N/A chrom_len N/A N/A fs N/A 0 N/A int N/A fs N/A 1 N/A N/A N/A N/A N/A N/A N/A fhd close N/A N/A N/A os unlink tmpfname N/A chrom_len N/A main N/A N/A N/A N/A N/A usage usage: %prog <-r rfile> [options] <wiggle files> ... N/A description Draw correlation plot for many wiggle files. Based on qc_chIP_whole.py N/A optparser N/A OptionParser version %prog 0.1 description description usage usage add_help_option False N/A N/A N/A optparser add_option -h --help action help help Show this help message and exit. N/A N/A N/A optparser add_option -d --db type str dest dbname help UCSC db name for the assembly. Default: ce4 default ce4 N/A N/A N/A optparser add_option -r --rfile dest rfile help R output file. If not set, do not save R file. N/A N/A N/A optparser add_option -s --step dest step type int help sampling step in kbps. default: 100, minimal: 1 default 100 N/A N/A N/A optparser add_option -z --imgsize dest imgsize type int help image size in inches, note the PNG dpi is 72. default: 10, minimal: 10 default 10 N/A N/A N/A optparser add_option -f --format dest imgformat type string help image format. PDF or PNG default PDF N/A N/A N/A optparser add_option -m --method dest method type string default median help method to process the paired two sets of data in the sampling step. Choices are 'median', 'mean', and 'sample' (just take one point out of a data set). Default: median N/A N/A N/A optparser add_option -l --wig-label dest wiglabel type string action append help the wiggle file labels in the figure. No space is allowed. This option should be used same times as wiggle files, and please input them in the same order as -w option. default: will use the wiggle file filename as labels. N/A N/A N/A optparser add_option --min-score dest minscore type float default -10000 help minimum score included in calculation. Points w/ score lower than this will be discarded. N/A N/A N/A optparser add_option --max-score dest maxscore type float default 10000 help maximum score included in calculation. Points w/ score larger than this will be discarded. N/A N/A N/A optparser add_option -H --heatmap dest heatmap action store_true default False help If True, a heatmap image will be generated instead of paired scatterplot image. N/A N/A options wigfiles N/A N/A optparser parse_args N/A imgfmt N/A N/A N/A options imgformat upper N/A N/A N/A imgfmt PDF N/A imgfmt PNG N/A N/A N/A unrecognized format: %s imgfmt N/A N/A N/A sys exit 1 N/A method N/A N/A N/A options method lower N/A N/A method median N/A N/A medfunc median N/A N/A N/A method mean N/A N/A medfunc mean N/A N/A N/A method sample N/A N/A medfunc N/A N/A N/A u N/A N/A u N/A -1 N/A N/A N/A unrecognized method: %s method N/A N/A N/A sys exit 1 N/A wigfilenum N/A len wigfiles N/A N/A N/A wigfilenum 2 N/A N/A options rfile N/A N/A N/A N/A optparser print_help N/A N/A N/A sys exit 1 N/A N/A N/A options wiglabel N/A N/A len N/A options wiglabel wigfilenum N/A N/A wiglabel N/A options wiglabel N/A N/A wiglabel N/A map N/A N/A N/A x N/A N/A N/A N/A os path basename x wigfiles N/A N/A N/A options step 1 N/A N/A N/A error Step can not be lower than 1! N/A N/A N/A sys exit 1 N/A N/A N/A options imgsize 10 N/A N/A N/A error Image size can not be lower than 10! N/A N/A N/A sys exit 1 N/A f wigfiles N/A N/A N/A N/A N/A N/A os path isfile f N/A N/A N/A error N/A %s is not valid! f N/A N/A N/A sys exit 1 N/A wigfhds N/A map open wigfiles N/A N/A info N/A number of wiggle files: %d wigfilenum N/A N/A info connect to UCSC to get chromosome length information N/A N/A N/A chrom_len N/A get_chrom_length N/A options dbname N/A N/A N/A N/A N/A error Error! N/A N/A N/A sys exit 1 N/A chromsdict N/A N/A wigfhd wigfhds N/A N/A tmpset N/A set N/A N/A l wigfhd N/A N/A N/A N/A N/A l find chrom= -1 N/A N/A c N/A N/A N/A N/A re search chrom=(\w+) l group 1 N/A N/A N/A tmpset add c N/A c tmpset N/A N/A N/A chromsdict N/A c N/A N/A N/A chromsdict setdefault c 0 1 N/A chroms N/A N/A c N/A N/A chromsdict keys N/A N/A N/A N/A chromsdict N/A c wigfilenum N/A N/A N/A N/A chroms append c N/A N/A info N/A common chromosomes are %s... N/A N/A , join chroms N/A N/A options rfile N/A N/A rfhd N/A open N/A options rfile w N/A N/A N/A rfhd write 
require("RColorBrewer") ## from CRAN
 N/A i N/A range N/A len wigfhds N/A N/A wigfhd N/A wigfhds N/A i N/A N/A N/A wigfhd seek 0 N/A N/A info N/A read wiggle track from wiggle file #%d N/A i 1 N/A wig N/A N/A N/A N/A WiggleIO WiggleIO wigfhd build_binKeeper chromLenDict chrom_len bin N/A options step N/A p N/A N/A ap N/A p append N/A chrom chroms N/A N/A step_region N/A N/A step_region_a N/A step_region append N/A N/A N/A end_of_chrom N/A chrom_len N/A chrom N/A N/A N/A N/A N/A warn N/A chromosome %s can not be found in UCSC... skip... chrom N/A N/A bkeeper N/A wig N/A chrom N/A N/A parray varray N/A bkeeper cage N/A N/A varray N/A N/A N/A ap N/A medfunc varray N/A N/A N/A ap None N/A N/A info write values to r file N/A N/A N/A rfhd write N/A p%d <- c( i N/A N/A p N/A 0 N/A N/A N/A N/A rfhd write N/A %f N/A p N/A 0 N/A N/A N/A N/A rfhd write NA N/A v N/A p N/A 1 N/A N/A v N/A N/A N/A N/A rfhd write N/A ,%f v N/A N/A N/A N/A rfhd write ,NA N/A N/A N/A rfhd write )
 N/A N/A N/A rfhd write c <- cbind(p0 N/A i N/A range N/A wigfilenum 1 N/A N/A N/A N/A rfhd write N/A ,p%d N/A i 1 N/A N/A N/A rfhd write )
 N/A N/A N/A rfhd write N/A c <- c[ c[,1]<=%f & c[,1]>=%f  N/A N/A options maxscore N/A options minscore N/A i N/A range N/A wigfilenum 1 N/A N/A N/A N/A rfhd write N/A & c[,%d]<=%f & c[,%d]>=%f  N/A N/A i 2 N/A options maxscore N/A i 2 N/A options minscore N/A N/A N/A rfhd write ,]
 N/A N/A imgfmt PDF N/A N/A N/A N/A rfhd write N/A pdf("%s.pdf",width=%d,height=%d)
 N/A N/A options rfile N/A options imgsize N/A options imgsize N/A N/A N/A imgfmt PNG N/A N/A N/A N/A rfhd write N/A png("%s.png",units="in",res=150,width=%d,height=%d)
 N/A N/A options rfile N/A options imgsize N/A options imgsize N/A N/A options heatmap N/A N/A N/A N/A rfhd write library(gplots)
 N/A N/A N/A rfhd write 
m <- cor(c, method="pearson", use="pairwise.complete.obs")
 N/A labels N/A N/A , join N/A map N/A N/A N/A x N/A N/A N/A " x " wiglabel N/A N/A N/A rfhd write N/A rownames(m) <- c(%s)
 labels N/A N/A N/A rfhd write N/A colnames(m) <- c(%s)
 labels N/A N/A N/A rfhd write # draw the heatmap using gplots heatmap.2
 N/A N/A N/A rfhd write mn <- -1
 N/A N/A N/A rfhd write mx <- 1
 N/A N/A N/A rfhd write n <- 98
 N/A N/A N/A rfhd write bias <- 1
 N/A N/A N/A rfhd write mc <- matrix(as.character(round(m, 2)), ncol=dim(m)[2])
 N/A N/A N/A rfhd write breaks <- seq(mn, mx, (mx-mn)/(n))
 N/A N/A N/A rfhd write cr <- colorRampPalette(colors = c("#2927FF","#FFFFFF","#DF5C5C"), bias=bias)
 N/A N/A N/A rfhd write heatmap.2(m, col = cr(n), breaks=breaks, trace="none", cellnote=mc, notecol="black", notecex=1.8, keysize=0.5, density.info="histogram", margins=c(27.0,27.0), cexRow=2.20, cexCol=2.20, revC=T, symm=T)
 N/A N/A N/A N/A rfhd write 
panel.plot <- function( x,y, ... )
{
  par(new=TRUE)
  m <- cbind(x,y)
  plot(m,col=densCols(m),pch=20)
  lines(lowess(m[!is.na(m[,1])&!is.na(m[,2]),]),col="red")  
}
    
panel.cor <- function(x, y, digits=2, prefix="", cex.cor, ...)
{
  usr <- par("usr"); on.exit(par(usr))
  par(usr = c(0, 1, 0, 1))
  r <- cor(x, y,use="complete.obs")
  txt <- format(c(r, 0.123456789), digits=digits)[1]
  txt <- paste(prefix, txt, sep="")
  if(missing(cex.cor)) cex.cor <- 0.8/strwidth(txt)
  text(0.5, 0.5, txt, cex = cex.cor * abs(r))
}
 N/A labels N/A N/A , join N/A map N/A N/A N/A x N/A N/A N/A " x " wiglabel N/A N/A N/A rfhd write N/A 
pairs(c, lower.panel=panel.plot, upper.panel=panel.cor, labels=c(%s))
 labels N/A N/A N/A rfhd write dev.off()
 N/A N/A N/A rfhd close N/A N/A N/A N/A N/A subprocess call N/A Rscript N/A options rfile N/A N/A N/A N/A N/A info N/A Please check %s N/A options rfile N/A N/A N/A info N/A Please check %s N/A N/A options rfile .bmp N/A N/A N/A __name__ __main__ N/A N/A N/A N/A N/A main N/A N/A N/A KeyboardInterrupt N/A N/A N/A N/A N/A sys stderr write User interrupt me! ;-) See you!
 N/A N/A N/A sys exit 0