<s> '''<STR_LIT>''' <EOL> import os <EOL> import sys <EOL> import string <EOL> import re <EOL> import tempfile <EOL> import math <EOL> import code <EOL> import CGAT . Experiment as E <EOL> import CGAT . MatlabTools as MatlabTools <EOL> import numpy <EOL> import CGAT . Stats as Stats <EOL> from rpy2 . robjects import r as R <EOL> def readTable ( lines , <EOL> assign , <EOL> separator = "<STR_LIT:\t>" , <EOL> numeric_type = numpy . float , <EOL> take_columns = "<STR_LIT:all>" , <EOL> headers = True , <EOL> row_names = None , <EOL> colours = None , <EOL> ) : <EOL> """<STR_LIT>""" <EOL> take = take_columns <EOL> handle , name = tempfile . mkstemp ( ) <EOL> os . close ( handle ) <EOL> if take_columns == "<STR_LIT:all>" : <EOL> num_cols = len ( string . split ( lines [ <NUM_LIT:0> ] [ : - <NUM_LIT:1> ] , "<STR_LIT:\t>" ) ) <EOL> take = range ( <NUM_LIT:0> , num_cols ) <EOL> elif take_columns == "<STR_LIT>" : <EOL> num_cols = len ( string . split ( lines [ <NUM_LIT:0> ] [ : - <NUM_LIT:1> ] , "<STR_LIT:\t>" ) ) <EOL> take = range ( <NUM_LIT:1> , num_cols ) <EOL> outfile = open ( name , "<STR_LIT:w>" ) <EOL> c = [ ] <EOL> to_delete = [ ] <EOL> if row_names is not None : <EOL> legend = [ ] <EOL> if take_columns == "<STR_LIT:all>" : <EOL> to_delete . append ( row_names ) <EOL> else : <EOL> legend = None <EOL> if colours is not None : <EOL> if take_columns == "<STR_LIT:all>" : <EOL> to_delete . append ( colours ) <EOL> to_delete . sort ( ) <EOL> to_delete . reverse ( ) <EOL> for x in to_delete : <EOL> del take [ x ] <EOL> if headers : <EOL> headers = lines [ <NUM_LIT:0> ] [ : - <NUM_LIT:1> ] . split ( "<STR_LIT:\t>" ) <EOL> headers = map ( lambda x : headers [ x ] , take ) <EOL> del lines [ <NUM_LIT:0> ] <EOL> for l in lines : <EOL> data = [ x . strip ( ) for x in l [ : - <NUM_LIT:1> ] . split ( "<STR_LIT:\t>" ) ] <EOL> if not data or not [ x for x in data if x != "<STR_LIT>" ] : <EOL> continue <EOL> outfile . write ( string . join ( map ( lambda x : data [ x ] , take ) , "<STR_LIT:\t>" ) + "<STR_LIT:\n>" ) <EOL> if row_names is not None : <EOL> legend . append ( data [ row_names ] ) <EOL> if colours is not None : <EOL> c . append ( data [ colours ] ) <EOL> outfile . close ( ) <EOL> if headers : <EOL> matrix = R ( """<STR_LIT>""" % <EOL> ( assign , name , "<STR_LIT>" . join ( headers ) ) ) <EOL> else : <EOL> matrix = R ( <EOL> """<STR_LIT>""" % ( assign , name ) ) <EOL> os . remove ( name ) <EOL> return matrix , headers , c , legend <EOL> def writeMatrix ( file , <EOL> matrix , <EOL> separator = "<STR_LIT:\t>" , <EOL> headers = [ ] , <EOL> format = "<STR_LIT>" ) : <EOL> """<STR_LIT>""" <EOL> if headers : <EOL> file . write ( "<STR_LIT:\t>" + string . join ( headers , "<STR_LIT:\t>" ) + "<STR_LIT:\n>" ) <EOL> nrows , ncols = matrix . shape <EOL> for x in range ( nrows ) : <EOL> if headers : <EOL> file . write ( headers [ x ] + "<STR_LIT:\t>" ) <EOL> file . write ( <EOL> string . join ( map ( lambda x : format % x , matrix [ x ] ) , "<STR_LIT:\t>" ) + "<STR_LIT:\n>" ) <EOL> def FuncScatterDiagonal ( data ) : <EOL> R . points ( data ) <EOL> R . abline ( <NUM_LIT:0> , <NUM_LIT:1> ) <EOL> def main ( argv = None ) : <EOL> if argv is None : <EOL> argv = sys . argv <EOL> parser = E . OptionParser ( <EOL> version = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT:-c>" , "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT:string>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT:string>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT:string>" , <EOL> help = "<STR_LIT>" , <EOL> metavar = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT:string>" , <EOL> help = "<STR_LIT>" , <EOL> metavar = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT:string>" , <EOL> help = "<STR_LIT>" , <EOL> metavar = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT>" , <EOL> choices = ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:count>" ) , <EOL> help = "<STR_LIT>" , <EOL> action = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT>" , <EOL> choices = ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:bar>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> help = "<STR_LIT>" , <EOL> action = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT:float>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT:int>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT:string>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , action = "<STR_LIT:store_true>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT:int>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT:string>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT>" , <EOL> choices = ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , dest = "<STR_LIT:title>" , type = "<STR_LIT:string>" , <EOL> help = """<STR_LIT>""" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT:string>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT:string>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , dest = "<STR_LIT>" , action = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , dest = "<STR_LIT>" , action = "<STR_LIT:store_true>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . set_defaults ( <EOL> hardcopy = None , <EOL> input_filename = "<STR_LIT>" , <EOL> input_filename2 = None , <EOL> columns = "<STR_LIT:all>" , <EOL> logscale = None , <EOL> statistics = [ ] , <EOL> plot = [ ] , <EOL> threshold = <NUM_LIT:0.0> , <EOL> labels = "<STR_LIT>" , <EOL> colours = None , <EOL> diagonal = False , <EOL> legend = None , <EOL> title = None , <EOL> xrange = None , <EOL> yrange = None , <EOL> r_options = "<STR_LIT>" , <EOL> fail_on_empty = True , <EOL> format = "<STR_LIT>" ) <EOL> ( options , args ) = E . Start ( parser ) <EOL> if len ( args ) == <NUM_LIT:1> and not options . input_filename : <EOL> options . input_filename = args [ <NUM_LIT:0> ] <EOL> if options . columns not in ( "<STR_LIT:all>" , "<STR_LIT>" ) : <EOL> options . columns = map ( lambda x : int ( x ) - <NUM_LIT:1> , options . columns . split ( "<STR_LIT:U+002C>" ) ) <EOL> if options . colours : <EOL> options . colours -= <NUM_LIT:1> <EOL> if options . legend : <EOL> options . legend -= <NUM_LIT:1> <EOL> table = { } <EOL> headers = [ ] <EOL> if options . input_filename : <EOL> lines = open ( options . input_filename , "<STR_LIT:r>" ) . readlines ( ) <EOL> else : <EOL> lines = sys . stdin . readlines ( ) <EOL> lines = filter ( lambda x : x [ <NUM_LIT:0> ] != "<STR_LIT:#>" , lines ) <EOL> if len ( lines ) == <NUM_LIT:0> : <EOL> if options . fail_on_empty : <EOL> raise IOError ( "<STR_LIT>" ) <EOL> E . warn ( "<STR_LIT>" ) <EOL> E . Stop ( ) <EOL> return <EOL> matrix , headers , colours , legend = readTable ( lines , <EOL> "<STR_LIT>" , <EOL> take_columns = options . columns , <EOL> headers = True , <EOL> colours = options . colours , <EOL> row_names = options . legend ) <EOL> if options . input_filename2 : <EOL> matrix2 , headers2 , colours2 , legend2 = readTable ( <EOL> lines , <EOL> "<STR_LIT>" , <EOL> take_columns = options . columns , <EOL> headers = True , <EOL> colours = options . colours , <EOL> row_names = options . legend ) <EOL> R . assign ( "<STR_LIT>" , headers ) <EOL> ndata = R ( """<STR_LIT>""" ) [ <NUM_LIT:0> ] <EOL> if options . loglevel >= <NUM_LIT:1> : <EOL> options . stdlog . write ( "<STR_LIT>" % ( len ( headers ) , ndata ) ) <EOL> if colours : <EOL> R . assign ( "<STR_LIT>" , colours ) <EOL> for method in options . statistics : <EOL> if method == "<STR_LIT>" : <EOL> cor = R . cor ( matrix , use = "<STR_LIT>" ) <EOL> writeMatrix ( sys . stdout , cor , headers = headers , format = "<STR_LIT>" ) <EOL> elif method == "<STR_LIT>" : <EOL> options . stdout . write ( "<STR_LIT:\t>" . join ( ( "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT:n>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) ) + "<STR_LIT:\n>" ) <EOL> for x in range ( len ( headers ) - <NUM_LIT:1> ) : <EOL> for y in range ( x + <NUM_LIT:1> , len ( headers ) ) : <EOL> try : <EOL> result = R ( <EOL> """<STR_LIT>""" % ( x + <NUM_LIT:1> , y + <NUM_LIT:1> ) ) <EOL> except rpy . RPyException , msg : <EOL> E . warn ( "<STR_LIT>" % ( <EOL> x , headers [ x ] , y , headers [ y ] , msg ) ) <EOL> options . stdout . write ( "<STR_LIT>" % <EOL> ( headers [ x ] , headers [ y ] , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> <NUM_LIT:0> , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) ) <EOL> else : <EOL> options . stdout . write ( <EOL> "<STR_LIT>" % <EOL> ( headers [ x ] , headers [ y ] , <EOL> result . rx2 ( '<STR_LIT>' ) . rx2 ( <EOL> '<STR_LIT>' ) [ <NUM_LIT:0> ] , <EOL> Stats . getSignificance ( <EOL> float ( result . rx2 ( '<STR_LIT>' ) [ <NUM_LIT:0> ] ) ) , <EOL> result . rx2 ( '<STR_LIT>' ) [ <NUM_LIT:0> ] , <EOL> result . rx2 ( '<STR_LIT>' ) . rx2 ( <EOL> '<STR_LIT>' ) [ <NUM_LIT:0> ] , <EOL> result . rx2 ( '<STR_LIT>' ) [ <NUM_LIT:0> ] , <EOL> result . rx2 ( '<STR_LIT>' ) [ <NUM_LIT:0> ] ) ) <EOL> elif method == "<STR_LIT>" : <EOL> options . stdout . write ( "<STR_LIT:\t>" . join ( ( "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) ) + "<STR_LIT:\n>" ) <EOL> for x in range ( len ( headers ) - <NUM_LIT:1> ) : <EOL> for y in range ( x + <NUM_LIT:1> , len ( headers ) ) : <EOL> result = R ( <EOL> """<STR_LIT>""" % ( x + <NUM_LIT:1> , y + <NUM_LIT:1> ) ) <EOL> options . stdout . write ( <EOL> "<STR_LIT>" % <EOL> ( headers [ x ] , headers [ y ] , <EOL> result [ '<STR_LIT>' ] [ '<STR_LIT>' ] , <EOL> Stats . getSignificance ( float ( result [ '<STR_LIT>' ] ) ) , <EOL> result [ '<STR_LIT>' ] , <EOL> result [ '<STR_LIT>' ] [ '<STR_LIT>' ] , <EOL> result [ '<STR_LIT>' ] , <EOL> result [ '<STR_LIT>' ] ) ) <EOL> elif method == "<STR_LIT:count>" : <EOL> m , r , c = MatlabTools . ReadMatrix ( open ( options . input_filename , "<STR_LIT:r>" ) , <EOL> take = options . columns , <EOL> headers = True ) <EOL> mask = numpy . greater ( m , options . threshold ) <EOL> counts = numpy . dot ( numpy . transpose ( mask ) , mask ) <EOL> writeMatrix ( options . stdout , counts , headers = c , format = "<STR_LIT>" ) <EOL> if options . plot : <EOL> if "<STR_LIT>" in options . plot : <EOL> colsums = R ( '''<STR_LIT>''' ) <EOL> take = [ x for x in range ( len ( colsums ) ) if colsums [ x ] != ndata ] <EOL> if take : <EOL> E . warn ( "<STR_LIT>" % str ( take ) ) <EOL> matrix = R . subset ( matrix , select = [ x + <NUM_LIT:1> for x in take ] ) <EOL> R . assign ( """<STR_LIT>""" , matrix ) <EOL> headers = [ headers [ x ] for x in take ] <EOL> if legend : <EOL> legend = [ headers [ x ] for x in take ] <EOL> if options . r_options : <EOL> extra_options = "<STR_LIT>" % options . r_options <EOL> else : <EOL> extra_options = "<STR_LIT>" <EOL> if options . legend is not None and len ( legend ) : <EOL> extra_options += "<STR_LIT>" % "<STR_LIT>" . join ( legend ) <EOL> if options . labels : <EOL> xlabel , ylabel = options . labels . split ( "<STR_LIT:U+002C>" ) <EOL> extra_options += "<STR_LIT>" % ( xlabel , ylabel ) <EOL> else : <EOL> xlabel , ylabel = "<STR_LIT>" , "<STR_LIT>" <EOL> if options . colours : <EOL> extra_options += "<STR_LIT>" <EOL> if options . logscale : <EOL> extra_options += "<STR_LIT>" % options . logscale <EOL> if options . xrange : <EOL> extra_options += "<STR_LIT>" % tuple ( <EOL> map ( float , options . xrange . split ( "<STR_LIT:U+002C>" ) ) ) <EOL> if options . yrange : <EOL> extra_options += "<STR_LIT>" % tuple ( <EOL> map ( float , options . yrange . split ( "<STR_LIT:U+002C>" ) ) ) <EOL> if options . hardcopy : <EOL> if options . hardcopy . endswith ( "<STR_LIT>" ) : <EOL> R . postscript ( options . hardcopy ) <EOL> elif options . hardcopy . endswith ( "<STR_LIT>" ) : <EOL> R . png ( options . hardcopy , width = <NUM_LIT> , height = <NUM_LIT> , type = "<STR_LIT>" ) <EOL> elif options . hardcopy . endswith ( "<STR_LIT>" ) : <EOL> R . jpg ( options . hardcopy , width = <NUM_LIT> , height = <NUM_LIT> , type = "<STR_LIT>" ) <EOL> for method in options . plot : <EOL> if ndata < <NUM_LIT:100> : <EOL> point_size = "<STR_LIT:1>" <EOL> pch = "<STR_LIT:o>" <EOL> elif ndata < <NUM_LIT:1000> : <EOL> point_size = "<STR_LIT:1>" <EOL> pch = "<STR_LIT:o>" <EOL> else : <EOL> point_size = "<STR_LIT>" <EOL> pch = "<STR_LIT:.>" <EOL> if method == "<STR_LIT>" : <EOL> R ( """<STR_LIT>""" % ( <EOL> point_size , extra_options ) ) <EOL> if method == "<STR_LIT>" : <EOL> R ( """<STR_LIT>""" % ( <EOL> point_size , extra_options ) ) <EOL> dat = R ( <EOL> """<STR_LIT>""" ) <EOL> R ( <EOL> """<STR_LIT>""" ) <EOL> mod = R ( """<STR_LIT>""" ) <EOL> R ( """<STR_LIT>""" ) <EOL> R ( """<STR_LIT>""" ) <EOL> R ( """<STR_LIT>""" ) <EOL> R ( <EOL> """<STR_LIT>""" ) <EOL> R . mtext ( <EOL> "<STR_LIT>" % ( mod [ "<STR_LIT>" ] [ "<STR_LIT:x>" ] , <EOL> mod [ "<STR_LIT>" ] [ <EOL> "<STR_LIT>" ] , <EOL> R ( """<STR_LIT>""" ) , <EOL> ndata ) , <EOL> <NUM_LIT:3> , <EOL> cex = <NUM_LIT:1.0> ) <EOL> elif method == "<STR_LIT>" : <EOL> if options . add_diagonal : <EOL> R ( <EOL> """<STR_LIT>""" ) <EOL> else : <EOL> R ( <EOL> """<STR_LIT>""" ) <EOL> if options . colours : <EOL> R . pairs ( matrix , <EOL> pch = pch , <EOL> col = colours , <EOL> main = options . title , <EOL> panel = "<STR_LIT>" , <EOL> labels = headers , <EOL> cex_labels = <NUM_LIT> ) <EOL> else : <EOL> R . pairs ( matrix , <EOL> pch = pch , <EOL> panel = "<STR_LIT>" , <EOL> main = options . title , <EOL> labels = headers , <EOL> cex_labels = <NUM_LIT> ) <EOL> elif method == "<STR_LIT>" : <EOL> extra_options += "<STR_LIT>" % options . title <EOL> if max ( [ len ( x ) for x in headers ] ) > <NUM_LIT> / len ( headers ) : <EOL> extra_options = re . sub ( "<STR_LIT>" , "<STR_LIT>" , extra_options ) <EOL> extra_options += "<STR_LIT>" <EOL> R ( <EOL> """<STR_LIT>""" ) <EOL> R ( """<STR_LIT>""" % extra_options ) <EOL> elif method == "<STR_LIT:bar>" or method == "<STR_LIT>" : <EOL> if not options . colours : <EOL> extra_options += "<STR_LIT>" <EOL> if max ( [ len ( x ) for x in headers ] ) > <NUM_LIT> / len ( headers ) : <EOL> extra_options = re . sub ( "<STR_LIT>" , "<STR_LIT>" , extra_options ) <EOL> extra_options += "<STR_LIT>" <EOL> R ( <EOL> """<STR_LIT>""" ) <EOL> R ( """<STR_LIT>""" % extra_options ) <EOL> elif method == "<STR_LIT>" : <EOL> if not options . colours : <EOL> extra_options += "<STR_LIT>" % ndata <EOL> if max ( [ len ( x ) for x in headers ] ) > <NUM_LIT> / len ( headers ) : <EOL> extra_options = re . sub ( "<STR_LIT>" , "<STR_LIT>" , extra_options ) <EOL> extra_options += "<STR_LIT>" <EOL> R ( <EOL> """<STR_LIT>""" ) <EOL> R ( """<STR_LIT>""" % <EOL> extra_options ) <EOL> elif method == "<STR_LIT>" : <EOL> if options . title : <EOL> R . par ( oma = R . c ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:4> , <NUM_LIT:0> ) ) <EOL> R ( """<STR_LIT>""" ) <EOL> R ( """<STR_LIT>""" % ( point_size , extra_options , xlabel , ylabel ) ) <EOL> if options . title : <EOL> R . mtext ( options . title , <NUM_LIT:3> , outer = True , line = <NUM_LIT:1> , cex = <NUM_LIT> ) <EOL> elif method in ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) : <EOL> if method == "<STR_LIT>" : <EOL> pairs = [ ] <EOL> for x in range ( len ( headers ) - <NUM_LIT:1> ) : <EOL> for y in range ( x + <NUM_LIT:1> , len ( headers ) ) : <EOL> pairs . append ( ( x , y ) ) <EOL> elif method == "<STR_LIT>" : <EOL> pairs = [ ] <EOL> for x in range ( <NUM_LIT:1> , len ( headers ) ) : <EOL> pairs . append ( ( <NUM_LIT:0> , x ) ) <EOL> elif method == "<STR_LIT>" : <EOL> pairs = [ ] <EOL> for x in range ( len ( headers ) - <NUM_LIT:1> ) : <EOL> for y in range ( x + <NUM_LIT:1> , len ( headers ) ) : <EOL> if headers [ x ] == headers [ y ] : <EOL> pairs . append ( ( x , y ) ) <EOL> break <EOL> w = int ( math . ceil ( math . sqrt ( len ( pairs ) ) ) ) <EOL> h = int ( math . ceil ( float ( len ( pairs ) ) / w ) ) <EOL> PosInf = <NUM_LIT> <EOL> NegInf = - <NUM_LIT> <EOL> xlabel , ylabel = options . labels . split ( "<STR_LIT:U+002C>" ) <EOL> R ( """<STR_LIT>""" % <EOL> ( w * h , w , h ) ) <EOL> for a , b in pairs : <EOL> new_matrix = filter ( lambda x : <EOL> x [ <NUM_LIT:0> ] not in ( float ( "<STR_LIT>" ) , PosInf , NegInf ) and <EOL> x [ <NUM_LIT:1> ] not in ( <EOL> float ( "<STR_LIT>" ) , PosInf , NegInf ) , <EOL> zip ( matrix [ a ] . values ( ) [ <NUM_LIT:0> ] , matrix [ b ] . values ( ) [ <NUM_LIT:0> ] ) ) <EOL> try : <EOL> R ( """<STR_LIT>""" % ( <EOL> a + <NUM_LIT:1> , b + <NUM_LIT:1> , headers [ b ] , headers [ a ] , xlabel , ylabel ) ) <EOL> except rpy . RException , msg : <EOL> print "<STR_LIT>" % ( headers [ b ] , headers [ a ] , msg ) <EOL> if options . hardcopy : <EOL> R [ '<STR_LIT>' ] ( ) <EOL> E . info ( "<STR_LIT>" ) <EOL> if not options . hardcopy : <EOL> if options . input_filename : <EOL> interpreter = code . InteractiveConsole ( globals ( ) ) <EOL> interpreter . interact ( ) <EOL> else : <EOL> E . info ( <EOL> "<STR_LIT>" ) <EOL> E . Stop ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
