commit/galaxy-central: 5 new changesets
5 new changesets in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/7c3d155fae75/ changeset: r5552:7c3d155fae75 user: fubar date: 2011-05-12 15:56:01 summary: Picard wrapper modified to use python logging module for all logging affected #: 2 files (419 bytes) --- a/test-data/picard_output_alignment_summary_metrics.html Wed May 11 16:02:06 2011 -0400 +++ b/test-data/picard_output_alignment_summary_metrics.html Thu May 12 09:56:01 2011 -0400 @@ -6,54 +6,56 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="Galaxy CollectAlignmentSummaryMetrics tool output - see http://getgalaxy.org/" /> +<meta name="generator" content="Galaxy picard_wrapper tool output - see http://getgalaxy.org/" /><title></title><link rel="stylesheet" href="/static/style/base.css" type="text/css" /></head><body><div class="document"> -Galaxy tool wrapper picard_wrapper at 09/05/2011 11:03:41</b><br/><b>The following output files were created (click the filename to view/download a copy):</b><hr/><table> +Galaxy tool CollectAlignmentSummaryMetrics run at 11/05/2011 23:16:24</b><br/><b>The following output files were created (click the filename to view/download a copy):</b><hr/><table><tr><td><a href="CollectAlignmentSummaryMetrics.log">CollectAlignmentSummaryMetrics.log</a></td></tr><tr><td><a href="CollectAlignmentSummaryMetrics.metrics.txt">CollectAlignmentSummaryMetrics.metrics.txt</a></td></tr></table><p/> -<b>Picard on line resources:</b><ul> +<b>Picard on line resources</b><ul><li><a href="http://picard.sourceforge.net/index.shtml">Click here for Picard Documentation</a></li><li><a href="http://picard.sourceforge.net/picard-metric-definitions.shtml">Click here for Picard Metrics definitions</a></li></ul><hr/><b>Picard output (transposed to make it easier to see)</b><hr/><table cellpadding="3" > -<tr class="d0"><td>## net.sf.picard.metrics.StringHeader</td></tr><tr class="d1"><td># net.sf.picard.analysis.CollectAlignmentSummaryMetrics MAX_INSERT_SIZE=100000 ADAPTER_SEQUENCE=[AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT, AGATCGGAAGAGCTCGTATGCCGTCTTCTGCTTG, AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT, AGATCGGAAGAGCGGTTCAGCAGGAATGCCGAGACCGATCTCGTATGCCGTCTTCTGCTTG, AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT, AGATCGGAAGAGCACACGTCTGAACTCCAGTCACNNNNNNNNATCTCGTATGCCGTCTTCTGCTTG, IS_BISULFITE_SEQUENCED=false] INPUT=/export/tmp/tmpBrCiH5/database/files/000/dataset_2.dat OUTPUT=/udd/rerla/galaxy-central/database/job_working_directory/3/dataset_3_files/CollectAlignmentSummaryMetrics.metrics.txt REFERENCE_SEQUENCE=/udd/rerla/galaxy-central/database/job_working_directory/3/dataset_3_files/CollectAlignmentSummaryMetricsDXFFCP.fasta_fake.fasta ASSUME_SORTED=true TMP_DIR=/tmp VALIDATION_STRINGENCY=LENIENT IS_BISULFITE_SEQUENCED=false STOP_AFTER=0 VERBOSITY=INFO QUIET=false COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false</td></tr><tr class="d0"><td>## net.sf.picard.metrics.StringHeader</td></tr><tr class="d1"><td># Started on: Mon May 09 11:03:41 EDT 2011</td></tr><tr class="d0"><td>## METRICS CLASS net.sf.picard.analysis.AlignmentSummaryMetrics</td></tr><tr class="d0"><td>CATEGORY</td><td>FIRST_OF_PAIR</td></tr> -<tr class="d1"><td>TOTAL_READS</td><td>4</td></tr> -<tr class="d0"><td>PF_READS</td><td>4</td></tr> -<tr class="d1"><td>PCT_PF_READS</td><td>1</td></tr> -<tr class="d0"><td>PF_NOISE_READS</td><td>0</td></tr> -<tr class="d1"><td>PF_READS_ALIGNED</td><td>4</td></tr> -<tr class="d0"><td>PCT_PF_READS_ALIGNED</td><td>1</td></tr> -<tr class="d1"><td>PF_HQ_ALIGNED_READS</td><td>4</td></tr> -<tr class="d0"><td>PF_HQ_ALIGNED_BASES</td><td>404</td></tr> -<tr class="d1"><td>PF_HQ_ALIGNED_Q20_BASES</td><td>28</td></tr> -<tr class="d0"><td>PF_HQ_MEDIAN_MISMATCHES</td><td>78</td></tr> -<tr class="d1"><td>PF_HQ_ERROR_RATE</td><td>0.777228</td></tr> -<tr class="d0"><td>MEAN_READ_LENGTH</td><td>101</td></tr> -<tr class="d1"><td>READS_ALIGNED_IN_PAIRS</td><td>3</td></tr> -<tr class="d0"><td>PCT_READS_ALIGNED_IN_PAIRS</td><td>0.75</td></tr> -<tr class="d1"><td>BAD_CYCLES</td><td>63</td></tr> -<tr class="d0"><td>STRAND_BALANCE</td><td>0.25</td></tr> -<tr class="d1"><td>PCT_CHIMERAS</td><td>0</td></tr> +<tr class="d0"><td colspan="2">## net.sf.picard.metrics.StringHeader</td></tr><tr class="d1"><td colspan="2"># net.sf.picard.analysis.CollectAlignmentSummaryMetrics MAX_INSERT_SIZE=100000 ADAPTER_SEQUENCE=[AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT, AGATCGGAAGAGCTCGTATGCCGTCTTCTGCTTG, AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT, AGATCGGAAGAGCGGTTCAGCAGGAATGCCGAGACCGATCTCGTATGCCGTCTTCTGCTTG, AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT, AGATCGGAAGAGCACACGTCTGAACTCCAGTCACNNNNNNNNATCTCGTATGCCGTCTTCTGCTTG, IS_BISULFITE_SEQUENCED=false] INPUT=/export/tmp/tmp1-mt_l/database/files/000/dataset_2.dat OUTPUT=/udd/rerla/galaxy-central/database/job_working_directory/3/dataset_3_files/CollectAlignmentSummaryMetrics.metrics.txt REFERENCE_SEQUENCE=/udd/rerla/galaxy-central/database/job_working_directory/3/dataset_3_files/CollectAlignmentSummaryMetricsZJS8q6.fasta_fake.fasta ASSUME_SORTED=true TMP_DIR=/tmp VALIDATION_STRINGENCY=LENIENT IS_BISULFITE_SEQUENCED=false STOP_AFTER=0 VERBOSITY=INFO QUIET=false COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false</td></tr><tr class="d0"><td colspan="2">## net.sf.picard.metrics.StringHeader</td></tr><tr class="d1"><td colspan="2"># Started on: Wed May 11 23:16:24 EDT 2011</td></tr><tr class="d0"><td colspan="2">## METRICS CLASS net.sf.picard.analysis.AlignmentSummaryMetrics</td></tr><tr class="d0"><td>CATEGORY</td><td>FIRST_OF_PAIR </td></tr> +<tr class="d1"><td>TOTAL_READS</td><td>4 </td></tr> +<tr class="d0"><td>PF_READS</td><td>4 </td></tr> +<tr class="d1"><td>PCT_PF_READS</td><td>1 </td></tr> +<tr class="d0"><td>PF_NOISE_READS</td><td>0 </td></tr> +<tr class="d1"><td>PF_READS_ALIGNED</td><td>4 </td></tr> +<tr class="d0"><td>PCT_PF_READS_ALIGNED</td><td>1 </td></tr> +<tr class="d1"><td>PF_HQ_ALIGNED_READS</td><td>4 </td></tr> +<tr class="d0"><td>PF_HQ_ALIGNED_BASES</td><td>404 </td></tr> +<tr class="d1"><td>PF_HQ_ALIGNED_Q20_BASES</td><td>28 </td></tr> +<tr class="d0"><td>PF_HQ_MEDIAN_MISMATCHES</td><td>78 </td></tr> +<tr class="d1"><td>PF_HQ_ERROR_RATE</td><td>0.777228 </td></tr> +<tr class="d0"><td>MEAN_READ_LENGTH</td><td>101 </td></tr> +<tr class="d1"><td>READS_ALIGNED_IN_PAIRS</td><td>3 </td></tr> +<tr class="d0"><td>PCT_READS_ALIGNED_IN_PAIRS</td><td>0.75 </td></tr> +<tr class="d1"><td>BAD_CYCLES</td><td>63 </td></tr> +<tr class="d0"><td>STRAND_BALANCE</td><td>0.25 </td></tr> +<tr class="d1"><td>PCT_CHIMERAS</td><td>0 </td></tr><tr class="d0"><td>PCT_ADAPTER </td><td>0 -</td></tr> + </td></tr></table> -<b>Picard log</b><hr/> -<pre>## executing java -Xmx2g -jar /udd/rerla/galaxy-central/tool-data/shared/jars/CreateSequenceDictionary.jar REFERENCE=/tmp/CollectAlignmentSummaryMetricsDXFFCP.fasta OUTPUT=/tmp/CollectAlignmentSummaryMetricsDXFFCP.dict URI=dataset_1.dat TRUNCATE_NAMES_AT_WHITESPACE=None returned status 0 and stderr: -[Mon May 09 11:03:40 EDT 2011] net.sf.picard.sam.CreateSequenceDictionary REFERENCE=/tmp/CollectAlignmentSummaryMetricsDXFFCP.fasta OUTPUT=/tmp/CollectAlignmentSummaryMetricsDXFFCP.dict URI=dataset_1.dat TRUNCATE_NAMES_AT_WHITESPACE=false NUM_SEQUENCES=2147483647 TMP_DIR=/tmp/rerla VERBOSITY=INFO QUIET=false VALIDATION_STRINGENCY=STRICT COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false -[Mon May 09 11:03:40 EDT 2011] net.sf.picard.sam.CreateSequenceDictionary done. +<b>Picard Tool Run Log</b><hr/> +<pre>Wed, 11 May 2011 23:16:24 INFO + ## executing java -Xmx2g -jar /udd/rerla/galaxy-central/tool-data/shared/jars/CreateSequenceDictionary.jar REFERENCE=/tmp/CollectAlignmentSummaryMetricsZJS8q6.fasta OUTPUT=/tmp/CollectAlignmentSummaryMetricsZJS8q6.dict URI=dataset_1.dat TRUNCATE_NAMES_AT_WHITESPACE=None returned status 0 and stderr: +[Wed May 11 23:16:24 EDT 2011] net.sf.picard.sam.CreateSequenceDictionary REFERENCE=/tmp/CollectAlignmentSummaryMetricsZJS8q6.fasta OUTPUT=/tmp/CollectAlignmentSummaryMetricsZJS8q6.dict URI=dataset_1.dat TRUNCATE_NAMES_AT_WHITESPACE=false NUM_SEQUENCES=2147483647 TMP_DIR=/tmp/rerla VERBOSITY=INFO QUIET=false VALIDATION_STRINGENCY=STRICT COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false +[Wed May 11 23:16:24 EDT 2011] net.sf.picard.sam.CreateSequenceDictionary done. Runtime.totalMemory()=9109504 -## executing java -Xmx2g -jar /udd/rerla/galaxy-central/tool-data/shared/jars/CollectAlignmentSummaryMetrics.jar VALIDATION_STRINGENCY=LENIENT ASSUME_SORTED=true ADAPTER_SEQUENCE= IS_BISULFITE_SEQUENCED=false MAX_INSERT_SIZE=100000 OUTPUT=/udd/rerla/galaxy-central/database/job_working_directory/3/dataset_3_files/CollectAlignmentSummaryMetrics.metrics.txt R=/udd/rerla/galaxy-central/database/job_working_directory/3/dataset_3_files/CollectAlignmentSummaryMetricsDXFFCP.fasta_fake.fasta TMP_DIR=/tmp INPUT=/export/tmp/tmpBrCiH5/database/files/000/dataset_2.dat returned status 0 and stderr: -[Mon May 09 11:03:41 EDT 2011] net.sf.picard.analysis.CollectAlignmentSummaryMetrics MAX_INSERT_SIZE=100000 ADAPTER_SEQUENCE=[AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT, AGATCGGAAGAGCTCGTATGCCGTCTTCTGCTTG, AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT, AGATCGGAAGAGCGGTTCAGCAGGAATGCCGAGACCGATCTCGTATGCCGTCTTCTGCTTG, AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT, AGATCGGAAGAGCACACGTCTGAACTCCAGTCACNNNNNNNNATCTCGTATGCCGTCTTCTGCTTG, IS_BISULFITE_SEQUENCED=false] INPUT=/export/tmp/tmpBrCiH5/database/files/000/dataset_2.dat OUTPUT=/udd/rerla/galaxy-central/database/job_working_directory/3/dataset_3_files/CollectAlignmentSummaryMetrics.metrics.txt REFERENCE_SEQUENCE=/udd/rerla/galaxy-central/database/job_working_directory/3/dataset_3_files/CollectAlignmentSummaryMetricsDXFFCP.fasta_fake.fasta ASSUME_SORTED=true TMP_DIR=/tmp VALIDATION_STRINGENCY=LENIENT IS_BISULFITE_SEQUENCED=false STOP_AFTER=0 VERBOSITY=INFO QUIET=false COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false -WARNING 2011-05-09 11:03:41 SinglePassSamProgram File reports sort order 'queryname', assuming it's coordinate sorted anyway. -[Mon May 09 11:03:41 EDT 2011] net.sf.picard.analysis.CollectAlignmentSummaryMetrics done. +Wed, 11 May 2011 23:16:24 INFO + ## executing java -Xmx2g -jar /udd/rerla/galaxy-central/tool-data/shared/jars/CollectAlignmentSummaryMetrics.jar VALIDATION_STRINGENCY=LENIENT ASSUME_SORTED=true ADAPTER_SEQUENCE= IS_BISULFITE_SEQUENCED=false MAX_INSERT_SIZE=100000 OUTPUT=/udd/rerla/galaxy-central/database/job_working_directory/3/dataset_3_files/CollectAlignmentSummaryMetrics.metrics.txt R=/udd/rerla/galaxy-central/database/job_working_directory/3/dataset_3_files/CollectAlignmentSummaryMetricsZJS8q6.fasta_fake.fasta TMP_DIR=/tmp INPUT=/export/tmp/tmp1-mt_l/database/files/000/dataset_2.dat returned status 0 and stderr: +[Wed May 11 23:16:24 EDT 2011] net.sf.picard.analysis.CollectAlignmentSummaryMetrics MAX_INSERT_SIZE=100000 ADAPTER_SEQUENCE=[AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT, AGATCGGAAGAGCTCGTATGCCGTCTTCTGCTTG, AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT, AGATCGGAAGAGCGGTTCAGCAGGAATGCCGAGACCGATCTCGTATGCCGTCTTCTGCTTG, AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT, AGATCGGAAGAGCACACGTCTGAACTCCAGTCACNNNNNNNNATCTCGTATGCCGTCTTCTGCTTG, IS_BISULFITE_SEQUENCED=false] INPUT=/export/tmp/tmp1-mt_l/database/files/000/dataset_2.dat OUTPUT=/udd/rerla/galaxy-central/database/job_working_directory/3/dataset_3_files/CollectAlignmentSummaryMetrics.metrics.txt REFERENCE_SEQUENCE=/udd/rerla/galaxy-central/database/job_working_directory/3/dataset_3_files/CollectAlignmentSummaryMetricsZJS8q6.fasta_fake.fasta ASSUME_SORTED=true TMP_DIR=/tmp VALIDATION_STRINGENCY=LENIENT IS_BISULFITE_SEQUENCED=false STOP_AFTER=0 VERBOSITY=INFO QUIET=false COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false +WARNING 2011-05-11 23:16:24 SinglePassSamProgram File reports sort order 'queryname', assuming it's coordinate sorted anyway. +[Wed May 11 23:16:24 EDT 2011] net.sf.picard.analysis.CollectAlignmentSummaryMetrics done. Runtime.totalMemory()=9109504 --- a/tools/picard/picard_wrapper.py Wed May 11 16:02:06 2011 -0400 +++ b/tools/picard/picard_wrapper.py Thu May 12 09:56:01 2011 -0400 @@ -8,7 +8,7 @@ see http://www.gnu.org/copyleft/lesser.html """ -import optparse, os, sys, subprocess, tempfile, shutil, time +import optparse, os, sys, subprocess, tempfile, shutil, time, logging galhtmlprefix = """<?xml version="1.0" encoding="utf-8" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> @@ -22,7 +22,7 @@ <body><div class="document"> """ -galhtmlattr = """Galaxy tool wrapper %s at %s</b><br/>""" +galhtmlattr = """Galaxy tool %s run at %s</b><br/>""" galhtmlpostfix = """</div></body></html>\n""" @@ -68,12 +68,24 @@ os.makedirs(opts.tmpdir) except: pass - self.log_filename = os.path.join(opts.outdir,'%s.log' % self.picname) + self.log_filename = os.path.join(self.opts.outdir,'%s.log' % self.picname) self.metricsOut = os.path.join(opts.outdir,'%s.metrics.txt' % self.picname) + self.setLogging(logfname=self.log_filename) def baseName(self,name=None): return os.path.splitext(os.path.basename(name))[0] + def setLogging(self,logfname="picard_wrapper.log"): + """setup a logger + """ + today=timenow() + logging.basicConfig(level=logging.INFO, + format='%(asctime)s %(levelname)s\n %(message)s', + datefmt='%a, %d %b %Y %H:%M:%S', + filename=logfname, + filemode='a') + + def readLarge(self,fname=None): """ read a potentially huge file.. """ @@ -120,6 +132,7 @@ s = '## executing %s returned status %d and stderr: \n%s\n' % (cl,rval,stderrs) else: s = '## executing %s returned status %d and nothing on stderr\n' % (cl,rval) + logging.info(s) os.unlink(templog) # always os.unlink(temperr) # always return s, stdouts # sometimes this is an output @@ -132,10 +145,6 @@ runme.append('-jar %s' % jar) runme += cl s,stdout = self.runCL(cl=runme, output_dir=self.opts.outdir) - lf = open(self.log_filename,'a') - lf.write(s) - lf.write('\n') - lf.close() return stdout def samToBam(self,infile=None,outdir=None): @@ -180,7 +189,7 @@ except: r = [] if len(r) > 0: - res.append('<b>Picard on line resources:</b><ul>\n') + res.append('<b>Picard on line resources</b><ul>\n') res.append('<li><a href="http://picard.sourceforge.net/index.shtml">Click here for Picard Documentation</a></li>\n') res.append('<li><a href="http://picard.sourceforge.net/picard-metric-definitions.shtml">Click here for Picard Metrics definitions</a></li></ul><hr/>\n') if transpose: @@ -204,20 +213,20 @@ thist = True if row.strip() == '' or i == lastr: # last line or blank means write a segment if len(heads) > 0: - hres = ['<tr class="d%d"><td>%s</td></tr>' % (i % 2,x) for i,x in enumerate(heads)] + hres = ['<tr class="d%d"><td colspan="2">%s</td></tr>' % (i % 2,x) for i,x in enumerate(heads)] res += hres heads = [] if len(dat) > 0: if transpose and not thist: tdat = map(None,*dat) # transpose an arbitrary list of lists - tdat = ['<tr class="d%d"><td>%s</td><td>%s</td></tr>\n' % ((i+len(heads)) % 2,x[0],x[1]) for i,x in enumerate(tdat) if i < maxrows] + tdat = ['<tr class="d%d"><td>%s</td><td>%s </td></tr>\n' % ((i+len(heads)) % 2,x[0],x[1]) for i,x in enumerate(tdat) if i < maxrows] missing = len(tdat) - maxrows if missing > 0: tdat.append('<tr><td colspan="2">...WARNING: %d rows deleted..see raw file %s for entire output</td></tr>' % (missing,os.path.basename(picout))) else: if thist or not transpose: dat = ['\t'.join(x).strip() for x in dat] # back to strings :( - tdat = ['<tr class="d%d"><td>%s</td></tr>\n' % ((i+len(heads)) % 2,x) for i,x in enumerate(dat) if i < maxrows] + tdat = ['<tr class="d%d"><td colspan="2">%s</td></tr>\n' % ((i+len(heads)) % 2,x) for i,x in enumerate(dat) if i < maxrows] missing = len(tdat) - maxrows if missing > 0: tdat.append('<tr><td>...WARNING: %d rows deleted..see raw file %s for entire output</td></tr>' % (missing,os.path.basename(self.metricsOut))) @@ -231,14 +240,15 @@ picard produces long hard to read tab header files make them available but present them transposed for readability """ + logging.shutdown() self.cleanup() # remove temp files stored in delme rstyle="""<style type="text/css"> tr.d0 td {background-color: oldlace; color: black;} tr.d1 td {background-color: aliceblue; color: black;} </style>""" res = [rstyle,] - res.append(galhtmlprefix % self.picname) - res.append(galhtmlattr % (self.progname,timenow())) + res.append(galhtmlprefix % self.progname) + res.append(galhtmlattr % (self.picname,timenow())) flist = [x for x in os.listdir(self.opts.outdir) if not x.startswith('.')] pdflist = [x for x in flist if os.path.splitext(x)[-1].lower() == '.pdf'] if len(pdflist) > 0: # assumes all pdfs come with thumbnail .jpgs @@ -260,7 +270,7 @@ l = open(self.log_filename,'r').readlines() llen = len(l) if llen > 0: - res.append('<b>Picard log</b><hr/>\n') + res.append('<b>Picard Tool Run Log</b><hr/>\n') rlog = ['<pre>',] if llen > maxloglines: rlog += l[:maxloglines] @@ -295,9 +305,7 @@ self.runCL(cl=cl,output_dir=self.opts.outdir) head = open(thead,'r').readlines() s = '## got %d rows of header\n' % (len(head)) - lf = open(self.log_filename,'a') - lf.write(s) - lf.close() + logging.info(s) o = open(outf,'w') o.write(''.join(head)) o.write(''.join(bed)) @@ -344,10 +352,7 @@ infile.close() if newsam: shutil.copy(insam,newsam) - lf = open(self.log_filename,'a') - lf.write(info) - lf.write('\n') - lf.close() + logging.info(info) @@ -606,13 +611,9 @@ s += 'so please double check that your input data really is paired-end NGS data.<br/>\n' s += 'If your input was paired data this may be a bug worth reporting to the galaxy-bugs list\n<br/>' stdouts = '' - lf = open(pic.log_filename,'a') - lf.write(s) - lf.write('\n') + logging.info(s) if len(stdouts) > 0: - lf.write(stdouts) - lf.write('\n') - lf.close() + logging.info(stdouts) elif pic.picname == 'MarkDuplicates': # assume sorted even if header says otherwise http://bitbucket.org/galaxy/galaxy-central/changeset/60ce33ea8e41/ changeset: r5553:60ce33ea8e41 user: fubar date: 2011-05-12 22:48:31 summary: update some test outputs for picard affected #: 2 files (212 bytes) --- a/test-data/picard_BIS_output1.txt Thu May 12 09:56:01 2011 -0400 +++ b/test-data/picard_BIS_output1.txt Thu May 12 16:48:31 2011 -0400 @@ -6,30 +6,31 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="Galaxy BamIndexStats tool output - see http://getgalaxy.org/" /> +<meta name="generator" content="Galaxy picard_wrapper tool output - see http://getgalaxy.org/" /><title></title><link rel="stylesheet" href="/static/style/base.css" type="text/css" /></head><body><div class="document"> -Galaxy tool wrapper picard_wrapper at 09/05/2011 13:04:11</b><br/><b>The following output files were created (click the filename to view/download a copy):</b><hr/><table> +Galaxy tool BamIndexStats run at 12/05/2011 14:18:06</b><br/><b>The following output files were created (click the filename to view/download a copy):</b><hr/><table><tr><td><a href="BamIndexStats.metrics.txt">BamIndexStats.metrics.txt</a></td></tr><tr><td><a href="BamIndexStats.log">BamIndexStats.log</a></td></tr></table><p/> -<b>Picard on line resources:</b><ul> +<b>Picard on line resources</b><ul><li><a href="http://picard.sourceforge.net/index.shtml">Click here for Picard Documentation</a></li><li><a href="http://picard.sourceforge.net/picard-metric-definitions.shtml">Click here for Picard Metrics definitions</a></li></ul><hr/><b>Picard output</b><hr/><table cellpadding="3" > -<tr class="d0"><td>chr1 length= 101 Aligned= 0 Unaligned= 0</td></tr> -<tr class="d1"><td>chr7 length= 404 Aligned= 7 Unaligned= 0</td></tr> -<tr class="d0"><td>chr8 length= 202 Aligned= 0 Unaligned= 0</td></tr> -<tr class="d1"><td>NoCoordinateCount= 1</td></tr> +<tr class="d0"><td colspan="2">chr1 length= 101 Aligned= 0 Unaligned= 0</td></tr> +<tr class="d1"><td colspan="2">chr7 length= 404 Aligned= 7 Unaligned= 0</td></tr> +<tr class="d0"><td colspan="2">chr8 length= 202 Aligned= 0 Unaligned= 0</td></tr> +<tr class="d1"><td colspan="2">NoCoordinateCount= 1</td></tr></table> -<b>Picard log</b><hr/> -<pre>## executing java -Xmx2g -jar /udd/rerla/galaxy-central/tool-data/shared/jars/BamIndexStats.jar VALIDATION_STRINGENCY=LENIENT INPUT=/udd/rerla/galaxy-central/database/job_working_directory/2/dataset_2_files/tmpMiaCgO.bam returned status 0 and stderr: -[Mon May 09 13:04:11 EDT 2011] net.sf.picard.sam.BamIndexStats INPUT=/udd/rerla/galaxy-central/database/job_working_directory/2/dataset_2_files/tmpMiaCgO.bam VALIDATION_STRINGENCY=LENIENT TMP_DIR=/tmp/rerla VERBOSITY=INFO QUIET=false COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false -[Mon May 09 13:04:11 EDT 2011] net.sf.picard.sam.BamIndexStats done. +<b>Picard Tool Run Log</b><hr/> +<pre>Thu, 12 May 2011 14:18:06 INFO + ## executing java -Xmx2g -jar /udd/rerla/galaxy-central/tool-data/shared/jars/BamIndexStats.jar VALIDATION_STRINGENCY=LENIENT INPUT=/udd/rerla/galaxy-central/database/job_working_directory/955/dataset_1015_files/tmp45bd_D.bam returned status 0 and stderr: +[Thu May 12 14:18:06 EDT 2011] net.sf.picard.sam.BamIndexStats INPUT=/udd/rerla/galaxy-central/database/job_working_directory/955/dataset_1015_files/tmp45bd_D.bam VALIDATION_STRINGENCY=LENIENT TMP_DIR=/tmp/rerla VERBOSITY=INFO QUIET=false COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false +[Thu May 12 14:18:06 EDT 2011] net.sf.picard.sam.BamIndexStats done. Runtime.totalMemory()=9109504 --- a/test-data/picard_BIS_output2.txt Thu May 12 09:56:01 2011 -0400 +++ b/test-data/picard_BIS_output2.txt Thu May 12 16:48:31 2011 -0400 @@ -6,32 +6,33 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="Galaxy BamIndexStats tool output - see http://getgalaxy.org/" /> +<meta name="generator" content="Galaxy picard_wrapper tool output - see http://getgalaxy.org/" /><title></title><link rel="stylesheet" href="/static/style/base.css" type="text/css" /></head><body><div class="document"> -Galaxy tool wrapper picard_wrapper at 09/05/2011 13:04:21</b><br/><b>The following output files were created (click the filename to view/download a copy):</b><hr/><table> +Galaxy tool BamIndexStats run at 12/05/2011 14:18:22</b><br/><b>The following output files were created (click the filename to view/download a copy):</b><hr/><table><tr><td><a href="BamIndexStats.metrics.txt">BamIndexStats.metrics.txt</a></td></tr><tr><td><a href="BamIndexStats.log">BamIndexStats.log</a></td></tr></table><p/> -<b>Picard on line resources:</b><ul> +<b>Picard on line resources</b><ul><li><a href="http://picard.sourceforge.net/index.shtml">Click here for Picard Documentation</a></li><li><a href="http://picard.sourceforge.net/picard-metric-definitions.shtml">Click here for Picard Metrics definitions</a></li></ul><hr/><b>Picard output</b><hr/><table cellpadding="3" > -<tr class="d0"><td>chr1 length= 101 Aligned= 0 Unaligned= 0</td></tr> -<tr class="d1"><td>chr7 length= 404 Aligned= 7 Unaligned= 0</td></tr> -<tr class="d0"><td>chr8 length= 202 Aligned= 0 Unaligned= 0</td></tr> -<tr class="d1"><td>chr10 length= 303 Aligned= 0 Unaligned= 0</td></tr> -<tr class="d0"><td>chr14 length= 505 Aligned= 0 Unaligned= 0</td></tr> -<tr class="d1"><td>NoCoordinateCount= 1</td></tr> +<tr class="d0"><td colspan="2">chr1 length= 101 Aligned= 0 Unaligned= 0</td></tr> +<tr class="d1"><td colspan="2">chr7 length= 404 Aligned= 7 Unaligned= 0</td></tr> +<tr class="d0"><td colspan="2">chr8 length= 202 Aligned= 0 Unaligned= 0</td></tr> +<tr class="d1"><td colspan="2">chr10 length= 303 Aligned= 0 Unaligned= 0</td></tr> +<tr class="d0"><td colspan="2">chr14 length= 505 Aligned= 0 Unaligned= 0</td></tr> +<tr class="d1"><td colspan="2">NoCoordinateCount= 1</td></tr></table> -<b>Picard log</b><hr/> -<pre>## executing java -Xmx2g -jar /udd/rerla/galaxy-central/tool-data/shared/jars/BamIndexStats.jar VALIDATION_STRINGENCY=LENIENT INPUT=/udd/rerla/galaxy-central/database/job_working_directory/4/dataset_4_files/tmpB_J8W5.bam returned status 0 and stderr: -[Mon May 09 13:04:21 EDT 2011] net.sf.picard.sam.BamIndexStats INPUT=/udd/rerla/galaxy-central/database/job_working_directory/4/dataset_4_files/tmpB_J8W5.bam VALIDATION_STRINGENCY=LENIENT TMP_DIR=/tmp/rerla VERBOSITY=INFO QUIET=false COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false -[Mon May 09 13:04:21 EDT 2011] net.sf.picard.sam.BamIndexStats done. +<b>Picard Tool Run Log</b><hr/> +<pre>Thu, 12 May 2011 14:18:22 INFO + ## executing java -Xmx2g -jar /udd/rerla/galaxy-central/tool-data/shared/jars/BamIndexStats.jar VALIDATION_STRINGENCY=LENIENT INPUT=/udd/rerla/galaxy-central/database/job_working_directory/957/dataset_1017_files/tmpqXGksN.bam returned status 0 and stderr: +[Thu May 12 14:18:21 EDT 2011] net.sf.picard.sam.BamIndexStats INPUT=/udd/rerla/galaxy-central/database/job_working_directory/957/dataset_1017_files/tmpqXGksN.bam VALIDATION_STRINGENCY=LENIENT TMP_DIR=/tmp/rerla VERBOSITY=INFO QUIET=false COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false +[Thu May 12 14:18:22 EDT 2011] net.sf.picard.sam.BamIndexStats done. Runtime.totalMemory()=9109504 http://bitbucket.org/galaxy/galaxy-central/changeset/c53834f418c9/ changeset: r5554:c53834f418c9 user: fubar date: 2011-05-12 22:48:45 summary: branch merge affected #: 7 files (405 bytes) --- a/buildbot_setup.sh Thu May 12 16:48:31 2011 -0400 +++ b/buildbot_setup.sh Thu May 12 16:48:45 2011 -0400 @@ -61,6 +61,7 @@ /galaxy/data/location/srma_index.loc /galaxy/data/taxonomy /galaxy/data/location/twobit.loc +/galaxy/software/tool-data/gatk " SAMPLES=" @@ -135,4 +136,7 @@ echo "Setting up test data location files" python test-data-repo/location/make_location.py +echo "Appending tool-data/shared/ucsc/builds.txt.buildbot to tool-data/shared/ucsc/builds.txt" +cat tool-data/shared/ucsc/builds.txt.buildbot >> tool-data/shared/ucsc/builds.txt + python ./scripts/fetch_eggs.py all --- a/test-data/gatk/gatk_analyze_covariates/gatk_analyze_covariates_out_1.html Thu May 12 16:48:31 2011 -0400 +++ b/test-data/gatk/gatk_analyze_covariates/gatk_analyze_covariates_out_1.html Thu May 12 16:48:45 2011 -0400 @@ -1,1 +1,17 @@ -<html><head><title>Galaxy - GATK Output</title></head><body><p/><ul><li><a href="A Fake phiX Sample.CycleCovariate.dat">A Fake phiX Sample.CycleCovariate.dat</a></li><li><a href="A Fake phiX Sample.DinucCovariate.dat">A Fake phiX Sample.DinucCovariate.dat</a></li><li><a href="A Fake phiX Sample.HomopolymerCovariate.dat">A Fake phiX Sample.HomopolymerCovariate.dat</a></li><li><a href="A Fake phiX Sample.MinimumNQSCovariate.dat">A Fake phiX Sample.MinimumNQSCovariate.dat</a></li><li><a href="A Fake phiX Sample.PositionCovariate.dat">A Fake phiX Sample.PositionCovariate.dat</a></li><li><a href="A Fake phiX Sample.QualityScoreCovariate.dat">A Fake phiX Sample.QualityScoreCovariate.dat</a></li><li><a href="A.qual_diff_v_Fake.pdf">A.qual_diff_v_Fake.pdf</a></li></ul></body></html> \ No newline at end of file +<html> +<head> +<title>Galaxy - GATK Output</title> +</head> +<body> +<p/> +<ul> +<li><a href="A Fake phiX Sample.CycleCovariate.dat">A Fake phiX Sample.CycleCovariate.dat</a></li> +<li><a href="A Fake phiX Sample.DinucCovariate.dat">A Fake phiX Sample.DinucCovariate.dat</a></li> +<li><a href="A Fake phiX Sample.HomopolymerCovariate.dat">A Fake phiX Sample.HomopolymerCovariate.dat</a></li> +<li><a href="A Fake phiX Sample.MinimumNQSCovariate.dat">A Fake phiX Sample.MinimumNQSCovariate.dat</a></li> +<li><a href="A Fake phiX Sample.PositionCovariate.dat">A Fake phiX Sample.PositionCovariate.dat</a></li> +<li><a href="A Fake phiX Sample.QualityScoreCovariate.dat">A Fake phiX Sample.QualityScoreCovariate.dat</a></li> +<li><a href="A.qual_diff_v_Fake.pdf">A.qual_diff_v_Fake.pdf</a></li> +</ul> +</body> +</html> --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool-data/shared/ucsc/builds.txt.buildbot Thu May 12 16:48:45 2011 -0400 @@ -0,0 +1,1 @@ +chrM equCab2 chrM (chrM) --- a/tools/gatk/gatk_wrapper.py Thu May 12 16:48:31 2011 -0400 +++ b/tools/gatk/gatk_wrapper.py Thu May 12 16:48:45 2011 -0400 @@ -37,10 +37,10 @@ return None def html_report_from_directory( html_out, dir ): - html_out.write( '<html><head><title>Galaxy - GATK Output</title></head><body><p/><ul>' ) - for fname in os.listdir( dir ): - html_out.write( '<li><a href="%s">%s</a></li>' % ( fname, fname ) ) - html_out.write( '</ul></body></html>' ) + html_out.write( '<html>\n<head>\n<title>Galaxy - GATK Output</title>\n</head>\n<body>\n<p/>\n<ul>\n' ) + for fname in sorted( os.listdir( dir ) ): + html_out.write( '<li><a href="%s">%s</a></li>\n' % ( fname, fname ) ) + html_out.write( '</ul>\n</body>\n</html>\n' ) def __main__(): #Parse Command Line --- a/tools/picard/picard_AddOrReplaceReadGroups.xml Thu May 12 16:48:31 2011 -0400 +++ b/tools/picard/picard_AddOrReplaceReadGroups.xml Thu May 12 16:48:45 2011 -0400 @@ -63,7 +63,7 @@ <param name="rgsm" value="sam1" /><param name="rgOpts" value="preSet" /><param name="outputFormat" value="sam" /> - <output name="outFileSam" ftype="picard_ARRG_output1.sam" /> + <output name="outFileSam" file="picard_ARRG_output1.sam" /></test><!-- Functional tests with Picard bam outputs currently aren't working <test> --- a/tools/sr_mapping/bwa_color_wrapper.xml Thu May 12 16:48:31 2011 -0400 +++ b/tools/sr_mapping/bwa_color_wrapper.xml Thu May 12 16:48:45 2011 -0400 @@ -137,23 +137,23 @@ <option value="no">No</option></param><when value="yes"> - <param name="rgid" type="text" size="25" label="Read group identifier. Each @RG line must have a unique ID. The value of ID is used in the RG + <param name="rgid" type="text" size="25" label="Read group identifier (ID). Each @RG line must have a unique ID. The value of ID is used in the RG tags of alignment records. Must be unique among all read groups in header section." help="Required if RG specified. Read group IDs may be modified when merging SAM files in order to handle collisions." /> - <param name="rgcn" type="text" size="25" label="Sequencing center that produced the read" help="Optional" /> - <param name="rgds" type="text" size="25" label="Description" help="Optional" /> - <param name="rgdt" type="text" size="25" label="Date that run was produced (ISO8601 format date or date/time, like YYYY-MM-DD)" help="Optional" /> - <param name="rgfo" type="text" size="25" label="Flow order. The array of nucleotide bases that correspond to the nucleotides used for each -flow of each read." help="Optional. Multi-base flows are encoded in IUPAC format, and non-nucleotide flows by + <param name="rgcn" type="text" size="25" label="Sequencing center that produced the read (CN)" help="Optional" /> + <param name="rgds" type="text" size="25" label="Description (DS)" help="Optional" /> + <param name="rgdt" type="text" size="25" label="Date that run was produced (DT)" help="Optional. ISO8601 format date or date/time, like YYYY-MM-DD" /> + <param name="rgfo" type="text" size="25" label="Flow order (FO). The array of nucleotide bases that correspond to the nucleotides used for each +flow of each read." help="Optional. Multi-base flows are encoded in IUPAC format, and non-nucleotide flows by various other characters. Format : /\*|[ACMGRSVTWYHKDBN]+/" /> - <param name="rgks" type="text" size="25" label="The array of nucleotide bases that correspond to the key sequence of each read" help="Optional" /> - <param name="rglb" type="text" size="25" label="Library name" help="Required if RG specified" /> - <param name="rgpg" type="text" size="25" label="Programs used for processing the read group" help="Optional" /> - <param name="rgpi" type="text" size="25" label="Predicted median insert size" help="Optional" /> - <param name="rgpl" type="text" size="25" label="Platform/technology used to produce the reads. Valid values : CAPILLARY, LS454, ILLUMINA, -SOLID, HELICOS, IONTORRENT and PACBIO" help="Required if RG specified" /> - <param name="rgpu" type="text" size="25" label="Platform unit (e.g. flowcell-barcode.lane for Illumina or slide for SOLiD). Unique identifier." help="Optional" /> - <param name="rgsm" type="text" size="25" label="Sample. Use pool name where a pool is being sequenced" help="Required if RG specified" /> + <param name="rgks" type="text" size="25" label="The array of nucleotide bases that correspond to the key sequence of each read (KS)" help="Optional" /> + <param name="rglb" type="text" size="25" label="Library name (LB)" help="Required if RG specified" /> + <param name="rgpg" type="text" size="25" label="Programs used for processing the read group (PG)" help="Optional" /> + <param name="rgpi" type="text" size="25" label="Predicted median insert size (PI)" help="Optional" /> + <param name="rgpl" type="text" size="25" label="Platform/technology used to produce the reads (PL)" help="Required if RG specified. Valid values : CAPILLARY, LS454, ILLUMINA, +SOLID, HELICOS, IONTORRENT and PACBIO" /> + <param name="rgpu" type="text" size="25" label="Platform unit (PU)" help="Optional. Unique identifier (e.g. flowcell-barcode.lane for Illumina or slide for SOLiD)" /> + <param name="rgsm" type="text" size="25" label="Sample (SM)" help="Required if RG specified. Use pool name where a pool is being sequenced" /></when><when value="no" /></conditional> --- a/tools/sr_mapping/bwa_wrapper.xml Thu May 12 16:48:31 2011 -0400 +++ b/tools/sr_mapping/bwa_wrapper.xml Thu May 12 16:48:45 2011 -0400 @@ -130,23 +130,23 @@ <option value="no">No</option></param><when value="yes"> - <param name="rgid" type="text" size="25" label="Read group identifier. Each @RG line must have a unique ID. The value of ID is used in the RG + <param name="rgid" type="text" size="25" label="Read group identifier (ID). Each @RG line must have a unique ID. The value of ID is used in the RG tags of alignment records. Must be unique among all read groups in header section." help="Required if RG specified. Read group IDs may be modified when merging SAM files in order to handle collisions." /> - <param name="rgcn" type="text" size="25" label="Sequencing center that produced the read" help="Optional" /> - <param name="rgds" type="text" size="25" label="Description" help="Optional" /> - <param name="rgdt" type="text" size="25" label="Date that run was produced (ISO8601 format date or date/time, like YYYY-MM-DD)" help="Optional" /> - <param name="rgfo" type="text" size="25" label="Flow order. The array of nucleotide bases that correspond to the nucleotides used for each + <param name="rgcn" type="text" size="25" label="Sequencing center that produced the read (CN)" help="Optional" /> + <param name="rgds" type="text" size="25" label="Description (DS)" help="Optional" /> + <param name="rgdt" type="text" size="25" label="Date that run was produced (DT)" help="Optional. ISO8601 format date or date/time, like YYYY-MM-DD" /> + <param name="rgfo" type="text" size="25" label="Flow order (FO). The array of nucleotide bases that correspond to the nucleotides used for each flow of each read." help="Optional. Multi-base flows are encoded in IUPAC format, and non-nucleotide flows by various other characters. Format : /\*|[ACMGRSVTWYHKDBN]+/" /> - <param name="rgks" type="text" size="25" label="The array of nucleotide bases that correspond to the key sequence of each read" help="Optional" /> - <param name="rglb" type="text" size="25" label="Library name" help="Required if RG specified" /> - <param name="rgpg" type="text" size="25" label="Programs used for processing the read group" help="Optional" /> - <param name="rgpi" type="text" size="25" label="Predicted median insert size" help="Optional" /> - <param name="rgpl" type="text" size="25" label="Platform/technology used to produce the reads. Valid values : CAPILLARY, LS454, ILLUMINA, -SOLID, HELICOS, IONTORRENT and PACBIO" help="Required if RG specified" /> - <param name="rgpu" type="text" size="25" label="Platform unit (e.g. flowcell-barcode.lane for Illumina or slide for SOLiD). Unique identifier." help="Optional" /> - <param name="rgsm" type="text" size="25" label="Sample. Use pool name where a pool is being sequenced" help="Required if RG specified" /> + <param name="rgks" type="text" size="25" label="The array of nucleotide bases that correspond to the key sequence of each read (KS)" help="Optional" /> + <param name="rglb" type="text" size="25" label="Library name (LB)" help="Required if RG specified" /> + <param name="rgpg" type="text" size="25" label="Programs used for processing the read group (PG)" help="Optional" /> + <param name="rgpi" type="text" size="25" label="Predicted median insert size (PI)" help="Optional" /> + <param name="rgpl" type="text" size="25" label="Platform/technology used to produce the reads (PL)" help="Required if RG specified. Valid values : CAPILLARY, LS454, ILLUMINA, +SOLID, HELICOS, IONTORRENT and PACBIO" /> + <param name="rgpu" type="text" size="25" label="Platform unit (PU)" help="Optional. Unique identifier (e.g. flowcell-barcode.lane for Illumina or slide for SOLiD)" /> + <param name="rgsm" type="text" size="25" label="Sample (SM)" help="Required if RG specified. Use pool name where a pool is being sequenced" /></when><when value="no" /></conditional> http://bitbucket.org/galaxy/galaxy-central/changeset/eddee43cb8e6/ changeset: r5555:eddee43cb8e6 user: fubar date: 2011-05-12 22:53:11 summary: more fixes for tests related to new logging method for picard tools affected #: 2 files (1.7 KB) --- a/test-data/picard_output_insertsize_tinysam.html Thu May 12 16:48:45 2011 -0400 +++ b/test-data/picard_output_insertsize_tinysam.html Thu May 12 16:53:11 2011 -0400 @@ -6,17 +6,18 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="Galaxy picard tool output - see http://getgalaxy.org/" /> +<meta name="generator" content="Galaxy picard_wrapper tool output - see http://getgalaxy.org/" /><title></title><link rel="stylesheet" href="/static/style/base.css" type="text/css" /></head><body><div class="document"> -<b><a href="http://rgenetics.org">Galaxy Rgenetics</a> tool output picard run at 24/04/2011 13:22:02</b><br/><table cellpadding="10"><tr><td> +Galaxy tool CollectInsertSizeMetrics run at 12/05/2011 14:33:49</b><br/><table cellpadding="10"><tr><td><a href="InsertSizeHist.pdf"><img src="InsertSizeHist.jpg" title="Click image preview for a print quality PDF version" hspace="10" align="middle"></a></tr></td></table><b>The following output files were created (click the filename to view/download a copy):</b><hr/><table><tr><td><a href="CollectInsertSizeMetrics.metrics.txt">CollectInsertSizeMetrics.metrics.txt</a></td></tr> +<tr><td><a href="CollectInsertSizeMetrics.log">CollectInsertSizeMetrics.log</a></td></tr><tr><td><a href="InsertSizeHist.pdf">InsertSizeHist.pdf</a></td></tr><tr><td><a href="InsertSizeHist.jpg">InsertSizeHist.jpg</a></td></tr></table><p/> @@ -25,41 +26,46 @@ <li><a href="http://picard.sourceforge.net/picard-metric-definitions.shtml">Click here for Picard Metrics definitions</a></li></ul><hr/><b>Picard output (transposed to make it easier to see)</b><hr/><table cellpadding="3" > -<tr class="d0"><td>## net.sf.picard.metrics.StringHeader</td></tr><tr class="d1"><td># net.sf.picard.analysis.CollectInsertSizeMetrics HISTOGRAM_FILE=InsertSizeHist.pdf TAIL_LIMIT=10000 MINIMUM_PCT=0.01 INPUT=/dev/shm/tmpwOFdMU/database/files/000/dataset_1.dat OUTPUT=/udd/rerla/rgalaxy/database/job_working_directory/2/dataset_2_files/CollectInsertSizeMetrics.metrics.txt VALIDATION_STRINGENCY=LENIENT ASSUME_SORTED=true STOP_AFTER=0 TMP_DIR=/tmp/rerla VERBOSITY=INFO QUIET=false COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false</td></tr><tr class="d0"><td>## net.sf.picard.metrics.StringHeader</td></tr><tr class="d1"><td># Started on: Sun Apr 24 13:22:01 EDT 2011</td></tr><tr class="d0"><td>## METRICS CLASS net.sf.picard.analysis.InsertSizeMetrics</td></tr><tr class="d0"><td>MEDIAN_INSERT_SIZE</td><td>96</td></tr> -<tr class="d1"><td>MIN_INSERT_SIZE</td><td>96</td></tr> -<tr class="d0"><td>MAX_INSERT_SIZE</td><td>96</td></tr> -<tr class="d1"><td>MEAN_INSERT_SIZE</td><td>96</td></tr> -<tr class="d0"><td>STANDARD_DEVIATION</td><td>?</td></tr> -<tr class="d1"><td>READ_PAIRS</td><td>1</td></tr> -<tr class="d0"><td>PAIR_ORIENTATION</td><td>FR</td></tr> -<tr class="d1"><td>WIDTH_OF_10_PERCENT</td><td>1</td></tr> -<tr class="d0"><td>WIDTH_OF_20_PERCENT</td><td>1</td></tr> -<tr class="d1"><td>WIDTH_OF_30_PERCENT</td><td>1</td></tr> -<tr class="d0"><td>WIDTH_OF_40_PERCENT</td><td>1</td></tr> -<tr class="d1"><td>WIDTH_OF_50_PERCENT</td><td>1</td></tr> -<tr class="d0"><td>WIDTH_OF_60_PERCENT</td><td>1</td></tr> -<tr class="d1"><td>WIDTH_OF_70_PERCENT</td><td>1</td></tr> -<tr class="d0"><td>WIDTH_OF_80_PERCENT</td><td>1</td></tr> -<tr class="d1"><td>WIDTH_OF_90_PERCENT</td><td>1</td></tr> +<tr class="d0"><td colspan="2">## net.sf.picard.metrics.StringHeader</td></tr><tr class="d1"><td colspan="2"># net.sf.picard.analysis.CollectInsertSizeMetrics HISTOGRAM_FILE=InsertSizeHist.pdf TAIL_LIMIT=10000 MINIMUM_PCT=0.01 INPUT=/tmp/6729253.1.all.q/tmpM5wI_h/database/files/001/dataset_1092.dat OUTPUT=/udd/rerla/galaxy-central/database/job_working_directory/1028/dataset_1093_files/CollectInsertSizeMetrics.metrics.txt VALIDATION_STRINGENCY=LENIENT ASSUME_SORTED=true STOP_AFTER=0 TMP_DIR=/tmp/rerla VERBOSITY=INFO QUIET=false COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false</td></tr><tr class="d0"><td colspan="2">## net.sf.picard.metrics.StringHeader</td></tr><tr class="d1"><td colspan="2"># Started on: Thu May 12 14:33:48 EDT 2011</td></tr><tr class="d0"><td colspan="2">## METRICS CLASS net.sf.picard.analysis.InsertSizeMetrics</td></tr><tr class="d0"><td>MEDIAN_INSERT_SIZE</td><td>96 </td></tr> +<tr class="d1"><td>MIN_INSERT_SIZE</td><td>96 </td></tr> +<tr class="d0"><td>MAX_INSERT_SIZE</td><td>96 </td></tr> +<tr class="d1"><td>MEAN_INSERT_SIZE</td><td>96 </td></tr> +<tr class="d0"><td>STANDARD_DEVIATION</td><td>? </td></tr> +<tr class="d1"><td>READ_PAIRS</td><td>1 </td></tr> +<tr class="d0"><td>PAIR_ORIENTATION</td><td>FR </td></tr> +<tr class="d1"><td>WIDTH_OF_10_PERCENT</td><td>1 </td></tr> +<tr class="d0"><td>WIDTH_OF_20_PERCENT</td><td>1 </td></tr> +<tr class="d1"><td>WIDTH_OF_30_PERCENT</td><td>1 </td></tr> +<tr class="d0"><td>WIDTH_OF_40_PERCENT</td><td>1 </td></tr> +<tr class="d1"><td>WIDTH_OF_50_PERCENT</td><td>1 </td></tr> +<tr class="d0"><td>WIDTH_OF_60_PERCENT</td><td>1 </td></tr> +<tr class="d1"><td>WIDTH_OF_70_PERCENT</td><td>1 </td></tr> +<tr class="d0"><td>WIDTH_OF_80_PERCENT</td><td>1 </td></tr> +<tr class="d1"><td>WIDTH_OF_90_PERCENT</td><td>1 </td></tr><tr class="d0"><td>WIDTH_OF_99_PERCENT </td><td>1 -</td></tr> -<tr class="d0"><td>## HISTOGRAM java.lang.Integer</td></tr><tr class="d0"><td>insert_size fr_count rf_count</td></tr> -<tr class="d1"><td>96 1 0</td></tr> -<tr class="d0"><td>201 0 1</td></tr> + </td></tr> +<tr class="d0"><td colspan="2">## HISTOGRAM java.lang.Integer</td></tr><tr class="d0"><td colspan="2">insert_size fr_count rf_count</td></tr> +<tr class="d1"><td colspan="2">96 1 0</td></tr> +<tr class="d0"><td colspan="2">201 0 1</td></tr></table> -<b>Picard log</b><hr/> -<pre>## executing java -Xmx2g -jar /udd/rerla/rgalaxy/tool-data/shared/jars/CollectInsertSizeMetrics.jar VALIDATION_STRINGENCY=LENIENT I=/dev/shm/tmpwOFdMU/database/files/000/dataset_1.dat O=/udd/rerla/rgalaxy/database/job_working_directory/2/dataset_2_files/CollectInsertSizeMetrics.metrics.txt HISTOGRAM_FILE=InsertSizeHist.pdf TAIL_LIMIT=10000 MINIMUM_PCT=0.01 returned status 0 and stderr: -[Sun Apr 24 13:22:01 EDT 2011] net.sf.picard.analysis.CollectInsertSizeMetrics HISTOGRAM_FILE=InsertSizeHist.pdf TAIL_LIMIT=10000 MINIMUM_PCT=0.01 INPUT=/dev/shm/tmpwOFdMU/database/files/000/dataset_1.dat OUTPUT=/udd/rerla/rgalaxy/database/job_working_directory/2/dataset_2_files/CollectInsertSizeMetrics.metrics.txt VALIDATION_STRINGENCY=LENIENT ASSUME_SORTED=true STOP_AFTER=0 TMP_DIR=/tmp/rerla VERBOSITY=INFO QUIET=false COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false -WARNING 2011-04-24 13:22:01 SinglePassSamProgram File reports sort order 'queryname', assuming it's coordinate sorted anyway. -INFO 2011-04-24 13:22:01 ProcessExecutor [1] "FR = red" "RF = blue" -INFO 2011-04-24 13:22:01 ProcessExecutor null device -INFO 2011-04-24 13:22:01 ProcessExecutor 1 -[Sun Apr 24 13:22:01 EDT 2011] net.sf.picard.analysis.CollectInsertSizeMetrics done. +<b>Picard Tool Run Log</b><hr/> +<pre>Thu, 12 May 2011 14:33:48 INFO + ## executing java -Xmx2g -jar /udd/rerla/galaxy-central/tool-data/shared/jars/CollectInsertSizeMetrics.jar VALIDATION_STRINGENCY=LENIENT I=/tmp/6729253.1.all.q/tmpM5wI_h/database/files/001/dataset_1092.dat O=/udd/rerla/galaxy-central/database/job_working_directory/1028/dataset_1093_files/CollectInsertSizeMetrics.metrics.txt HISTOGRAM_FILE=InsertSizeHist.pdf TAIL_LIMIT=10000 MINIMUM_PCT=0.01 returned status 0 and stderr: +[Thu May 12 14:33:48 EDT 2011] net.sf.picard.analysis.CollectInsertSizeMetrics HISTOGRAM_FILE=InsertSizeHist.pdf TAIL_LIMIT=10000 MINIMUM_PCT=0.01 INPUT=/tmp/6729253.1.all.q/tmpM5wI_h/database/files/001/dataset_1092.dat OUTPUT=/udd/rerla/galaxy-central/database/job_working_directory/1028/dataset_1093_files/CollectInsertSizeMetrics.metrics.txt VALIDATION_STRINGENCY=LENIENT ASSUME_SORTED=true STOP_AFTER=0 TMP_DIR=/tmp/rerla VERBOSITY=INFO QUIET=false COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false +WARNING 2011-05-12 14:33:48 SinglePassSamProgram File reports sort order 'queryname', assuming it's coordinate sorted anyway. +INFO 2011-05-12 14:33:48 ProcessExecutor [1] "FR = red" "RF = blue" +INFO 2011-05-12 14:33:48 ProcessExecutor null device +INFO 2011-05-12 14:33:48 ProcessExecutor 1 +[Thu May 12 14:33:48 EDT 2011] net.sf.picard.analysis.CollectInsertSizeMetrics done. Runtime.totalMemory()=9109504 -## executing mogrify -format jpg -resize x400 /udd/rerla/rgalaxy/database/job_working_directory/2/dataset_2_files/InsertSizeHist.pdf returned status 0 and nothing on stderr +Thu, 12 May 2011 14:33:49 INFO + ## executing mogrify -format jpg -resize x400 /udd/rerla/galaxy-central/database/job_working_directory/1028/dataset_1093_files/InsertSizeHist.pdf returned status 0 and nothing on stderr + +Thu, 12 May 2011 14:33:49 INFO + ## executing mogrify -format jpg -resize x400 /udd/rerla/galaxy-central/database/job_working_directory/1028/dataset_1093_files/InsertSizeHist.pdf returned status 0 and nothing on stderr </pre><hr/>The freely available <a href="http://picard.sourceforge.net/command-line-overview.shtml">Picard software</a> generated all outputs reported here running as a <a href="http://getgalaxy.org">Galaxy</a> tool</div></body></html> --- a/test-data/picard_output_markdups_sortedpairsam.html Thu May 12 16:48:45 2011 -0400 +++ b/test-data/picard_output_markdups_sortedpairsam.html Thu May 12 16:53:11 2011 -0400 @@ -6,156 +6,155 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> -<meta name="generator" content="Galaxy rgPicardMarkDups.py tool output - see http://g2.trac.bx.psu.edu/" /> +<meta name="generator" content="Galaxy picard_wrapper tool output - see http://getgalaxy.org/" /><title></title><link rel="stylesheet" href="/static/style/base.css" type="text/css" /></head><body><div class="document"> -<b><a href="http://rgenetics.org">Galaxy Rgenetics</a> tool output rgPicardMarkDups.py run at 22/04/2011 22:31:48</b><br/><b>Running this Galaxy tool produced the following output files (click the filename to view/download a copy).</b><hr/><table> -<tr><td><a href="rgPicardMarkDupsout.txt">rgPicardMarkDupsout.txt</a></td></tr> +Galaxy tool MarkDuplicates run at 12/05/2011 14:34:29</b><br/><b>The following output files were created (click the filename to view/download a copy):</b><hr/><table> +<tr><td><a href="MarkDuplicates.log">MarkDuplicates.log</a></td></tr> +<tr><td><a href="MarkDuplicates.metrics.txt">MarkDuplicates.metrics.txt</a></td></tr></table><p/><b>Picard on line resources</b><ul><li><a href="http://picard.sourceforge.net/index.shtml">Click here for Picard Documentation</a></li><li><a href="http://picard.sourceforge.net/picard-metric-definitions.shtml">Click here for Picard Metrics definitions</a></li></ul><hr/><b>Picard output (transposed to make it easier to see)</b><hr/><table cellpadding="3" > -<tr class="d0"><td>## net.sf.picard.metrics.StringHeader</td></tr><tr class="d1"><td># net.sf.picard.sam.MarkDuplicates INPUT=/dev/shm/tmpk9pvdq/database/files/000/dataset_1.dat OUTPUT=/dev/shm/tmpk9pvdq/database/files/000/dataset_2.dat METRICS_FILE=/udd/rerla/rgalaxy/database/job_working_directory/2/dataset_3_files/rgPicardMarkDupsout.txt ASSUME_SORTED=true READ_NAME_REGEX=[a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).* OPTICAL_DUPLICATE_PIXEL_DISTANCE=100 VALIDATION_STRINGENCY=LENIENT REMOVE_DUPLICATES=false MAX_SEQUENCES_FOR_DISK_READ_ENDS_MAP=50000 MAX_FILE_HANDLES_FOR_READ_ENDS_MAP=8000 TMP_DIR=/tmp/rerla VERBOSITY=INFO QUIET=false COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false</td></tr><tr class="d0"><td>## net.sf.picard.metrics.StringHeader</td></tr><tr class="d1"><td># Started on: Fri Apr 22 22:31:46 EDT 2011</td></tr><tr class="d0"><td>## METRICS CLASS net.sf.picard.sam.DuplicationMetrics</td></tr><tr class="d0"><td>LIBRARY</td><td></td></tr> -<tr class="d1"><td>UNPAIRED_READS_EXAMINED</td><td>1</td></tr> -<tr class="d0"><td>READ_PAIRS_EXAMINED</td><td>3</td></tr> -<tr class="d1"><td>UNMAPPED_READS</td><td>1</td></tr> -<tr class="d0"><td>UNPAIRED_READ_DUPLICATES</td><td>1</td></tr> -<tr class="d1"><td>READ_PAIR_DUPLICATES</td><td>1</td></tr> -<tr class="d0"><td>READ_PAIR_OPTICAL_DUPLICATES</td><td>0</td></tr> -<tr class="d1"><td>PERCENT_DUPLICATION</td><td>0.428571</td></tr> +<tr class="d0"><td colspan="2">## net.sf.picard.metrics.StringHeader</td></tr><tr class="d1"><td colspan="2"># net.sf.picard.sam.MarkDuplicates INPUT=/tmp/6729253.1.all.q/tmpM5wI_h/database/files/001/dataset_1097.dat OUTPUT=/tmp/6729253.1.all.q/tmpM5wI_h/database/files/001/dataset_1098.dat METRICS_FILE=/udd/rerla/galaxy-central/database/job_working_directory/1032/dataset_1099_files/MarkDuplicates.metrics.txt REMOVE_DUPLICATES=true ASSUME_SORTED=true READ_NAME_REGEX=[a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).* OPTICAL_DUPLICATE_PIXEL_DISTANCE=100 VALIDATION_STRINGENCY=LENIENT MAX_SEQUENCES_FOR_DISK_READ_ENDS_MAP=50000 MAX_FILE_HANDLES_FOR_READ_ENDS_MAP=8000 TMP_DIR=/tmp/rerla VERBOSITY=INFO QUIET=false COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false</td></tr><tr class="d0"><td colspan="2">## net.sf.picard.metrics.StringHeader</td></tr><tr class="d1"><td colspan="2"># Started on: Thu May 12 14:34:28 EDT 2011</td></tr><tr class="d0"><td colspan="2">## METRICS CLASS net.sf.picard.sam.DuplicationMetrics</td></tr><tr class="d0"><td>LIBRARY</td><td> </td></tr> +<tr class="d1"><td>UNPAIRED_READS_EXAMINED</td><td>1 </td></tr> +<tr class="d0"><td>READ_PAIRS_EXAMINED</td><td>3 </td></tr> +<tr class="d1"><td>UNMAPPED_READS</td><td>1 </td></tr> +<tr class="d0"><td>UNPAIRED_READ_DUPLICATES</td><td>1 </td></tr> +<tr class="d1"><td>READ_PAIR_DUPLICATES</td><td>1 </td></tr> +<tr class="d0"><td>READ_PAIR_OPTICAL_DUPLICATES</td><td>0 </td></tr> +<tr class="d1"><td>PERCENT_DUPLICATION</td><td>0.428571 </td></tr><tr class="d0"><td>ESTIMATED_LIBRARY_SIZE </td><td>3 -</td></tr> -<tr class="d0"><td>## HISTOGRAM java.lang.Double</td></tr><tr class="d0"><td>BIN VALUE</td></tr> -<tr class="d1"><td>1.0 0.948181</td></tr> -<tr class="d0"><td>2.0 1.296997</td></tr> -<tr class="d1"><td>3.0 1.425319</td></tr> -<tr class="d0"><td>4.0 1.472527</td></tr> -<tr class="d1"><td>5.0 1.489893</td></tr> -<tr class="d0"><td>6.0 1.496282</td></tr> -<tr class="d1"><td>7.0 1.498632</td></tr> -<tr class="d0"><td>8.0 1.499497</td></tr> -<tr class="d1"><td>9.0 1.499815</td></tr> -<tr class="d0"><td>10.0 1.499932</td></tr> -<tr class="d1"><td>11.0 1.499975</td></tr> -<tr class="d0"><td>12.0 1.499991</td></tr> -<tr class="d1"><td>13.0 1.499997</td></tr> -<tr class="d0"><td>14.0 1.499999</td></tr> -<tr class="d1"><td>15.0 1.5</td></tr> -<tr class="d0"><td>16.0 1.5</td></tr> -<tr class="d1"><td>17.0 1.5</td></tr> -<tr class="d0"><td>18.0 1.5</td></tr> -<tr class="d1"><td>19.0 1.5</td></tr> -<tr class="d0"><td>20.0 1.5</td></tr> -<tr class="d1"><td>21.0 1.5</td></tr> -<tr class="d0"><td>22.0 1.5</td></tr> -<tr class="d1"><td>23.0 1.5</td></tr> -<tr class="d0"><td>24.0 1.5</td></tr> -<tr class="d1"><td>25.0 1.5</td></tr> -<tr class="d0"><td>26.0 1.5</td></tr> -<tr class="d1"><td>27.0 1.5</td></tr> -<tr class="d0"><td>28.0 1.5</td></tr> -<tr class="d1"><td>29.0 1.5</td></tr> -<tr class="d0"><td>30.0 1.5</td></tr> -<tr class="d1"><td>31.0 1.5</td></tr> -<tr class="d0"><td>32.0 1.5</td></tr> -<tr class="d1"><td>33.0 1.5</td></tr> -<tr class="d0"><td>34.0 1.5</td></tr> -<tr class="d1"><td>35.0 1.5</td></tr> -<tr class="d0"><td>36.0 1.5</td></tr> -<tr class="d1"><td>37.0 1.5</td></tr> -<tr class="d0"><td>38.0 1.5</td></tr> -<tr class="d1"><td>39.0 1.5</td></tr> -<tr class="d0"><td>40.0 1.5</td></tr> -<tr class="d1"><td>41.0 1.5</td></tr> -<tr class="d0"><td>42.0 1.5</td></tr> -<tr class="d1"><td>43.0 1.5</td></tr> -<tr class="d0"><td>44.0 1.5</td></tr> -<tr class="d1"><td>45.0 1.5</td></tr> -<tr class="d0"><td>46.0 1.5</td></tr> -<tr class="d1"><td>47.0 1.5</td></tr> -<tr class="d0"><td>48.0 1.5</td></tr> -<tr class="d1"><td>49.0 1.5</td></tr> -<tr class="d0"><td>50.0 1.5</td></tr> -<tr class="d1"><td>51.0 1.5</td></tr> -<tr class="d0"><td>52.0 1.5</td></tr> -<tr class="d1"><td>53.0 1.5</td></tr> -<tr class="d0"><td>54.0 1.5</td></tr> -<tr class="d1"><td>55.0 1.5</td></tr> -<tr class="d0"><td>56.0 1.5</td></tr> -<tr class="d1"><td>57.0 1.5</td></tr> -<tr class="d0"><td>58.0 1.5</td></tr> -<tr class="d1"><td>59.0 1.5</td></tr> -<tr class="d0"><td>60.0 1.5</td></tr> -<tr class="d1"><td>61.0 1.5</td></tr> -<tr class="d0"><td>62.0 1.5</td></tr> -<tr class="d1"><td>63.0 1.5</td></tr> -<tr class="d0"><td>64.0 1.5</td></tr> -<tr class="d1"><td>65.0 1.5</td></tr> -<tr class="d0"><td>66.0 1.5</td></tr> -<tr class="d1"><td>67.0 1.5</td></tr> -<tr class="d0"><td>68.0 1.5</td></tr> -<tr class="d1"><td>69.0 1.5</td></tr> -<tr class="d0"><td>70.0 1.5</td></tr> -<tr class="d1"><td>71.0 1.5</td></tr> -<tr class="d0"><td>72.0 1.5</td></tr> -<tr class="d1"><td>73.0 1.5</td></tr> -<tr class="d0"><td>74.0 1.5</td></tr> -<tr class="d1"><td>75.0 1.5</td></tr> -<tr class="d0"><td>76.0 1.5</td></tr> -<tr class="d1"><td>77.0 1.5</td></tr> -<tr class="d0"><td>78.0 1.5</td></tr> -<tr class="d1"><td>79.0 1.5</td></tr> -<tr class="d0"><td>80.0 1.5</td></tr> -<tr class="d1"><td>81.0 1.5</td></tr> -<tr class="d0"><td>82.0 1.5</td></tr> -<tr class="d1"><td>83.0 1.5</td></tr> -<tr class="d0"><td>84.0 1.5</td></tr> -<tr class="d1"><td>85.0 1.5</td></tr> -<tr class="d0"><td>86.0 1.5</td></tr> -<tr class="d1"><td>87.0 1.5</td></tr> -<tr class="d0"><td>88.0 1.5</td></tr> -<tr class="d1"><td>89.0 1.5</td></tr> -<tr class="d0"><td>90.0 1.5</td></tr> -<tr class="d1"><td>91.0 1.5</td></tr> -<tr class="d0"><td>92.0 1.5</td></tr> -<tr class="d1"><td>93.0 1.5</td></tr> -<tr class="d0"><td>94.0 1.5</td></tr> -<tr class="d1"><td>95.0 1.5</td></tr> -<tr class="d0"><td>96.0 1.5</td></tr> -<tr class="d1"><td>97.0 1.5</td></tr> -<tr class="d0"><td>98.0 1.5</td></tr> -<tr class="d1"><td>99.0 1.5</td></tr> -<tr class="d0"><td>100.0 1.5</td></tr> + </td></tr> +<tr class="d0"><td colspan="2">## HISTOGRAM java.lang.Double</td></tr><tr class="d0"><td colspan="2">BIN VALUE</td></tr> +<tr class="d1"><td colspan="2">1.0 0.948181</td></tr> +<tr class="d0"><td colspan="2">2.0 1.296997</td></tr> +<tr class="d1"><td colspan="2">3.0 1.425319</td></tr> +<tr class="d0"><td colspan="2">4.0 1.472527</td></tr> +<tr class="d1"><td colspan="2">5.0 1.489893</td></tr> +<tr class="d0"><td colspan="2">6.0 1.496282</td></tr> +<tr class="d1"><td colspan="2">7.0 1.498632</td></tr> +<tr class="d0"><td colspan="2">8.0 1.499497</td></tr> +<tr class="d1"><td colspan="2">9.0 1.499815</td></tr> +<tr class="d0"><td colspan="2">10.0 1.499932</td></tr> +<tr class="d1"><td colspan="2">11.0 1.499975</td></tr> +<tr class="d0"><td colspan="2">12.0 1.499991</td></tr> +<tr class="d1"><td colspan="2">13.0 1.499997</td></tr> +<tr class="d0"><td colspan="2">14.0 1.499999</td></tr> +<tr class="d1"><td colspan="2">15.0 1.5</td></tr> +<tr class="d0"><td colspan="2">16.0 1.5</td></tr> +<tr class="d1"><td colspan="2">17.0 1.5</td></tr> +<tr class="d0"><td colspan="2">18.0 1.5</td></tr> +<tr class="d1"><td colspan="2">19.0 1.5</td></tr> +<tr class="d0"><td colspan="2">20.0 1.5</td></tr> +<tr class="d1"><td colspan="2">21.0 1.5</td></tr> +<tr class="d0"><td colspan="2">22.0 1.5</td></tr> +<tr class="d1"><td colspan="2">23.0 1.5</td></tr> +<tr class="d0"><td colspan="2">24.0 1.5</td></tr> +<tr class="d1"><td colspan="2">25.0 1.5</td></tr> +<tr class="d0"><td colspan="2">26.0 1.5</td></tr> +<tr class="d1"><td colspan="2">27.0 1.5</td></tr> +<tr class="d0"><td colspan="2">28.0 1.5</td></tr> +<tr class="d1"><td colspan="2">29.0 1.5</td></tr> +<tr class="d0"><td colspan="2">30.0 1.5</td></tr> +<tr class="d1"><td colspan="2">31.0 1.5</td></tr> +<tr class="d0"><td colspan="2">32.0 1.5</td></tr> +<tr class="d1"><td colspan="2">33.0 1.5</td></tr> +<tr class="d0"><td colspan="2">34.0 1.5</td></tr> +<tr class="d1"><td colspan="2">35.0 1.5</td></tr> +<tr class="d0"><td colspan="2">36.0 1.5</td></tr> +<tr class="d1"><td colspan="2">37.0 1.5</td></tr> +<tr class="d0"><td colspan="2">38.0 1.5</td></tr> +<tr class="d1"><td colspan="2">39.0 1.5</td></tr> +<tr class="d0"><td colspan="2">40.0 1.5</td></tr> +<tr class="d1"><td colspan="2">41.0 1.5</td></tr> +<tr class="d0"><td colspan="2">42.0 1.5</td></tr> +<tr class="d1"><td colspan="2">43.0 1.5</td></tr> +<tr class="d0"><td colspan="2">44.0 1.5</td></tr> +<tr class="d1"><td colspan="2">45.0 1.5</td></tr> +<tr class="d0"><td colspan="2">46.0 1.5</td></tr> +<tr class="d1"><td colspan="2">47.0 1.5</td></tr> +<tr class="d0"><td colspan="2">48.0 1.5</td></tr> +<tr class="d1"><td colspan="2">49.0 1.5</td></tr> +<tr class="d0"><td colspan="2">50.0 1.5</td></tr> +<tr class="d1"><td colspan="2">51.0 1.5</td></tr> +<tr class="d0"><td colspan="2">52.0 1.5</td></tr> +<tr class="d1"><td colspan="2">53.0 1.5</td></tr> +<tr class="d0"><td colspan="2">54.0 1.5</td></tr> +<tr class="d1"><td colspan="2">55.0 1.5</td></tr> +<tr class="d0"><td colspan="2">56.0 1.5</td></tr> +<tr class="d1"><td colspan="2">57.0 1.5</td></tr> +<tr class="d0"><td colspan="2">58.0 1.5</td></tr> +<tr class="d1"><td colspan="2">59.0 1.5</td></tr> +<tr class="d0"><td colspan="2">60.0 1.5</td></tr> +<tr class="d1"><td colspan="2">61.0 1.5</td></tr> +<tr class="d0"><td colspan="2">62.0 1.5</td></tr> +<tr class="d1"><td colspan="2">63.0 1.5</td></tr> +<tr class="d0"><td colspan="2">64.0 1.5</td></tr> +<tr class="d1"><td colspan="2">65.0 1.5</td></tr> +<tr class="d0"><td colspan="2">66.0 1.5</td></tr> +<tr class="d1"><td colspan="2">67.0 1.5</td></tr> +<tr class="d0"><td colspan="2">68.0 1.5</td></tr> +<tr class="d1"><td colspan="2">69.0 1.5</td></tr> +<tr class="d0"><td colspan="2">70.0 1.5</td></tr> +<tr class="d1"><td colspan="2">71.0 1.5</td></tr> +<tr class="d0"><td colspan="2">72.0 1.5</td></tr> +<tr class="d1"><td colspan="2">73.0 1.5</td></tr> +<tr class="d0"><td colspan="2">74.0 1.5</td></tr> +<tr class="d1"><td colspan="2">75.0 1.5</td></tr> +<tr class="d0"><td colspan="2">76.0 1.5</td></tr> +<tr class="d1"><td colspan="2">77.0 1.5</td></tr> +<tr class="d0"><td colspan="2">78.0 1.5</td></tr> +<tr class="d1"><td colspan="2">79.0 1.5</td></tr> +<tr class="d0"><td colspan="2">80.0 1.5</td></tr> +<tr class="d1"><td colspan="2">81.0 1.5</td></tr> +<tr class="d0"><td colspan="2">82.0 1.5</td></tr> +<tr class="d1"><td colspan="2">83.0 1.5</td></tr> +<tr class="d0"><td colspan="2">84.0 1.5</td></tr> +<tr class="d1"><td colspan="2">85.0 1.5</td></tr> +<tr class="d0"><td colspan="2">86.0 1.5</td></tr> +<tr class="d1"><td colspan="2">87.0 1.5</td></tr> +<tr class="d0"><td colspan="2">88.0 1.5</td></tr> +<tr class="d1"><td colspan="2">89.0 1.5</td></tr> +<tr class="d0"><td colspan="2">90.0 1.5</td></tr> +<tr class="d1"><td colspan="2">91.0 1.5</td></tr> +<tr class="d0"><td colspan="2">92.0 1.5</td></tr> +<tr class="d1"><td colspan="2">93.0 1.5</td></tr> +<tr class="d0"><td colspan="2">94.0 1.5</td></tr> +<tr class="d1"><td colspan="2">95.0 1.5</td></tr> +<tr class="d0"><td colspan="2">96.0 1.5</td></tr> +<tr class="d1"><td colspan="2">97.0 1.5</td></tr> +<tr class="d0"><td colspan="2">98.0 1.5</td></tr> +<tr class="d1"><td colspan="2">99.0 1.5</td></tr></table> -<b>Picard log</b><hr/> -<pre>## executing java -Xmx2g -jar /udd/rerla/rgalaxy/tool-data/shared/jars/MarkDuplicates.jar I=/dev/shm/tmpk9pvdq/database/files/000/dataset_1.dat VALIDATION_STRINGENCY=LENIENT O=/dev/shm/tmpk9pvdq/database/files/000/dataset_2.dat READ_NAME_REGEX="[a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).*" ASSUME_SORTED=true M=/udd/rerla/rgalaxy/database/job_working_directory/2/dataset_3_files/rgPicardMarkDupsout.txt OPTICAL_DUPLICATE_PIXEL_DISTANCE=100 returned status 0 and log (stdout/stderr) records: -[Fri Apr 22 22:31:46 EDT 2011] net.sf.picard.sam.MarkDuplicates INPUT=/dev/shm/tmpk9pvdq/database/files/000/dataset_1.dat OUTPUT=/dev/shm/tmpk9pvdq/database/files/000/dataset_2.dat METRICS_FILE=/udd/rerla/rgalaxy/database/job_working_directory/2/dataset_3_files/rgPicardMarkDupsout.txt ASSUME_SORTED=true READ_NAME_REGEX=[a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).* OPTICAL_DUPLICATE_PIXEL_DISTANCE=100 VALIDATION_STRINGENCY=LENIENT REMOVE_DUPLICATES=false MAX_SEQUENCES_FOR_DISK_READ_ENDS_MAP=50000 MAX_FILE_HANDLES_FOR_READ_ENDS_MAP=8000 TMP_DIR=/tmp/rerla VERBOSITY=INFO QUIET=false COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false -INFO 2011-04-22 22:31:46 MarkDuplicates Start of doWork freeMemory: 8633664; totalMemory: 9109504; maxMemory: 1908932608 -INFO 2011-04-22 22:31:46 MarkDuplicates Reading input file and constructing read end information. -INFO 2011-04-22 22:31:46 MarkDuplicates Will retain up to 7575129 data points before spilling to disk. -INFO 2011-04-22 22:31:46 MarkDuplicates Read 7 records. 0 pairs never matched. -INFO 2011-04-22 22:31:46 MarkDuplicates After buildSortedReadEndLists freeMemory: 8197920; totalMemory: 130351104; maxMemory: 1908932608 -INFO 2011-04-22 22:31:46 MarkDuplicates Will retain up to 59654144 duplicate indices before spilling to disk. -INFO 2011-04-22 22:31:47 MarkDuplicates Traversing read pair information and detecting duplicates. -INFO 2011-04-22 22:31:47 MarkDuplicates Traversing fragment information and detecting duplicates. -INFO 2011-04-22 22:31:47 MarkDuplicates Sorting list of duplicate records. -INFO 2011-04-22 22:31:47 MarkDuplicates After generateDuplicateIndexes freeMemory: 129603512; totalMemory: 607649792; maxMemory: 1908932608 -INFO 2011-04-22 22:31:47 MarkDuplicates Marking 3 records as duplicates. -INFO 2011-04-22 22:31:47 MarkDuplicates Found 0 optical duplicate clusters. -INFO 2011-04-22 22:31:48 MarkDuplicates Before output close freeMemory: 129348680; totalMemory: 607649792; maxMemory: 1908932608 -INFO 2011-04-22 22:31:48 MarkDuplicates After output close freeMemory: 129348440; totalMemory: 607649792; maxMemory: 1908932608 -[Fri Apr 22 22:31:48 EDT 2011] net.sf.picard.sam.MarkDuplicates done. +<b>Picard Tool Run Log</b><hr/> +<pre>Thu, 12 May 2011 14:34:29 INFO + ## executing java -Xmx2g -jar /udd/rerla/galaxy-central/tool-data/shared/jars/MarkDuplicates.jar VALIDATION_STRINGENCY=LENIENT ASSUME_SORTED=true INPUT=/tmp/6729253.1.all.q/tmpM5wI_h/database/files/001/dataset_1097.dat OUTPUT=/tmp/6729253.1.all.q/tmpM5wI_h/database/files/001/dataset_1098.dat METRICS_FILE=/udd/rerla/galaxy-central/database/job_working_directory/1032/dataset_1099_files/MarkDuplicates.metrics.txt REMOVE_DUPLICATES=true READ_NAME_REGEX="[a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).*" OPTICAL_DUPLICATE_PIXEL_DISTANCE=100 returned status 0 and stderr: +[Thu May 12 14:34:28 EDT 2011] net.sf.picard.sam.MarkDuplicates INPUT=/tmp/6729253.1.all.q/tmpM5wI_h/database/files/001/dataset_1097.dat OUTPUT=/tmp/6729253.1.all.q/tmpM5wI_h/database/files/001/dataset_1098.dat METRICS_FILE=/udd/rerla/galaxy-central/database/job_working_directory/1032/dataset_1099_files/MarkDuplicates.metrics.txt REMOVE_DUPLICATES=true ASSUME_SORTED=true READ_NAME_REGEX=[a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).* OPTICAL_DUPLICATE_PIXEL_DISTANCE=100 VALIDATION_STRINGENCY=LENIENT MAX_SEQUENCES_FOR_DISK_READ_ENDS_MAP=50000 MAX_FILE_HANDLES_FOR_READ_ENDS_MAP=8000 TMP_DIR=/tmp/rerla VERBOSITY=INFO QUIET=false COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false +INFO 2011-05-12 14:34:28 MarkDuplicates Start of doWork freeMemory: 8644632; totalMemory: 9109504; maxMemory: 1908932608 +INFO 2011-05-12 14:34:28 MarkDuplicates Reading input file and constructing read end information. +INFO 2011-05-12 14:34:28 MarkDuplicates Will retain up to 7575129 data points before spilling to disk. +INFO 2011-05-12 14:34:28 MarkDuplicates Read 7 records. 0 pairs never matched. +INFO 2011-05-12 14:34:29 MarkDuplicates After buildSortedReadEndLists freeMemory: 8316168; totalMemory: 130351104; maxMemory: 1908932608 +INFO 2011-05-12 14:34:29 MarkDuplicates Will retain up to 59654144 duplicate indices before spilling to disk. +INFO 2011-05-12 14:34:29 MarkDuplicates Traversing read pair information and detecting duplicates. +INFO 2011-05-12 14:34:29 MarkDuplicates Traversing fragment information and detecting duplicates. +INFO 2011-05-12 14:34:29 MarkDuplicates Sorting list of duplicate records. +INFO 2011-05-12 14:34:29 MarkDuplicates After generateDuplicateIndexes freeMemory: 129615120; totalMemory: 607649792; maxMemory: 1908932608 +INFO 2011-05-12 14:34:29 MarkDuplicates Marking 3 records as duplicates. +INFO 2011-05-12 14:34:29 MarkDuplicates Found 0 optical duplicate clusters. +INFO 2011-05-12 14:34:29 MarkDuplicates Before output close freeMemory: 128997520; totalMemory: 607649792; maxMemory: 1908932608 +INFO 2011-05-12 14:34:29 MarkDuplicates After output close freeMemory: 128997280; totalMemory: 607649792; maxMemory: 1908932608 +[Thu May 12 14:34:29 EDT 2011] net.sf.picard.sam.MarkDuplicates done. Runtime.totalMemory()=607649792 </pre><hr/>The freely available <a href="http://picard.sourceforge.net/command-line-overview.shtml">Picard software</a> -generated all outputs reported here, using this command line:<br/> -<pre>java -Xmx2g -jar /udd/rerla/rgalaxy/tool-data/shared/jars/MarkDuplicates.jar I=/dev/shm/tmpk9pvdq/database/files/000/dataset_1.dat VALIDATION_STRINGENCY=LENIENT O=/dev/shm/tmpk9pvdq/database/files/000/dataset_2.dat READ_NAME_REGEX="[a-zA-Z0-9]+:[0-9]:([0-9]+):([0-9]+):([0-9]+).*" ASSUME_SORTED=true M=/udd/rerla/rgalaxy/database/job_working_directory/2/dataset_3_files/rgPicardMarkDupsout.txt OPTICAL_DUPLICATE_PIXEL_DISTANCE=100</pre> -</div></body></html> +generated all outputs reported here running as a <a href="http://getgalaxy.org">Galaxy</a> tool</div></body></html> http://bitbucket.org/galaxy/galaxy-central/changeset/e8531528b65c/ changeset: r5556:e8531528b65c user: fubar date: 2011-05-13 14:32:35 summary: branch merge affected #: 7 files (7.8 KB) --- a/lib/galaxy/tools/__init__.py Thu May 12 16:53:11 2011 -0400 +++ b/lib/galaxy/tools/__init__.py Fri May 13 08:32:35 2011 -0400 @@ -917,7 +917,7 @@ else: input.visit_inputs( "", value[input.name], callback ) - def handle_input( self, trans, incoming ): + def handle_input( self, trans, incoming, history=None ): """ Process incoming parameters for this tool from the dict `incoming`, update the tool state (or create if none existed), and either return @@ -966,7 +966,7 @@ return "tool_form.mako", dict( errors=errors, tool_state=state, incoming=incoming, error_message=error_message ) # If we've completed the last page we can execute the tool elif state.page == self.last_page: - _, out_data = self.execute( trans, incoming=params ) + _, out_data = self.execute( trans, incoming=params, history=history ) try: assert isinstance( out_data, odict ) return 'tool_executed.mako', dict( out_data=out_data ) --- a/lib/galaxy/visualization/tracks/data_providers.py Thu May 12 16:53:11 2011 -0400 +++ b/lib/galaxy/visualization/tracks/data_providers.py Fri May 13 08:32:35 2011 -0400 @@ -395,13 +395,22 @@ filter_col = 8 if isinstance( self.original_dataset.datatype, Gff ): # Can filter by score and GTF attributes. - filters = [ { 'name': 'Score', 'type': 'int', 'index': filter_col } ] + filters = [ { 'name': 'Score', + 'type': 'int', + 'index': filter_col, + 'tool_id': 'Filter1', + 'tool_exp_name': 'c5' } ] filter_col += 1 if isinstance( self.original_dataset.datatype, Gtf ): # Create filters based on dataset metadata. for name, a_type in self.original_dataset.metadata.attribute_types.items(): if a_type in [ 'int', 'float' ]: - filters.append( { 'name': name, 'type': a_type, 'index': filter_col } ) + filters.append( + { 'name': name, + 'type': a_type, + 'index': filter_col, + 'tool_id': 'gff_filter_by_attribute', + 'tool_exp_name': name } ) filter_col += 1 ''' @@ -426,7 +435,12 @@ ''' elif isinstance( self.original_dataset.datatype, Bed ): # Can filter by score column only. - filters = [ { 'name': 'Score', 'type': 'int', 'index': filter_col } ] + filters = [ { 'name': 'Score', + 'type': 'int', + 'index': filter_col, + 'tool_id': 'Filter1', + 'tool_exp_name': 'c5' + } ] return filters --- a/lib/galaxy/web/controllers/tracks.py Thu May 12 16:53:11 2011 -0400 +++ b/lib/galaxy/web/controllers/tracks.py Fri May 13 08:32:35 2011 -0400 @@ -26,7 +26,8 @@ NO_CONVERTER = "no converter", NO_TOOL = "no tool", DATA = "data", - ERROR = "error" + ERROR = "error", + OK = "ok" ) class NameColumn( grids.TextColumn ): @@ -643,13 +644,60 @@ @web.expose def list_tracks( self, trans, **kwargs ): return self.tracks_grid( trans, **kwargs ) + + @web.expose + def run_tool( self, trans, tool_id, target_dataset_id, **kwargs ): + """ + Run a tool. This method serves as a general purpose way to run tools asynchronously. + """ + + # + # Set target history (the history that tool will use for outputs) using + # target dataset. If user owns dataset, put new data in original + # dataset's history; if user does not own dataset (and hence is accessing + # dataset via sharing), put new data in user's current history. + # + target_dataset = self.get_dataset( trans, target_dataset_id, check_ownership=False, check_accessible=True ) + if target_dataset.history.user == trans.user: + target_history = target_dataset.history + else: + target_history = trans.get_history( create=True ) + + # HACK: tools require unencoded parameters but kwargs are typically + # encoded, so try decoding all parameter values. + for key, value in kwargs.items(): + try: + value = trans.security.decode_id( value ) + kwargs[ key ] = value + except: + pass + + # + # Execute tool. + # + tool = trans.app.toolbox.tools_by_id.get( tool_id, None ) + if not tool: + return messages.NO_TOOL + + # HACK: add run button so that tool.handle_input will run tool. + kwargs['runtool_btn'] = 'Execute' + params = util.Params( kwargs, sanitize = False ) + print target_history.name + template, vars = tool.handle_input( trans, params.__dict__, history=target_history ) + + # TODO: parse output and send response. + return messages.OK @web.expose - def run_tool( self, trans, dataset_id, tool_id, chrom=None, low=None, high=None, **kwargs ): - """ - Run a tool on a subset of input data to produce a new output dataset that - corresponds to a dataset that a user is currently viewing. + def rerun_tool( self, trans, dataset_id, tool_id, chrom=None, low=None, high=None, **kwargs ): """ + Rerun a tool to produce a new output dataset that corresponds to a + dataset that a user is currently viewing. + """ + + # + # TODO: refactor to use same code as run_tool. + # # Run tool on region if region is specificied. run_on_region = False --- a/static/scripts/packed/trackster.js Thu May 12 16:53:11 2011 -0400 +++ b/static/scripts/packed/trackster.js Fri May 13 08:32:35 2011 -0400 @@ -1,1 +1,1 @@ -var class_module=function(b,a){var c=function(){var f=arguments[0];for(var e=1;e<arguments.length;e++){var d=arguments[e];for(key in d){f[key]=d[key]}}return f};a.extend=c};var BEFORE=1001,CONTAINS=1002,OVERLAP_START=1003,OVERLAP_END=1004,CONTAINED_BY=1005,AFTER=1006;var compute_overlap=function(e,b){var g=e[0],f=e[1],d=b[0],c=b[1],a;if(g<d){if(f<d){a=BEFORE}else{if(f<=c){a=OVERLAP_START}else{a=CONTAINS}}}else{if(g>c){a=AFTER}else{if(f<=c){a=CONTAINED_BY}else{a=OVERLAP_END}}}return a};var is_overlap=function(c,b){var a=compute_overlap(c,b);return(a!==BEFORE&&a!==AFTER)};var trackster_module=function(f,S){var n=f("class").extend,p=f("slotting"),H=f("painters");var Y=function(Z,aa){this.document=Z;this.default_font=aa!==undefined?aa:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};n(Y.prototype,{load_pattern:function(Z,ad){var aa=this.patterns,ab=this.dummy_context,ac=new Image();ac.src=image_path+ad;ac.onload=function(){aa[Z]=ab.createPattern(ac,"repeat")}},get_pattern:function(Z){return this.patterns[Z]},new_canvas:function(){var Z=this.document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(Z)}Z.manager=this;return Z}});var B=function(Z,aa){Z.bind("drag",{handle:aa,relative:true},function(ae,af){var ad=$(this).parent();var ac=ad.children();var ab;for(ab=0;ab<ac.length;ab++){if(af.offsetY<$(ac.get(ab)).position().top){break}}if(ab===ac.length){if(this!==ac.get(ab-1)){ad.append(this)}}else{if(this!==ac.get(ab)){$(this).insertBefore(ac.get(ab))}}})};S.sortable=B;var C=9,z=10,N=C+2,w=100,E=12000,L=200,s=10,G=5000,t=100,m="There was an error in indexing this dataset. ",F="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",A="No data for this chrom/contig.",q="Currently indexing... please wait",v="Tool cannot be rerun: ",a="Loading data...",T="Ready for display",d=10,r=5,y=5;function u(Z){return Math.round(Z*1000)/1000}var c=function(Z){this.num_elements=Z;this.clear()};n(c.prototype,{get:function(aa){var Z=this.key_ary.indexOf(aa);if(Z!==-1){this.move_key_to_end(aa,Z)}return this.obj_cache[aa]},set:function(aa,ab){if(!this.obj_cache[aa]){if(this.key_ary.length>=this.num_elements){var Z=this.key_ary.shift();delete this.obj_cache[Z]}this.key_ary.push(aa)}this.obj_cache[aa]=ab;return ab},move_key_to_end:function(aa,Z){this.key_ary.splice(Z,1);this.key_ary.push(aa)},clear:function(){this.obj_cache={};this.key_ary=[]},size:function(){return this.key_ary.length}});var M=function(aa,Z,ab){c.call(this,aa);this.track=Z;this.subset=(ab!==undefined?ab:true)};n(M.prototype,c.prototype,{load_data:function(ah,ai,ad,ag,aa,af){var ac={chrom:ah,low:ai,high:ad,mode:ag,resolution:aa,dataset_id:this.track.dataset_id,hda_ldda:this.track.hda_ldda};$.extend(ac,af);if(this.track.filters_manager){var aj=[];var Z=this.track.filters_manager.filters;for(var ae=0;ae<Z.length;ae++){aj[aj.length]=Z[ae].name}ac.filter_cols=JSON.stringify(aj)}var ab=this;return $.getJSON(this.track.data_url,ac,function(ak){ab.set_data(ai,ad,ag,ak)})},get_data:function(ab,Z,ae,af,aa,ad){var ac=this.get(this.gen_key(Z,ae,af));if(ac){return ac}ac=this.load_data(ab,Z,ae,af,aa,ad);this.set_data(Z,ae,af,ac);return ac},set_data:function(aa,ab,ac,Z){return this.set(this.gen_key(aa,ab,ac),Z)},gen_key:function(Z,ab,ac){var aa=Z+"_"+ab+"_"+ac;return aa},split_key:function(Z){return Z.split("_")}});var D=function(aa,Z,ab){M.call(this,aa,Z,ab)};n(D.prototype,M.prototype,c.prototype,{load_data:function(ab,Z,ad,ae,aa,ac){if(aa>1){return}return M.prototype.load_data.call(this,ab,Z,ad,ae,aa,ac)}});var X=function(Z,ac,ab,aa,ad){this.container=Z;this.chrom=null;this.vis_id=ab;this.dbkey=aa;this.title=ac;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init(ad);this.canvas_manager=new Y(Z.get(0).ownerDocument);this.reset()};n(X.prototype,{init:function(ac){var ab=this.container,Z=this;this.top_container=$("<div/>").addClass("top-container").appendTo(ab);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(ab);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(ab);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var aa=function(ad){if(ad.type==="focusout"||(ad.keyCode||ad.which)===13||(ad.keyCode||ad.which)===27){if((ad.keyCode||ad.which)!==27){Z.go_to($(this).val())}$(this).hide();$(this).val("");Z.location_span.show();Z.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",aa).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").appendTo(this.nav_controls);this.location_span.bind("click",function(){Z.location_span.hide();Z.chrom_select.hide();Z.nav_input.val(Z.chrom+":"+Z.low+"-"+Z.high);Z.nav_input.css("display","inline-block");Z.nav_input.select();Z.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a id='zoom-out' />").click(function(){Z.zoom_out();Z.redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a id='zoom-in' />").click(function(){Z.zoom_in();Z.redraw()}).appendTo(this.nav_controls);this.load_chroms({low:0},ac);this.chrom_select.bind("change",function(){Z.change_chrom(Z.chrom_select.val())});this.intro_div.show();this.content_div.bind("click",function(ad){$(this).find("input").trigger("blur")});this.content_div.bind("dblclick",function(ad){Z.zoom_in(ad.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ad,ae){this.current_x=ae.offsetX}).bind("drag",function(ad,af){var ag=af.offsetX-this.current_x;this.current_x=af.offsetX;var ae=Math.round(ag/Z.viewport_container.width()*(Z.max_high-Z.max_low));Z.move_delta(-ae)});this.overview_close.bind("click",function(){for(var ae=0,ad=Z.tracks.length;ae<ad;ae++){Z.tracks[ae].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",Z.overview_box.height());Z.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("draginit",function(ad,ae){if(ad.clientX>Z.viewport_container.width()-16){return false}}).bind("dragstart",function(ad,ae){ae.original_low=Z.low;ae.current_height=ad.clientY;ae.current_x=ae.offsetX}).bind("drag",function(af,ah){var ad=$(this);var ai=ah.offsetX-ah.current_x;var ae=ad.scrollTop()-(af.clientY-ah.current_height);ad.scrollTop(ae);ah.current_height=af.clientY;ah.current_x=ah.offsetX;var ag=Math.round(ai/Z.viewport_container.width()*(Z.high-Z.low));Z.move_delta(ag)}).bind("mousewheel",function(af,ah,ae,ad){if(ae){var ag=Math.round(-ae/Z.viewport_container.width()*(Z.high-Z.low));Z.move_delta(ag)}});this.top_labeltrack.bind("dragstart",function(ad,ae){return $("<div />").css({height:Z.content_div.height()+Z.top_labeltrack.height()+Z.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(ah,ai){$(ai.proxy).css({left:Math.min(ah.pageX,ai.startX),width:Math.abs(ah.pageX-ai.startX)});var ae=Math.min(ah.pageX,ai.startX)-Z.container.offset().left,ad=Math.max(ah.pageX,ai.startX)-Z.container.offset().left,ag=(Z.high-Z.low),af=Z.viewport_container.width();Z.update_location(Math.round(ae/af*ag)+Z.low,Math.round(ad/af*ag)+Z.low)}).bind("dragend",function(ai,aj){var ae=Math.min(ai.pageX,aj.startX),ad=Math.max(ai.pageX,aj.startX),ag=(Z.high-Z.low),af=Z.viewport_container.width(),ah=Z.low;Z.low=Math.round(ae/af*ag)+ah;Z.high=Math.round(ad/af*ag)+ah;$(aj.proxy).remove();Z.redraw()});this.add_label_track(new W(this,this.top_labeltrack));this.add_label_track(new W(this,this.nav_labeltrack));$(window).bind("resize",function(){Z.resize_window()});$(document).bind("redraw",function(){Z.redraw()});this.reset();$(window).trigger("resize")},update_location:function(Z,aa){this.location_span.text(commatize(Z)+" - "+commatize(aa));this.nav_input.val(this.chrom+":"+commatize(Z)+"-"+commatize(aa))},load_chroms:function(aa,ab){aa.num=t;$.extend(aa,(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}));var Z=this;$.ajax({url:chrom_url,data:aa,dataType:"json",success:function(ad){if(ad.chrom_info.length===0){alert("Invalid chromosome: "+aa.chrom);return}if(ad.reference){Z.add_label_track(new x(Z))}Z.chrom_data=ad.chrom_info;var ag='<option value="">Select Chrom/Contig</option>';for(var af=0,ac=Z.chrom_data.length;af<ac;af++){var ae=Z.chrom_data[af].chrom;ag+='<option value="'+ae+'">'+ae+"</option>"}if(ad.prev_chroms){ag+='<option value="previous">Previous '+t+"</option>"}if(ad.next_chroms){ag+='<option value="next">Next '+t+"</option>"}Z.chrom_select.html(ag);if(ab){ab()}Z.chrom_start_index=ad.start_index},error:function(){alert("Could not load chroms for this dbkey:",Z.dbkey)}})},change_chrom:function(ad,aa,af){if(!ad||ad==="None"){return}var ac=this;if(ad==="previous"){ac.load_chroms({low:this.chrom_start_index-t});return}if(ad==="next"){ac.load_chroms({low:this.chrom_start_index+t});return}var ae=$.grep(ac.chrom_data,function(ah,ai){return ah.chrom===ad})[0];if(ae===undefined){ac.load_chroms({chrom:ad},function(){ac.change_chrom(ad,aa,af)});return}else{if(ad!==ac.chrom){ac.chrom=ad;if(!ac.chrom){ac.intro_div.show()}else{ac.intro_div.hide()}ac.chrom_select.val(ac.chrom);ac.max_high=ae.len-1;ac.reset();ac.redraw(true);for(var ag=0,Z=ac.tracks.length;ag<Z;ag++){var ab=ac.tracks[ag];if(ab.init){ab.init()}}}if(aa!==undefined&&af!==undefined){ac.low=Math.max(aa,0);ac.high=Math.min(af,ac.max_high)}ac.reset_overview();ac.redraw()}},go_to:function(ad){var ah=this,Z,ac,aa=ad.split(":"),af=aa[0],ag=aa[1];if(ag!==undefined){try{var ae=ag.split("-");Z=parseInt(ae[0].replace(/,/g,""),10);ac=parseInt(ae[1].replace(/,/g,""),10)}catch(ab){return false}}ah.change_chrom(af,Z,ac)},move_fraction:function(ab){var Z=this;var aa=Z.high-Z.low;this.move_delta(ab*aa)},move_delta:function(ab){var Z=this;var aa=Z.high-Z.low;if(Z.low-ab<Z.max_low){Z.low=Z.max_low;Z.high=Z.max_low+aa}else{if(Z.high-ab>Z.max_high){Z.high=Z.max_high;Z.low=Z.max_high-aa}else{Z.high-=ab;Z.low-=ab}}Z.redraw()},add_track:function(Z){Z.view=this;Z.track_id=this.track_id_counter;this.tracks.push(Z);if(Z.init){Z.init()}Z.container_div.attr("id","track_"+Z.track_id);B(Z.container_div,".draghandle");this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(Z){Z.view=this;this.label_tracks.push(Z)},remove_track:function(Z){this.has_changes=true;Z.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(Z)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(ag){var af=this.high-this.low,ae=this.low,aa=this.high;if(ae<this.max_low){ae=this.max_low}if(aa>this.max_high){aa=this.max_high}if(this.high!==0&&af<this.min_separation){aa=ae+this.min_separation}this.low=Math.floor(ae);this.high=Math.ceil(aa);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/L)/Math.LN10));this.zoom_res=Math.pow(s,Math.max(0,Math.ceil(Math.log(this.resolution,s)/Math.log(s))));var Z=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ad=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ah=13;this.overview_box.css({left:Z,width:Math.max(ah,ad)}).show();if(ad<ah){this.overview_box.css("left",Z-(ah-ad)/2)}if(this.overview_highlight){this.overview_highlight.css({left:Z,width:ad})}this.update_location(this.low,this.high);if(!ag){for(var ab=0,ac=this.tracks.length;ab<ac;ab++){if(this.tracks[ab]&&this.tracks[ab].enabled){this.tracks[ab].draw()}}for(ab=0,ac=this.label_tracks.length;ab<ac;ab++){this.label_tracks[ab].draw()}}},zoom_in:function(aa,ab){if(this.max_high===0||this.high-this.low<this.min_separation){return}var ac=this.high-this.low,ad=ac/2+this.low,Z=(ac/this.zoom_factor)/2;if(aa){ad=aa/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ad-Z);this.high=Math.round(ad+Z);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var aa=this.high-this.low,ab=aa/2+this.low,Z=(aa*this.zoom_factor)/2;this.low=Math.round(ab-Z);this.high=Math.round(ab+Z);this.redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide()}});var o=function(ab,af){this.track=ab;this.name=af.name;this.params=[];var am=af.params;for(var ac=0;ac<am.length;ac++){var ah=am[ac],aa=ah.name,al=ah.label,ad=unescape(ah.html),an=ah.value,aj=ah.type;if(aj==="number"){this.params[this.params.length]=new g(aa,al,ad,an,ah.min,ah.max)}else{if(aj=="select"){this.params[this.params.length]=new J(aa,al,ad,an)}else{console.log("WARNING: unrecognized tool parameter type:",aa,aj)}}}this.parent_div=$("<div/>").addClass("dynamic-tool").hide();this.parent_div.bind("drag",function(ap){ap.stopPropagation()}).bind("click",function(ap){ap.stopPropagation()}).bind("dblclick",function(ap){ap.stopPropagation()});var ak=$("<div class='tool-name'>").appendTo(this.parent_div).text(this.name);var ai=this.params;var ag=this;$.each(this.params,function(aq,au){var at=$("<div>").addClass("param-row").appendTo(ag.parent_div);var ap=$("<div>").addClass("param-label").text(au.label).appendTo(at);var ar=$("<div/>").addClass("slider").html(au.html).appendTo(at);ar.find(":input").val(au.value);$("<div style='clear: both;'/>").appendTo(at)});this.parent_div.find("input").click(function(){$(this).select()});var ao=$("<div>").addClass("param-row").appendTo(this.parent_div);var ae=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(ao);var Z=$("<input type='submit'>").attr("value","Run on visible region").css("margin-left","3em").appendTo(ao);var ag=this;Z.click(function(){ag.run_on_region()});ae.click(function(){ag.run_on_dataset()})};n(o.prototype,{get_param_values_dict:function(){var Z={};this.parent_div.find(":input").each(function(){var aa=$(this).attr("name"),ab=$(this).val();Z[aa]=JSON.stringify(ab)});return Z},get_param_values:function(){var aa=[];var Z={};this.parent_div.find(":input").each(function(){var ab=$(this).attr("name"),ac=$(this).val();if(ab){aa[aa.length]=ac}});return aa},run_on_dataset:function(){var Z=this;Z.run({dataset_id:this.track.original_dataset_id,tool_id:Z.name},function(aa){show_modal(Z.name+" is Running",Z.name+" is running on the complete dataset. Tool outputs are in dataset's history.",{Close:hide_modal})})},run_on_region:function(){var Z={dataset_id:this.track.original_dataset_id,chrom:this.track.view.chrom,low:this.track.view.low,high:this.track.view.high,tool_id:this.name},ab=this.track,aa=Z.tool_id+ab.tool_region_and_parameters_str(Z.chrom,Z.low,Z.high),ac;if(ab.track_type==="FeatureTrack"){ac=new P(aa,view,ab.hda_ldda,undefined,{},{},ab)}this.track.add_track(ac);ac.content_div.text("Starting job.");this.run(Z,function(ad){ac.dataset_id=ad.dataset_id;ac.content_div.text("Running job.");ac.init()})},run:function(aa,ab){$.extend(aa,this.get_param_values_dict());var Z=function(){$.getJSON(run_tool_url,aa,function(ac){if(ac==="no converter"){new_track.container_div.addClass("error");new_track.content_div.text(F)}else{if(ac.error){new_track.container_div.addClass("error");new_track.content_div.text(v+ac.message)}else{if(ac==="pending"){new_track.container_div.addClass("pending");new_track.content_div.text("Converting input data so that it can be easily reused.");setTimeout(Z,2000)}else{ab(ac)}}}})};Z()}});var J=function(aa,Z,ab,ac){this.name=aa;this.label=Z;this.html=ab;this.value=ac};var g=function(ab,aa,ad,ae,ac,Z){J.call(this,ab,aa,ad,ae);this.min=ac;this.max=Z};var h=function(aa,Z,ab){this.name=aa;this.index=Z;this.value=ab};var Q=function(aa,Z){this.name=aa;this.index=Z;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.min=Number.MAX_VALUE;this.max=-Number.MAX_VALUE;this.slider=null;this.slider_label=null};n(Q.prototype,{applies_to:function(Z){if(Z.length>this.index){return true}return false},keep:function(Z){if(!this.applies_to(Z)){return true}var aa=parseInt(Z[this.index]);return(isNaN(aa)||(aa>=this.low&&aa<=this.high))},update_attrs:function(aa){var Z=false;if(!this.applies_to(aa)){return Z}if(aa[this.index]<this.min){this.min=Math.floor(aa[this.index]);Z=true}if(aa[this.index]>this.max){this.max=Math.ceil(aa[this.index]);Z=true}return Z},update_ui_elt:function(){var ab=function(ae,ac){var ad=ac-ae;return(ad<=2?0.01:1)};var aa=this.slider.slider("option","min"),Z=this.slider.slider("option","max");if(this.min<aa||this.max>Z){this.slider.slider("option","min",this.min);this.slider.slider("option","max",this.max);this.slider.slider("option","step",ab(this.min,this.max));this.slider.slider("option","values",[this.min,this.max])}}});var V=function(ab,ah){this.track=ab;this.filters=[];for(var ad=0;ad<ah.length;ad++){var Z=ah[ad];var aa=Z.name,ag=Z.type,ae=Z.index;if(ag==="int"||ag==="float"){this.filters[ad]=new Q(aa,ae)}else{this.filters[ad]=new h(aa,ae,ag)}}var af=function(ai,aj,ak){ai.click(function(){var al=aj.text();max=parseFloat(ak.slider("option","max")),input_size=(max<=1?4:max<=1000000?max.toString().length:6),multi_value=false;if(ak.slider("option","values")){input_size=2*input_size+1;multi_value=true}aj.text("");$("<input type='text'/>").attr("size",input_size).attr("maxlength",input_size).attr("value",al).appendTo(aj).focus().select().click(function(am){am.stopPropagation()}).blur(function(){$(this).remove();aj.text(al)}).keyup(function(aq){if(aq.keyCode===27){$(this).trigger("blur")}else{if(aq.keyCode===13){var ao=ak.slider("option","min"),am=ak.slider("option","max"),ap=function(ar){return(isNaN(ar)||ar>am||ar<ao)},an=$(this).val();if(!multi_value){an=parseFloat(an);if(ap(an)){alert("Parameter value must be in the range ["+ao+"-"+am+"]");return $(this)}}else{an=an.split("-");an=[parseFloat(an[0]),parseFloat(an[1])];if(ap(an[0])||ap(an[1])){alert("Parameter value must be in the range ["+ao+"-"+am+"]");return $(this)}}ak.slider((multi_value?"values":"value"),an)}}})})};this.parent_div=$("<div/>").addClass("filters").hide();this.parent_div.bind("drag",function(ai){ai.stopPropagation()}).bind("click",function(ai){ai.stopPropagation()}).bind("dblclick",function(ai){ai.stopPropagation()}).bind("keydown",function(ai){ai.stopPropagation()});var ac=this;$.each(this.filters,function(ao,aj){var al=$("<div/>").addClass("slider-row").appendTo(ac.parent_div);var ai=$("<div/>").addClass("slider-label").appendTo(al);var aq=$("<span/>").addClass("slider-name").text(aj.name+" ").appendTo(ai);var ak=$("<span/>");var am=$("<span/>").addClass("slider-value").appendTo(ai).append("[").append(ak).append("]");var ap=$("<div/>").addClass("slider").appendTo(al);aj.control_element=$("<div/>").attr("id",aj.name+"-filter-control").appendTo(ap);var an=[0,0];aj.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(ar,at){an=at.values;ak.text(at.values[0]+"-"+at.values[1]);setTimeout(function(){if(at.values[0]==an[0]&&at.values[1]==an[1]){var au=at.values;ak.text(au[0]+"-"+au[1]);aj.low=au[0];aj.high=au[1];ac.track.draw(true,true)}},50)},change:function(ar,at){aj.control_element.slider("option","slide").call(aj.control_element,ar,at)}});aj.slider=aj.control_element;aj.slider_label=ak;af(am,ak,aj.control_element);$("<div style='clear: both;'/>").appendTo(al)})};var U=function(Z){this.track=Z.track;this.params=Z.params;this.values={};if(Z.saved_values){this.restore_values(Z.saved_values)}this.onchange=Z.onchange};n(U.prototype,{restore_values:function(Z){var aa=this;$.each(this.params,function(ab,ac){if(Z[ac.key]!==undefined){aa.values[ac.key]=Z[ac.key]}else{aa.values[ac.key]=ac.default_value}})},build_form:function(){var aa=this;var Z=$("<div />");$.each(this.params,function(ae,ac){if(!ac.hidden){var ab="param_"+ae;var aj=$("<div class='form-row' />").appendTo(Z);aj.append($("<label />").attr("for",ab).text(ac.label+":"));if(ac.type==="bool"){aj.append($('<input type="checkbox" />').attr("id",ab).attr("name",ab).attr("checked",aa.values[ac.key]))}else{if(ac.type==="color"){var ag=aa.values[ac.key];var af=$("<input />").attr("id",ab).attr("name",ab).val(ag);var ah=$("<div class='tipsy tipsy-north' style='position: absolute;' />").hide();var ad=$("<div style='background-color: black; padding: 10px;'></div>").appendTo(ah);var ai=$("<div/>").appendTo(ad).farbtastic({width:100,height:100,callback:af,color:ag});$("<div />").append(af).append(ah).appendTo(aj).bind("click",function(ak){ah.css({left:$(this).position().left+($(af).width()/2)-60,top:$(this).position().top+$(this.height)}).show();$(document).bind("click.color-picker",function(){ah.hide();$(document).unbind("click.color-picker")});ak.stopPropagation()})}else{aj.append($("<input />").attr("id",ab).attr("name",ab).val(aa.values[ac.key]))}}}});return Z},update_from_form:function(Z){var ab=this;var aa=false;$.each(this.params,function(ac,ae){if(!ae.hidden){var af="param_"+ac;var ad=Z.find("#"+af).val();if(ae.type==="float"){ad=parseFloat(ad)}else{if(ae.type==="int"){ad=parseInt(ad)}else{if(ae.type==="bool"){ad=Z.find("#"+af).is(":checked")}}}if(ad!==ab.values[ae.key]){ab.values[ae.key]=ad;aa=true}}});if(aa){this.onchange()}}});var b=function(ab,aa,Z){this.index=ab;this.resolution=aa;this.canvas=$("<div class='track-tile'/>").append(Z)};var l=function(ab,aa,Z,ac){b.call(this,ab,aa,Z);this.max_val=ac};var K=function(ab,aa,Z){b.call(this,ab,aa,Z)};var j=function(aa,Z,ad,ab,ac){this.name=aa;this.view=Z;this.parent_element=ad;this.data_url=(ab?ab:default_data_url);this.data_url_extra_params={};this.data_query_wait=(ac?ac:G);this.dataset_check_url=converted_datasets_state_url;this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)};n(j.prototype,{init:function(){var Z=this;Z.enabled=false;Z.tile_cache.clear();Z.data_cache.clear();Z.initial_canvas=undefined;Z.content_div.css("height","auto");Z.container_div.removeClass("nodata error pending");if(!Z.dataset_id){return}$.getJSON(converted_datasets_state_url,{hda_ldda:Z.hda_ldda,dataset_id:Z.dataset_id,chrom:Z.view.chrom},function(aa){if(!aa||aa==="error"||aa.kind==="error"){Z.container_div.addClass("error");Z.content_div.text(m);if(aa.message){var ac=Z.view.tracks.indexOf(Z);var ab=$(" <a href='javascript:void(0);'></a>").text("View error").bind("click",function(){show_modal("Trackster Error","<pre>"+aa.message+"</pre>",{Close:hide_modal})});Z.content_div.append(ab)}}else{if(aa==="no converter"){Z.container_div.addClass("error");Z.content_div.text(F)}else{if(aa==="no data"||(aa.data!==undefined&&(aa.data===null||aa.data.length===0))){Z.container_div.addClass("nodata");Z.content_div.text(A)}else{if(aa==="pending"){Z.container_div.addClass("pending");Z.content_div.text(q);setTimeout(function(){Z.init()},Z.data_query_wait)}else{if(aa.status==="data"){if(aa.valid_chroms){Z.valid_chroms=aa.valid_chroms;Z.make_name_popup_menu()}Z.content_div.text(T);if(Z.view.chrom){Z.content_div.text("");Z.content_div.css("height",Z.height_px+"px");Z.enabled=true;$.when(Z.predraw_init()).done(function(){Z.container_div.removeClass("nodata error pending");Z.draw()})}}}}}}})},predraw_init:function(){},update_name:function(Z){this.old_name=this.name;this.name=Z;this.name_div.text(this.name)},revert_name:function(){this.name=this.old_name;this.name_div.text(this.name)}});var I=function(ah,af,ai){var aa=this,aj=aa.view;this.filters_manager=(ah!==undefined?new V(this,ah):undefined);this.filters_available=false;this.filters_visible=false;this.tool=(af!==undefined&&obj_length(af)>0?new o(this,af):undefined);this.parent_track=ai;this.child_tracks=[];if(aa.hidden){return}if(this.parent_track){this.header_div.find(".draghandle").removeClass("draghandle").addClass("child-track-icon").addClass("icon-button");this.parent_element.addClass("child-track");this.tool=undefined}aa.child_tracks_container=$("<div/>").addClass("child-tracks-container").hide();aa.container_div.append(aa.child_tracks_container);if(this.filters_manager){this.filters_div=this.filters_manager.parent_div;this.header_div.after(this.filters_div)}if(this.tool){this.dynamic_tool_div=this.tool.parent_div;this.header_div.after(this.dynamic_tool_div)}if(aa.display_modes!==undefined){if(aa.mode_div===undefined){aa.mode_div=$("<div class='right-float menubutton popup' />").appendTo(aa.header_div);var ac=(aa.track_config&&aa.track_config.values.mode?aa.track_config.values.mode:aa.display_modes[0]);aa.mode=ac;aa.mode_div.text(ac);var ab=function(ak){aa.mode_div.text(ak);aa.mode=ak;aa.track_config.values.mode=ak;aa.tile_cache.clear();aa.draw()};var Z={};for(var ad=0,ag=aa.display_modes.length;ad<ag;ad++){var ae=aa.display_modes[ad];Z[ae]=function(ak){return function(){ab(ak)}}(ae)}make_popupmenu(aa.mode_div,Z)}else{aa.mode_div.hide()}}this.make_name_popup_menu()};n(I.prototype,j.prototype,{make_name_popup_menu:function(){var aa=this;var Z={};Z["Edit configuration"]=function(){var ag=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ae=function(){aa.track_config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},af=function(ah){if((ah.keyCode||ah.which)===27){ag()}else{if((ah.keyCode||ah.which)===13){ae()}}};$(window).bind("keypress.check_enter_esc",af);show_modal("Configure Track",aa.track_config.build_form(),{Cancel:ag,OK:ae})};if(aa.filters_available>0){var ad=(aa.filters_div.is(":visible")?"Hide filters":"Show filters");Z[ad]=function(){aa.filters_visible=(aa.filters_div.is(":visible"));aa.filters_div.toggle();aa.make_name_popup_menu()}}if(aa.tool){var ad=(aa.dynamic_tool_div.is(":visible")?"Hide tool":"Show tool");Z[ad]=function(){if(!aa.dynamic_tool_div.is(":visible")){aa.update_name(aa.name+aa.tool_region_and_parameters_str())}else{menu_option_text="Show dynamic tool";aa.revert_name()}aa.dynamic_tool_div.toggle();aa.make_name_popup_menu()}}if(aa.valid_chroms){Z["List chrom/contigs with data"]=function(){show_modal("Chrom/contigs with data","<p>"+aa.valid_chroms.join("<br/>")+"</p>",{Close:function(){hide_modal()}})}}var ab=view;var ac=function(){$("#no-tracks").show()};if(this.parent_track){ab=this.parent_track;ac=function(){}}Z.Remove=function(){ab.remove_track(aa);if(ab.num_tracks===0){ac()}};make_popupmenu(aa.name_div,Z)},draw:function(Z,ab){var at=this.view.low,af=this.view.high,ah=af-at,aj=this.view.container.width(),ad=aj/ah,ak=this.view.resolution,ac=$("<div style='position: relative;'></div>"),al=function(av,aw,au){return av+"_"+aw+"_"+au};if(!ab){this.content_div.children().remove()}this.content_div.append(ac);this.max_height=0;var an=Math.floor(at/ak/L);var ae=[];var ao=0;while((an*L*ak)<af){var ar=al(aj,ad,an);var ag=this.tile_cache.get(ar);var ap=an*L*this.view.resolution;var aa=ap+L*this.view.resolution;if(!Z&&ag){ae[ae.length]=ag;this.show_tile(ag,ac,ap,ad)}else{this.delayed_draw(Z,ar,an,ak,ac,ad,ae)}an+=1;ao++}var ai=this;var aq=setInterval(function(){if(ae.length===ao){clearInterval(aq);if(ab){var ax=ai.content_div.children();var ay=false;for(var aw=ax.length-1,aC=0;aw>=aC;aw--){var av=$(ax[aw]);if(ay){av.remove()}else{if(av.children().length!==0){ay=true}}}}if(ai.track_type=="FeatureTrack"&&ai.mode=="Histogram"){var aB=-1;for(var aw=0;aw<ae.length;aw++){var aE=ae[aw].max_val;if(aE>aB){aB=aE}}for(var aw=0;aw<ae.length;aw++){if(ae[aw].max_val!==aB){var aD=ae[aw];aD.canvas.remove();ai.delayed_draw(true,al(aj,ad,aD.index),aD.index,aD.resolution,ac,ad,[],{max:aB})}}}if(ai.filters_manager){var au=ai.filters_manager.filters;for(var aA=0;aA<au.length;aA++){au[aA].update_ui_elt()}var az=false;if(ai.example_feature){for(var aA=0;aA<au.length;aA++){if(au[aA].applies_to(ai.example_feature)){az=true;break}}}if(ai.filters_available!==az){ai.filters_available=az;if(!ai.filters_available){ai.filters_div.hide()}ai.make_name_popup_menu()}}}},50);for(var am=0;am<this.child_tracks.length;am++){this.child_tracks[am].draw(Z,ab)}},delayed_draw:function(aa,ah,ab,ad,ai,al,aj,ae){var ac=this,af=ab*L*ad,ak=af+L*ad;var ag=function(au,am,ao,an,ar,at,ap){var aq=ac.draw_tile(am,ao,an,at,ap);ac.tile_cache.set(ah,aq);if(aq===undefined){return}ac.show_tile(aq,ar,af,at);aj[aj.length]=aq};var Z=setTimeout(function(){if(af<=ac.view.high&&ak>=ac.view.low){var am=(aa?undefined:ac.tile_cache.get(ah));if(am){ac.show_tile(am,ai,af,al);aj[aj.length]=am}else{$.when(ac.data_cache.get_data(view.chrom,af,ak,ac.mode,ad,ac.data_url_extra_params)).then(function(an){n(an,ae);if(view.reference_track&&al>view.canvas_manager.char_width_px){$.when(view.reference_track.data_cache.get_data(view.chrom,af,ak,ac.mode,ad,view.reference_track.data_url_extra_params)).then(function(ao){ag(Z,an,ad,ab,ai,al,ao)})}else{ag(Z,an,ad,ab,ai,al)}})}}},50)},show_tile:function(ac,af,ad,ag){var aa=this;var ab=this.view.high-this.view.low,ae=(ad-this.view.low)*ag;if(this.left_offset){ae-=this.left_offset}var Z=ac.canvas;Z.css({position:"absolute",top:0,left:ae,height:""});af.append(Z);aa.max_height=Math.max(aa.max_height,Z.height());aa.content_div.css("height",aa.max_height+"px");af.children().css("height",aa.max_height+"px")},set_overview:function(){var Z=this.view;if(this.initial_canvas&&this.is_overview){Z.overview_close.show();Z.overview_viewport.append(this.initial_canvas);Z.overview_highlight.show().height(this.initial_canvas.height());Z.overview_viewport.height(this.initial_canvas.height()+Z.overview_box.height())}$(window).trigger("resize")},tool_region_and_parameters_str:function(ab,Z,ac){var aa=this,ad=(ab!==undefined&&Z!==undefined&&ac!==undefined?ab+":"+Z+"-"+ac:"all");return" - region=["+ad+"], parameters=["+aa.tool.get_param_values().join(", ")+"]"},add_track:function(Z){Z.track_id=this.track_id+"_"+this.child_tracks.length;Z.container_div.attr("id","track_"+Z.track_id);this.child_tracks_container.append(Z.container_div);B(Z.container_div,".child-track-icon");if(!$(this.child_tracks_container).is(":visible")){this.child_tracks_container.show()}this.child_tracks.push(Z);this.view.has_changes=true},remove_track:function(Z){Z.container_div.fadeOut("slow",function(){$(this).remove()})}});var W=function(Z,aa){this.track_type="LabelTrack";this.hidden=true;j.call(this,null,Z,aa);this.container_div.addClass("label-track")};n(W.prototype,j.prototype,{draw:function(){var ab=this.view,ac=ab.high-ab.low,af=Math.floor(Math.pow(10,Math.floor(Math.log(ac)/Math.log(10)))),Z=Math.floor(ab.low/af)*af,ad=this.view.container.width(),aa=$("<div style='position: relative; height: 1.3em;'></div>");while(Z<ab.high){var ae=(Z-ab.low)/ac*ad;aa.append($("<div class='label'>"+commatize(Z)+"</div>").css({position:"absolute",left:ae-1}));Z+=af}this.content_div.children(":first").remove();this.content_div.append(aa)}});var x=function(Z){this.track_type="ReferenceTrack";this.hidden=true;j.call(this,null,Z,Z.top_labeltrack);I.call(this);Z.reference_track=this;this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_url=reference_url;this.data_url_extra_params={dbkey:Z.dbkey};this.data_cache=new D(y,this,false);this.tile_cache=new c(r)};n(x.prototype,I.prototype,{draw_tile:function(ah,ae,aa,aj){var ad=this,ab=L*ae;if(aj>this.view.canvas_manager.char_width_px){if(ah===null){ad.content_div.css("height","0px");return}var ac=this.view.canvas_manager.new_canvas();var ai=ac.getContext("2d");ac.width=Math.ceil(ab*aj+ad.left_offset);ac.height=ad.height_px;ai.font=ai.canvas.manager.default_font;ai.textAlign="center";for(var af=0,ag=ah.length;af<ag;af++){var Z=Math.round(af*aj);ai.fillText(ah[af],Z+ad.left_offset,10)}return new b(aa,ae,ac)}this.content_div.css("height","0px")}});var k=function(ad,ab,ae,Z,ac){var aa=this;this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";j.call(this,ad,ab,ab.viewport_container);I.call(this);this.min_height_px=16;this.max_height_px=400;this.height_px=80;this.hda_ldda=ae;this.dataset_id=Z;this.original_dataset_id=Z;this.data_cache=new M(y,this);this.tile_cache=new c(r);this.track_config=new U({track:this,params:[{key:"color",label:"Color",type:"color",default_value:"black"},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.height_px,hidden:true}],saved_values:ac,onchange:function(){aa.vertical_range=aa.prefs.max_value-aa.prefs.min_value;$("#linetrack_"+aa.track_id+"_minval").text(aa.prefs.min_value);$("#linetrack_"+aa.track_id+"_maxval").text(aa.prefs.max_value);aa.tile_cache.clear();aa.draw()}});this.prefs=this.track_config.values;this.height_px=this.track_config.values.height;this.vertical_range=this.track_config.values.max_value-this.track_config.values.min_value;this.add_resize_handle()};n(k.prototype,I.prototype,{add_resize_handle:function(){var Z=this;var ac=false;var ab=false;var aa=$("<div class='track-resize'>");$(Z.container_div).hover(function(){ac=true;aa.show()},function(){ac=false;if(!ab){aa.hide()}});aa.hide().bind("dragstart",function(ad,ae){ab=true;ae.original_height=$(Z.content_div).height()}).bind("drag",function(ae,af){var ad=Math.min(Math.max(af.original_height+af.deltaY,Z.min_height_px),Z.max_height_px);$(Z.content_div).css("height",ad);Z.height_px=ad;Z.draw(true)}).bind("dragend",function(ad,ae){Z.tile_cache.clear();ab=false;if(!ac){aa.hide()}Z.track_config.values.height=Z.height_px}).appendTo(Z.container_div)},predraw_init:function(){var Z=this,aa=Z.view.tracks.indexOf(Z);Z.vertical_range=undefined;return $.getJSON(Z.data_url,{stats:true,chrom:Z.view.chrom,low:null,high:null,hda_ldda:Z.hda_ldda,dataset_id:Z.dataset_id},function(ab){Z.container_div.addClass("line-track");var ad=ab.data;if(isNaN(parseFloat(Z.prefs.min_value))||isNaN(parseFloat(Z.prefs.max_value))){Z.prefs.min_value=ad.min;Z.prefs.max_value=ad.max;$("#track_"+aa+"_minval").val(Z.prefs.min_value);$("#track_"+aa+"_maxval").val(Z.prefs.max_value)}Z.vertical_range=Z.prefs.max_value-Z.prefs.min_value;Z.total_frequency=ad.total_frequency;Z.container_div.find(".yaxislabel").remove();var ae=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+aa+"_minval").text(u(Z.prefs.min_value));var ac=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+aa+"_maxval").text(u(Z.prefs.max_value));ac.css({position:"absolute",top:"24px",left:"10px"});ac.prependTo(Z.container_div);ae.css({position:"absolute",bottom:"2px",left:"10px"});ae.prependTo(Z.container_div)})},draw_tile:function(aj,ad,aa,ai){if(this.vertical_range===undefined){return}var ae=aa*L*ad,ac=L*ad,Z=Math.ceil(ac*ai),ag=this.height_px;var ab=this.view.canvas_manager.new_canvas();ab.width=Z,ab.height=ag;var ah=ab.getContext("2d");var af=new H.LinePainter(aj.data,ae,ae+ac,this.prefs,this.mode);af.draw(ah,Z,ag);return new b(ac,ad,ab)}});var e=function(Z,ae,ad,ah,ag,ab,ac,af){var aa=this;this.track_type="FeatureTrack";this.display_modes=["Auto","Histogram","Dense","Squish","Pack"];this.track_config=new U({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},],saved_values:ag,onchange:function(){aa.tile_cache.clear();aa.draw()}});this.prefs=this.track_config.values;j.call(this,Z,ae,ae.viewport_container);I.call(this,ab,ac,af);this.height_px=0;this.container_div.addClass("feature-track");this.hda_ldda=ad;this.dataset_id=ah;this.original_dataset_id=ah;this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.inc_slots={};this.start_end_dct={};this.tile_cache=new c(d);this.data_cache=new M(20,this);this.left_offset=200;this.painter=H.LinkedFeaturePainter};n(e.prototype,I.prototype,{update_auto_mode:function(Z){if(this.mode=="Auto"){if(Z=="no_detail"){Z="feature spans"}else{if(Z=="summary_tree"){Z="coverage histogram"}}this.mode_div.text("Auto ("+Z+")")}},incremental_slots:function(ad,aa,ac){var ab=this.view.canvas_manager.dummy_context,Z=this.inc_slots[ad];if(!Z||(Z.mode!==ac)){Z=new (p.FeatureSlotter)(ad,ac==="Pack",w,function(ae){return ab.measureText(ae)});Z.mode=ac;this.inc_slots[ad]=Z}return Z.slot_features(aa)},get_summary_tree_data:function(ad,ag,ab,ao){if(ao>ab-ag){ao=ab-ag}var ak=Math.floor((ab-ag)/ao),an=[],ac=0;var ae=0,af=0,aj,am=0,ah=[],al,ai;var aa=function(ar,aq,at,ap){ar[0]=aq+at*ap;ar[1]=aq+(at+1)*ap};while(am<ao&&ae!==ad.length){var Z=false;for(;am<ao&&!Z;am++){aa(ah,ag,am,ak);for(af=ae;af<ad.length;af++){aj=ad[af].slice(1,3);if(is_overlap(aj,ah)){Z=true;break}}if(Z){break}}data_start_index=af;an[an.length]=al=[ah[0],0];for(;af<ad.length;af++){aj=ad[af].slice(1,3);if(is_overlap(aj,ah)){al[1]++}else{break}}if(al[1]>ac){ac=al[1]}am++}return{max:ac,delta:ak,data:an}},draw_tile:function(am,av,az,ai,ac){var ar=this,aB=az*L*av,aa=(az+1)*L*av,ao=aa-aB,at=Math.ceil(ao*ai),aq=this.mode,aF=25,ad=this.left_offset,an,ae;if(aq==="Auto"){if(am.dataset_type==="summary_tree"){aq=am.dataset_type}else{if(am.extra_info==="no_detail"){aq="no_detail"}else{var aE=am.data;if(this.view.high-this.view.low>E){aq="Squish"}else{aq="Pack"}}}this.update_auto_mode(aq)}if(aq==="summary_tree"||aq==="Histogram"){ae=this.summary_draw_height;this.container_div.find(".yaxislabel").remove();var Z=$("<div />").addClass("yaxislabel");Z.text(am.max);Z.css({position:"absolute",top:"22px",left:"10px",color:this.prefs.label_color});Z.prependTo(this.container_div);var ab=this.view.canvas_manager.new_canvas();ab.width=at+ad;ab.height=ae+N;if(am.dataset_type!="summary_tree"){var aj=this.get_summary_tree_data(am.data,aB,aa,200);if(am.max){aj.max=am.max}am=aj}var aC=new H.SummaryTreePainter(am,aB,aa,this.prefs);var au=ab.getContext("2d");au.translate(ad,N);aC.draw(au,at,ae);return new l(az,av,ab,am.max)}var an,ag=1;if(aq==="no_detail"||aq==="Squish"||aq==="Pack"){ag=this.incremental_slots(ai,am.data,aq);an=this.inc_slots[ai].slots}var ah=[];if(am.data){var ak=this.filters_manager.filters;for(var aw=0,ay=am.data.length;aw<ay;aw++){var af=am.data[aw];var ax=false;var al;for(var aA=0,aD=ak.length;aA<aD;aA++){al=ak[aA];al.update_attrs(af);if(!al.keep(af)){ax=true;break}}if(!ax){ah.push(af)}}}var aC=new (this.painter)(ah,aB,aa,this.prefs,aq,ac);var ae=aC.get_required_height(ag)+z;var ab=this.view.canvas_manager.new_canvas();ab.width=at+ad;ab.height=ae;var au=ab.getContext("2d");au.fillStyle=this.prefs.block_color;au.font=au.canvas.manager.default_font;au.textAlign="right";this.container_div.find(".yaxislabel").remove();if(am.message){$(ab).css({"border-top":"1px solid red"});au.fillStyle="red";au.textAlign="left";var ap=au.textBaseline;au.textBaseline="top";au.fillText(am.message,ad,0);au.textBaseline=ap;if(!am.data){return new b(az,av,ab,ae)}}this.example_feature=(am.data.length?am.data[0]:undefined);au.translate(ad,z);aC.draw(au,at,ae,an);return new K(az,av,ab)}});var O=function(ac,aa,ae,Z,ab,ad){e.call(this,ac,aa,ae,Z,ab,ad);this.track_type="VcfTrack";this.painter=H.VariantPainter};n(O.prototype,I.prototype,e.prototype);var R=function(ac,aa,ae,Z,ab,ad){e.call(this,ac,aa,ae,Z,ab,ad);this.track_config=new U({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_differences",label:"Show differences only",type:"bool",default_value:true},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},],saved_values:ab,onchange:function(){this.track.tile_cache.clear();this.track.draw()}});this.prefs=this.track_config.values;this.track_type="ReadTrack";this.painter=H.ReadPainter;this.make_name_popup_menu()};n(R.prototype,I.prototype,e.prototype);var P=function(ad,ab,af,Z,ac,ae,aa){e.call(this,ad,ab,af,Z,ac,ae,{},aa);this.track_type="ToolDataFeatureTrack";this.data_url=raw_data_url;this.data_query_wait=1000;this.dataset_check_url=dataset_state_url};n(P.prototype,I.prototype,e.prototype,{predraw_init:function(){var aa=this;var Z=function(){if(aa.data_cache.size()===0){setTimeout(Z,300)}else{aa.data_url=default_data_url;aa.data_query_wait=G;aa.dataset_state_url=converted_datasets_state_url;$.getJSON(aa.dataset_state_url,{dataset_id:aa.dataset_id,hda_ldda:aa.hda_ldda},function(ab){})}};Z()}});S.View=X;S.LineTrack=k;S.FeatureTrack=e;S.ReadTrack=R};var slotting_module=function(c,b){var e=c("class").extend;var d=2,a=5;b.FeatureSlotter=function(j,h,f,g){this.slots={};this.start_end_dct={};this.w_scale=j;this.include_label=h;this.max_rows=f;this.measureText=g};e(b.FeatureSlotter.prototype,{slot_features:function(m){var p=this.w_scale,s=this.slots,h=this.start_end_dct,y=[],A=[],n=0,z=this.max_rows;for(var w=0,x=m.length;w<x;w++){var l=m[w],o=l[0];if(s[o]!==undefined){n=Math.max(n,s[o]);A.push(s[o])}else{y.push(w)}}var q=function(G,H){for(var F=0;F<=z;F++){var D=false,I=h[F];if(I!==undefined){for(var C=0,E=I.length;C<E;C++){var B=I[C];if(H>B[0]&&G<B[1]){D=true;break}}}if(!D){return F}}return -1};for(var w=0,x=y.length;w<x;w++){var l=m[y[w]],o=l[0],u=l[1],f=l[2],r=l[3],g=Math.floor(u*p),k=Math.ceil(f*p),v=this.measureText(r).width,j;if(r!==undefined&&this.include_label){v+=(d+a);if(g-v>=0){g-=v;j="left"}else{k+=v;j="right"}}var t=q(g,k);if(t>=0){if(h[t]===undefined){h[t]=[]}h[t].push([g,k]);s[o]=t;n=Math.max(n,t)}else{}}return n+1}})};var painters_module=function(j,w){var t=j("class").extend;var o=function(H,z,F,y,E,C){if(C===undefined){C=4}var B=y-z;var A=E-F;var D=Math.floor(Math.sqrt(B*B+A*A)/C);var I=B/D;var G=A/D;var x;for(x=0;x<D;x++,z+=I,F+=G){if(x%2!==0){continue}H.fillRect(z,F,C,1)}};var p=function(A,z,x,D){var C=z-D/2,B=z+D/2,E=x-Math.sqrt(D*3/2);A.beginPath();A.moveTo(C,E);A.lineTo(B,E);A.lineTo(z,x);A.lineTo(C,E);A.strokeStyle=this.fillStyle;A.fill();A.stroke();A.closePath()};var m=function(z,B,x,y,A){this.data=z;this.view_start=B;this.view_end=x;this.prefs=t({},this.default_prefs,y);this.mode=A};m.prototype.default_prefs={};var u=function(z,B,x,y,A){m.call(this,z,B,x,y,A)};u.prototype.default_prefs={show_counts:false};u.prototype.draw=function(M,z,L){var E=this.view_start,O=this.view_end-this.view_start,N=z/O;var J=this.data.data,I=this.data.delta,G=this.data.max,B=L;delta_x_px=Math.ceil(I*N);M.save();for(var C=0,D=J.length;C<D;C++){var H=Math.floor((J[C][0]-E)*N);var F=J[C][1];if(!F){continue}var K=F/G*L;if(F!==0&&K<1){K=1}M.fillStyle=this.prefs.block_color;M.fillRect(H,B-K,delta_x_px,K);var A=4;if(this.prefs.show_counts&&(M.measureText(F).width+A)<delta_x_px){M.fillStyle=this.prefs.label_color;M.textAlign="center";M.fillText(F,H+(delta_x_px/2),10)}}M.restore()};var c=function(x,B,D,E,z){m.call(this,x,B,D,E,z);if(this.prefs.min_value===undefined){var F=Infinity;for(var y=0,A=this.data.length;y<A;y++){F=Math.min(F,this.data[y][1])}this.prefs.min_value=F}if(this.prefs.max_value===undefined){var C=-Infinity;for(var y=0,A=this.data.length;y<A;y++){C=Math.max(C,this.data[y][1])}this.prefs.max_value=C}};c.prototype.default_prefs={min_value:undefined,max_value:undefined,mode:"Histogram",color:"#000",overflow_color:"#F66"};c.prototype.draw=function(O,N,L){var F=false,H=this.prefs.min_value,D=this.prefs.max_value,K=D-H,z=L,A=this.view_start,M=this.view_end-this.view_start,B=N/M,I=this.mode,S=this.data;O.save();var T=Math.round(L+H/K*L);if(I!=="Intensity"){O.fillStyle="#aaa";O.fillRect(0,T,N,1)}O.beginPath();O.fillStyle=this.prefs.color;var R,E,C;if(S.length>1){C=Math.ceil((S[1][0]-S[0][0])*B)}else{C=10}for(var P=0,Q=S.length;P<Q;P++){R=Math.round((S[P][0]-A)*B);E=S[P][1];if(E===null){if(F&&I==="Filled"){O.lineTo(R,z)}F=false;continue}if(E<H){E=H}else{if(E>D){E=D}}if(I==="Histogram"){E=Math.round(E/K*z);O.fillRect(R,T,C,-E)}else{if(I==="Intensity"){E=255-Math.floor((E-H)/K*255);O.fillStyle="rgb("+E+","+E+","+E+")";O.fillRect(R,0,C,z)}else{E=Math.round(z-(E-H)/K*z);if(F){O.lineTo(R,E)}else{F=true;if(I==="Filled"){O.moveTo(R,z);O.lineTo(R,E)}else{O.moveTo(R,E)}}}}}if(I==="Filled"){if(F){O.lineTo(R,T);O.lineTo(0,T)}O.fill()}else{O.stroke()}var x=-1,J=-1;O.fillStyle=this.prefs.overflow_color;var G;for(var P=0,Q=S.length;P<Q;P++){E=S[P][1];R=Math.round((S[P][0]-A)*B);if(J>=0&&(E===null||E<D)){O.fillRect(J,0,G+C-J,2);J=-1}else{if(x>=0&&(E===null||E>H)){O.fillRect(x,L-2,G+C-x,2);x=-1}}if(E!==null&&E>D&&J<0){J=R}else{if(E!==null&&E<H&&x<0){x=R}}G=R}O.restore()};var n=function(z,B,x,y,A){m.call(this,z,B,x,y,A)};n.prototype.default_prefs={block_color:"#FFF",connector_color:"#FFF"};t(n.prototype,{get_required_height:function(y){var x=y_scale=this.get_row_height(),z=this.mode;if(z==="no_detail"||z==="Squish"||z==="Pack"){x=y*y_scale}return x+Math.max(Math.round(y_scale/2),5)},draw:function(J,A,I,F){var D=this.data,G=this.view_start,K=this.view_end;J.save();J.fillStyle=this.prefs.block_color;J.textAlign="right";var N=this.view_end-this.view_start,M=A/N,z=this.get_row_height();for(var C=0,E=D.length;C<E;C++){var L=D[C],B=L[0],x=L[1],y=L[2],H=(F&&F[B]!==undefined?F[B]:null);if((x<K&&y>G)&&(this.mode=="Dense"||H!==null)){this.draw_element(J,this.mode,L,H,G,K,M,z,A)}}J.restore()}});var d=10,h=3,l=5,v=10,f=1,r=3,e=3,a=9,k=2,g="#ccc";var q=function(z,B,x,y,A){n.call(this,z,B,x,y,A)};t(q.prototype,n.prototype,{get_row_height:function(){var y=this.mode,x;if(y==="Dense"){x=d}else{if(y==="no_detail"){x=h}else{if(y==="Squish"){x=l}else{x=v}}}return x},draw_element:function(J,C,R,E,L,ab,af,ag,x){var O=R[0],ad=R[1],V=R[2],M=R[3],W=Math.floor(Math.max(0,(ad-L)*af)),K=Math.ceil(Math.min(x,Math.max(0,(V-L)*af))),U=(C==="Dense"?0:(0+E))*ag,I,Z,N=null,ah=null,A=this.prefs.block_color,Y=this.prefs.label_color;if(C=="Dense"){E=1}if(C==="no_detail"){J.fillStyle=A;J.fillRect(W,U+5,K-W,f)}else{var H=R[4],T=R[5],X=R[6],B=R[7];if(T&&X){N=Math.floor(Math.max(0,(T-L)*af));ah=Math.ceil(Math.min(x,Math.max(0,(X-L)*af)))}var ae,P;if(C==="Squish"||C==="Dense"){ae=1;P=e}else{ae=5;P=a}if(!B){if(R.strand){if(R.strand==="+"){J.fillStyle=J.canvas.manager.get_pattern("right_strand_inv")}else{if(R.strand==="-"){J.fillStyle=J.canvas.manager.get_pattern("left_strand_inv")}}}else{J.fillStyle=A}J.fillRect(W,U,K-W,P)}else{var G,Q;if(C==="Squish"||C==="Dense"){J.fillStyle=g;G=U+Math.floor(e/2)+1;Q=1}else{if(H){var G=U;var Q=P;if(H==="+"){J.fillStyle=J.canvas.manager.get_pattern("right_strand")}else{if(H==="-"){J.fillStyle=J.canvas.manager.get_pattern("left_strand")}}}else{J.fillStyle=g;G+=(e/2)+1;Q=1}}J.fillRect(W,G,K-W,Q);for(var ac=0,z=B.length;ac<z;ac++){var D=B[ac],y=Math.floor(Math.max(0,(D[0]-L)*af)),S=Math.ceil(Math.min(x,Math.max((D[1]-L)*af)));if(y>S){continue}J.fillStyle=A;J.fillRect(y,U+(P-ae)/2+1,S-y,ae);if(N!==undefined&&X>T&&!(y>ah||S<N)){var aa=Math.max(y,N),F=Math.min(S,ah);J.fillRect(aa,U+1,F-aa,P);if(B.length==1&&C=="Pack"){if(H==="+"){J.fillStyle=J.canvas.manager.get_pattern("right_strand_inv")}else{if(H==="-"){J.fillStyle=J.canvas.manager.get_pattern("left_strand_inv")}}if(aa+14<F){aa+=2;F-=2}J.fillRect(aa,U+1,F-aa,P)}}}}if(C==="Pack"&&ad>L){J.fillStyle=Y;if(L===0&&W-J.measureText(M).width<0){J.textAlign="left";J.fillText(M,K+k,U+8)}else{J.textAlign="right";J.fillText(M,W-k,U+8)}J.fillStyle=A}}}});var b=function(z,B,x,y,A){n.call(this,z,B,x,y,A)};t(b.prototype,n.prototype,{draw_element:function(Q,L,F,B,T,z,I,R,O){var F=data[i],H=F[0],P=F[1],A=F[2],K=F[3],D=Math.floor(Math.max(0,(P-T)*I)),G=Math.ceil(Math.min(O,Math.max(0,(A-T)*I))),C=(L==="Dense"?0:(0+B))*R,x,U,y=null,J=null;if(no_label){Q.fillStyle=block_color;Q.fillRect(D+left_offset,C+5,G-D,1)}else{var S=F[4],N=F[5],E=F[6];x=9;U=1;Q.fillRect(D+left_offset,C,G-D,x);if(L!=="Dense"&&K!==undefined&&P>T){Q.fillStyle=label_color;if(T===0&&D-Q.measureText(K).width<0){Q.textAlign="left";Q.fillText(K,G+2+left_offset,C+8)}else{Q.textAlign="right";Q.fillText(K,D-2+left_offset,C+8)}Q.fillStyle=block_color}var M=S+" / "+N;if(P>T&&Q.measureText(M).width<(G-D)){Q.fillStyle="white";Q.textAlign="center";Q.fillText(M,left_offset+D+(G-D)/2,C+8);Q.fillStyle=block_color}}}});var s=function(A,C,x,z,B,y){n.call(this,A,C,x,z,B);this.ref_seq=y};s.prototype.default_prefs=t({},n.prototype.default_prefs,{show_insertions:false});t(s.prototype,n.prototype,{get_row_height:function(){var x,y=this.mode;if(y==="Dense"){x=d}else{if(y==="Squish"){x=l}else{x=v;if(this.prefs.show_insertions){x*=2}}}return x},draw_read:function(T,O,K,Y,z,S,H,E,D){T.textAlign="center";var R=this,y=[Y,z],N=0,U=0,Q=0;ref_seq=this.ref_seq,char_width_px=T.canvas.manager.char_width_px;var ad=[];if((O==="Pack"||this.mode==="Auto")&&E!==undefined&&K>char_width_px){Q=Math.round(K/2)}if(!H){H=[[0,E.length]]}for(var L=0,W=H.length;L<W;L++){var I=H[L],A="MIDNSHP=X"[I[0]],M=I[1];if(A==="H"||A==="S"){N-=M}var F=S+N,ac=Math.floor(Math.max(0,(F-Y)*K)),G=Math.floor(Math.max(0,(F+M-Y)*K));if(ac===G){G+=1}switch(A){case"H":break;case"S":case"M":case"=":if(is_overlap([F,F+M],y)){var P=E.slice(U,U+M);if(Q>0){T.fillStyle=this.prefs.block_color;T.fillRect(ac-Q,D+1,G-ac,9);T.fillStyle=g;for(var aa=0,x=P.length;aa<x;aa++){if(this.prefs.show_differences&&ref_seq){var J=ref_seq[F-Y+aa];if(!J||J.toLowerCase()===P[aa].toLowerCase()){continue}}if(F+aa>=Y&&F+aa<=z){var ab=Math.floor(Math.max(0,(F+aa-Y)*K));T.fillText(P[aa],ab,D+9)}}}else{T.fillStyle=this.prefs.block_color;T.fillRect(ac,D+4,G-ac,e)}}U+=M;N+=M;break;case"N":T.fillStyle=g;T.fillRect(ac-Q,D+5,G-ac,1);N+=M;break;case"D":T.fillStyle="red";T.fillRect(ac-Q,D+4,G-ac,3);N+=M;break;case"P":break;case"I":var X=ac-Q;if(is_overlap([F,F+M],y)){var P=E.slice(U,U+M);if(this.prefs.show_insertions){var C=ac-(G-ac)/2;if((O==="Pack"||this.mode==="Auto")&&E!==undefined&&K>char_width_px){T.fillStyle="yellow";T.fillRect(C-Q,D-9,G-ac,9);ad[ad.length]={type:"triangle",data:[X,D+4,5]};T.fillStyle=g;switch(seq_tile_overlap){case (OVERLAP_START):P=P.slice(Y-F);break;case (OVERLAP_END):P=P.slice(0,F-z);break;case (CONTAINED_BY):break;case (CONTAINS):P=P.slice(Y-F,F-z);break}for(var aa=0,x=P.length;aa<x;aa++){var ab=Math.floor(Math.max(0,(F+aa-Y)*K));T.fillText(P[aa],ab-(G-ac)/2,D)}}else{T.fillStyle="yellow";T.fillRect(C,D+(this.mode!=="Dense"?2:5),G-ac,(O!=="Dense"?e:r))}}else{if((O==="Pack"||this.mode==="Auto")&&E!==undefined&&K>char_width_px){ad[ad.length]={type:"text",data:[P.length,X,D+9]}}else{}}}U+=M;break;case"X":U+=M;break}}T.fillStyle="yellow";var Z,B,ae;for(var V=0;V<ad.length;V++){Z=ad[V];B=Z.type;ae=Z.data;if(B==="text"){T.save();T.font="bold "+T.font;T.fillText(ae[0],ae[1],ae[2]);T.restore()}else{if(B=="triangle"){p(T,ae[0],ae[1],ae[2])}}}},draw_element:function(Q,L,D,A,T,y,H,R,O){var G=D[0],P=D[1],z=D[2],I=D[3],C=Math.floor(Math.max(0,(P-T)*H)),E=Math.ceil(Math.min(O,Math.max(0,(z-T)*H))),B=(L==="Dense"?0:(0+A))*R,U=this.prefs.block_color,F=this.prefs.label_color,N=0;if((L==="Pack"||this.mode==="Auto")&&H>Q.canvas.manager.char_width_px){var N=Math.round(H/2)}Q.fillStyle=U;if(D[5] instanceof Array){var M=Math.floor(Math.max(0,(D[4][0]-T)*H)),K=Math.ceil(Math.min(O,Math.max(0,(D[4][1]-T)*H))),J=Math.floor(Math.max(0,(D[5][0]-T)*H)),x=Math.ceil(Math.min(O,Math.max(0,(D[5][1]-T)*H)));if(D[4][1]>=T&&D[4][0]<=y&&D[4][2]){this.draw_read(Q,L,H,T,y,D[4][0],D[4][2],D[4][3],B)}if(D[5][1]>=T&&D[5][0]<=y&&D[5][2]){this.draw_read(Q,L,H,T,y,D[5][0],D[5][2],D[5][3],B)}if(J>K){Q.fillStyle=g;o(Q,K-N,B+5,J-N,B+5)}}else{Q.fillStyle=U;this.draw_read(Q,L,H,T,y,P,D[4],D[5],B)}if(L==="Pack"&&P>T){Q.fillStyle=this.prefs.label_color;var S=1;if(S===0&&C-Q.measureText(I).width<0){Q.textAlign="left";Q.fillText(I,E+k-N,B+8)}else{Q.textAlign="right";Q.fillText(I,C-k-N,B+8)}Q.fillStyle=U}}});w.SummaryTreePainter=u;w.LinePainter=c;w.LinkedFeaturePainter=q;w.ReadPainter=s;w.VariantPainter=b};(function(d){var c={};var b=function(e){return c[e]};var a=function(f,g){var e={};g(b,e);c[f]=e};a("class",class_module);a("slotting",slotting_module);a("painters",painters_module);a("trackster",trackster_module);for(key in c.trackster){d[key]=c.trackster[key]}})(window); \ No newline at end of file +var class_module=function(b,a){var c=function(){var f=arguments[0];for(var e=1;e<arguments.length;e++){var d=arguments[e];for(key in d){f[key]=d[key]}}return f};a.extend=c};var BEFORE=1001,CONTAINS=1002,OVERLAP_START=1003,OVERLAP_END=1004,CONTAINED_BY=1005,AFTER=1006;var compute_overlap=function(e,b){var g=e[0],f=e[1],d=b[0],c=b[1],a;if(g<d){if(f<d){a=BEFORE}else{if(f<=c){a=OVERLAP_START}else{a=CONTAINS}}}else{if(g>c){a=AFTER}else{if(f<=c){a=CONTAINED_BY}else{a=OVERLAP_END}}}return a};var is_overlap=function(c,b){var a=compute_overlap(c,b);return(a!==BEFORE&&a!==AFTER)};var trackster_module=function(f,S){var n=f("class").extend,p=f("slotting"),H=f("painters");var Y=function(Z,aa){this.document=Z;this.default_font=aa!==undefined?aa:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};n(Y.prototype,{load_pattern:function(Z,ad){var aa=this.patterns,ab=this.dummy_context,ac=new Image();ac.src=image_path+ad;ac.onload=function(){aa[Z]=ab.createPattern(ac,"repeat")}},get_pattern:function(Z){return this.patterns[Z]},new_canvas:function(){var Z=this.document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(Z)}Z.manager=this;return Z}});var B=function(Z,aa){Z.bind("drag",{handle:aa,relative:true},function(ae,af){var ad=$(this).parent();var ac=ad.children();var ab;for(ab=0;ab<ac.length;ab++){if(af.offsetY<$(ac.get(ab)).position().top){break}}if(ab===ac.length){if(this!==ac.get(ab-1)){ad.append(this)}}else{if(this!==ac.get(ab)){$(this).insertBefore(ac.get(ab))}}}).bind("dragstart",function(){$(this).css({"border-top":"1px solid blue","border-bottom":"1px solid blue"})}).bind("dragend",function(){$(this).css("border","0px")})};S.sortable=B;var C=9,z=10,N=C+2,w=100,E=12000,L=200,s=10,G=5000,t=100,m="There was an error in indexing this dataset. ",F="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",A="No data for this chrom/contig.",q="Currently indexing... please wait",v="Tool cannot be rerun: ",a="Loading data...",T="Ready for display",d=10,r=5,y=5;function u(Z){return Math.round(Z*1000)/1000}var c=function(Z){this.num_elements=Z;this.clear()};n(c.prototype,{get:function(aa){var Z=this.key_ary.indexOf(aa);if(Z!==-1){this.move_key_to_end(aa,Z)}return this.obj_cache[aa]},set:function(aa,ab){if(!this.obj_cache[aa]){if(this.key_ary.length>=this.num_elements){var Z=this.key_ary.shift();delete this.obj_cache[Z]}this.key_ary.push(aa)}this.obj_cache[aa]=ab;return ab},move_key_to_end:function(aa,Z){this.key_ary.splice(Z,1);this.key_ary.push(aa)},clear:function(){this.obj_cache={};this.key_ary=[]},size:function(){return this.key_ary.length}});var M=function(aa,Z,ab){c.call(this,aa);this.track=Z;this.subset=(ab!==undefined?ab:true)};n(M.prototype,c.prototype,{load_data:function(ah,ai,ad,ag,aa,af){var ac={chrom:ah,low:ai,high:ad,mode:ag,resolution:aa,dataset_id:this.track.dataset_id,hda_ldda:this.track.hda_ldda};$.extend(ac,af);if(this.track.filters_manager){var aj=[];var Z=this.track.filters_manager.filters;for(var ae=0;ae<Z.length;ae++){aj[aj.length]=Z[ae].name}ac.filter_cols=JSON.stringify(aj)}var ab=this;return $.getJSON(this.track.data_url,ac,function(ak){ab.set_data(ai,ad,ag,ak)})},get_data:function(ab,Z,ae,af,aa,ad){var ac=this.get(this.gen_key(Z,ae,af));if(ac){return ac}ac=this.load_data(ab,Z,ae,af,aa,ad);this.set_data(Z,ae,af,ac);return ac},set_data:function(aa,ab,ac,Z){return this.set(this.gen_key(aa,ab,ac),Z)},gen_key:function(Z,ab,ac){var aa=Z+"_"+ab+"_"+ac;return aa},split_key:function(Z){return Z.split("_")}});var D=function(aa,Z,ab){M.call(this,aa,Z,ab)};n(D.prototype,M.prototype,c.prototype,{load_data:function(ab,Z,ad,ae,aa,ac){if(aa>1){return}return M.prototype.load_data.call(this,ab,Z,ad,ae,aa,ac)}});var X=function(Z,ac,ab,aa,ad){this.container=Z;this.chrom=null;this.vis_id=ab;this.dbkey=aa;this.title=ac;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init(ad);this.canvas_manager=new Y(Z.get(0).ownerDocument);this.reset()};n(X.prototype,{init:function(ac){var ab=this.container,Z=this;this.top_container=$("<div/>").addClass("top-container").appendTo(ab);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(ab);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(ab);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var aa=function(ad){if(ad.type==="focusout"||(ad.keyCode||ad.which)===13||(ad.keyCode||ad.which)===27){if((ad.keyCode||ad.which)!==27){Z.go_to($(this).val())}$(this).hide();$(this).val("");Z.location_span.show();Z.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",aa).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").appendTo(this.nav_controls);this.location_span.bind("click",function(){Z.location_span.hide();Z.chrom_select.hide();Z.nav_input.val(Z.chrom+":"+Z.low+"-"+Z.high);Z.nav_input.css("display","inline-block");Z.nav_input.select();Z.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a id='zoom-out' />").click(function(){Z.zoom_out();Z.redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a id='zoom-in' />").click(function(){Z.zoom_in();Z.redraw()}).appendTo(this.nav_controls);this.load_chroms({low:0},ac);this.chrom_select.bind("change",function(){Z.change_chrom(Z.chrom_select.val())});this.intro_div.show();this.content_div.bind("click",function(ad){$(this).find("input").trigger("blur")});this.content_div.bind("dblclick",function(ad){Z.zoom_in(ad.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ad,ae){this.current_x=ae.offsetX}).bind("drag",function(ad,af){var ag=af.offsetX-this.current_x;this.current_x=af.offsetX;var ae=Math.round(ag/Z.viewport_container.width()*(Z.max_high-Z.max_low));Z.move_delta(-ae)});this.overview_close.bind("click",function(){for(var ae=0,ad=Z.tracks.length;ae<ad;ae++){Z.tracks[ae].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",Z.overview_box.height());Z.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("draginit",function(ad,ae){if(ad.clientX>Z.viewport_container.width()-16){return false}}).bind("dragstart",function(ad,ae){ae.original_low=Z.low;ae.current_height=ad.clientY;ae.current_x=ae.offsetX}).bind("drag",function(af,ah){var ad=$(this);var ai=ah.offsetX-ah.current_x;var ae=ad.scrollTop()-(af.clientY-ah.current_height);ad.scrollTop(ae);ah.current_height=af.clientY;ah.current_x=ah.offsetX;var ag=Math.round(ai/Z.viewport_container.width()*(Z.high-Z.low));Z.move_delta(ag)}).bind("mousewheel",function(af,ah,ae,ad){if(ae){var ag=Math.round(-ae/Z.viewport_container.width()*(Z.high-Z.low));Z.move_delta(ag)}});this.top_labeltrack.bind("dragstart",function(ad,ae){return $("<div />").css({height:Z.content_div.height()+Z.top_labeltrack.height()+Z.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(ah,ai){$(ai.proxy).css({left:Math.min(ah.pageX,ai.startX),width:Math.abs(ah.pageX-ai.startX)});var ae=Math.min(ah.pageX,ai.startX)-Z.container.offset().left,ad=Math.max(ah.pageX,ai.startX)-Z.container.offset().left,ag=(Z.high-Z.low),af=Z.viewport_container.width();Z.update_location(Math.round(ae/af*ag)+Z.low,Math.round(ad/af*ag)+Z.low)}).bind("dragend",function(ai,aj){var ae=Math.min(ai.pageX,aj.startX),ad=Math.max(ai.pageX,aj.startX),ag=(Z.high-Z.low),af=Z.viewport_container.width(),ah=Z.low;Z.low=Math.round(ae/af*ag)+ah;Z.high=Math.round(ad/af*ag)+ah;$(aj.proxy).remove();Z.redraw()});this.add_label_track(new W(this,this.top_labeltrack));this.add_label_track(new W(this,this.nav_labeltrack));$(window).bind("resize",function(){Z.resize_window()});$(document).bind("redraw",function(){Z.redraw()});this.reset();$(window).trigger("resize")},update_location:function(Z,aa){this.location_span.text(commatize(Z)+" - "+commatize(aa));this.nav_input.val(this.chrom+":"+commatize(Z)+"-"+commatize(aa))},load_chroms:function(aa,ab){aa.num=t;$.extend(aa,(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}));var Z=this;$.ajax({url:chrom_url,data:aa,dataType:"json",success:function(ad){if(ad.chrom_info.length===0){alert("Invalid chromosome: "+aa.chrom);return}if(ad.reference){Z.add_label_track(new x(Z))}Z.chrom_data=ad.chrom_info;var ag='<option value="">Select Chrom/Contig</option>';for(var af=0,ac=Z.chrom_data.length;af<ac;af++){var ae=Z.chrom_data[af].chrom;ag+='<option value="'+ae+'">'+ae+"</option>"}if(ad.prev_chroms){ag+='<option value="previous">Previous '+t+"</option>"}if(ad.next_chroms){ag+='<option value="next">Next '+t+"</option>"}Z.chrom_select.html(ag);if(ab){ab()}Z.chrom_start_index=ad.start_index},error:function(){alert("Could not load chroms for this dbkey:",Z.dbkey)}})},change_chrom:function(ad,aa,af){if(!ad||ad==="None"){return}var ac=this;if(ad==="previous"){ac.load_chroms({low:this.chrom_start_index-t});return}if(ad==="next"){ac.load_chroms({low:this.chrom_start_index+t});return}var ae=$.grep(ac.chrom_data,function(ah,ai){return ah.chrom===ad})[0];if(ae===undefined){ac.load_chroms({chrom:ad},function(){ac.change_chrom(ad,aa,af)});return}else{if(ad!==ac.chrom){ac.chrom=ad;if(!ac.chrom){ac.intro_div.show()}else{ac.intro_div.hide()}ac.chrom_select.val(ac.chrom);ac.max_high=ae.len-1;ac.reset();ac.redraw(true);for(var ag=0,Z=ac.tracks.length;ag<Z;ag++){var ab=ac.tracks[ag];if(ab.init){ab.init()}}}if(aa!==undefined&&af!==undefined){ac.low=Math.max(aa,0);ac.high=Math.min(af,ac.max_high)}ac.reset_overview();ac.redraw()}},go_to:function(ad){var ah=this,Z,ac,aa=ad.split(":"),af=aa[0],ag=aa[1];if(ag!==undefined){try{var ae=ag.split("-");Z=parseInt(ae[0].replace(/,/g,""),10);ac=parseInt(ae[1].replace(/,/g,""),10)}catch(ab){return false}}ah.change_chrom(af,Z,ac)},move_fraction:function(ab){var Z=this;var aa=Z.high-Z.low;this.move_delta(ab*aa)},move_delta:function(ab){var Z=this;var aa=Z.high-Z.low;if(Z.low-ab<Z.max_low){Z.low=Z.max_low;Z.high=Z.max_low+aa}else{if(Z.high-ab>Z.max_high){Z.high=Z.max_high;Z.low=Z.max_high-aa}else{Z.high-=ab;Z.low-=ab}}Z.redraw()},add_track:function(Z){Z.view=this;Z.track_id=this.track_id_counter;this.tracks.push(Z);if(Z.init){Z.init()}Z.container_div.attr("id","track_"+Z.track_id);B(Z.container_div,".draghandle");this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(Z){Z.view=this;this.label_tracks.push(Z)},remove_track:function(Z){this.has_changes=true;Z.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(Z)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(ag){var af=this.high-this.low,ae=this.low,aa=this.high;if(ae<this.max_low){ae=this.max_low}if(aa>this.max_high){aa=this.max_high}if(this.high!==0&&af<this.min_separation){aa=ae+this.min_separation}this.low=Math.floor(ae);this.high=Math.ceil(aa);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/L)/Math.LN10));this.zoom_res=Math.pow(s,Math.max(0,Math.ceil(Math.log(this.resolution,s)/Math.log(s))));var Z=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ad=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ah=13;this.overview_box.css({left:Z,width:Math.max(ah,ad)}).show();if(ad<ah){this.overview_box.css("left",Z-(ah-ad)/2)}if(this.overview_highlight){this.overview_highlight.css({left:Z,width:ad})}this.update_location(this.low,this.high);if(!ag){for(var ab=0,ac=this.tracks.length;ab<ac;ab++){if(this.tracks[ab]&&this.tracks[ab].enabled){this.tracks[ab].draw()}}for(ab=0,ac=this.label_tracks.length;ab<ac;ab++){this.label_tracks[ab].draw()}}},zoom_in:function(aa,ab){if(this.max_high===0||this.high-this.low<this.min_separation){return}var ac=this.high-this.low,ad=ac/2+this.low,Z=(ac/this.zoom_factor)/2;if(aa){ad=aa/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ad-Z);this.high=Math.round(ad+Z);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var aa=this.high-this.low,ab=aa/2+this.low,Z=(aa*this.zoom_factor)/2;this.low=Math.round(ab-Z);this.high=Math.round(ab+Z);this.redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide()}});var o=function(ab,af){this.track=ab;this.name=af.name;this.params=[];var am=af.params;for(var ac=0;ac<am.length;ac++){var ah=am[ac],aa=ah.name,al=ah.label,ad=unescape(ah.html),an=ah.value,aj=ah.type;if(aj==="number"){this.params[this.params.length]=new g(aa,al,ad,an,ah.min,ah.max)}else{if(aj=="select"){this.params[this.params.length]=new J(aa,al,ad,an)}else{console.log("WARNING: unrecognized tool parameter type:",aa,aj)}}}this.parent_div=$("<div/>").addClass("dynamic-tool").hide();this.parent_div.bind("drag",function(ap){ap.stopPropagation()}).bind("click",function(ap){ap.stopPropagation()}).bind("dblclick",function(ap){ap.stopPropagation()});var ak=$("<div class='tool-name'>").appendTo(this.parent_div).text(this.name);var ai=this.params;var ag=this;$.each(this.params,function(aq,au){var at=$("<div>").addClass("param-row").appendTo(ag.parent_div);var ap=$("<div>").addClass("param-label").text(au.label).appendTo(at);var ar=$("<div/>").addClass("slider").html(au.html).appendTo(at);ar.find(":input").val(au.value);$("<div style='clear: both;'/>").appendTo(at)});this.parent_div.find("input").click(function(){$(this).select()});var ao=$("<div>").addClass("param-row").appendTo(this.parent_div);var ae=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(ao);var Z=$("<input type='submit'>").attr("value","Run on visible region").css("margin-left","3em").appendTo(ao);var ag=this;Z.click(function(){ag.run_on_region()});ae.click(function(){ag.run_on_dataset()})};n(o.prototype,{get_param_values_dict:function(){var Z={};this.parent_div.find(":input").each(function(){var aa=$(this).attr("name"),ab=$(this).val();Z[aa]=JSON.stringify(ab)});return Z},get_param_values:function(){var aa=[];var Z={};this.parent_div.find(":input").each(function(){var ab=$(this).attr("name"),ac=$(this).val();if(ab){aa[aa.length]=ac}});return aa},run_on_dataset:function(){var Z=this;Z.run({dataset_id:this.track.original_dataset_id,tool_id:Z.name},function(aa){show_modal(Z.name+" is Running",Z.name+" is running on the complete dataset. Tool outputs are in dataset's history.",{Close:hide_modal})})},run_on_region:function(){var Z={dataset_id:this.track.original_dataset_id,chrom:this.track.view.chrom,low:this.track.view.low,high:this.track.view.high,tool_id:this.name},ab=this.track,aa=Z.tool_id+ab.tool_region_and_parameters_str(Z.chrom,Z.low,Z.high),ac;if(ab.track_type==="FeatureTrack"){ac=new P(aa,view,ab.hda_ldda,undefined,{},{},ab)}this.track.add_track(ac);ac.content_div.text("Starting job.");this.run(Z,function(ad){ac.dataset_id=ad.dataset_id;ac.content_div.text("Running job.");ac.init()})},run:function(aa,ab){$.extend(aa,this.get_param_values_dict());var Z=function(){$.getJSON(rerun_tool_url,aa,function(ac){if(ac==="no converter"){new_track.container_div.addClass("error");new_track.content_div.text(F)}else{if(ac.error){new_track.container_div.addClass("error");new_track.content_div.text(v+ac.message)}else{if(ac==="pending"){new_track.container_div.addClass("pending");new_track.content_div.text("Converting input data so that it can be easily reused.");setTimeout(Z,2000)}else{ab(ac)}}}})};Z()}});var J=function(aa,Z,ab,ac){this.name=aa;this.label=Z;this.html=ab;this.value=ac};var g=function(ab,aa,ad,ae,ac,Z){J.call(this,ab,aa,ad,ae);this.min=ac;this.max=Z};var h=function(aa,Z,ab,ac){this.name=aa;this.index=Z;this.tool_id=ab;this.tool_exp_name=ac};var Q=function(aa,Z,ab,ac){h.call(this,aa,Z,ab,ac);this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.min=Number.MAX_VALUE;this.max=-Number.MAX_VALUE;this.slider=null;this.slider_label=null};n(Q.prototype,{applies_to:function(Z){if(Z.length>this.index){return true}return false},keep:function(Z){if(!this.applies_to(Z)){return true}var aa=parseInt(Z[this.index]);return(isNaN(aa)||(aa>=this.low&&aa<=this.high))},update_attrs:function(aa){var Z=false;if(!this.applies_to(aa)){return Z}if(aa[this.index]<this.min){this.min=Math.floor(aa[this.index]);Z=true}if(aa[this.index]>this.max){this.max=Math.ceil(aa[this.index]);Z=true}return Z},update_ui_elt:function(){var ab=function(ae,ac){var ad=ac-ae;return(ad<=2?0.01:1)};var aa=this.slider.slider("option","min"),Z=this.slider.slider("option","max");if(this.min<aa||this.max>Z){this.slider.slider("option","min",this.min);this.slider.slider("option","max",this.max);this.slider.slider("option","step",ab(this.min,this.max));this.slider.slider("option","values",[this.min,this.max])}}});var V=function(ab,ak){this.track=ab;this.filters=[];for(var af=0;af<ak.length;af++){var Z=ak[af],aa=Z.name,aj=Z.type,ah=Z.index,am=Z.tool_id,ac=Z.tool_exp_name;if(aj==="int"||aj==="float"){this.filters[af]=new Q(aa,ah,am,ac)}else{console.log("ERROR: unsupported filter: ",aa,aj)}}var ai=function(an,ao,ap){an.click(function(){var aq=ao.text();max=parseFloat(ap.slider("option","max")),input_size=(max<=1?4:max<=1000000?max.toString().length:6),multi_value=false;if(ap.slider("option","values")){input_size=2*input_size+1;multi_value=true}ao.text("");$("<input type='text'/>").attr("size",input_size).attr("maxlength",input_size).attr("value",aq).appendTo(ao).focus().select().click(function(ar){ar.stopPropagation()}).blur(function(){$(this).remove();ao.text(aq)}).keyup(function(aw){if(aw.keyCode===27){$(this).trigger("blur")}else{if(aw.keyCode===13){var au=ap.slider("option","min"),ar=ap.slider("option","max"),av=function(ax){return(isNaN(ax)||ax>ar||ax<au)},at=$(this).val();if(!multi_value){at=parseFloat(at);if(av(at)){alert("Parameter value must be in the range ["+au+"-"+ar+"]");return $(this)}}else{at=at.split("-");at=[parseFloat(at[0]),parseFloat(at[1])];if(av(at[0])||av(at[1])){alert("Parameter value must be in the range ["+au+"-"+ar+"]");return $(this)}}ap.slider((multi_value?"values":"value"),at)}}})})};this.parent_div=$("<div/>").addClass("filters").hide();this.parent_div.bind("drag",function(an){an.stopPropagation()}).bind("click",function(an){an.stopPropagation()}).bind("dblclick",function(an){an.stopPropagation()}).bind("keydown",function(an){an.stopPropagation()});var ad=this;$.each(this.filters,function(au,ao){var aq=$("<div/>").addClass("slider-row").appendTo(ad.parent_div);var an=$("<div/>").addClass("slider-label").appendTo(aq);var aw=$("<span/>").addClass("slider-name").text(ao.name+" ").appendTo(an);var ap=$("<span/>");var ar=$("<span/>").addClass("slider-value").appendTo(an).append("[").append(ap).append("]");var av=$("<div/>").addClass("slider").appendTo(aq);ao.control_element=$("<div/>").attr("id",ao.name+"-filter-control").appendTo(av);var at=[0,0];ao.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(ax,ay){at=ay.values;ap.text(ay.values[0]+"-"+ay.values[1]);setTimeout(function(){if(ay.values[0]==at[0]&&ay.values[1]==at[1]){var az=ay.values;ap.text(az[0]+"-"+az[1]);ao.low=az[0];ao.high=az[1];ad.track.draw(true,true)}},50)},change:function(ax,ay){ao.control_element.slider("option","slide").call(ao.control_element,ax,ay)}});ao.slider=ao.control_element;ao.slider_label=ap;ai(ar,ap,ao.control_element);$("<div style='clear: both;'/>").appendTo(aq)});if(this.filters.length!=0){var al=$("<div>").addClass("param-row").appendTo(this.parent_div);var ag=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(al);var ae=this;ag.click(function(){ae.run_on_dataset()})}};n(V.prototype,{reset_filters:function(){for(var Z=0;Z<this.filters.length;Z++){filter=this.filters[Z];filter.slider.slider("option","values",[filter.min,filter.max])}},run_on_dataset:function(){var ag=function(al,aj,ak){if(!(aj in al)){al[aj]=ak}return al[aj]};var ad={},aa,ac,ae;for(var af=0;af<this.filters.length;af++){aa=this.filters[af];if(aa.tool_id){if(aa.min!=aa.low){ac=ag(ad,aa.tool_id,[]);ac[ac.length]=aa.tool_exp_name+" >= "+aa.low}if(aa.max!=aa.high){ac=ag(ad,aa.tool_id,[]);ac[ac.length]=aa.tool_exp_name+" <= "+aa.high}}}for(var ai in ad){var Z=ad[ai],ab="("+Z.join(") and (")+")",ah={cond:ab,input:this.track.dataset_id,target_dataset_id:this.track.dataset_id,tool_id:ai};$.getJSON(run_tool_url,ah,function(aj){if(aj.error){new_track.container_div.addClass("error");new_track.content_div.text(v+aj.message)}else{show_modal("Filter Dataset",ai+" is running on the complete dataset. Tool outputs are in dataset's history.",{Close:hide_modal})}})}}});var U=function(Z){this.track=Z.track;this.params=Z.params;this.values={};if(Z.saved_values){this.restore_values(Z.saved_values)}this.onchange=Z.onchange};n(U.prototype,{restore_values:function(Z){var aa=this;$.each(this.params,function(ab,ac){if(Z[ac.key]!==undefined){aa.values[ac.key]=Z[ac.key]}else{aa.values[ac.key]=ac.default_value}})},build_form:function(){var aa=this;var Z=$("<div />");$.each(this.params,function(ae,ac){if(!ac.hidden){var ab="param_"+ae;var aj=$("<div class='form-row' />").appendTo(Z);aj.append($("<label />").attr("for",ab).text(ac.label+":"));if(ac.type==="bool"){aj.append($('<input type="checkbox" />').attr("id",ab).attr("name",ab).attr("checked",aa.values[ac.key]))}else{if(ac.type==="color"){var ag=aa.values[ac.key];var af=$("<input />").attr("id",ab).attr("name",ab).val(ag);var ah=$("<div class='tipsy tipsy-north' style='position: absolute;' />").hide();var ad=$("<div style='background-color: black; padding: 10px;'></div>").appendTo(ah);var ai=$("<div/>").appendTo(ad).farbtastic({width:100,height:100,callback:af,color:ag});$("<div />").append(af).append(ah).appendTo(aj).bind("click",function(ak){ah.css({left:$(this).position().left+($(af).width()/2)-60,top:$(this).position().top+$(this.height)}).show();$(document).bind("click.color-picker",function(){ah.hide();$(document).unbind("click.color-picker")});ak.stopPropagation()})}else{aj.append($("<input />").attr("id",ab).attr("name",ab).val(aa.values[ac.key]))}}}});return Z},update_from_form:function(Z){var ab=this;var aa=false;$.each(this.params,function(ac,ae){if(!ae.hidden){var af="param_"+ac;var ad=Z.find("#"+af).val();if(ae.type==="float"){ad=parseFloat(ad)}else{if(ae.type==="int"){ad=parseInt(ad)}else{if(ae.type==="bool"){ad=Z.find("#"+af).is(":checked")}}}if(ad!==ab.values[ae.key]){ab.values[ae.key]=ad;aa=true}}});if(aa){this.onchange()}}});var b=function(ab,aa,Z){this.index=ab;this.resolution=aa;this.canvas=$("<div class='track-tile'/>").append(Z)};var l=function(ab,aa,Z,ac){b.call(this,ab,aa,Z);this.max_val=ac};var K=function(ab,aa,Z){b.call(this,ab,aa,Z)};var j=function(aa,Z,ad,ab,ac){this.name=aa;this.view=Z;this.parent_element=ad;this.data_url=(ab?ab:default_data_url);this.data_url_extra_params={};this.data_query_wait=(ac?ac:G);this.dataset_check_url=converted_datasets_state_url;this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)};n(j.prototype,{init:function(){var Z=this;Z.enabled=false;Z.tile_cache.clear();Z.data_cache.clear();Z.initial_canvas=undefined;Z.content_div.css("height","auto");Z.container_div.removeClass("nodata error pending");if(!Z.dataset_id){return}$.getJSON(converted_datasets_state_url,{hda_ldda:Z.hda_ldda,dataset_id:Z.dataset_id,chrom:Z.view.chrom},function(aa){if(!aa||aa==="error"||aa.kind==="error"){Z.container_div.addClass("error");Z.content_div.text(m);if(aa.message){var ac=Z.view.tracks.indexOf(Z);var ab=$(" <a href='javascript:void(0);'></a>").text("View error").bind("click",function(){show_modal("Trackster Error","<pre>"+aa.message+"</pre>",{Close:hide_modal})});Z.content_div.append(ab)}}else{if(aa==="no converter"){Z.container_div.addClass("error");Z.content_div.text(F)}else{if(aa==="no data"||(aa.data!==undefined&&(aa.data===null||aa.data.length===0))){Z.container_div.addClass("nodata");Z.content_div.text(A)}else{if(aa==="pending"){Z.container_div.addClass("pending");Z.content_div.text(q);setTimeout(function(){Z.init()},Z.data_query_wait)}else{if(aa.status==="data"){if(aa.valid_chroms){Z.valid_chroms=aa.valid_chroms;Z.make_name_popup_menu()}Z.content_div.text(T);if(Z.view.chrom){Z.content_div.text("");Z.content_div.css("height",Z.height_px+"px");Z.enabled=true;$.when(Z.predraw_init()).done(function(){Z.container_div.removeClass("nodata error pending");Z.draw()})}}}}}}})},predraw_init:function(){},update_name:function(Z){this.old_name=this.name;this.name=Z;this.name_div.text(this.name)},revert_name:function(){this.name=this.old_name;this.name_div.text(this.name)}});var I=function(ah,af,ai){var aa=this,aj=aa.view;this.filters_manager=(ah!==undefined?new V(this,ah):undefined);this.filters_available=false;this.filters_visible=false;this.tool=(af!==undefined&&obj_length(af)>0?new o(this,af):undefined);this.parent_track=ai;this.child_tracks=[];if(aa.hidden){return}if(this.parent_track){this.header_div.find(".draghandle").removeClass("draghandle").addClass("child-track-icon").addClass("icon-button");this.parent_element.addClass("child-track");this.tool=undefined}aa.child_tracks_container=$("<div/>").addClass("child-tracks-container").hide();aa.container_div.append(aa.child_tracks_container);if(this.filters_manager){this.filters_div=this.filters_manager.parent_div;this.header_div.after(this.filters_div)}if(this.tool){this.dynamic_tool_div=this.tool.parent_div;this.header_div.after(this.dynamic_tool_div)}if(aa.display_modes!==undefined){if(aa.mode_div===undefined){aa.mode_div=$("<div class='right-float menubutton popup' />").appendTo(aa.header_div);var ac=(aa.track_config&&aa.track_config.values.mode?aa.track_config.values.mode:aa.display_modes[0]);aa.mode=ac;aa.mode_div.text(ac);var ab=function(ak){aa.mode_div.text(ak);aa.mode=ak;aa.track_config.values.mode=ak;aa.tile_cache.clear();aa.draw()};var Z={};for(var ad=0,ag=aa.display_modes.length;ad<ag;ad++){var ae=aa.display_modes[ad];Z[ae]=function(ak){return function(){ab(ak)}}(ae)}make_popupmenu(aa.mode_div,Z)}else{aa.mode_div.hide()}}this.make_name_popup_menu()};n(I.prototype,j.prototype,{make_name_popup_menu:function(){var aa=this;var Z={};Z["Edit configuration"]=function(){var ag=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ae=function(){aa.track_config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},af=function(ah){if((ah.keyCode||ah.which)===27){ag()}else{if((ah.keyCode||ah.which)===13){ae()}}};$(window).bind("keypress.check_enter_esc",af);show_modal("Configure Track",aa.track_config.build_form(),{Cancel:ag,OK:ae})};if(aa.filters_available>0){var ad=(aa.filters_div.is(":visible")?"Hide filters":"Show filters");Z[ad]=function(){aa.filters_visible=(aa.filters_div.is(":visible"));if(aa.filters_visible){aa.filters_manager.reset_filters()}aa.filters_div.toggle();aa.make_name_popup_menu()}}if(aa.tool){var ad=(aa.dynamic_tool_div.is(":visible")?"Hide tool":"Show tool");Z[ad]=function(){if(!aa.dynamic_tool_div.is(":visible")){aa.update_name(aa.name+aa.tool_region_and_parameters_str())}else{menu_option_text="Show dynamic tool";aa.revert_name()}aa.dynamic_tool_div.toggle();aa.make_name_popup_menu()}}if(aa.valid_chroms){Z["List chrom/contigs with data"]=function(){show_modal("Chrom/contigs with data","<p>"+aa.valid_chroms.join("<br/>")+"</p>",{Close:function(){hide_modal()}})}}var ab=view;var ac=function(){$("#no-tracks").show()};if(this.parent_track){ab=this.parent_track;ac=function(){}}Z.Remove=function(){ab.remove_track(aa);if(ab.num_tracks===0){ac()}};make_popupmenu(aa.name_div,Z)},draw:function(Z,ab){var at=this.view.low,af=this.view.high,ah=af-at,aj=this.view.container.width(),ad=aj/ah,ak=this.view.resolution,ac=$("<div style='position: relative;'></div>"),al=function(av,aw,au){return av+"_"+aw+"_"+au};if(!ab){this.content_div.children().remove()}this.content_div.append(ac);this.max_height=0;var an=Math.floor(at/ak/L);var ae=[];var ao=0;while((an*L*ak)<af){var ar=al(aj,ad,an);var ag=this.tile_cache.get(ar);var ap=an*L*this.view.resolution;var aa=ap+L*this.view.resolution;if(!Z&&ag){ae[ae.length]=ag;this.show_tile(ag,ac,ap,ad)}else{this.delayed_draw(Z,ar,an,ak,ac,ad,ae)}an+=1;ao++}var ai=this;var aq=setInterval(function(){if(ae.length===ao){clearInterval(aq);if(ab){var ax=ai.content_div.children();var ay=false;for(var aw=ax.length-1,aC=0;aw>=aC;aw--){var av=$(ax[aw]);if(ay){av.remove()}else{if(av.children().length!==0){ay=true}}}}if(ai.track_type=="FeatureTrack"&&ai.mode=="Histogram"){var aB=-1;for(var aw=0;aw<ae.length;aw++){var aE=ae[aw].max_val;if(aE>aB){aB=aE}}for(var aw=0;aw<ae.length;aw++){if(ae[aw].max_val!==aB){var aD=ae[aw];aD.canvas.remove();ai.delayed_draw(true,al(aj,ad,aD.index),aD.index,aD.resolution,ac,ad,[],{max:aB})}}}if(ai.filters_manager){var au=ai.filters_manager.filters;for(var aA=0;aA<au.length;aA++){au[aA].update_ui_elt()}var az=false;if(ai.example_feature){for(var aA=0;aA<au.length;aA++){if(au[aA].applies_to(ai.example_feature)){az=true;break}}}if(ai.filters_available!==az){ai.filters_available=az;if(!ai.filters_available){ai.filters_div.hide()}ai.make_name_popup_menu()}}}},50);for(var am=0;am<this.child_tracks.length;am++){this.child_tracks[am].draw(Z,ab)}},delayed_draw:function(aa,ah,ab,ad,ai,al,aj,ae){var ac=this,af=ab*L*ad,ak=af+L*ad;var ag=function(au,am,ao,an,ar,at,ap){var aq=ac.draw_tile(am,ao,an,at,ap);ac.tile_cache.set(ah,aq);if(aq===undefined){return}ac.show_tile(aq,ar,af,at);aj[aj.length]=aq};var Z=setTimeout(function(){if(af<=ac.view.high&&ak>=ac.view.low){var am=(aa?undefined:ac.tile_cache.get(ah));if(am){ac.show_tile(am,ai,af,al);aj[aj.length]=am}else{$.when(ac.data_cache.get_data(view.chrom,af,ak,ac.mode,ad,ac.data_url_extra_params)).then(function(an){n(an,ae);if(view.reference_track&&al>view.canvas_manager.char_width_px){$.when(view.reference_track.data_cache.get_data(view.chrom,af,ak,ac.mode,ad,view.reference_track.data_url_extra_params)).then(function(ao){ag(Z,an,ad,ab,ai,al,ao)})}else{ag(Z,an,ad,ab,ai,al)}})}}},50)},show_tile:function(ac,af,ad,ag){var aa=this;var ab=this.view.high-this.view.low,ae=(ad-this.view.low)*ag;if(this.left_offset){ae-=this.left_offset}var Z=ac.canvas;Z.css({position:"absolute",top:0,left:ae,height:""});af.append(Z);aa.max_height=Math.max(aa.max_height,Z.height());aa.content_div.css("height",aa.max_height+"px");af.children().css("height",aa.max_height+"px")},set_overview:function(){var Z=this.view;if(this.initial_canvas&&this.is_overview){Z.overview_close.show();Z.overview_viewport.append(this.initial_canvas);Z.overview_highlight.show().height(this.initial_canvas.height());Z.overview_viewport.height(this.initial_canvas.height()+Z.overview_box.height())}$(window).trigger("resize")},tool_region_and_parameters_str:function(ab,Z,ac){var aa=this,ad=(ab!==undefined&&Z!==undefined&&ac!==undefined?ab+":"+Z+"-"+ac:"all");return" - region=["+ad+"], parameters=["+aa.tool.get_param_values().join(", ")+"]"},add_track:function(Z){Z.track_id=this.track_id+"_"+this.child_tracks.length;Z.container_div.attr("id","track_"+Z.track_id);this.child_tracks_container.append(Z.container_div);B(Z.container_div,".child-track-icon");if(!$(this.child_tracks_container).is(":visible")){this.child_tracks_container.show()}this.child_tracks.push(Z);this.view.has_changes=true},remove_track:function(Z){Z.container_div.fadeOut("slow",function(){$(this).remove()})}});var W=function(Z,aa){this.track_type="LabelTrack";this.hidden=true;j.call(this,null,Z,aa);this.container_div.addClass("label-track")};n(W.prototype,j.prototype,{draw:function(){var ab=this.view,ac=ab.high-ab.low,af=Math.floor(Math.pow(10,Math.floor(Math.log(ac)/Math.log(10)))),Z=Math.floor(ab.low/af)*af,ad=this.view.container.width(),aa=$("<div style='position: relative; height: 1.3em;'></div>");while(Z<ab.high){var ae=(Z-ab.low)/ac*ad;aa.append($("<div class='label'>"+commatize(Z)+"</div>").css({position:"absolute",left:ae-1}));Z+=af}this.content_div.children(":first").remove();this.content_div.append(aa)}});var x=function(Z){this.track_type="ReferenceTrack";this.hidden=true;j.call(this,null,Z,Z.top_labeltrack);I.call(this);Z.reference_track=this;this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_url=reference_url;this.data_url_extra_params={dbkey:Z.dbkey};this.data_cache=new D(y,this,false);this.tile_cache=new c(r)};n(x.prototype,I.prototype,{draw_tile:function(ah,ae,aa,aj){var ad=this,ab=L*ae;if(aj>this.view.canvas_manager.char_width_px){if(ah===null){ad.content_div.css("height","0px");return}var ac=this.view.canvas_manager.new_canvas();var ai=ac.getContext("2d");ac.width=Math.ceil(ab*aj+ad.left_offset);ac.height=ad.height_px;ai.font=ai.canvas.manager.default_font;ai.textAlign="center";for(var af=0,ag=ah.length;af<ag;af++){var Z=Math.round(af*aj);ai.fillText(ah[af],Z+ad.left_offset,10)}return new b(aa,ae,ac)}this.content_div.css("height","0px")}});var k=function(ad,ab,ae,Z,ac){var aa=this;this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";j.call(this,ad,ab,ab.viewport_container);I.call(this);this.min_height_px=16;this.max_height_px=400;this.height_px=80;this.hda_ldda=ae;this.dataset_id=Z;this.original_dataset_id=Z;this.data_cache=new M(y,this);this.tile_cache=new c(r);this.track_config=new U({track:this,params:[{key:"color",label:"Color",type:"color",default_value:"black"},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.height_px,hidden:true}],saved_values:ac,onchange:function(){aa.vertical_range=aa.prefs.max_value-aa.prefs.min_value;$("#linetrack_"+aa.track_id+"_minval").text(aa.prefs.min_value);$("#linetrack_"+aa.track_id+"_maxval").text(aa.prefs.max_value);aa.tile_cache.clear();aa.draw()}});this.prefs=this.track_config.values;this.height_px=this.track_config.values.height;this.vertical_range=this.track_config.values.max_value-this.track_config.values.min_value;this.add_resize_handle()};n(k.prototype,I.prototype,{add_resize_handle:function(){var Z=this;var ac=false;var ab=false;var aa=$("<div class='track-resize'>");$(Z.container_div).hover(function(){ac=true;aa.show()},function(){ac=false;if(!ab){aa.hide()}});aa.hide().bind("dragstart",function(ad,ae){ab=true;ae.original_height=$(Z.content_div).height()}).bind("drag",function(ae,af){var ad=Math.min(Math.max(af.original_height+af.deltaY,Z.min_height_px),Z.max_height_px);$(Z.content_div).css("height",ad);Z.height_px=ad;Z.draw(true)}).bind("dragend",function(ad,ae){Z.tile_cache.clear();ab=false;if(!ac){aa.hide()}Z.track_config.values.height=Z.height_px}).appendTo(Z.container_div)},predraw_init:function(){var Z=this,aa=Z.view.tracks.indexOf(Z);Z.vertical_range=undefined;return $.getJSON(Z.data_url,{stats:true,chrom:Z.view.chrom,low:null,high:null,hda_ldda:Z.hda_ldda,dataset_id:Z.dataset_id},function(ab){Z.container_div.addClass("line-track");var ad=ab.data;if(isNaN(parseFloat(Z.prefs.min_value))||isNaN(parseFloat(Z.prefs.max_value))){Z.prefs.min_value=ad.min;Z.prefs.max_value=ad.max;$("#track_"+aa+"_minval").val(Z.prefs.min_value);$("#track_"+aa+"_maxval").val(Z.prefs.max_value)}Z.vertical_range=Z.prefs.max_value-Z.prefs.min_value;Z.total_frequency=ad.total_frequency;Z.container_div.find(".yaxislabel").remove();var ae=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+aa+"_minval").text(u(Z.prefs.min_value));var ac=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+aa+"_maxval").text(u(Z.prefs.max_value));ac.css({position:"absolute",top:"24px",left:"10px"});ac.prependTo(Z.container_div);ae.css({position:"absolute",bottom:"2px",left:"10px"});ae.prependTo(Z.container_div)})},draw_tile:function(aj,ad,aa,ai){if(this.vertical_range===undefined){return}var ae=aa*L*ad,ac=L*ad,Z=Math.ceil(ac*ai),ag=this.height_px;var ab=this.view.canvas_manager.new_canvas();ab.width=Z,ab.height=ag;var ah=ab.getContext("2d");var af=new H.LinePainter(aj.data,ae,ae+ac,this.prefs,this.mode);af.draw(ah,Z,ag);return new b(ac,ad,ab)}});var e=function(Z,ae,ad,ah,ag,ab,ac,af){var aa=this;this.track_type="FeatureTrack";this.display_modes=["Auto","Histogram","Dense","Squish","Pack"];this.track_config=new U({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},],saved_values:ag,onchange:function(){aa.tile_cache.clear();aa.draw()}});this.prefs=this.track_config.values;j.call(this,Z,ae,ae.viewport_container);I.call(this,ab,ac,af);this.height_px=0;this.container_div.addClass("feature-track");this.hda_ldda=ad;this.dataset_id=ah;this.original_dataset_id=ah;this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.inc_slots={};this.start_end_dct={};this.tile_cache=new c(d);this.data_cache=new M(20,this);this.left_offset=200;this.painter=H.LinkedFeaturePainter};n(e.prototype,I.prototype,{update_auto_mode:function(Z){if(this.mode=="Auto"){if(Z=="no_detail"){Z="feature spans"}else{if(Z=="summary_tree"){Z="coverage histogram"}}this.mode_div.text("Auto ("+Z+")")}},incremental_slots:function(ad,aa,ac){var ab=this.view.canvas_manager.dummy_context,Z=this.inc_slots[ad];if(!Z||(Z.mode!==ac)){Z=new (p.FeatureSlotter)(ad,ac==="Pack",w,function(ae){return ab.measureText(ae)});Z.mode=ac;this.inc_slots[ad]=Z}return Z.slot_features(aa)},get_summary_tree_data:function(ad,ag,ab,ao){if(ao>ab-ag){ao=ab-ag}var ak=Math.floor((ab-ag)/ao),an=[],ac=0;var ae=0,af=0,aj,am=0,ah=[],al,ai;var aa=function(ar,aq,at,ap){ar[0]=aq+at*ap;ar[1]=aq+(at+1)*ap};while(am<ao&&ae!==ad.length){var Z=false;for(;am<ao&&!Z;am++){aa(ah,ag,am,ak);for(af=ae;af<ad.length;af++){aj=ad[af].slice(1,3);if(is_overlap(aj,ah)){Z=true;break}}if(Z){break}}data_start_index=af;an[an.length]=al=[ah[0],0];for(;af<ad.length;af++){aj=ad[af].slice(1,3);if(is_overlap(aj,ah)){al[1]++}else{break}}if(al[1]>ac){ac=al[1]}am++}return{max:ac,delta:ak,data:an}},draw_tile:function(am,av,az,ai,ac){var ar=this,aB=az*L*av,aa=(az+1)*L*av,ao=aa-aB,at=Math.ceil(ao*ai),aq=this.mode,aF=25,ad=this.left_offset,an,ae;if(aq==="Auto"){if(am.dataset_type==="summary_tree"){aq=am.dataset_type}else{if(am.extra_info==="no_detail"){aq="no_detail"}else{var aE=am.data;if(this.view.high-this.view.low>E){aq="Squish"}else{aq="Pack"}}}this.update_auto_mode(aq)}if(aq==="summary_tree"||aq==="Histogram"){ae=this.summary_draw_height;this.container_div.find(".yaxislabel").remove();var Z=$("<div />").addClass("yaxislabel");Z.text(am.max);Z.css({position:"absolute",top:"24px",left:"10px",color:this.prefs.label_color});Z.prependTo(this.container_div);var ab=this.view.canvas_manager.new_canvas();ab.width=at+ad;ab.height=ae+N;if(am.dataset_type!="summary_tree"){var aj=this.get_summary_tree_data(am.data,aB,aa,200);if(am.max){aj.max=am.max}am=aj}var aC=new H.SummaryTreePainter(am,aB,aa,this.prefs);var au=ab.getContext("2d");au.translate(ad,N);aC.draw(au,at,ae);return new l(az,av,ab,am.max)}var an,ag=1;if(aq==="no_detail"||aq==="Squish"||aq==="Pack"){ag=this.incremental_slots(ai,am.data,aq);an=this.inc_slots[ai].slots}var ah=[];if(am.data){var ak=this.filters_manager.filters;for(var aw=0,ay=am.data.length;aw<ay;aw++){var af=am.data[aw];var ax=false;var al;for(var aA=0,aD=ak.length;aA<aD;aA++){al=ak[aA];al.update_attrs(af);if(!al.keep(af)){ax=true;break}}if(!ax){ah.push(af)}}}var aC=new (this.painter)(ah,aB,aa,this.prefs,aq,ac);var ae=aC.get_required_height(ag)+z;var ab=this.view.canvas_manager.new_canvas();ab.width=at+ad;ab.height=ae;var au=ab.getContext("2d");au.fillStyle=this.prefs.block_color;au.font=au.canvas.manager.default_font;au.textAlign="right";this.container_div.find(".yaxislabel").remove();if(am.message){au.fillStyle="red";au.textAlign="left";var ap=au.textBaseline;au.textBaseline="top";au.fillRect(ad,0,ab.width-ad,1);au.fillText(am.message,ad,2);au.textBaseline=ap;if(!am.data){return new b(az,av,ab,ae)}}this.example_feature=(am.data.length?am.data[0]:undefined);au.translate(ad,z);aC.draw(au,at,ae,an);return new K(az,av,ab)}});var O=function(ac,aa,ae,Z,ab,ad){e.call(this,ac,aa,ae,Z,ab,ad);this.track_type="VcfTrack";this.painter=H.VariantPainter};n(O.prototype,I.prototype,e.prototype);var R=function(ac,aa,ae,Z,ab,ad){e.call(this,ac,aa,ae,Z,ab,ad);this.track_config=new U({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_differences",label:"Show differences only",type:"bool",default_value:true},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},],saved_values:ab,onchange:function(){this.track.tile_cache.clear();this.track.draw()}});this.prefs=this.track_config.values;this.track_type="ReadTrack";this.painter=H.ReadPainter;this.make_name_popup_menu()};n(R.prototype,I.prototype,e.prototype);var P=function(ad,ab,af,Z,ac,ae,aa){e.call(this,ad,ab,af,Z,ac,ae,{},aa);this.track_type="ToolDataFeatureTrack";this.data_url=raw_data_url;this.data_query_wait=1000;this.dataset_check_url=dataset_state_url};n(P.prototype,I.prototype,e.prototype,{predraw_init:function(){var aa=this;var Z=function(){if(aa.data_cache.size()===0){setTimeout(Z,300)}else{aa.data_url=default_data_url;aa.data_query_wait=G;aa.dataset_state_url=converted_datasets_state_url;$.getJSON(aa.dataset_state_url,{dataset_id:aa.dataset_id,hda_ldda:aa.hda_ldda},function(ab){})}};Z()}});S.View=X;S.LineTrack=k;S.FeatureTrack=e;S.ReadTrack=R};var slotting_module=function(c,b){var e=c("class").extend;var d=2,a=5;b.FeatureSlotter=function(j,h,f,g){this.slots={};this.start_end_dct={};this.w_scale=j;this.include_label=h;this.max_rows=f;this.measureText=g};e(b.FeatureSlotter.prototype,{slot_features:function(m){var p=this.w_scale,s=this.slots,h=this.start_end_dct,y=[],A=[],n=0,z=this.max_rows;for(var w=0,x=m.length;w<x;w++){var l=m[w],o=l[0];if(s[o]!==undefined){n=Math.max(n,s[o]);A.push(s[o])}else{y.push(w)}}var q=function(G,H){for(var F=0;F<=z;F++){var D=false,I=h[F];if(I!==undefined){for(var C=0,E=I.length;C<E;C++){var B=I[C];if(H>B[0]&&G<B[1]){D=true;break}}}if(!D){return F}}return -1};for(var w=0,x=y.length;w<x;w++){var l=m[y[w]],o=l[0],u=l[1],f=l[2],r=l[3],g=Math.floor(u*p),k=Math.ceil(f*p),v=this.measureText(r).width,j;if(r!==undefined&&this.include_label){v+=(d+a);if(g-v>=0){g-=v;j="left"}else{k+=v;j="right"}}var t=q(g,k);if(t>=0){if(h[t]===undefined){h[t]=[]}h[t].push([g,k]);s[o]=t;n=Math.max(n,t)}else{}}return n+1}})};var painters_module=function(j,w){var t=j("class").extend;var o=function(H,z,F,y,E,C){if(C===undefined){C=4}var B=y-z;var A=E-F;var D=Math.floor(Math.sqrt(B*B+A*A)/C);var I=B/D;var G=A/D;var x;for(x=0;x<D;x++,z+=I,F+=G){if(x%2!==0){continue}H.fillRect(z,F,C,1)}};var p=function(A,z,x,D){var C=z-D/2,B=z+D/2,E=x-Math.sqrt(D*3/2);A.beginPath();A.moveTo(C,E);A.lineTo(B,E);A.lineTo(z,x);A.lineTo(C,E);A.strokeStyle=this.fillStyle;A.fill();A.stroke();A.closePath()};var m=function(z,B,x,y,A){this.data=z;this.view_start=B;this.view_end=x;this.prefs=t({},this.default_prefs,y);this.mode=A};m.prototype.default_prefs={};var u=function(z,B,x,y,A){m.call(this,z,B,x,y,A)};u.prototype.default_prefs={show_counts:false};u.prototype.draw=function(M,z,L){var E=this.view_start,O=this.view_end-this.view_start,N=z/O;var J=this.data.data,I=this.data.delta,G=this.data.max,B=L;delta_x_px=Math.ceil(I*N);M.save();for(var C=0,D=J.length;C<D;C++){var H=Math.floor((J[C][0]-E)*N);var F=J[C][1];if(!F){continue}var K=F/G*L;if(F!==0&&K<1){K=1}M.fillStyle=this.prefs.block_color;M.fillRect(H,B-K,delta_x_px,K);var A=4;if(this.prefs.show_counts&&(M.measureText(F).width+A)<delta_x_px){M.fillStyle=this.prefs.label_color;M.textAlign="center";M.fillText(F,H+(delta_x_px/2),10)}}M.restore()};var c=function(x,B,D,E,z){m.call(this,x,B,D,E,z);if(this.prefs.min_value===undefined){var F=Infinity;for(var y=0,A=this.data.length;y<A;y++){F=Math.min(F,this.data[y][1])}this.prefs.min_value=F}if(this.prefs.max_value===undefined){var C=-Infinity;for(var y=0,A=this.data.length;y<A;y++){C=Math.max(C,this.data[y][1])}this.prefs.max_value=C}};c.prototype.default_prefs={min_value:undefined,max_value:undefined,mode:"Histogram",color:"#000",overflow_color:"#F66"};c.prototype.draw=function(O,N,L){var F=false,H=this.prefs.min_value,D=this.prefs.max_value,K=D-H,z=L,A=this.view_start,M=this.view_end-this.view_start,B=N/M,I=this.mode,S=this.data;O.save();var T=Math.round(L+H/K*L);if(I!=="Intensity"){O.fillStyle="#aaa";O.fillRect(0,T,N,1)}O.beginPath();O.fillStyle=this.prefs.color;var R,E,C;if(S.length>1){C=Math.ceil((S[1][0]-S[0][0])*B)}else{C=10}for(var P=0,Q=S.length;P<Q;P++){R=Math.round((S[P][0]-A)*B);E=S[P][1];if(E===null){if(F&&I==="Filled"){O.lineTo(R,z)}F=false;continue}if(E<H){E=H}else{if(E>D){E=D}}if(I==="Histogram"){E=Math.round(E/K*z);O.fillRect(R,T,C,-E)}else{if(I==="Intensity"){E=255-Math.floor((E-H)/K*255);O.fillStyle="rgb("+E+","+E+","+E+")";O.fillRect(R,0,C,z)}else{E=Math.round(z-(E-H)/K*z);if(F){O.lineTo(R,E)}else{F=true;if(I==="Filled"){O.moveTo(R,z);O.lineTo(R,E)}else{O.moveTo(R,E)}}}}}if(I==="Filled"){if(F){O.lineTo(R,T);O.lineTo(0,T)}O.fill()}else{O.stroke()}var x=-1,J=-1;O.fillStyle=this.prefs.overflow_color;var G;for(var P=0,Q=S.length;P<Q;P++){E=S[P][1];R=Math.round((S[P][0]-A)*B);if(J>=0&&(E===null||E<D)){O.fillRect(J,0,G+C-J,2);J=-1}else{if(x>=0&&(E===null||E>H)){O.fillRect(x,L-2,G+C-x,2);x=-1}}if(E!==null&&E>D&&J<0){J=R}else{if(E!==null&&E<H&&x<0){x=R}}G=R}O.restore()};var n=function(z,B,x,y,A){m.call(this,z,B,x,y,A)};n.prototype.default_prefs={block_color:"#FFF",connector_color:"#FFF"};t(n.prototype,{get_required_height:function(y){var x=y_scale=this.get_row_height(),z=this.mode;if(z==="no_detail"||z==="Squish"||z==="Pack"){x=y*y_scale}return x+Math.max(Math.round(y_scale/2),5)},draw:function(J,A,I,F){var D=this.data,G=this.view_start,K=this.view_end;J.save();J.fillStyle=this.prefs.block_color;J.textAlign="right";var N=this.view_end-this.view_start,M=A/N,z=this.get_row_height();for(var C=0,E=D.length;C<E;C++){var L=D[C],B=L[0],x=L[1],y=L[2],H=(F&&F[B]!==undefined?F[B]:null);if((x<K&&y>G)&&(this.mode=="Dense"||H!==null)){this.draw_element(J,this.mode,L,H,G,K,M,z,A)}}J.restore()}});var d=10,h=3,l=5,v=10,f=1,r=3,e=3,a=9,k=2,g="#ccc";var q=function(z,B,x,y,A){n.call(this,z,B,x,y,A)};t(q.prototype,n.prototype,{get_row_height:function(){var y=this.mode,x;if(y==="Dense"){x=d}else{if(y==="no_detail"){x=h}else{if(y==="Squish"){x=l}else{x=v}}}return x},draw_element:function(J,C,R,E,L,ab,af,ag,x){var O=R[0],ad=R[1],V=R[2],M=R[3],W=Math.floor(Math.max(0,(ad-L)*af)),K=Math.ceil(Math.min(x,Math.max(0,(V-L)*af))),U=(C==="Dense"?0:(0+E))*ag,I,Z,N=null,ah=null,A=this.prefs.block_color,Y=this.prefs.label_color;if(C=="Dense"){E=1}if(C==="no_detail"){J.fillStyle=A;J.fillRect(W,U+5,K-W,f)}else{var H=R[4],T=R[5],X=R[6],B=R[7];if(T&&X){N=Math.floor(Math.max(0,(T-L)*af));ah=Math.ceil(Math.min(x,Math.max(0,(X-L)*af)))}var ae,P;if(C==="Squish"||C==="Dense"){ae=1;P=e}else{ae=5;P=a}if(!B){if(R.strand){if(R.strand==="+"){J.fillStyle=J.canvas.manager.get_pattern("right_strand_inv")}else{if(R.strand==="-"){J.fillStyle=J.canvas.manager.get_pattern("left_strand_inv")}}}else{J.fillStyle=A}J.fillRect(W,U,K-W,P)}else{var G,Q;if(C==="Squish"||C==="Dense"){J.fillStyle=g;G=U+Math.floor(e/2)+1;Q=1}else{if(H){var G=U;var Q=P;if(H==="+"){J.fillStyle=J.canvas.manager.get_pattern("right_strand")}else{if(H==="-"){J.fillStyle=J.canvas.manager.get_pattern("left_strand")}}}else{J.fillStyle=g;G+=(e/2)+1;Q=1}}J.fillRect(W,G,K-W,Q);for(var ac=0,z=B.length;ac<z;ac++){var D=B[ac],y=Math.floor(Math.max(0,(D[0]-L)*af)),S=Math.ceil(Math.min(x,Math.max((D[1]-L)*af)));if(y>S){continue}J.fillStyle=A;J.fillRect(y,U+(P-ae)/2+1,S-y,ae);if(N!==undefined&&X>T&&!(y>ah||S<N)){var aa=Math.max(y,N),F=Math.min(S,ah);J.fillRect(aa,U+1,F-aa,P);if(B.length==1&&C=="Pack"){if(H==="+"){J.fillStyle=J.canvas.manager.get_pattern("right_strand_inv")}else{if(H==="-"){J.fillStyle=J.canvas.manager.get_pattern("left_strand_inv")}}if(aa+14<F){aa+=2;F-=2}J.fillRect(aa,U+1,F-aa,P)}}}}if(C==="Pack"&&ad>L){J.fillStyle=Y;if(L===0&&W-J.measureText(M).width<0){J.textAlign="left";J.fillText(M,K+k,U+8)}else{J.textAlign="right";J.fillText(M,W-k,U+8)}J.fillStyle=A}}}});var b=function(z,B,x,y,A){n.call(this,z,B,x,y,A)};t(b.prototype,n.prototype,{draw_element:function(Q,L,F,B,T,z,I,R,O){var F=data[i],H=F[0],P=F[1],A=F[2],K=F[3],D=Math.floor(Math.max(0,(P-T)*I)),G=Math.ceil(Math.min(O,Math.max(0,(A-T)*I))),C=(L==="Dense"?0:(0+B))*R,x,U,y=null,J=null;if(no_label){Q.fillStyle=block_color;Q.fillRect(D+left_offset,C+5,G-D,1)}else{var S=F[4],N=F[5],E=F[6];x=9;U=1;Q.fillRect(D+left_offset,C,G-D,x);if(L!=="Dense"&&K!==undefined&&P>T){Q.fillStyle=label_color;if(T===0&&D-Q.measureText(K).width<0){Q.textAlign="left";Q.fillText(K,G+2+left_offset,C+8)}else{Q.textAlign="right";Q.fillText(K,D-2+left_offset,C+8)}Q.fillStyle=block_color}var M=S+" / "+N;if(P>T&&Q.measureText(M).width<(G-D)){Q.fillStyle="white";Q.textAlign="center";Q.fillText(M,left_offset+D+(G-D)/2,C+8);Q.fillStyle=block_color}}}});var s=function(A,C,x,z,B,y){n.call(this,A,C,x,z,B);this.ref_seq=y};s.prototype.default_prefs=t({},n.prototype.default_prefs,{show_insertions:false});t(s.prototype,n.prototype,{get_row_height:function(){var x,y=this.mode;if(y==="Dense"){x=d}else{if(y==="Squish"){x=l}else{x=v;if(this.prefs.show_insertions){x*=2}}}return x},draw_read:function(T,O,K,Y,z,S,H,E,D){T.textAlign="center";var R=this,y=[Y,z],N=0,U=0,Q=0;ref_seq=this.ref_seq,char_width_px=T.canvas.manager.char_width_px;var ad=[];if((O==="Pack"||this.mode==="Auto")&&E!==undefined&&K>char_width_px){Q=Math.round(K/2)}if(!H){H=[[0,E.length]]}for(var L=0,W=H.length;L<W;L++){var I=H[L],A="MIDNSHP=X"[I[0]],M=I[1];if(A==="H"||A==="S"){N-=M}var F=S+N,ac=Math.floor(Math.max(0,(F-Y)*K)),G=Math.floor(Math.max(0,(F+M-Y)*K));if(ac===G){G+=1}switch(A){case"H":break;case"S":case"M":case"=":if(is_overlap([F,F+M],y)){var P=E.slice(U,U+M);if(Q>0){T.fillStyle=this.prefs.block_color;T.fillRect(ac-Q,D+1,G-ac,9);T.fillStyle=g;for(var aa=0,x=P.length;aa<x;aa++){if(this.prefs.show_differences&&ref_seq){var J=ref_seq[F-Y+aa];if(!J||J.toLowerCase()===P[aa].toLowerCase()){continue}}if(F+aa>=Y&&F+aa<=z){var ab=Math.floor(Math.max(0,(F+aa-Y)*K));T.fillText(P[aa],ab,D+9)}}}else{T.fillStyle=this.prefs.block_color;T.fillRect(ac,D+4,G-ac,e)}}U+=M;N+=M;break;case"N":T.fillStyle=g;T.fillRect(ac-Q,D+5,G-ac,1);N+=M;break;case"D":T.fillStyle="red";T.fillRect(ac-Q,D+4,G-ac,3);N+=M;break;case"P":break;case"I":var X=ac-Q;if(is_overlap([F,F+M],y)){var P=E.slice(U,U+M);if(this.prefs.show_insertions){var C=ac-(G-ac)/2;if((O==="Pack"||this.mode==="Auto")&&E!==undefined&&K>char_width_px){T.fillStyle="yellow";T.fillRect(C-Q,D-9,G-ac,9);ad[ad.length]={type:"triangle",data:[X,D+4,5]};T.fillStyle=g;switch(seq_tile_overlap){case (OVERLAP_START):P=P.slice(Y-F);break;case (OVERLAP_END):P=P.slice(0,F-z);break;case (CONTAINED_BY):break;case (CONTAINS):P=P.slice(Y-F,F-z);break}for(var aa=0,x=P.length;aa<x;aa++){var ab=Math.floor(Math.max(0,(F+aa-Y)*K));T.fillText(P[aa],ab-(G-ac)/2,D)}}else{T.fillStyle="yellow";T.fillRect(C,D+(this.mode!=="Dense"?2:5),G-ac,(O!=="Dense"?e:r))}}else{if((O==="Pack"||this.mode==="Auto")&&E!==undefined&&K>char_width_px){ad[ad.length]={type:"text",data:[P.length,X,D+9]}}else{}}}U+=M;break;case"X":U+=M;break}}T.fillStyle="yellow";var Z,B,ae;for(var V=0;V<ad.length;V++){Z=ad[V];B=Z.type;ae=Z.data;if(B==="text"){T.save();T.font="bold "+T.font;T.fillText(ae[0],ae[1],ae[2]);T.restore()}else{if(B=="triangle"){p(T,ae[0],ae[1],ae[2])}}}},draw_element:function(Q,L,D,A,T,y,H,R,O){var G=D[0],P=D[1],z=D[2],I=D[3],C=Math.floor(Math.max(0,(P-T)*H)),E=Math.ceil(Math.min(O,Math.max(0,(z-T)*H))),B=(L==="Dense"?0:(0+A))*R,U=this.prefs.block_color,F=this.prefs.label_color,N=0;if((L==="Pack"||this.mode==="Auto")&&H>Q.canvas.manager.char_width_px){var N=Math.round(H/2)}Q.fillStyle=U;if(D[5] instanceof Array){var M=Math.floor(Math.max(0,(D[4][0]-T)*H)),K=Math.ceil(Math.min(O,Math.max(0,(D[4][1]-T)*H))),J=Math.floor(Math.max(0,(D[5][0]-T)*H)),x=Math.ceil(Math.min(O,Math.max(0,(D[5][1]-T)*H)));if(D[4][1]>=T&&D[4][0]<=y&&D[4][2]){this.draw_read(Q,L,H,T,y,D[4][0],D[4][2],D[4][3],B)}if(D[5][1]>=T&&D[5][0]<=y&&D[5][2]){this.draw_read(Q,L,H,T,y,D[5][0],D[5][2],D[5][3],B)}if(J>K){Q.fillStyle=g;o(Q,K-N,B+5,J-N,B+5)}}else{Q.fillStyle=U;this.draw_read(Q,L,H,T,y,P,D[4],D[5],B)}if(L==="Pack"&&P>T){Q.fillStyle=this.prefs.label_color;var S=1;if(S===0&&C-Q.measureText(I).width<0){Q.textAlign="left";Q.fillText(I,E+k-N,B+8)}else{Q.textAlign="right";Q.fillText(I,C-k-N,B+8)}Q.fillStyle=U}}});w.SummaryTreePainter=u;w.LinePainter=c;w.LinkedFeaturePainter=q;w.ReadPainter=s;w.VariantPainter=b};(function(d){var c={};var b=function(e){return c[e]};var a=function(f,g){var e={};g(b,e);c[f]=e};a("class",class_module);a("slotting",slotting_module);a("painters",painters_module);a("trackster",trackster_module);for(key in c.trackster){d[key]=c.trackster[key]}})(window); \ No newline at end of file --- a/static/scripts/trackster.js Thu May 12 16:53:11 2011 -0400 +++ b/static/scripts/trackster.js Fri May 13 08:32:35 2011 -0400 @@ -999,8 +999,9 @@ $.extend(url_params, this.get_param_values_dict()); // Run tool. + // TODO: rewrite to use $.when(): var json_run_tool = function() { - $.getJSON(run_tool_url, url_params, function(response) { + $.getJSON(rerun_tool_url, url_params, function(response) { if (response === "no converter") { // No converter available for input datasets, so cannot run tool. new_track.container_div.addClass("error"); @@ -1046,18 +1047,19 @@ /** * Filters that enable users to show/hide data points dynamically. */ -var Filter = function(name, index, value) { +var Filter = function(name, index, tool_id, tool_exp_name) { this.name = name; + // Index into payload to filter. this.index = index; - this.value = value; + this.tool_id = tool_id; + // Name to use for filter when building expression for tool. + this.tool_exp_name = tool_exp_name; }; /** * Number filters have a min, max as well as a low, high; low and high are used */ -var NumberFilter = function(name, index) { - this.name = name; - // Index into payload to filter. - this.index = index; +var NumberFilter = function(name, index, tool_id, tool_exp_name) { + Filter.call(this, name, index, tool_id, tool_exp_name); // Filter low/high. These values are used to filter elements. this.low = -Number.MAX_VALUE; this.high = Number.MAX_VALUE; @@ -1148,12 +1150,18 @@ this.track = track; this.filters = []; for (var i = 0; i < filters_list.length; i++) { - var filter_dict = filters_list[i]; - var name = filter_dict.name, type = filter_dict.type, index = filter_dict.index; + var + filter_dict = filters_list[i], + name = filter_dict.name, + type = filter_dict.type, + index = filter_dict.index, + tool_id = filter_dict.tool_id, + tool_exp_name = filter_dict.tool_exp_name; if (type === 'int' || type === 'float') { - this.filters[i] = new NumberFilter(name, index); + this.filters[i] = + new NumberFilter(name, index, tool_id, tool_exp_name); } else { - this.filters[i] = new Filter(name, index, type); + console.log("ERROR: unsupported filter: ", name, type) } } @@ -1283,9 +1291,93 @@ // Add to clear floating layout. $("<div style='clear: both;'/>").appendTo(filter_div); - }); + }); + + // Add button to filter complete dataset. + if (this.filters.length != 0) { + var run_buttons_row = $("<div>").addClass("param-row").appendTo(this.parent_div); + var run_on_dataset_button = $("<input type='submit'>").attr("value", "Run on complete dataset").appendTo(run_buttons_row); + var filter_manager = this; + run_on_dataset_button.click( function() { + filter_manager.run_on_dataset(); + }); + } }; +extend(FiltersManager.prototype, { + /** + * Reset filters to min and max. + */ + reset_filters: function() { + for (var i = 0; i < this.filters.length; i++) { + filter = this.filters[i]; + filter.slider.slider("option", "values", [filter.min, filter.max]); + } + }, + run_on_dataset: function() { + // Get or create dictionary item. + var get_or_create_dict_item = function(dict, key, new_item) { + // Add new item to dict if + if (!(key in dict)) { + dict[key] = new_item; + } + return dict[key]; + }; + + // + // Find and group active filters. Active filters are those being used to hide data. + // Filters with the same tool id are grouped. + // + var active_filters = {}, + filter, + tool_filter_conditions, + operation; + for (var i = 0; i < this.filters.length; i++) { + filter = this.filters[i]; + if (filter.tool_id) { + // Add filtering conditions if filter low/high are set. + if (filter.min != filter.low) { + tool_filter_conditions = get_or_create_dict_item(active_filters, filter.tool_id, []); + tool_filter_conditions[tool_filter_conditions.length] = filter.tool_exp_name + " >= " + filter.low; + } + if (filter.max != filter.high) { + tool_filter_conditions = get_or_create_dict_item(active_filters, filter.tool_id, []); + tool_filter_conditions[tool_filter_conditions.length] = filter.tool_exp_name + " <= " + filter.high; + } + } + } + + // + // Use tools to run filters. + // + for (var tool_id in active_filters) { + var + tool_filters = active_filters[tool_id], + tool_filter_str = "(" + tool_filters.join(") and (") + ")", + url_params = { + cond: tool_filter_str, + input: this.track.dataset_id, + target_dataset_id: this.track.dataset_id, + tool_id: tool_id + }; + + $.getJSON(run_tool_url, url_params, function(response) { + if (response.error) { + // General error. + new_track.container_div.addClass("error"); + new_track.content_div.text(DATA_CANNOT_RUN_TOOL + response.message); + } + else { + // Job submitted and running. + show_modal("Filter Dataset", + tool_id + " is running on the complete dataset. Tool outputs are in dataset's history.", + { "Close" : hide_modal } ); + } + }); + } + } +}); + /** * Container for track configuration data. */ @@ -1683,8 +1775,11 @@ // Show/hide filters menu item. var text = (track.filters_div.is(":visible") ? "Hide filters" : "Show filters"); track_dropdown[text] = function() { - // Toggle filtering div and remake menu. + // Toggle filtering div, reset filters, and remake menu. track.filters_visible = (track.filters_div.is(":visible")); + if (track.filters_visible) { + track.filters_manager.reset_filters(); + } track.filters_div.toggle(); track.make_name_popup_menu(); }; --- a/templates/tracks/browser.mako Thu May 12 16:53:11 2011 -0400 +++ b/templates/tracks/browser.mako Fri May 13 08:32:35 2011 -0400 @@ -65,6 +65,7 @@ var default_data_url = "${h.url_for( action='data' )}", raw_data_url = "${h.url_for( action='raw_data' )}", run_tool_url = "${h.url_for( action='run_tool' )}", + rerun_tool_url = "${h.url_for( action='rerun_tool' )}", reference_url = "${h.url_for( action='reference' )}", chrom_url = "${h.url_for( action='chroms' )}", dataset_state_url = "${h.url_for( action='dataset_state' )}", --- a/templates/visualization/display.mako Thu May 12 16:53:11 2011 -0400 +++ b/templates/visualization/display.mako Fri May 13 08:32:35 2011 -0400 @@ -64,6 +64,7 @@ var default_data_url = "${h.url_for( controller='/tracks', action='data' )}", raw_data_url = "${h.url_for( controller='/tracks', action='raw_data' )}", run_tool_url = "${h.url_for( controller='/tracks', action='run_tool' )}", + rerun_tool_url = "${h.url_for( controller='/tracks', action='run_tool' )}", reference_url = "${h.url_for( controller='/tracks', action='reference' )}", chrom_url = "${h.url_for( controller='/tracks', action='chroms' )}", dataset_state_url = "${h.url_for( controller='/tracks', action='dataset_state' )}", Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket