Mercurial > repos > jjohnson > cummerbund
comparison cummerbund_wrapper.py @ 8:b0d11fcbc3ac
cummerbund add MDS and PCA plots, handle errors from R
| author | Jim Johnson <jj@umn.edu> |
|---|---|
| date | Thu, 11 Oct 2012 15:14:51 -0500 |
| parents | 6a9bc26ab8d9 |
| children | 2d7eee38ab5b |
comparison
equal
deleted
inserted
replaced
| 7:c2b922c9d545 | 8:b0d11fcbc3ac |
|---|---|
| 6 | 6 |
| 7 import optparse, os, shutil, subprocess, sys, tempfile | 7 import optparse, os, shutil, subprocess, sys, tempfile |
| 8 | 8 |
| 9 def stop_err( msg ): | 9 def stop_err( msg ): |
| 10 sys.stderr.write( "%s\n" % msg ) | 10 sys.stderr.write( "%s\n" % msg ) |
| 11 sys.exit() | 11 sys.exit(1) |
| 12 | 12 |
| 13 def html_report_from_directory( html_out, dir ): | 13 def html_report_from_directory( html_out, dir ): |
| 14 html_out.write( '<html>\n<head>\n<title>Galaxy - cummeRbund Output</title>\n</head>\n<body>\n<p/>\n<ul>\n' ) | 14 html_out.write( '<html>\n<head>\n<title>Galaxy - cummeRbund Output</title>\n</head>\n<body>\n<p/>\n<ul>\n' ) |
| 15 for fname in sorted( os.listdir( dir ) ): | 15 for fname in sorted( os.listdir( dir ) ): |
| 16 # html_out.write( '<li><a href="%s">%s</a></li>\n' % ( fname, fname ) ) | 16 # html_out.write( '<li><a href="%s">%s</a></li>\n' % ( fname, fname ) ) |
| 17 html_out.write( '<li><a href="%s"><img src="%s" alt="" height="42" width="42">%s</a></li>\n' % ( fname, fname , fname ) ) | 17 html_out.write( '<li><a href="%s"><img src="%s" alt="" height="80" width="80">%s</a></li>\n' % ( fname, fname , fname ) ) |
| 18 html_out.write( '</ul>\n</body>\n</html>\n' ) | 18 html_out.write( '</ul>\n</body>\n</html>\n' ) |
| 19 | 19 |
| 20 def __main__(): | 20 def __main__(): |
| 21 #Parse Command Line | 21 #Parse Command Line |
| 22 parser = optparse.OptionParser() | 22 parser = optparse.OptionParser() |
| 37 | 37 |
| 38 # Build command. | 38 # Build command. |
| 39 cmd = ( "Rscript --vanilla %s" % options.r_script ) | 39 cmd = ( "Rscript --vanilla %s" % options.r_script ) |
| 40 | 40 |
| 41 # Debugging. | 41 # Debugging. |
| 42 print cmd | 42 # print cmd |
| 43 | 43 |
| 44 #liubo added, for test, look at the generated R script | 44 #liubo added, for test, look at the generated R script |
| 45 # shutil.copy2(options.r_script, '/nfs/software/galaxy/r_script') | 45 # shutil.copy2(options.r_script, '/nfs/software/galaxy/r_script') |
| 46 | 46 |
| 47 | 47 |
