galaxy-commits
Threads by month
- ----- 2026 -----
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 15302 discussions
galaxy-dist commit b1ec8342053f: Adding NGS simulation tool
by commits-noreply@bitbucket.org 19 Nov '10
by commits-noreply@bitbucket.org 19 Nov '10
19 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kelly Vincent <kpvincent(a)bx.psu.edu>
# Date 1288806772 14400
# Node ID b1ec8342053f3cdcd0a081ff28f077a76bd188cc
# Parent 9d68027b01096e2b32101234878d11946c03d08c
Adding NGS simulation tool
--- /dev/null
+++ b/tool-data/ngs_sim_fasta.loc.sample
@@ -0,0 +1,20 @@
+#This is a sample file distributed with Galaxy that enables the NGS simulation
+#tool to use some FASTA files. You will need to make sure that these FASTA files
+#are in place and then create the ngs_sim.loc file similar to this one (store it
+#in this directory) that points to the locations of those files. The ngs_sim.loc
+#file has this format (white space characters are TAB characters):
+#
+#<unique_build_id><dbkey><display_name><file_base_path>
+#
+#So, for example, if you had hg18chrM.fa in
+#/data/path/hg18/seq/,
+#then the ngs_sim.loc entry would look like this:
+#
+#hg18chrM hg18 hg18chrM /data/path/hg18/seq/hg18chrM.fa
+#
+#Your ngs_sim.loc file should include an entry per line for each FASTA file you
+#have stored.
+#
+#hg18chrM hg18 hg18chrM /data/path/hg18/seq/hg18chrM.fa
+#phiX174 phiX phiX174 /data/path/genome/phiX/seq/phiX.fa
+#pUC18 pUC18 pUC18 /data/path/genome/pUC18/seq/pUC18.fa
Binary file test-data/ngs_simulation_out3.png has changed
--- /dev/null
+++ b/tools/ngs_simulation/ngs_simulation.xml
@@ -0,0 +1,217 @@
+<tool id="ngs_simulation" name="Simulate" version="1.0.0">
+<!--<tool id="ngs_simulation" name="Simulate" force_history_refresh="True" version="1.0.0">-->
+ <description>Illumina runs</description>
+ <command interpreter="python">
+ ngs_simulation.py
+ #if $in_type.input_type == "built-in"
+ --input="${ filter( lambda x: str( x[0] ) == str( $in_type.genome ), $__app__.tool_data_tables[ 'ngs_sim_fasta' ].get_fields() )[0][-1] }"
+ --genome=$genome
+ #else
+ --input=$in_type.input1
+ #end if
+ --read_len=$read_len
+ --avg_coverage=$avg_coverage
+ --error_rate=$error_rate
+ --num_sims=$num_sims
+ --polymorphism=$polymorphism
+ --detection_thresh=$detection_thresh
+ --output_png=$output_png
+ --summary_out=$summary_out
+ --output_summary=$output_summary
+ --new_file_path=$__new_file_path__
+ </command>
+<!-- If want to include all simulation results file
+ sim_results=$sim_results
+ output=$output.id
+-->
+ <inputs>
+ <conditional name="in_type">
+ <param name="input_type" type="select" label="Use a built-in FASTA file or one from the history?">
+ <option value="built-in">Built-in</option>
+ <option value="history">History file</option>
+ </param>
+ <when value="built-in">
+ <param name="genome" type="select" label="Select a built-in genome" help="if your genome of interest is not listed - contact Galaxy team">
+ <options from_data_table="ngs_sim_fasta" />
+ </param>
+ </when>
+ <when value="history">
+ <param name="input1" type="data" format="fasta" label="Input genome (FASTA format)" />
+ </when>
+ </conditional>
+ <param name="read_len" type="integer" value="76" label="Read length" />
+ <param name="avg_coverage" type="integer" value="200" label="Average coverage" />
+ <param name="error_rate" type="float" value="0.001" label="Error rate or quality score" help="Quality score if integer 1 or greater; error rate if between 0 and 1" />
+ <param name="num_sims" type="integer" value="100" label="The number of simulations to run" />
+ <param name="polymorphism" type="select" multiple="true" label="Frequency/ies for minor allele">
+ <option value="0.001">0.001</option>
+ <option value="0.002">0.002</option>
+ <option value="0.003">0.003</option>
+ <option value="0.004">0.004</option>
+ <option value="0.005">0.005</option>
+ <option value="0.006">0.006</option>
+ <option value="0.007">0.007</option>
+ <option value="0.008">0.008</option>
+ <option value="0.009">0.009</option>
+ <option value="0.01">0.01</option>
+ <option value="0.02">0.02</option>
+ <option value="0.03">0.03</option>
+ <option value="0.04">0.04</option>
+ <option value="0.05">0.05</option>
+ <option value="0.06">0.06</option>
+ <option value="0.07">0.07</option>
+ <option value="0.08">0.08</option>
+ <option value="0.09">0.09</option>
+ <option value="0.1">0.1</option>
+ <option value="0.2">0.2</option>
+ <option value="0.3">0.3</option>
+ <option value="0.4">0.4</option>
+ <option value="0.5">0.5</option>
+ <option value="0.6">0.6</option>
+ <option value="0.7">0.7</option>
+ <option value="0.8">0.8</option>
+ <option value="0.9">0.9</option>
+ <option value="1.0">1.0</option>
+ </param>
+ <param name="detection_thresh" type="select" multiple="true" label="Detection thresholds">
+ <option value="0.001">0.001</option>
+ <option value="0.002">0.002</option>
+ <option value="0.003">0.003</option>
+ <option value="0.004">0.004</option>
+ <option value="0.005">0.005</option>
+ <option value="0.006">0.006</option>
+ <option value="0.007">0.007</option>
+ <option value="0.008">0.008</option>
+ <option value="0.009">0.009</option>
+ <option value="0.01">0.01</option>
+ <option value="0.02">0.02</option>
+ <option value="0.03">0.03</option>
+ <option value="0.04">0.04</option>
+ <option value="0.05">0.05</option>
+ <option value="0.06">0.06</option>
+ <option value="0.07">0.07</option>
+ <option value="0.08">0.08</option>
+ <option value="0.09">0.09</option>
+ <option value="0.1">0.1</option>
+ <option value="0.2">0.2</option>
+ <option value="0.3">0.3</option>
+ <option value="0.4">0.4</option>
+ <option value="0.5">0.5</option>
+ <option value="0.6">0.6</option>
+ <option value="0.7">0.7</option>
+ <option value="0.8">0.8</option>
+ <option value="0.9">0.9</option>
+ <option value="1.0">1.0</option>
+ </param>
+ <param name="summary_out" type="boolean" truevalue="true" falsevalue="false" checked="true" label="Include a (text) summary file for all the simulations" />
+<!-- <param name="sim_results" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Output all tabular simulation results" help="Number of polymorphisms times number of detection thresholds"/>
+-->
+ </inputs>
+ <outputs>
+ <data format="png" name="output_png" />
+ <data format="tabular" name="output_summary">
+ <filter>summary_out == True</filter>
+ </data>
+<!--
+ <data format="tabular" name="output">
+ <filter>sim_files_out</filter>
+ </data>
+-->
+ </outputs>
+ <tests>
+ <!--
+ Tests cannot be run because of the non-deterministic element of the simulation.
+ But if you run the following "tests" manually in the browser and check against
+ the output files, they should be very similar to the listed output files.
+ -->
+ <!--
+ <test>
+ <param name="input_type" value="history" />
+ <param name="input1" value="ngs_simulation_in1.fasta" ftype="fasta" />
+ <param name="read_len" value="76" />
+ <param name="avg_coverage" value="200" />
+ <param name="error_rate" value="0.001" />
+ <param name="num_sims" value="25" />
+ <param name="polymorphism" value="0.02,0.04,0.1" />
+ <param name="detection_thresh" value="0.01,0.02" />
+ <param name="summary_out" value="true" />
+ <output name="output_png" file="ngs_simulation_out1.png" />
+ <output name="output_summary" file="ngs_simulation_out2.tabular" />
+ </test>
+ <test>
+ <param name="input_type" value="built-in" />
+ <param name="genome" value="pUC18" />
+ <param name="read_len" value="50" />
+ <param name="avg_coverage" value="150" />
+ <param name="error_rate" value="0.005" />
+ <param name="num_sims" value="25" />
+ <param name="polymorphism" value="0.001,0.005" />
+ <param name="detection_thresh" value="0.001,0.002" />
+ <param name="summary_out" value="false" />
+ <output name="output_png" file="ngs_simulation_out3.png" />
+ </test>
+ -->
+ </tests>
+ <help>
+
+**What it does**
+
+This tool simulates an Illumina run and provides plots of false positives and false negatives. It allows for a range of simulation parameters to be set. Note that this simulation sets only one (randomly chosen) position in the genome as polymorphic, according to the value specified. Superimposed on this are "sequencing errors", which are uniformly (and randomly) distributed. Polymorphisms are assigned using the detection threshold, so if the detection threshold is set to the same as the minor allele frequency, the expected false negative rate is 50%.
+
+**Parameter list**
+
+These are the parameters that should be set for the simulation::
+
+ Read length (which is the same for all reads)
+ Average Coverage
+ Frequency for Minor Allele
+ Sequencing Error Rate
+ Detection Threshold
+ Number of Simulations
+
+You also should choose to use either a built-in genome or supply your own FASTA file.
+
+**Output**
+
+There are one or two. The first is a png that contains two different plots and is always generated. The second is optional and is a text file with some summary information about the simulations that were run. Below are some example outputs for a 10-simulation run on phiX with the default settings::
+
+ Read length 76
+ Average coverage 200
+ Error rate/quality score 0.001
+ Number of simulations 100
+ Frequencies for minor allele 0.002
+ 0.004
+ Detection thresholds 0.003
+ 0.005
+ 0.007
+ Include summary file Yes
+
+Plot output (png):
+
+.. image:: ../static/images/ngs_simulation.png
+
+Summary output (txt)::
+
+ FP FN GENOMESIZE.5386 fprate hetcol errcol
+ Min. : 71.0 Min. :0.0 Mode:logical Min. :0.01318 Min. :0.004 Min. :0.007
+ 1st Qu.:86.0 1st Qu.:1.0 NA's:10 1st Qu.:0.01597 1st Qu.:0.004 1st Qu.:0.007
+ Median :92.5 Median :1.0 NA Median :0.01717 Median :0.004 Median :0.007
+ Mean :93.6 Mean :0.9 NA Mean :0.01738 Mean :0.004 Mean :0.007
+ 3rd Qu.:100.8 3rd Qu.:1.0 NA 3rd Qu.:0.01871 3rd Qu.:0.004 3rd Qu.:0.007
+ Max. :123.0 Max. :1.0 NA Max. :0.02284 Max. :0.004 Max. :0.007
+
+ False Positive Rate Summary
+ 0.003 0.005 0.007
+ 0.001 0.17711 0.10854 0.01673
+ 0.009 0.18049 0.10791 0.01738
+
+ False Negative Rate Summary
+ 0.003 0.005 0.007
+ 0.001 1.0 0.8 1.0
+ 0.009 0.4 0.7 0.9
+
+
+ </help>
+</tool>
+
+
Binary file test-data/ngs_simulation_out1.png has changed
--- a/tool_conf.xml.sample
+++ b/tool_conf.xml.sample
@@ -312,6 +312,9 @@
<tool file="genetrack/genetrack_indexer.xml" /><tool file="genetrack/genetrack_peak_prediction.xml" /></section>
+ <section name="NGS: Simulation" id="ngs-simulation">
+ <tool file="ngs_simulation/ngs_simulation.xml" />
+ </section><section name="SNP/WGA: Data; Filters" id="rgdat"><label text="Data: Import and upload" id="rgimport" /><tool file="data_source/upload.xml"/>
--- /dev/null
+++ b/test-data/ngs_simulation_in1.fasta
@@ -0,0 +1,41 @@
+>gi|209210|gb|L09136.1|SYNPUC18CV pUC18c cloning vector (beta-galactosidase mRNA on complementary strand)
+TCGCGCGTTTCGGTGATGACGGTGAAAACCTCTGACACATGCAGCTCCCGGAGACGGTCACAGCTTGTCT
+GTAAGCGGATGCCGGGAGCAGACAAGCCCGTCAGGGCGCGTCAGCGGGTGTTGGCGGGTGTCGGGGCTGG
+CTTAACTATGCGGCATCAGAGCAGATTGTACTGAGAGTGCACCATATGCGGTGTGAAATACCGCACAGAT
+GCGTAAGGAGAAAATACCGCATCAGGCGCCATTCGCCATTCAGGCTGCGCAACTGTTGGGAAGGGCGATC
+GGTGCGGGCCTCTTCGCTATTACGCCAGCTGGCGAAAGGGGGATGTGCTGCAAGGCGATTAAGTTGGGTA
+ACGCCAGGGTTTTCCCAGTCACGACGTTGTAAAACGACGGCCAGTGCCAAGCTTGCATGCCTGCAGGTCG
+ACTCTAGAGGATCCCCGGGTACCGAGCTCGAATTCGTAATCATGGTCATAGCTGTTTCCTGTGTGAAATT
+GTTATCCGCTCACAATTCCACACAACATACGAGCCGGAAGCATAAAGTGTAAAGCCTGGGGTGCCTAATG
+AGTGAGCTAACTCACATTAATTGCGTTGCGCTCACTGCCCGCTTTCCAGTCGGGAAACCTGTCGTGCCAG
+CTGCATTAATGAATCGGCCAACGCGCGGGGAGAGGCGGTTTGCGTATTGGGCGCTCTTCCGCTTCCTCGC
+TCACTGACTCGCTGCGCTCGGTCGTTCGGCTGCGGCGAGCGGTATCAGCTCACTCAAAGGCGGTAATACG
+GTTATCCACAGAATCAGGGGATAACGCAGGAAAGAACATGTGAGCAAAAGGCCAGCAAAAGGCCAGGAAC
+CGTAAAAAGGCCGCGTTGCTGGCGTTTTTCCATAGGCTCCGCCCCCCTGACGAGCATCACAAAAATCGAC
+GCTCAAGTCAGAGGTGGCGAAACCCGACAGGACTATAAAGATACCAGGCGTTTCCCCCTGGAAGCTCCCT
+CGTGCGCTCTCCTGTTCCGACCCTGCCGCTTACCGGATACCTGTCCGCCTTTCTCCCTTCGGGAAGCGTG
+GCGCTTTCTCATAGCTCACGCTGTAGGTATCTCAGTTCGGTGTAGGTCGTTCGCTCCAAGCTGGGCTGTG
+TGCACGAACCCCCCGTTCAGCCCGACCGCTGCGCCTTATCCGGTAACTATCGTCTTGAGTCCAACCCGGT
+AAGACACGACTTATCGCCACTGGCAGCAGCCACTGGTAACAGGATTAGCAGAGCGAGGTATGTAGGCGGT
+GCTACAGAGTTCTTGAAGTGGTGGCCTAACTACGGCTACACTAGAAGGACAGTATTTGGTATCTGCGCTC
+TGCTGAAGCCAGTTACCTTCGGAAAAAGAGTTGGTAGCTCTTGATCCGGCAAACAAACCACCGCTGGTAG
+CGGTGGTTTTTTTGTTTGCAAGCAGCAGATTACGCGCAGAAAAAAAGGATCTCAAGAAGATCCTTTGATC
+TTTTCTACGGGGTCTGACGCTCAGTGGAACGAAAACTCACGTTAAGGGATTTTGGTCATGAGATTATCAA
+AAAGGATCTTCACCTAGATCCTTTTAAATTAAAAATGAAGTTTTAAATCAATCTAAAGTATATATGAGTA
+AACTTGGTCTGACAGTTACCAATGCTTAATCAGTGAGGCACCTATCTCAGCGATCTGTCTATTTCGTTCA
+TCCATAGTTGCCTGACTCCCCGTCGTGTAGATAACTACGATACGGGAGGGCTTACCATCTGGCCCCAGTG
+CTGCAATGATACCGCGAGACCCACGCTCACCGGCTCCAGATTTATCAGCAATAAACCAGCCAGCCGGAAG
+GGCCGAGCGCAGAAGTGGTCCTGCAACTTTATCCGCCTCCATCCAGTCTATTAATTGTTGCCGGGAAGCT
+AGAGTAAGTAGTTCGCCAGTTAATAGTTTGCGCAACGTTGTTGCCATTGCTACAGGCATCGTGGTGTCAC
+GCTCGTCGTTTGGTATGGCTTCATTCAGCTCCGGTTCCCAACGATCAAGGCGAGTTACATGATCCCCCAT
+GTTGTGCAAAAAAGCGGTTAGCTCCTTCGGTCCTCCGATCGTTGTCAGAAGTAAGTTGGCCGCAGTGTTA
+TCACTCATGGTTATGGCAGCACTGCATAATTCTCTTACTGTCATGCCATCCGTAAGATGCTTTTCTGTGA
+CTGGTGAGTACTCAACCAAGTCATTCTGAGAATAGTGTATGCGGCGACCGAGTTGCTCTTGCCCGGCGTC
+AATACGGGATAATACCGCGCCACATAGCAGAACTTTAAAAGTGCTCATCATTGGAAAACGTTCTTCGGGG
+CGAAAACTCTCAAGGATCTTACCGCTGTTGAGATCCAGTTCGATGTAACCCACTCGTGCACCCAACTGAT
+CTTCAGCATCTTTTACTTTCACCAGCGTTTCTGGGTGAGCAAAAACAGGAAGGCAAAATGCCGCAAAAAA
+GGGAATAAGGGCGACACGGAAATGTTGAATACTCATACTCTTCCTTTTTCAATATTATTGAAGCATTTAT
+CAGGGTTATTGTCTCATGAGCGGATACATATTTGAATGTATTTAGAAAAATAAACAAATAGGGGTTCCGC
+GCACATTTCCCCGAAAAGTGCCACCTGACGTCTAAGAAACCATTATTATCATGACATTAACCTATAAAAA
+TAGGCGTATCACGAGGCCCTTTCGTC
+
--- a/tool_data_table_conf.xml.sample
+++ b/tool_data_table_conf.xml.sample
@@ -1,22 +1,27 @@
<tables>
- <!-- Locations of MAF files that have been indexed with bx-python -->
- <table name="indexed_maf_files">
- <columns>name, value, dbkey, species</columns>
- <file path="tool-data/maf_index.loc" />
+ <!-- Locations of indexes in the BFAST mapper format -->
+ <table name="bfast_indexes" comment_char="#">
+ <columns>value, dbkey, formats, name, path</columns>
+ <file path="tool-data/bfast_indexes.loc" />
+ </table>
+ <!-- Locations of indexes in the Bowtie mapper format -->
+ <table name="bowtie_indexes">
+ <columns>name, value</columns>
+ <file path="tool-data/bowtie_indices.loc" /></table><!-- Locations of indexes in the BWA mapper format --><table name="bwa_indexes"><columns>name, value</columns><file path="tool-data/bwa_index.loc" /></table>
- <!-- Locations of indexes in the Bowtie mapper format -->
- <table name="bowtie_indexes">
- <columns>name, value</columns>
- <file path="tool-data/bowtie_indices.loc" />
+ <!-- Locations of MAF files that have been indexed with bx-python -->
+ <table name="indexed_maf_files">
+ <columns>name, value, dbkey, species</columns>
+ <file path="tool-data/maf_index.loc" /></table>
- <!-- Locations of indexes in the BFAST mapper format -->
- <table name="bfast_indexes" comment_char="#">
- <columns>value, dbkey, formats, name, path</columns>
- <file path="tool-data/bfast_indexes.loc" />
+ <!-- Locations of fasta files appropriate for NGS simulation -->
+ <table name="ngs_sim_fasta" comment_char="#">
+ <columns>value, dbkey, name, path</columns>
+ <file path="tool-data/ngs_sim_fasta.loc" /></table></tables>
--- /dev/null
+++ b/tools/ngs_simulation/ngs_simulation.py
@@ -0,0 +1,280 @@
+#!/usr/bin/env python
+
+"""
+Runs Ben's simulation.
+
+usage: %prog [options]
+ -i, --input=i: Input genome (FASTA format)
+ -g, --genome=g: If built-in, the genome being used
+ -l, --read_len=l: Read length
+ -c, --avg_coverage=c: Average coverage
+ -e, --error_rate=e: Error rate (0-1)
+ -n, --num_sims=n: Number of simulations to run
+ -p, --polymorphism=p: Frequency/ies for minor allele (comma-separate list of 0-1)
+ -d, --detection_thresh=d: Detection thresholds (comma-separate list of 0-1)
+ -p, --output_png=p: Plot output
+ -s, --summary_out=s: Whether or not to output a file with summary of all simulations
+ -m, --output_summary=m: File name for output summary of all simulations
+ -f, --new_file_path=f: Directory for summary output files
+
+"""
+# removed output of all simulation results on request (not working)
+# -r, --sim_results=r: Output all tabular simulation results (number of polymorphisms times number of detection thresholds)
+# -o, --output=o: Base name for summary output for each run
+
+from rpy import *
+import os
+import random, sys, tempfile
+from galaxy import eggs
+import pkg_resources; pkg_resources.require( "bx-python" )
+from bx.cookbook import doc_optparse
+
+def stop_err( msg ):
+ sys.stderr.write( '%s\n' % msg )
+ sys.exit()
+
+def __main__():
+ #Parse Command Line
+ options, args = doc_optparse.parse( __doc__ )
+ # validate parameters
+ error = ''
+ try:
+ read_len = int( options.read_len )
+ if read_len <= 0:
+ raise Exception, ' greater than 0'
+ except TypeError, e:
+ error = ': %s' % str( e )
+ if error:
+ stop_err( 'Make sure your number of reads is an integer value%s' % error )
+ error = ''
+ try:
+ avg_coverage = int( options.avg_coverage )
+ if avg_coverage <= 0:
+ raise Exception, ' greater than 0'
+ except Exception, e:
+ error = ': %s' % str( e )
+ if error:
+ stop_err( 'Make sure your average coverage is an integer value%s' % error )
+ error = ''
+ try:
+ error_rate = float( options.error_rate )
+ if error_rate >= 1.0:
+ error_rate = 10 ** ( -error_rate / 10.0 )
+ elif error_rate < 0:
+ raise Exception, ' between 0 and 1'
+ except Exception, e:
+ error = ': %s' % str( e )
+ if error:
+ stop_err( 'Make sure the error rate is a decimal value%s or the quality score is at least 1' % error )
+ try:
+ num_sims = int( options.num_sims )
+ except TypeError, e:
+ stop_err( 'Make sure the number of simulations is an integer value: %s' % str( e ) )
+ if len( options.polymorphism ) > 0:
+ polymorphisms = [ float( p ) for p in options.polymorphism.split( ',' ) ]
+ else:
+ stop_err( 'Select at least one polymorphism value to use' )
+ if len( options.detection_thresh ) > 0:
+ detection_threshes = [ float( dt ) for dt in options.detection_thresh.split( ',' ) ]
+ else:
+ stop_err( 'Select at least one detection threshold to use' )
+
+ # mutation dictionaries
+ hp_dict = { 'A':'G', 'G':'A', 'C':'T', 'T':'C', 'N':'N' } # heteroplasmy dictionary
+ mt_dict = { 'A':'C', 'C':'A', 'G':'T', 'T':'G', 'N':'N'} # misread dictionary
+
+ # read fasta file to seq string
+ all_lines = open( options.input, 'rb' ).readlines()
+ seq = ''
+ for line in all_lines:
+ line = line.rstrip()
+ if line.startswith('>'):
+ pass
+ else:
+ seq += line.upper()
+ seq_len = len( seq )
+
+ # output file name template
+# removed output of all simulation results on request (not working)
+# if options.sim_results == "true":
+# out_name_template = os.path.join( options.new_file_path, 'primary_output%s_' + options.output + '_visible_tabular' )
+# else:
+# out_name_template = tempfile.NamedTemporaryFile().name + '_%s'
+ out_name_template = tempfile.NamedTemporaryFile().name + '_%s'
+ print 'out_name_template:', out_name_template
+
+ # set up output files
+ outputs = {}
+ i = 1
+ for p in polymorphisms:
+ outputs[ p ] = {}
+ for d in detection_threshes:
+ outputs[ p ][ d ] = out_name_template % i
+ i += 1
+
+ # run sims
+ for polymorphism in polymorphisms:
+ for detection_thresh in detection_threshes:
+ output = open( outputs[ polymorphism ][ detection_thresh ], 'wb' )
+ output.write( 'FP\tFN\tGENOMESIZE=%s\n' % seq_len )
+ sim_count = 0
+ while sim_count < num_sims:
+ # randomly pick heteroplasmic base index
+ hbase = random.choice( range( 0, seq_len ) )
+ #hbase = seq_len/2#random.randrange( 0, seq_len )
+ # create 2D quasispecies list
+ qspec = map( lambda x: [], [0] * seq_len )
+ # simulate read indices and assign to quasispecies
+ i = 0
+ while i < ( avg_coverage * ( seq_len / read_len ) ): # number of reads (approximates coverage)
+ start = random.choice( range( 0, seq_len ) )
+ #start = seq_len/2#random.randrange( 0, seq_len ) # assign read start
+ if random.random() < 0.5: # positive sense read
+ end = start + read_len # assign read end
+ if end > seq_len: # overshooting origin
+ read = range( start, seq_len ) + range( 0, ( end - seq_len ) )
+ else: # regular read
+ read = range( start, end )
+ else: # negative sense read
+ end = start - read_len # assign read end
+ if end < -1: # overshooting origin
+ read = range( start, -1, -1) + range( ( seq_len - 1 ), ( seq_len + end ), -1 )
+ else: # regular read
+ read = range( start, end, -1 )
+ # assign read to quasispecies list by index
+ for j in read:
+ if j == hbase and random.random() < polymorphism: # heteroplasmic base is variant with p = het
+ ref = hp_dict[ seq[ j ] ]
+ else: # ref is the verbatim reference nucleotide (all positions)
+ ref = seq[ j ]
+ if random.random() < error_rate: # base in read is misread with p = err
+ qspec[ j ].append( mt_dict[ ref ] )
+ else: # otherwise we carry ref through to the end
+ qspec[ j ].append(ref)
+ # last but not least
+ i += 1
+ bases, fpos, fneg = {}, 0, 0 # last two will be outputted to summary file later
+ for i, nuc in enumerate( seq ):
+ cov = len( qspec[ i ] )
+ bases[ 'A' ] = qspec[ i ].count( 'A' )
+ bases[ 'C' ] = qspec[ i ].count( 'C' )
+ bases[ 'G' ] = qspec[ i ].count( 'G' )
+ bases[ 'T' ] = qspec[ i ].count( 'T' )
+ # calculate max NON-REF deviation
+ del bases[ nuc ]
+ maxdev = float( max( bases.values() ) ) / cov
+ # deal with non-het sites
+ if i != hbase:
+ if maxdev >= detection_thresh: # greater than detection threshold = false positive
+ fpos += 1
+ # deal with het sites
+ if i == hbase:
+ hnuc = hp_dict[ nuc ] # let's recover het variant
+ if ( float( bases[ hnuc ] ) / cov ) < detection_thresh: # less than detection threshold = false negative
+ fneg += 1
+ del bases[ hnuc ] # ignore het variant
+ maxdev = float( max( bases.values() ) ) / cov # check other non-ref bases at het site
+ if maxdev >= detection_thresh: # greater than detection threshold = false positive (possible)
+ fpos += 1
+ # output error sums and genome size to summary file
+ output.write( '%d\t%d\n' % ( fpos, fneg ) )
+ sim_count += 1
+ # close output up
+ output.close()
+
+ # Parameters (heteroplasmy, error threshold, colours)
+ r( '''
+ het=c(%s)
+ err=c(%s)
+ grade = (0:32)/32
+ hues = rev(gray(grade))
+ ''' % ( ','.join( [ str( p ) for p in polymorphisms ] ), ','.join( [ str( d ) for d in detection_threshes ] ) ) )
+
+ # Suppress warnings
+ r( 'options(warn=-1)' )
+
+ # Create allsum (for FP) and allneg (for FN) objects
+ r( 'allsum <- data.frame()' )
+ for polymorphism in polymorphisms:
+ for detection_thresh in detection_threshes:
+ output = outputs[ polymorphism ][ detection_thresh ]
+ cmd = '''
+ ngsum = read.delim('%s', header=T)
+ ngsum$fprate <- ngsum$FP/%s
+ ngsum$hetcol <- %s
+ ngsum$errcol <- %s
+ allsum <- rbind(allsum, ngsum)
+ ''' % ( output, seq_len, polymorphism, detection_thresh )
+ r( cmd )
+
+ if os.path.getsize( output ) == 0:
+ for p in outputs.keys():
+ for d in outputs[ p ].keys():
+ sys.stderr.write(outputs[ p ][ d ] + ' '+str( os.path.getsize( outputs[ p ][ d ] ) )+'\n')
+
+ if options.summary_out == "true":
+ r( 'write.table(summary(ngsum), file="%s", quote=FALSE, sep="\t", row.names=FALSE)' % options.output_summary )
+
+ # Summary objects (these could be printed)
+ r( '''
+ tr_pos <- tapply(allsum$fprate,list(allsum$hetcol,allsum$errcol), mean)
+ tr_neg <- tapply(allsum$FN,list(allsum$hetcol,allsum$errcol), mean)
+ cat('\nFalse Positive Rate Summary\n\t', file='%s', append=T, sep='\t')
+ write.table(format(tr_pos, digits=4), file='%s', append=T, quote=F, sep='\t')
+ cat('\nFalse Negative Rate Summary\n\t', file='%s', append=T, sep='\t')
+ write.table(format(tr_neg, digits=4), file='%s', append=T, quote=F, sep='\t')
+ ''' % tuple( [ options.output_summary ] * 4 ) )
+
+ # Setup graphs
+ #pdf(paste(prefix,'_jointgraph.pdf',sep=''), 15, 10)
+ r( '''
+ png('%s', width=800, height=500, units='px', res=250)
+ layout(matrix(data=c(1,2,1,3,1,4), nrow=2, ncol=3), widths=c(4,6,2), heights=c(1,10,10))
+ ''' % options.output_png )
+
+ # Main title
+ genome = ''
+ if options.genome:
+ genome = '%s: ' % options.genome
+ r( '''
+ par(mar=c(0,0,0,0))
+ plot(1, type='n', axes=F, xlab='', ylab='')
+ text(1,1,paste('%sVariation in False Positives and Negatives (', %s, ' simulations, coverage ', %s,')', sep=''), font=2, family='sans', cex=0.7)
+ ''' % ( genome, options.num_sims, options.avg_coverage ) )
+
+ # False positive boxplot
+ r( '''
+ par(mar=c(5,4,2,2), las=1, cex=0.35)
+ boxplot(allsum$fprate ~ allsum$errcol, horizontal=T, ylim=rev(range(allsum$fprate)), cex.axis=0.85)
+ title(main='False Positives', xlab='false positive rate', ylab='')
+ ''' )
+
+ # False negative heatmap (note zlim command!)
+ num_polys = len( polymorphisms )
+ num_dets = len( detection_threshes )
+ r( '''
+ par(mar=c(5,4,2,1), las=1, cex=0.35)
+ image(1:%s, 1:%s, tr_neg, zlim=c(0,1), col=hues, xlab='', ylab='', axes=F, border=1)
+ axis(1, at=1:%s, labels=rownames(tr_neg), lwd=1, cex.axis=0.85, axs='i')
+ axis(2, at=1:%s, labels=colnames(tr_neg), lwd=1, cex.axis=0.85)
+ title(main='False Negatives', xlab='minor allele frequency', ylab='detection threshold')
+ ''' % ( num_polys, num_dets, num_polys, num_dets ) )
+
+ # Scale alongside
+ r( '''
+ par(mar=c(2,2,2,3), las=1)
+ image(1, grade, matrix(grade, ncol=length(grade), nrow=1), col=hues, xlab='', ylab='', xaxt='n', las=1, cex.axis=0.85)
+ title(main='Key', cex=0.35)
+ mtext('false negative rate', side=1, cex=0.35)
+ ''' )
+
+ # Close graphics
+ r( '''
+ layout(1)
+ dev.off()
+ ''' )
+
+ # Tidy up
+# r( 'rm(folder,prefix,sim,cov,het,err,grade,hues,i,j,ngsum)' )
+
+if __name__ == "__main__" : __main__()
--- /dev/null
+++ b/test-data/ngs_simulation_out2.tabular
@@ -0,0 +1,19 @@
+ FP FN GENOMESIZE.2686 fprate hetcol errcol
+Min. :0.00 Min. :0 Mode:logical Min. :0.000e+00 Min. :0.1 Min. :0.02
+1st Qu.:0.00 1st Qu.:0 NA's:25 1st Qu.:0.000e+00 1st Qu.:0.1 1st Qu.:0.02
+Median :0.00 Median :0 NA Median :0.000e+00 Median :0.1 Median :0.02
+Mean :0.04 Mean :0 NA Mean :1.489e-05 Mean :0.1 Mean :0.02
+3rd Qu.:0.00 3rd Qu.:0 NA 3rd Qu.:0.000e+00 3rd Qu.:0.1 3rd Qu.:0.02
+Max. :1.00 Max. :0 NA Max. :3.723e-04 Max. :0.1 Max. :0.02
+
+False Positive Rate Summary
+ 0.01 0.02
+0.02 9.710e-03 4.468e-05
+0.04 9.680e-03 1.489e-05
+0.1 9.695e-03 1.489e-05
+
+False Negative Rate Summary
+ 0.01 0.02
+0.02 0.16 0.52
+0.04 0.00 0.04
+0.1 0.00 0.00
1
0
galaxy-dist commit 16bd91a54888: Must be logged in to use api keys. Fix small typo in error messages
by commits-noreply@bitbucket.org 19 Nov '10
by commits-noreply@bitbucket.org 19 Nov '10
19 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kanwei Li <kanwei(a)gmail.com>
# Date 1288813870 14400
# Node ID 16bd91a548887fb0be24b981c2d66fb7ef7b1922
# Parent cf8bef68e8befb8b6631578b71ff69f701fc0d4d
Must be logged in to use api keys. Fix small typo in error messages
--- a/lib/galaxy/web/controllers/user.py
+++ b/lib/galaxy/web/controllers/user.py
@@ -984,6 +984,7 @@ class User( BaseController, UsesFormDefi
message=message,
lines_skipped=lines_skipped )
@web.expose
+ @web.require_login()
def api_keys( self, trans, **kwd ):
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
--- a/lib/galaxy/web/framework/__init__.py
+++ b/lib/galaxy/web/framework/__init__.py
@@ -84,7 +84,7 @@ def require_login( verb="perform this ac
return func( self, trans, *args, **kwargs )
else:
return trans.show_error_message(
- 'You must be <a target="_top" href="%s">logged in</a> to %s</div>.'
+ 'You must be <a target="_top" href="%s">logged in</a> to %s.'
% ( url_for( controller='user', action='login', webapp=webapp ), verb ), use_panels=use_panels )
return decorator
return argcatcher
1
0
galaxy-dist commit cf8bef68e8be: Correction to docstring for Tool.build_param_dict() -- from peter@maubp.freeserve.co.uk
by commits-noreply@bitbucket.org 19 Nov '10
by commits-noreply@bitbucket.org 19 Nov '10
19 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User jeremy goecks <jeremy.goecks(a)emory.edu>
# Date 1288810958 14400
# Node ID cf8bef68e8befb8b6631578b71ff69f701fc0d4d
# Parent b1ec8342053f3cdcd0a081ff28f077a76bd188cc
Correction to docstring for Tool.build_param_dict() -- from peter(a)maubp.freeserve.co.uk
--- a/lib/galaxy/tools/__init__.py
+++ b/lib/galaxy/tools/__init__.py
@@ -1333,7 +1333,7 @@ class Tool:
line. Each value is wrapped in a `InputValueWrapper`, which allows
all the attributes of the value to be used in the template, *but*
when the __str__ method is called it actually calls the
- `to_param_dict_value` method of the associated input.
+ `to_param_dict_string` method of the associated input.
"""
param_dict = dict()
# All parameters go into the param_dict
1
0
galaxy-dist commit cdf8d61425cc: Fix typo when running a workflow that contains an updated tool.
by commits-noreply@bitbucket.org 19 Nov '10
by commits-noreply@bitbucket.org 19 Nov '10
19 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Daniel Blankenberg <dan(a)bx.psu.edu>
# Date 1288898016 14400
# Node ID cdf8d61425cce011f98b1f24bd9fe19dc59b10ab
# Parent bc690ccf23396e1c7e29e8ee801996ac3e3d3409
Fix typo when running a workflow that contains an updated tool.
--- a/templates/workflow/run.mako
+++ b/templates/workflow/run.mako
@@ -123,7 +123,7 @@ from galaxy.jobs.actions.post import Act
%if has_upgrade_messages:
<div class="warningmessage">
- Problems were encourered when loading this workflow, likely due to tool
+ Problems were encountered when loading this workflow, likely due to tool
version changes. Missing parameter values have been replaced with default.
Please review the parameter values below.
</div>
1
0
galaxy-dist commit 9d68027b0109: Add options to Tophat wrapper for specifying own splice junctions.
by commits-noreply@bitbucket.org 19 Nov '10
by commits-noreply@bitbucket.org 19 Nov '10
19 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User jeremy goecks <jeremy.goecks(a)emory.edu>
# Date 1288805582 14400
# Node ID 9d68027b01096e2b32101234878d11946c03d08c
# Parent 49f0e8441a4da6b1ec03250448ab84854f07aa77
Add options to Tophat wrapper for specifying own splice junctions.
--- a/tools/ngs_rna/tophat_wrapper.py
+++ b/tools/ngs_rna/tophat_wrapper.py
@@ -29,6 +29,24 @@ def __main__():
help='The maximum intron length. When searching for junctions ab initio, TopHat will ignore donor/acceptor pairs farther than this many bases apart, except when such a pair is supported by a split segment alignment of a long read.' )
parser.add_option( '-F', '--junction_filter', dest='junction_filter', help='Filter out junctions supported by too few alignments (number of reads divided by average depth of coverage)' )
parser.add_option( '-g', '--max_multihits', dest='max_multihits', help='Maximum number of alignments to be allowed' )
+ parser.add_option( '', '--seg-mismatches', dest='seg_mismatches', help='Number of mismatches allowed in each segment alignment for reads mapped independently' )
+ parser.add_option( '', '--seg-length', dest='seg_length', help='Minimum length of read segments' )
+
+ # Options for supplying own junctions
+ parser.add_option( '-G', '--GTF', dest='gene_model_annotations', help='Supply TopHat with a list of gene model annotations. \
+ TopHat will use the exon records in this file to build \
+ a set of known splice junctions for each gene, and will \
+ attempt to align reads to these junctions even if they \
+ would not normally be covered by the initial mapping.')
+ parser.add_option( '-j', '--raw-juncs', dest='raw_juncs', help='Supply TopHat with a list of raw junctions. Junctions are \
+ specified one per line, in a tab-delimited format. Records \
+ look like: <chrom><left><right><+/-> left and right are \
+ zero-based coordinates, and specify the last character of the \
+ left sequenced to be spliced to the first character of the right \
+ sequence, inclusive.')
+ parser.add_option( '', '--no-novel-juncs', action="store_true", dest='no_novel_juncs', help="Only look for junctions indicated in the \
+ supplied GFF file. (ignored without -G)")
+ # Types of search.
parser.add_option( '', '--microexon-search', action="store_true", dest='microexon_search', help='With this option, the pipeline will attempt to find alignments incident to microexons. Works only for reads 50bp or longer.')
parser.add_option( '', '--closure-search', action="store_true", dest='closure_search', help='Enables the mate pair closure-based search for junctions. Closure-based search should only be used when the expected inner distance between mates is small (<= 50bp)')
parser.add_option( '', '--no-closure-search', action="store_false", dest='closure_search' )
@@ -41,8 +59,6 @@ def __main__():
parser.add_option( '', '--max-closure-intron', dest='max_closure_intron', help='Maximum intron length that may be found during closure search' )
parser.add_option( '', '--min-coverage-intron', dest='min_coverage_intron', help='Minimum intron length that may be found during coverage search' )
parser.add_option( '', '--max-coverage-intron', dest='max_coverage_intron', help='Maximum intron length that may be found during coverage search' )
- parser.add_option( '', '--seg-mismatches', dest='seg_mismatches', help='Number of mismatches allowed in each segment alignment for reads mapped independently' )
- parser.add_option( '', '--seg-length', dest='seg_length', help='Minimum length of read segments' )
# Wrapper options.
parser.add_option( '-1', '--input1', dest='input1', help='The (forward or single-end) reads file in Sanger FASTQ format' )
@@ -107,6 +123,15 @@ def __main__():
if float( options.junction_filter ) != 0.0:
opts += ' -F %s' % options.junction_filter
opts += ' -g %s' % options.max_multihits
+ # Custom junctions options.
+ if options.gene_model_annotations:
+ opts += ' -G %s' % options.gene_model_annotations
+ if options.raw_juncs:
+ opts += ' -j %s' % options.raw_juncs
+ if options.no_novel_juncs:
+ opts += ' --no-novel-juncs'
+
+ # Search type options.
if options.coverage_search:
opts += ' --coverage-search --min-coverage-intron %s --max-coverage-intron %s' % ( options.min_coverage_intron, options.max_coverage_intron )
else:
--- a/tools/ngs_rna/tophat_wrapper.xml
+++ b/tools/ngs_rna/tophat_wrapper.xml
@@ -45,6 +45,21 @@
--max-segment-intron $singlePaired.sParams.max_segment_intron
--seg-mismatches=$singlePaired.sParams.seg_mismatches
--seg-length=$singlePaired.sParams.seg_length
+
+ ## Supplying junctions parameters.
+ #if $singlePaired.sParams.own_junctions.use_junctions == "Yes":
+ #if $singlePaired.sParams.own_junctions.gene_model_ann.use_annotations == "Yes":
+ -G $singlePaired.sParams.own_junctions.gene_model_ann.gene_annotation_model
+ #end if
+ #if $singlePaired.sParams.own_junctions.raw_juncs.use_juncs == "Yes":
+ -j $singlePaired.sParams.own_junctions.raw_juncs.raw_juncs
+ #end if
+ ## TODO: No idea why a string cast is necessary, but it is:
+ #if str($singlePaired.sParams.own_junctions.no_novel_juncs) == "Yes":
+ --no-novel-juncs
+ #end if
+ #end if
+
#if $singlePaired.sParams.closure_search.use_search == "Yes":
--closure-search
--min-closure-exon $singlePaired.sParams.closure_search.min_closure_exon
@@ -60,8 +75,8 @@
#else:
--no-coverage-search
#end if
- ## No idea why the type conversion is necessary, but it seems to be.
- #if str ($singlePaired.sParams.microexon_search) == "Yes":
+ ## TODO: No idea why the type conversion is necessary, but it seems to be.
+ #if str($singlePaired.sParams.microexon_search) == "Yes":
--microexon-search
#end if
#end if
@@ -81,6 +96,21 @@
--max-segment-intron $singlePaired.pParams.max_segment_intron
--seg-mismatches=$singlePaired.pParams.seg_mismatches
--seg-length=$singlePaired.pParams.seg_length
+
+ ## Supplying junctions parameters.
+ #if $singlePaired.pParams.own_junctions.use_junctions == "Yes":
+ #if $singlePaired.pParams.own_junctions.gene_model_ann.use_annotations == "Yes":
+ -G $singlePaired.pParams.own_junctions.gene_model_ann.gene_annotation_model
+ #end if
+ #if $singlePaired.pParams.own_junctions.raw_juncs.use_juncs == "Yes":
+ -j $singlePaired.pParams.own_junctions.raw_juncs.raw_juncs
+ #end if
+ ## TODO: No idea why type cast is necessary, but it is:
+ #if str($singlePaired.pParams.own_junctions.no_novel_juncs) == "Yes":
+ --no-novel-juncs
+ #end if
+ #end if
+
#if $singlePaired.pParams.closure_search.use_search == "Yes":
--closure-search
--min-closure-exon $singlePaired.pParams.closure_search.min_closure_exon
@@ -96,7 +126,7 @@
#else:
--no-coverage-search
#end if
- ## No idea why the type conversion is necessary, but it seems to be.
+ ## TODO: No idea why the type conversion is necessary, but it seems to be.
#if str ($singlePaired.pParams.microexon_search) == "Yes":
--microexon-search
#end if
@@ -146,6 +176,42 @@
<param name="max_segment_intron" type="integer" value="500000" label="Maximum intron length that may be found during split-segment (default) search" /><param name="seg_mismatches" type="integer" value="2" label="Number of mismatches allowed in each segment alignment for reads mapped independently" /><param name="seg_length" type="integer" value="25" label="Minimum length of read segments" />
+
+ <!-- Options for supplying own junctions. -->
+ <conditional name="own_junctions">
+ <param name="use_junctions" type="select" label="Use Own Junctions">
+ <option value="No">No</option>
+ <option value="Yes">Yes</option>
+ </param>
+ <when value="Yes">
+ <conditional name="gene_model_ann">
+ <param name="use_annotations" type="select" label="Use Gene Annotation Model">
+ <option value="No">No</option>
+ <option value="Yes">Yes</option>
+ </param>
+ <when value="No" />
+ <when value="Yes">
+ <param format="gtf" name="gene_annotation_model" type="data" label="Gene Model Annotations" help="TopHat will use the exon records in this file to build a set of known splice junctions for each gene, and will attempt to align reads to these junctions even if they would not normally be covered by the initial mapping."/>
+ </when>
+ </conditional>
+ <conditional name="raw_juncs">
+ <param name="use_juncs" type="select" label="Use Raw Junctions">
+ <option value="No">No</option>
+ <option value="Yes">Yes</option>
+ </param>
+ <when value="No" />
+ <when value="Yes">
+ <param format="interval" name="raw_juncs" type="data" label="Raw Junctions" help="Supply TopHat with a list of raw junctions. Junctions are specified one per line, in a tab-delimited format. Records look like: [chrom] [left] [right] [+/-] left and right are zero-based coordinates, and specify the last character of the left sequenced to be spliced to the first character of the right sequence, inclusive."/>
+ </when>
+ </conditional>
+ <param name="no_novel_juncs" type="select" label="Only look for supplied junctions">
+ <option value="No">No</option>
+ <option value="Yes">Yes</option>
+ </param>
+ </when>
+ <when value="No" />
+ </conditional><!-- /own_junctions -->
+
<!-- Closure search. --><conditional name="closure_search"><param name="use_search" type="select" label="Use Closure Search">
@@ -201,6 +267,41 @@
<param name="max_segment_intron" type="integer" value="500000" label="Maximum intron length that may be found during split-segment (default) search" /><param name="seg_mismatches" type="integer" value="2" label="Number of mismatches allowed in each segment alignment for reads mapped independently" /><param name="seg_length" type="integer" value="25" label="Minimum length of read segments" />
+ <!-- Options for supplying own junctions. -->
+ <conditional name="own_junctions">
+ <param name="use_junctions" type="select" label="Use Own Junctions">
+ <option value="No">No</option>
+ <option value="Yes">Yes</option>
+ </param>
+ <when value="Yes">
+ <conditional name="gene_model_ann">
+ <param name="use_annotations" type="select" label="Use Gene Annotation Model">
+ <option value="No">No</option>
+ <option value="Yes">Yes</option>
+ </param>
+ <when value="No" />
+ <when value="Yes">
+ <param format="gtf" name="gene_annotation_model" type="data" label="Gene Model Annotations" help="TopHat will use the exon records in this file to build a set of known splice junctions for each gene, and will attempt to align reads to these junctions even if they would not normally be covered by the initial mapping."/>
+ </when>
+ </conditional>
+ <conditional name="raw_juncs">
+ <param name="use_juncs" type="select" label="Use Raw Junctions">
+ <option value="No">No</option>
+ <option value="Yes">Yes</option>
+ </param>
+ <when value="No" />
+ <when value="Yes">
+ <param format="interval" name="raw_juncs" type="data" label="Raw Junctions" help="Supply TopHat with a list of raw junctions. Junctions are specified one per line, in a tab-delimited format. Records look like: [chrom] [left] [right] [+/-] left and right are zero-based coordinates, and specify the last character of the left sequenced to be spliced to the first character of the right sequence, inclusive."/>
+ </when>
+ </conditional>
+ <param name="no_novel_juncs" type="select" label="Only look for supplied junctions">
+ <option value="No">No</option>
+ <option value="Yes">Yes</option>
+ </param>
+ </when>
+ <when value="No" />
+ </conditional><!-- /own_junctions -->
+
<!-- Closure search. --><conditional name="closure_search"><param name="use_search" type="select" label="Use Closure Search">
@@ -385,8 +486,11 @@ This is a list of implemented Tophat opt
-F/--min-isoform-fraction 0.0-1.0 TopHat filters out junctions supported by too few alignments. Suppose a junction spanning two exons, is supported by S reads. Let the average depth of coverage of
exon A be D, and assume that it is higher than B. If S / D is less than the minimum isoform fraction, the junction is not reported. A value of zero disables the
filter. The default is 0.15.
- -g/--max-multihits INT Instructs TopHat to allow up to this many alignments to the reference for a given read, and suppresses all alignments for reads with more than this many
+ -g/--max-multihits INT Instructs TopHat to allow up to this many alignments to the reference for a given read, and suppresses all alignments for reads with more than this many
alignments. The default is 40.
+ -G/--GTF [GTF 2.2 file] Supply TopHat with a list of gene model annotations. TopHat will use the exon records in this file to build a set of known splice junctions for each gene, and will attempt to align reads to these junctions even if they would not normally be covered by the initial mapping.
+ -j/--raw-juncs [juncs file] Supply TopHat with a list of raw junctions. Junctions are specified one per line, in a tab-delimited format. Records look like: [chrom] [left] [right] [+/-], left and right are zero-based coordinates, and specify the last character of the left sequenced to be spliced to the first character of the right sequence, inclusive.
+ -no-novel-juncs Only look for junctions indicated in the supplied GFF file. (ignored without -G)
--no-closure-search Disables the mate pair closure-based search for junctions. Currently, has no effect - closure search is off by default.
--closure-search Enables the mate pair closure-based search for junctions. Closure-based search should only be used when the expected inner distance between mates is small (about or less than 50bp)
--no-coverage-search Disables the coverage based search for junctions.
1
0
galaxy-dist commit 6838e10e5912: Fix for TextToolParameter.get_html_field when provided value is an empty string but default value specified in tool is non-empty string. Fixes issue with rerun button where if a user had input an empty string, the form displayed when rerun would have the default value from the tool and not the actual previously specified value.
by commits-noreply@bitbucket.org 19 Nov '10
by commits-noreply@bitbucket.org 19 Nov '10
19 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Daniel Blankenberg <dan(a)bx.psu.edu>
# Date 1288818754 14400
# Node ID 6838e10e5912cec46060bda189841edba305ac1d
# Parent 16bd91a548887fb0be24b981c2d66fb7ef7b1922
Fix for TextToolParameter.get_html_field when provided value is an empty string but default value specified in tool is non-empty string. Fixes issue with rerun button where if a user had input an empty string, the form displayed when rerun would have the default value from the tool and not the actual previously specified value.
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -165,10 +165,11 @@ class TextToolParameter( ToolParameter )
self.value = elem.get( 'value' )
self.area = string_as_bool( elem.get( 'area', False ) )
def get_html_field( self, trans=None, value=None, other_values={} ):
+ if value is None: value = self.value
if self.area:
- return form_builder.TextArea( self.name, self.size, value or self.value )
+ return form_builder.TextArea( self.name, self.size, value )
else:
- return form_builder.TextField( self.name, self.size, value or self.value )
+ return form_builder.TextField( self.name, self.size, value )
def get_initial_value( self, trans, context ):
return self.value
1
0
galaxy-dist commit 37477f7d10e7: Data Libraries: Pre-generate and cache variables so that expensive functions like jQuery.siblings, jQuery.filter and jQuery.find only have to be called a minimum amount of times. Provides significant speedup to loading of large data libraries.
by commits-noreply@bitbucket.org 19 Nov '10
by commits-noreply@bitbucket.org 19 Nov '10
19 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kanwei Li <kanwei(a)gmail.com>
# Date 1288749068 14400
# Node ID 37477f7d10e7407186bd189fdec9e114e4b8f3d2
# Parent 4053c425b536b9878f6f8bdfac75453adec7bdf3
Data Libraries: Pre-generate and cache variables so that expensive functions like jQuery.siblings, jQuery.filter and jQuery.find only have to be called a minimum amount of times. Provides significant speedup to loading of large data libraries.
--- a/templates/library/common/browse_library.mako
+++ b/templates/library/common/browse_library.mako
@@ -68,7 +68,7 @@
}
}
};
-
+
var save_folder_state = function() {
var state = {};
$("tr.folderRow").each( function() {
@@ -79,12 +79,17 @@
};
$("#library-grid").each(function() {
- // Recursively fill in children and descendents of each row
- var process_row = function(q, parents) {
+
+ var child_of_parent_cache = {};
+ // Recursively fill in children and descendents of each row
+ var process_row = function(q, parents) {
// Find my index
- var index = q.parent().children().index(q);
+ var parent = q.parent(),
+ this_level = child_of_parent_cache[parent] || (child_of_parent_cache[parent] = parent.children());
+
+ var index = this_level.index(q);
// Find my immediate children
- var children = q.siblings().filter("[parent='" + index + "']");
+ var children = $(par_child_dict[index]);
// Recursively handle them
var descendents = children;
children.each( function() {
@@ -103,8 +108,7 @@
}
save_folder_state();
};
- $(q).find("span.expandLink").click(expand_fn);
- $(q).find("span.expandLink a").click(expand_fn);
+ $("." + q.attr("id") + "-click").click(expand_fn);
// Check/uncheck boxes in subfolders.
q.children("td").children("input[type=checkbox]").click( function() {
if ( $(this).is(":checked") ) {
@@ -112,15 +116,32 @@
} else {
descendents.find("input[type=checkbox]").attr("checked", false);
// If you uncheck a lower level checkbox, uncheck the boxes above it
- // (since deselecting a child means the parent is not fully selected any
- // more).
+ // (since deselecting a child means the parent is not fully selected any more).
parents.children("td").children("input[type=checkbox]").attr("checked", false);
}
});
// return descendents for use by parent
return descendents;
- }
- $(this).find("tbody tr").not("[parent]").each( function() {
+ }
+
+ // Initialize dict[parent_id] = rows_which_have_that_parent_id_as_parent_attr
+ var par_child_dict = {},
+ no_parent = [];
+
+ $(this).find("tbody tr").each( function() {
+ if (this.hasAttribute("parent")) {
+ var parent = this.getAttribute("parent");
+ if (par_child_dict[parent] !== undefined) {
+ par_child_dict[parent].push(this);
+ } else {
+ par_child_dict[parent] = [this];
+ }
+ } else {
+ no_parent.push(this);
+ }
+ });
+
+ $(no_parent).each( function() {
descendents = process_row( $(this), $([]) );
descendents.hide();
});
@@ -338,7 +359,8 @@
info_association, inherited = folder.get_info_association( restrict=True )
%>
%if not root_folder and ( not folder.deleted or show_deleted ):
- <tr id="folder-${trans.security.encode_id(folder.id)}" class="folderRow libraryOrFolderRow"
+ <% encoded_id = trans.security.encode_id(folder.id) %>
+ <tr id="folder-${encoded_id}" class="folderRow libraryOrFolderRow"
%if parent is not None:
parent="${parent}"
style="display: none;"
@@ -349,9 +371,9 @@
%if folder.deleted:
<span class="libraryItem-error">
%endif
- <span class="expandLink"><span class="rowIcon"></span>
+ <span class="expandLink folder-${encoded_id}-click"><span class="rowIcon"></span><div style="float: left; margin-left: 2px;" class="menubutton split popup" id="folder_img-${folder.id}-popup">
- <a href="javascript:void(0);">${folder.name}</a>
+ <a class="folder-${encoded_id}-click" href="javascript:void(0);">${folder.name}</a></div>
%if folder.deleted:
</span>
1
0
galaxy-dist commit 569483091092: Keep the sample's bar code incormation when editn the sample row in the non-admin user view.
by commits-noreply@bitbucket.org 19 Nov '10
by commits-noreply@bitbucket.org 19 Nov '10
19 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1288731289 14400
# Node ID 56948309109207f932a113e464409432c7a38df7
# Parent 27c152bb441a0136720dbbc0c7cb293e581b8f5f
Keep the sample's bar code incormation when editn the sample row in the non-admin user view.
--- a/templates/requests/common/common.mako
+++ b/templates/requests/common/common.mako
@@ -153,6 +153,7 @@
<input type="text" name="sample_${current_sample_index}_barcode" value="${current_sample['barcode']}" size="10"/>
%else:
${current_sample['barcode']}
+ <input type="hidden" name="sample_${current_sample_index}_barcode" value="${current_sample['barcode']}"/>
%endif
</td>
%endif
@@ -261,7 +262,7 @@
%elif sample:
<tr><td>${current_sample_name}</td>
- %if is_submitted or is_complete:
+ %if display_bar_code:
<td>${current_sample_barcode}</td>
%endif
%if is_unsubmitted:
1
0
galaxy-dist commit 27c152bb441a: More sample tracking bug fixes - tweaked permissions on displaying buttons, and fixed exceptions thrown when ddata transfer congid file is incorrect.
by commits-noreply@bitbucket.org 19 Nov '10
by commits-noreply@bitbucket.org 19 Nov '10
19 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1288730067 14400
# Node ID 27c152bb441a0136720dbbc0c7cb293e581b8f5f
# Parent 6497a8cfd12e477e9c92dd183c4abb81d469ba51
More sample tracking bug fixes - tweaked permissions on displaying buttons, and fixed exceptions thrown when ddata transfer congid file is incorrect.
--- a/lib/galaxy/web/controllers/requests_admin.py
+++ b/lib/galaxy/web/controllers/requests_admin.py
@@ -541,7 +541,7 @@ class RequestsAdmin( BaseController, Use
return sample.request.name + '_' + sample.name + '_' + name
if opt == options.EXPERIMENT_NAME:
return sample.request.name + '_' + name
- def __setup_datatx_user( self, trans, library, folder ):
+ def __setup_datatx_user( self, trans, sample ):
"""
Sets up the datatx user:
- Checks if the user exists, if not creates them.
@@ -550,9 +550,25 @@ class RequestsAdmin( BaseController, Use
"""
# Retrieve the upload user login information from the config file
config = ConfigParser.ConfigParser()
- config.read( 'transfer_datasets.ini' )
- email = config.get( "data_transfer_user_login_info", "email" )
- password = config.get( "data_transfer_user_login_info", "password" )
+ ok = True
+ try:
+ config.read( 'transfer_datasets.ini' )
+ except Exception, e:
+ message = "Error attempting to read config file named 'transfer_datasets.ini'. Make sure this file is correct."
+ ok = False
+ try:
+ email = config.get( "data_transfer_user_login_info", "email" )
+ password = config.get( "data_transfer_user_login_info", "password" )
+ except Exception, e:
+ message = "The 'data_transfer_user_login_info' section is missing from the 'transfer_datasets.ini'. Make sure this file is correct."
+ ok = False
+ if not ok:
+ status = 'error'
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='manage_datasets',
+ sample_id=trans.security.encode_id( sample.id ),
+ status=status,
+ message=message ) )
# check if the user already exists
datatx_user = trans.sa_session.query( trans.model.User ) \
.filter( trans.model.User.table.c.email==email ) \
@@ -570,14 +586,14 @@ class RequestsAdmin( BaseController, Use
datatx_user_private_role = trans.app.security_agent.get_private_user_role( datatx_user )
# Make sure this user has LIBRARY_ADD permissions on the target library and folder.
# If not, give them permission.
- if not trans.app.security_agent.can_add_library_item( datatx_user_roles, library ):
+ if not trans.app.security_agent.can_add_library_item( datatx_user_roles, sample.library ):
lp = trans.model.LibraryPermissions( trans.app.security_agent.permitted_actions.LIBRARY_ADD.action,
- library,
+ sample.library,
datatx_user_private_role )
trans.sa_session.add( lp )
- if not trans.app.security_agent.can_add_library_item( datatx_user_roles, folder ):
+ if not trans.app.security_agent.can_add_library_item( datatx_user_roles, sample.folder ):
lfp = trans.model.LibraryFolderPermissions( trans.app.security_agent.permitted_actions.LIBRARY_ADD.action,
- folder,
+ sample.folder,
datatx_user_private_role )
trans.sa_session.add( lfp )
trans.sa_session.flush()
@@ -646,7 +662,7 @@ class RequestsAdmin( BaseController, Use
message=message) )
def __start_datatx( self, trans, sample, selected_sample_datasets ):
- datatx_user = self.__setup_datatx_user( trans, sample.library, sample.folder )
+ datatx_user = self.__setup_datatx_user( trans, sample )
# Validate sequencer information
datatx_info = sample.request.type.datatx_info
if not datatx_info['host'] or not datatx_info['username'] or not datatx_info['password']:
@@ -660,7 +676,7 @@ class RequestsAdmin( BaseController, Use
action='manage_datasets',
sample_id=trans.security.encode_id( sample.id ),
status=status,
- message=message) )
+ message=message ) )
@web.expose
def update_sample_dataset_status(self, trans, cntrller, sample_dataset_ids, new_status, error_msg=None ):
# check if the new status is a valid transfer status
--- a/templates/requests/common/common.mako
+++ b/templates/requests/common/common.mako
@@ -120,20 +120,25 @@
if sample:
trans.sa_session.refresh( sample.request )
is_complete = sample.request.is_complete
+ is_rejected = request.is_rejected
is_submitted = sample.request.is_submitted
is_unsubmitted = sample.request.is_unsubmitted
+ display_checkboxes = editing_samples and ( is_complete or is_rejected or is_submitted )
+ display_bar_code = request.samples and ( is_complete or is_rejected or is_submitted )
+ display_datasets = request.samples and ( is_complete or is_rejected or is_submitted )
else:
is_complete = False
is_submitted = False
is_unsubmitted = False
+ display_checkboxes = False
%><%
- if is_submitted and editing_samples and trans.security.encode_id( sample.id ) in encoded_selected_sample_ids:
+ if display_checkboxes and trans.security.encode_id( sample.id ) in encoded_selected_sample_ids:
checked_str = "checked"
else:
checked_str = ""
%>
- %if is_submitted and editing_samples:
+ %if display_checkboxes:
<td><input type="checkbox" name=select_sample_${sample.id} id="sample_checkbox" value="true" ${checked_str}/><input type="hidden" name=select_sample_${sample.id} id="sample_checkbox" value="true"/></td>
%endif
<td valign="top">
@@ -142,12 +147,14 @@
<i>${' (required)' }</i></div></td>
- %if sample and is_submitted or is_complete:
- %if is_admin:
- <td valign="top"><input type="text" name="sample_${current_sample_index}_barcode" value="${current_sample['barcode']}" size="10"/></td>
- %else:
- ${current_sample['barcode']}
- %endif
+ %if display_bar_code:
+ <td valign="top">
+ %if is_admin:
+ <input type="text" name="sample_${current_sample_index}_barcode" value="${current_sample['barcode']}" size="10"/>
+ %else:
+ ${current_sample['barcode']}
+ %endif
+ </td>
%endif
%if sample:
%if is_unsubmitted:
@@ -160,7 +167,7 @@
%endif
<td valign="top">${current_sample['library_select_field'].get_html()}</td><td valign="top">${current_sample['folder_select_field'].get_html()}</td>
- %if is_submitted or is_complete:
+ %if display_datasets:
<%
if sample:
label = str( len( sample.datasets ) )
@@ -182,11 +189,15 @@
trans.sa_session.refresh( request )
is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
is_complete = request.is_complete
+ is_rejected = request.is_rejected
is_submitted = request.is_submitted
is_unsubmitted = request.is_unsubmitted
can_add_samples = request.is_unsubmitted
can_delete_samples = request.samples and not is_complete
can_edit_samples = request.samples and ( is_admin or not is_complete )
+ display_checkboxes = editing_samples and ( is_complete or is_rejected or is_submitted )
+ display_bar_code = request.samples and ( is_complete or is_rejected or is_submitted )
+ display_datasets = request.samples and ( is_complete or is_rejected or is_submitted )
%>
${grid_header}
%if render_buttons and ( can_add_samples or can_edit_samples ):
@@ -202,22 +213,22 @@
<table class="grid"><thead><tr>
- %if is_submitted and editing_samples:
+ %if display_checkboxes:
<th><input type="checkbox" id="checkAll" name=select_all_samples_checkbox value="true" onclick='checkAllFields(1);'/><input type="hidden" name=select_all_samples_checkbox value="true"/></th>
%endif
<th>Name</th>
- %if is_submitted or is_complete:
+ %if display_bar_code:
<th>Barcode</th>
%endif
<th>State</th><th>Data Library</th><th>Folder</th>
- %if is_submitted or is_complete:
+ %if display_datasets:
<th>Datasets Selected</th><th>Datasets Transferred</th>
%endif
<th>
- %if editing_samples:
+ %if can_delete_samples:
Delete
%endif
</th>
@@ -245,7 +256,7 @@
except:
sample = None
%>
- %if not is_complete and editing_samples:
+ %if editing_samples:
<tr>${render_editable_sample_row( is_admin, sample, current_sample_index, current_sample, encoded_selected_sample_ids )}</tr>
%elif sample:
<tr>
1
0
galaxy-dist commit 4053c425b536: No longer pre-generate menus on page load for popup-style menus. Instead, create menu dynamically when needed, greatly improving load time especially on data libraries with large number of potential menus.
by commits-noreply@bitbucket.org 19 Nov '10
by commits-noreply@bitbucket.org 19 Nov '10
19 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kanwei Li <kanwei(a)gmail.com>
# Date 1288748718 14400
# Node ID 4053c425b536b9878f6f8bdfac75453adec7bdf3
# Parent e000a6800e1cbfa15a190bb2aff90a5956882a43
No longer pre-generate menus on page load for popup-style menus. Instead, create menu dynamically when needed, greatly improving load time especially on data libraries with large number of potential menus.
Remove the creation of a background element that closes the active menu clicked. Instead, bind an event to close active menus to the document object of current and all other framesets. Tested in IE.
Update Tool Search/Recently Used code to reflect new changes.
Made some small tweaks to pass JSlint
--- a/templates/root/index.mako
+++ b/templates/root/index.mako
@@ -46,10 +46,8 @@
"Export to File": function() {
galaxy_main.location = "${h.url_for( controller='history', action='export_archive' )}";
},
- "Delete": function()
- {
- if ( confirm( "Really delete the current history?" ) )
- {
+ "Delete": function() {
+ if ( confirm( "Really delete the current history?" ) ) {
galaxy_main.location = "${h.url_for( controller='history', action='delete_current' )}";
}
},
@@ -59,98 +57,108 @@
}
});
+ var menu_options = {}; // Holds dictionary of { label: toggle_fn }
+
+ SHOW_TOOL = "Show Tool Search";
+ HIDE_TOOL = "Hide Tool Search";
+ SHOW_RECENT = "Show Recently Used";
+ HIDE_RECENT = "Hide Recently Used";
+
+ var toggle_tool_search_fn = function() {
+ // Show/hide menu and update vars, user preferences.
+ var menu = $("#galaxy_tools").contents().find('#tool-search'),
+ pref_value, menu_option_text, old_text;
+ if (menu.is(":visible")) {
+ // Hide menu.
+ pref_value = "False";
+ menu_option_text = SHOW_TOOL;
+ old_text = HIDE_TOOL;
+
+ // Reset search.
+ reset_tool_search(true);
+ } else {
+ // Show menu.
+ pref_value = "True";
+ menu_option_text = HIDE_TOOL;
+ old_text = SHOW_TOOL;
+ }
+ menu.toggle();
+
+ // Update menu option.
+ delete menu_options[old_text];
+ menu_options[menu_option_text] = toggle_tool_search_fn;
+ make_popupmenu( $("#tools-options-button"), menu_options );
+ galaxy_async.set_user_pref("show_tool_search", pref_value);
+ };
+
+ var toggle_recently_used_fn = function() {
+ // Show/hide menu.
+ var ru_menu = $('#galaxy_tools').contents().find('#recently_used_wrapper'),
+ ru_menu_body = ru_menu.find(".toolSectionBody"),
+ pref_value, old_text, menu_option_text;
+ if (ru_menu.hasClass("user_pref_visible")) {
+ // Hide menu.
+ ru_menu_body.slideUp();
+ ru_menu.slideUp();
+
+ // Set vars used below and in tool menu frame.
+ pref_value = "False";
+ old_text = HIDE_RECENT;
+ menu_option_text = SHOW_RECENT;
+ } else {
+ // "Show" menu.
+ if (!$('#galaxy_tools').contents().find('#tool-search-query').hasClass("search_active")) {
+ // Default.
+ ru_menu.slideDown();
+ } else {
+ // Search active: tf there are matching tools in RU menu, show menu.
+ if ( ru_menu.find(".toolTitle.search_match").length !== 0 ) {
+ ru_menu.slideDown();
+ ru_menu_body.slideDown();
+ }
+ }
+ // Set vars used below and in tool menu frame.
+ pref_value = "True";
+ old_text = SHOW_RECENT;
+ menu_option_text = HIDE_RECENT;
+ }
+
+ // Update menu class and option.
+ ru_menu.toggleClass("user_pref_hidden user_pref_visible");
+ delete menu_options[old_text];
+ menu_options[menu_option_text] = toggle_recently_used_fn;
+ make_popupmenu( $("#tools-options-button"), menu_options );
+ galaxy_async.set_user_pref("show_recently_used_menu", pref_value);
+ };
+
// Init tool options.
- make_popupmenu( $("#tools-options-button"), {
- ## Search tools menu item.
- %if trans.app.toolbox_search.enabled:
- <%
- show_tool_search = False
- if trans.user:
- show_tool_search = trans.user.preferences.get( "show_tool_search", "False" )
-
- if show_tool_search == "True":
- initial_text = "Hide Search"
- else:
- initial_text = "Search Tools"
- %>
- "${initial_text}": function() {
- // Show/hide menu and update vars, user preferences.
- var menu = $("#galaxy_tools").contents().find('#tool-search');
- if (menu.is(":visible"))
- {
- // Hide menu.
- pref_value = "False";
- menu_option_text = "Search Tools";
- menu.toggle();
-
- // Reset search.
- reset_tool_search(true);
- }
- else
- {
- // Show menu.
- pref_value = "True";
- menu_option_text = "Hide Search";
- menu.toggle();
- }
-
- // Update menu option.
- $("#tools-options-button-menu").find("li").eq(0).text(menu_option_text);
-
- galaxy_async.set_user_pref("show_tool_search", pref_value);
- },
- %endif
- ## Recently used tools menu.
- %if trans.user:
- <%
- if trans.user.preferences.get( 'show_recently_used_menu', 'False' ) == 'True':
- action = "Hide"
- else:
- action = "Show"
- %>
- "${action} Recently Used": function() {
- // Show/hide menu.
- var ru_menu = $('#galaxy_tools').contents().find('#recently_used_wrapper');
- var ru_menu_body = ru_menu.find(".toolSectionBody");
- var pref_value = null;
- var menu_option_text = null;
- if (ru_menu.hasClass("user_pref_visible"))
- {
- // Hide menu.
- ru_menu_body.slideUp();
- ru_menu.slideUp();
-
- // Set vars used below and in tool menu frame.
- pref_value = "False";
- menu_option_text = "Show Recently Used";
- }
- else
- {
- // "Show" menu.
- if (!$('#galaxy_tools').contents().find('#tool-search-query').hasClass("search_active"))
- // Default.
- ru_menu.slideDown();
- else
- // Search active: tf there are matching tools in RU menu, show menu.
- if ( ru_menu.find(".toolTitle.search_match").length != 0 )
- {
- ru_menu.slideDown();
- ru_menu_body.slideDown();
- }
-
- // Set vars used below and in tool menu frame.
- pref_value = "True";
- menu_option_text = "Hide Recently Used";
- }
-
- // Update menu class and option.
- ru_menu.toggleClass("user_pref_hidden user_pref_visible");
- $("#tools-options-button-menu").find("li").eq(1).text(menu_option_text);
-
- galaxy_async.set_user_pref("show_recently_used_menu", pref_value);
- }
- %endif
- });
+ ## Search tools menu item.
+ %if trans.app.toolbox_search.enabled:
+ <%
+ show_tool_search = False
+ if trans.user:
+ show_tool_search = trans.user.preferences.get( "show_tool_search", "False" )
+
+ if show_tool_search == "True":
+ action = "HIDE_TOOL"
+ else:
+ action = "SHOW_TOOL"
+ %>
+ menu_options[ ${action} ] = toggle_tool_search_fn;
+ %endif
+ ## Recently used tools menu.
+ %if trans.user:
+ <%
+ if trans.user.preferences.get( 'show_recently_used_menu', 'False' ) == 'True':
+ action = "HIDE_RECENT"
+ else:
+ action = "SHOW_RECENT"
+ %>
+ menu_options[ ${action} ] = toggle_recently_used_fn;
+ %endif
+
+
+ make_popupmenu( $("#tools-options-button"), menu_options );
});
</script></%def>
--- a/static/scripts/galaxy.base.js
+++ b/static/scripts/galaxy.base.js
@@ -7,7 +7,7 @@ if (!Array.indexOf) {
}
}
return -1;
- }
+ };
}
// Returns the number of keys (elements) in an array/dictionary.
@@ -39,93 +39,89 @@ function obj_length(obj) {
});
};
-function ensure_popup_helper() {
- // And the helper below the popup menus
- if ( $( "#popup-helper" ).length === 0 ) {
- $( "<div id='popup-helper'/>" ).css( {
- background: 'white', opacity: 0, zIndex: 15000,
- position: 'absolute', top: 0, left: 0, width: '100%', height: '100%'
- } ).appendTo( "body" ).hide();
- }
-}
-
-function attach_popupmenu( button_element, wrapper ) {
- var clean = function() {
- wrapper.unbind().hide();
- $("#popup-helper").unbind( "click.popupmenu" ).hide();
- // $(document).unbind( "click.popupmenu" );
- };
- var click_handler = function( e ) {
- // var o = $(button_element).offset();
- $("#popup-helper").bind( "click.popupmenu", clean ).show();
- // $(document).bind( "click.popupmenu", clean );
- // Show off screen to get size right
- wrapper.click( clean ).css( { left: 0, top: -1000 } ).show();
- // console.log( e.pageX, $(document).scrollLeft() + $(window).width(), $(menu_element).width() );
- var x = e.pageX - wrapper.width() / 2 ;
- x = Math.min( x, $(document).scrollLeft() + $(window).width() - $(wrapper).width() - 20 );
- x = Math.max( x, $(document).scrollLeft() + 20 );
- // console.log( e.pageX, $(document).scrollLeft() + $(window).width(), $(menu_element).width() );
-
-
- wrapper.css( {
- top: e.pageY - 5,
- left: x
- } );
- return false;
- };
- $(button_element).bind("click", click_handler);
+// Toggle popup menu options using regular expression on option names.
+function show_hide_popupmenu_options( menu, option_name_re, show ) {
+ show = (show === undefined ? true : show );
+ var re = new RegExp(option_name_re);
+ $(menu).find("li").each( function() {
+ if ( re.exec($(this).text()) ) {
+ if (show) {
+ $(this).show();
+ } else {
+ $(this).hide();
+ }
+ }
+ });
}
function make_popupmenu( button_element, options ) {
- ensure_popup_helper();
- // var container_element = $(button_element);
- // if ( container_element.parent().hasClass( "combo-button" ) ) {
- // container_element = container_element.parent();
- // }
- // container_element).css( "position", "relative" );
- var menu_element = $( "<ul id='" + button_element.attr('id') + "-menu'></ul>" );
- if (obj_length(options) <= 0) {
- $("<li/>").html("No options").appendTo(menu_element);
- }
- $.each( options, function( k, v ) {
- if (v) {
- $("<li/>").html(k).click(v).appendTo(menu_element);
- } else {
- $("<li class='head'/>").html(k).appendTo(menu_element);
- }
+ button_element.bind("click.show_popup", function(e) {
+ // Close existing visible menus
+ $(".popmenu-wrapper").remove();
+
+
+ // Need setTimeouts so clicks don't interfere with each other
+ setTimeout( function() {
+ // Dynamically generate the wrapper holding all the selectable options of the menu.
+ var menu_element = $( "<ul id='" + button_element.attr('id') + "-menu'></ul>" );
+ if (obj_length(options) <= 0) {
+ $("<li>No Options.</li>").appendTo(menu_element);
+ }
+ $.each( options, function( k, v ) {
+ if (v) {
+ $("<li/>").html(k).click(v).appendTo(menu_element);
+ } else {
+ $("<li class='head'/>").html(k).appendTo(menu_element);
+ }
+ });
+ var wrapper = $( "<div class='popmenu-wrapper' style='position: absolute;left: 0; top: -1000;'>" );
+ wrapper.append( menu_element )
+ .append( "<div class='overlay-border'>" )
+ .appendTo( "body" );
+
+ var x = e.pageX - wrapper.width() / 2 ;
+ x = Math.min( x, $(document).scrollLeft() + $(window).width() - $(wrapper).width() - 20 );
+ x = Math.max( x, $(document).scrollLeft() + 20 );
+
+ wrapper.css( {
+ top: e.pageY - 5,
+ left: x
+ } );
+ }, 10);
+
+ setTimeout( function() {
+ // Bind click event to current window and all frames to remove any visible menus
+ // Bind to document object instead of window object for IE compat
+ var close_popup = function(el) {
+ $(el).bind("click.close_popup", function() {
+ $(".popmenu-wrapper").remove();
+ el.unbind("click.close_popup");
+ });
+ };
+ close_popup( $(window.document) ); // Current frame
+ close_popup( $(window.top.document) ); // Parent frame
+ for (var frame_id = window.top.frames.length; frame_id--;) { // Sibling frames
+ var frame = $(window.top.frames[frame_id].document);
+ close_popup(frame);
+ }
+ }, 50);
+
+ return false;
});
- var wrapper = $( "<div class='popmenu-wrapper'>" );
- wrapper.append( menu_element )
- .append( "<div class='overlay-border'>" )
- .css( "position", "absolute" )
- .appendTo( "body" )
- .hide();
- attach_popupmenu( button_element, wrapper );
- return menu_element;
-}
-
-// Toggle popup menu options using regular expression on option names.
-function show_hide_popupmenu_options( menu, option_name_re, show ) {
- var show = (show === undefined ? true : show );
- var re = new RegExp(option_name_re);
- $(menu).find("li").each( function() {
- if ( re.exec( $(this).text() ) )
- if (show)
- $(this).show();
- else
- $(this).hide();
- });
+
}
function make_popup_menus() {
jQuery( "div[popupmenu]" ).each( function() {
var options = {};
- $(this).find( "a" ).each( function() {
- var confirmtext = $(this).attr( "confirm" ),
- href = $(this).attr( "href" ),
- target = $(this).attr( "target" );
- options[ $(this).text() ] = function() {
+ var menu = $(this);
+ menu.find( "a" ).each( function() {
+ var link = $(this),
+ link_dom = link.get(0);
+ var confirmtext = link_dom.getAttribute( "confirm" ),
+ href = link_dom.getAttribute( "href" ),
+ target = link_dom.getAttribute( "target" );
+ options[ link.text() ] = function() {
if ( !confirmtext || confirm( confirmtext ) ) {
var f = window;
if ( target == "_parent" ) {
@@ -137,14 +133,18 @@ function make_popup_menus() {
}
};
});
- var b = $( "#" + $(this).attr( 'popupmenu' ) );
- b.find("a").bind("click", function(e) {
+ var box = $( "#" + menu.attr( 'popupmenu' ) );
+
+ // For menus with clickable link text, make clicking on the link go through instead
+ // of activating the popup menu
+ box.find("a").bind("click", function(e) {
e.stopPropagation(); // Stop bubbling so clicking on the link goes through
return true;
});
- make_popupmenu( b, options );
- $(this).remove();
- b.addClass( "popup" ).show();
+
+ make_popupmenu(box, options);
+ box.addClass("popup");
+ menu.remove();
});
}
@@ -160,15 +160,17 @@ function naturalSort(a, b) {
xD = (new Date(x)).getTime(),
yD = xD ? (new Date(y)).getTime() : null;
// natural sorting of dates
- if ( yD )
- if ( xD < yD ) return -1;
- else if ( xD > yD ) return 1;
+ if ( yD ) {
+ if ( xD < yD ) { return -1; }
+ else if ( xD > yD ) { return 1; }
+ }
// natural sorting through split numeric strings and default strings
- for( var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++ ) {
+ var oFxNcL, oFyNcL;
+ for ( var cLoc = 0, numS = Math.max(xN.length, yN.length); cLoc < numS; cLoc++ ) {
oFxNcL = parseFloat(xN[cLoc]) || xN[cLoc];
oFyNcL = parseFloat(yN[cLoc]) || yN[cLoc];
- if (oFxNcL < oFyNcL) return -1;
- else if (oFxNcL > oFyNcL) return 1;
+ if (oFxNcL < oFyNcL) { return -1; }
+ else if (oFxNcL > oFyNcL) { return 1; }
}
return 0;
}
@@ -176,14 +178,17 @@ function naturalSort(a, b) {
// Replace select box with a text input box + autocomplete.
function replace_big_select_inputs(min_length, max_length) {
// To do replace, jQuery's autocomplete plugin must be loaded.
- if (!jQuery().autocomplete)
+ if (!jQuery().autocomplete) {
return;
+ }
// Set default for min_length and max_length
- if (min_length === undefined)
+ if (min_length === undefined) {
min_length = 20;
- if (max_length === undefined)
+ }
+ if (max_length === undefined) {
max_length = 3000;
+ }
$('select').each( function() {
var select_elt = $(this);
@@ -194,7 +199,7 @@ function replace_big_select_inputs(min_l
}
// Skip multi-select because widget cannot handle multi-select.
- if (select_elt.attr('multiple') == true) {
+ if (select_elt.attr('multiple') === true) {
return;
}
@@ -240,13 +245,14 @@ function replace_big_select_inputs(min_l
});
// Set initial text if it's empty.
- if ( start_value == '' || start_value == '?') {
+ if ( start_value === '' || start_value === '?') {
text_input_elt.attr('value', 'Click to Search or Select');
}
// Sort dbkey options list only.
- if (select_elt.attr('name') == 'dbkey')
+ if (select_elt.attr('name') == 'dbkey') {
select_options = select_options.sort(naturalSort);
+ }
// Do autocomplete.
var autocomplete_options = { selectFirst: false, autoFill: false, mustMatch: false, matchContains: true, max: max_length, minChars : 0, hideForLessThanMinChars : false };
@@ -265,7 +271,7 @@ function replace_big_select_inputs(min_l
}
else {
// If there is a non-empty start value, use that; otherwise unknown.
- if (start_value != "") {
+ if (start_value !== "") {
text_input_elt.attr('value', start_value);
} else {
// This is needed to make the DB key work.
@@ -283,9 +289,9 @@ function replace_big_select_inputs(min_l
// Get refresh vals.
var ref_on_change_vals = select_elt.attr('refresh_on_change_values'),
last_selected_value = select_elt.attr("last_selected_value");
- if (ref_on_change_vals !== undefined)
+ if (ref_on_change_vals !== undefined) {
ref_on_change_vals = ref_on_change_vals.split(',');
-
+ }
// Function that attempts to refresh based on the value in the text element.
var try_refresh_fn = function() {
// Get new value and see if it can be matched.
@@ -371,10 +377,11 @@ function async_save_text(click_to_edit_e
},
success: function(processed_text) {
// Set new text and call finish method.
- if (processed_text != "")
+ if (processed_text !== "") {
text_elt.text(processed_text);
- else
+ } else {
text_elt.html("<em>None</em>");
+ }
if (on_finish) {
on_finish(t);
}
@@ -415,15 +422,16 @@ function init_history_items(historywrapp
// If Mozilla, hide scrollbars in hidden items since they cause animation bugs
if ( $.browser.mozilla ) {
$( "div.historyItemBody" ).each( function() {
- if ( ! $(this).is( ":visible" ) ) $(this).find( "pre.peek" ).css( "overflow", "hidden" );
- })
+ if ( !$(this).is(":visible") ) { $(this).find( "pre.peek" ).css( "overflow", "hidden" ); }
+ });
}
historywrapper.each( function() {
- var id = this.id;
- var body = $(this).children( "div.historyItemBody" );
- var peek = body.find( "pre.peek" )
+ var id = this.id,
+ body = $(this).children( "div.historyItemBody" ),
+ peek = body.find( "pre.peek" );
$(this).find( ".historyItemTitleBar > .historyItemTitle" ).wrap( "<a href='javascript:void(0);'></a>" ).click( function() {
+ var prefs;
if ( body.is(":visible") ) {
// Hiding stuff here
if ( $.browser.mozilla ) { peek.css( "overflow", "hidden" ); }
@@ -431,7 +439,7 @@ function init_history_items(historywrapp
if (!nochanges) { // Ignore embedded item actions
// Save setting
- var prefs = $.jStore.store("history_expand_state");
+ prefs = $.jStore.store("history_expand_state");
if (prefs) {
delete prefs[id];
$.jStore.store("history_expand_state", prefs);
@@ -445,7 +453,7 @@ function init_history_items(historywrapp
if (!nochanges) {
// Save setting
- var prefs = $.jStore.store("history_expand_state");
+ prefs = $.jStore.store("history_expand_state");
if (prefs === undefined) { prefs = {}; }
prefs[id] = true;
$.jStore.store("history_expand_state", prefs);
@@ -470,7 +478,7 @@ function init_history_items(historywrapp
});
$.jStore.store("history_expand_state", prefs);
}).show();
- }
+ };
if (noinit) {
action();
@@ -497,7 +505,7 @@ function reset_tool_search( initValue )
// Function may be called in top frame or in tool_menu_frame;
// in either case, get the tool menu frame.
var tool_menu_frame = $("#galaxy_tools").contents();
- if (tool_menu_frame.length == 0) {
+ if (tool_menu_frame.length === 0) {
tool_menu_frame = $(document);
}
@@ -532,7 +540,7 @@ function reset_tool_search( initValue )
var GalaxyAsync = function(log_action) {
this.url_dict = {};
this.log_action = (log_action === undefined ? false : log_action);
-}
+};
GalaxyAsync.prototype.set_func_url = function( func_name, url ) {
this.url_dict[func_name] = url;
@@ -566,36 +574,6 @@ GalaxyAsync.prototype.log_user_action =
});
};
-// Add to trackster browser functionality
-$(".trackster-add").live("click", function() {
- var dataset = this,
- dataset_jquery = $(this);
- $.ajax({
- url: dataset_jquery.attr("data-url"),
- dataType: "html",
- error: function() { alert( "Could not add this dataset to browser." ); },
- success: function(table_html) {
- var parent = window.parent;
- parent.show_modal("Add to Browser:", table_html, {
- "Cancel": function() {
- parent.hide_modal();
- },
- "Insert into selected": function() {
- $(parent.document).find('input[name=id]:checked').each(function() {
- var vis_id = $(this).val();
- parent.location = dataset_jquery.attr("action-url") + "&id=" + vis_id;
- });
- },
- "Insert into new browser": function() {
- parent.location = dataset_jquery.attr("new-url");
- }
- });
- }
- });
-});
-
-
-
$(document).ready( function() {
$("select[refresh_on_change='true']").change( function() {
var select_field = $(this),
--- a/static/scripts/packed/galaxy.base.js
+++ b/static/scripts/packed/galaxy.base.js
@@ -1,1 +1,1 @@
-if(!Array.indexOf){Array.prototype.indexOf=function(c){for(var b=0,a=this.length;b<a;b++){if(this[b]==c){return b}}return -1}}function obj_length(c){if(c.length!==undefined){return c.length}var b=0;for(var a in c){b++}return b}$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function ensure_popup_helper(){if($("#popup-helper").length===0){$("<div id='popup-helper'/>").css({background:"white",opacity:0,zIndex:15000,position:"absolute",top:0,left:0,width:"100%",height:"100%"}).appendTo("body").hide()}}function attach_popupmenu(b,d){var a=function(){d.unbind().hide();$("#popup-helper").unbind("click.popupmenu").hide()};var c=function(g){$("#popup-helper").bind("click.popupmenu",a).show();d.click(a).css({left:0,top:-1000}).show();var f=g.pageX-d.width()/2;f=Math.min(f,$(document).scr
ollLeft()+$(window).width()-$(d).width()-20);f=Math.max(f,$(document).scrollLeft()+20);d.css({top:g.pageY-5,left:f});return false};$(b).bind("click",c)}function make_popupmenu(c,b){ensure_popup_helper();var a=$("<ul id='"+c.attr("id")+"-menu'></ul>");if(obj_length(b)<=0){$("<li/>").html("No options").appendTo(a)}$.each(b,function(f,e){if(e){$("<li/>").html(f).click(e).appendTo(a)}else{$("<li class='head'/>").html(f).appendTo(a)}});var d=$("<div class='popmenu-wrapper'>");d.append(a).append("<div class='overlay-border'>").css("position","absolute").appendTo("body").hide();attach_popupmenu(c,d);return a}function show_hide_popupmenu_options(d,c,a){var a=(a===undefined?true:a);var b=new RegExp(c);$(d).find("li").each(function(){if(b.exec($(this).text())){if(a){$(this).show()}else{$(this).hide()}}})}function make_popup_menus(){jQuery("div[popupmenu]").each(function(){var c={};$(this).find("a").each(function(){var b=$(this).attr("confirm"),d=$(this).attr("href"),e=$(this).attr("ta
rget");c[$(this).text()]=function(){if(!b||confirm(b)){var g=window;if(e=="_parent"){g=window.parent}else{if(e=="_top"){g=window.top}}g.location=d}}});var a=$("#"+$(this).attr("popupmenu"));a.find("a").bind("click",function(b){b.stopPropagation();return true});make_popupmenu(a,c);$(this).remove();a.addClass("popup").show()})}function naturalSort(i,g){var n=/(-?[0-9\.]+)/g,j=i.toString().toLowerCase()||"",f=g.toString().toLowerCase()||"",k=String.fromCharCode(0),l=j.replace(n,k+"$1"+k).split(k),e=f.replace(n,k+"$1"+k).split(k),d=(new Date(j)).getTime(),m=d?(new Date(f)).getTime():null;if(m){if(d<m){return -1}else{if(d>m){return 1}}}for(var h=0,c=Math.max(l.length,e.length);h<c;h++){oFxNcL=parseFloat(l[h])||l[h];oFyNcL=parseFloat(e[h])||e[h];if(oFxNcL<oFyNcL){return -1}else{if(oFxNcL>oFyNcL){return 1}}}return 0}function replace_big_select_inputs(a,b){if(!jQuery().autocomplete){return}if(a===undefined){a=20}if(b===undefined){b=3000}$("select").each(function(){var d=$(this);var
g=d.find("option").length;if((g<a)||(g>b)){return}if(d.attr("multiple")==true){return}if(d.hasClass("no-autocomplete")){return}var m=d.attr("value");var c=$("<input type='text' class='text-and-autocomplete-select'></input>");c.attr("size",40);c.attr("name",d.attr("name"));c.attr("id",d.attr("id"));c.click(function(){var n=$(this).val();$(this).val("Loading...");$(this).showAllInCache();$(this).val(n);$(this).select()});var e=[];var i={};d.children("option").each(function(){var o=$(this).text();var n=$(this).attr("value");e.push(o);i[o]=n;i[n]=n;if(n==m){c.attr("value",o)}});if(m==""||m=="?"){c.attr("value","Click to Search or Select")}if(d.attr("name")=="dbkey"){e=e.sort(naturalSort)}var f={selectFirst:false,autoFill:false,mustMatch:false,matchContains:true,max:b,minChars:0,hideForLessThanMinChars:false};c.autocomplete(e,f);d.replaceWith(c);var k=function(){var o=c.attr("value");var n=i[o];if(n!==null&&n!==undefined){c.attr("value",n)}else{if(m!=""){c.attr("value",m)}else{c.
attr("value","?")}}};c.parents("form").submit(function(){k()});$(document).bind("convert_dbkeys",function(){k()});if(d.attr("refresh_on_change")=="true"){var h=d.attr("refresh_on_change_values"),l=d.attr("last_selected_value");if(h!==undefined){h=h.split(",")}var j=function(){var n=i[c.attr("value")];if(l!==n&&n!==null&&n!==undefined){if(h!==undefined&&$.inArray(n,h)===-1&&$.inArray(l,h)===-1){return}c.attr("value",n);$(window).trigger("refresh_on_change");c.parents("form").submit()}};c.bind("result",j);c.keyup(function(n){if(n.keyCode===13){j()}});c.keydown(function(n){if(n.keyCode===13){return false}})}})}function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefined){i=4}$("#"+d).live("click",function(){if($("#renaming-active").length>0){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({rows:i,cols:c}).text($.trim(k))}else{j=$("<input type='text'></input>").attr({value:$.trim(k),size:c})}j.attr("id","renaming-active");j.blur(
function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]=$(this).val();$(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){if(o!=""){l.text(o)}else{l.html("<em>None</em>")}if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}function init_history_items(d,a,c){var b=function(){try{var e=$.jStore.store("history_expand_state");if(e){for(var g in e){$("#"+g+" div.historyItemBody").show()}}}catch(f){$.jStore.remove("history_expand_state")}if($.browser.mozilla){$("div.historyItemBody").each(function(){if(!$(this).is(":visible")){$(this).find("pre.peek").css("overflow","hidden")}})}d.each(function(){var j=this.id;var h=$(this).children("div.historyItemBody");var i=h.find("pre.peek");$(this).find(".historyItemTitleBar > .historyItemTitle").wrap("<a href='javascript:void(0);'></a>").cl
ick(function(){if(h.is(":visible")){if($.browser.mozilla){i.css("overflow","hidden")}h.slideUp("fast");if(!c){var k=$.jStore.store("history_expand_state");if(k){delete k[j];$.jStore.store("history_expand_state",k)}}}else{h.slideDown("fast",function(){if($.browser.mozilla){i.css("overflow","auto")}});if(!c){var k=$.jStore.store("history_expand_state");if(k===undefined){k={}}k[j]=true;$.jStore.store("history_expand_state",k)}}return false})});$("#top-links > a.toggle").click(function(){var h=$.jStore.store("history_expand_state");if(h===undefined){h={}}$("div.historyItemBody:visible").each(function(){if($.browser.mozilla){$(this).find("pre.peek").css("overflow","hidden")}$(this).slideUp("fast");if(h){delete h[$(this).parent().attr("id")]}});$.jStore.store("history_expand_state",h)}).show()};if(a){b()}else{$.jStore.init("galaxy");$.jStore.engineReady(function(){b()})}}function commatize(b){b+="";var a=/(\d+)(\d{3})/;while(a.test(b)){b=b.replace(a,"$1,$2")}return b}function rese
t_tool_search(a){var c=$("#galaxy_tools").contents();if(c.length==0){c=$(document)}$(this).removeClass("search_active");c.find(".toolTitle").removeClass("search_match");c.find(".toolSectionBody").hide();c.find(".toolTitle").show();c.find(".toolPanelLabel").show();c.find(".toolSectionWrapper").each(function(){if($(this).attr("id")!="recently_used_wrapper"){$(this).show()}else{if($(this).hasClass("user_pref_visible")){$(this).show()}}});c.find("#search-no-results").hide();c.find("#search-spinner").hide();if(a){var b=c.find("#tool-search-query");b.val("search tools");b.css("font-style","italic")}}var GalaxyAsync=function(a){this.url_dict={};this.log_action=(a===undefined?false:a)};GalaxyAsync.prototype.set_func_url=function(a,b){this.url_dict[a]=b};GalaxyAsync.prototype.set_user_pref=function(a,b){var c=this.url_dict[arguments.callee];if(c===undefined){return false}$.ajax({url:c,data:{pref_name:a,pref_value:b},error:function(){return false},success:function(){return true}})};Ga
laxyAsync.prototype.log_user_action=function(c,b,d){if(!this.log_action){return}var a=this.url_dict[arguments.callee];if(a===undefined){return false}$.ajax({url:a,data:{action:c,context:b,params:d},error:function(){return false},success:function(){return true}})};$(".trackster-add").live("click",function(){var b=this,a=$(this);$.ajax({url:a.attr("data-url"),dataType:"html",error:function(){alert("Could not add this dataset to browser.")},success:function(c){var d=window.parent;d.show_modal("Add to Browser:",c,{Cancel:function(){d.hide_modal()},"Insert into selected":function(){$(d.document).find("input[name=id]:checked").each(function(){var e=$(this).val();d.location=a.attr("action-url")+"&id="+e})},"Insert into new browser":function(){d.location=a.attr("new-url")}})}})});$(document).ready(function(){$("select[refresh_on_change='true']").change(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_val
ue");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");a.get(0).form.submit()});$("a[confirm]").click(function(){return confirm($(this).attr("confirm"))});if($.fn.tipsy){$(".tooltip").tipsy({gravity:"s"})}make_popup_menus();replace_big_select_inputs(20,1500)});
+if(!Array.indexOf){Array.prototype.indexOf=function(c){for(var b=0,a=this.length;b<a;b++){if(this[b]==c){return b}}return -1}}function obj_length(c){if(c.length!==undefined){return c.length}var b=0;for(var a in c){b++}return b}$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function show_hide_popupmenu_options(d,c,a){a=(a===undefined?true:a);var b=new RegExp(c);$(d).find("li").each(function(){if(b.exec($(this).text())){if(a){$(this).show()}else{$(this).hide()}}})}function make_popupmenu(b,a){b.bind("click.show_popup",function(c){$(".popmenu-wrapper").remove();setTimeout(function(){var e=$("<ul id='"+b.attr("id")+"-menu'></ul>");if(obj_length(a)<=0){$("<li>No Options.</li>").appendTo(e)}$.each(a,function(h,g){if(g){$("<li/>").html(h).click(g).appendTo(e)}else{$("<li class='head'/
>").html(h).appendTo(e)}});var f=$("<div class='popmenu-wrapper' style='position: absolute;left: 0; top: -1000;'>");f.append(e).append("<div class='overlay-border'>").appendTo("body");var d=c.pageX-f.width()/2;d=Math.min(d,$(document).scrollLeft()+$(window).width()-$(f).width()-20);d=Math.max(d,$(document).scrollLeft()+20);f.css({top:c.pageY-5,left:d})},10);setTimeout(function(){var e=function(g){$(g).bind("click.close_popup",function(){$(".popmenu-wrapper").remove();g.unbind("click.close_popup")})};e($(window.document));e($(window.top.document));for(var d=window.top.frames.length;d--;){var f=$(window.top.frames[d].document);e(f)}},50);return false})}function make_popup_menus(){jQuery("div[popupmenu]").each(function(){var a={};var c=$(this);c.find("a").each(function(){var f=$(this),h=f.get(0);var d=h.getAttribute("confirm"),e=h.getAttribute("href"),g=h.getAttribute("target");a[f.text()]=function(){if(!d||confirm(d)){var i=window;if(g=="_parent"){i=window.parent}else{if(g=="_
top"){i=window.top}}i.location=e}}});var b=$("#"+c.attr("popupmenu"));b.find("a").bind("click",function(d){d.stopPropagation();return true});make_popupmenu(b,a);b.addClass("popup");c.remove()})}function naturalSort(j,h){var p=/(-?[0-9\.]+)/g,k=j.toString().toLowerCase()||"",g=h.toString().toLowerCase()||"",l=String.fromCharCode(0),n=k.replace(p,l+"$1"+l).split(l),e=g.replace(p,l+"$1"+l).split(l),d=(new Date(k)).getTime(),o=d?(new Date(g)).getTime():null;if(o){if(d<o){return -1}else{if(d>o){return 1}}}var m,f;for(var i=0,c=Math.max(n.length,e.length);i<c;i++){m=parseFloat(n[i])||n[i];f=parseFloat(e[i])||e[i];if(m<f){return -1}else{if(m>f){return 1}}}return 0}function replace_big_select_inputs(a,b){if(!jQuery().autocomplete){return}if(a===undefined){a=20}if(b===undefined){b=3000}$("select").each(function(){var d=$(this);var g=d.find("option").length;if((g<a)||(g>b)){return}if(d.attr("multiple")===true){return}if(d.hasClass("no-autocomplete")){return}var m=d.attr("value");var c
=$("<input type='text' class='text-and-autocomplete-select'></input>");c.attr("size",40);c.attr("name",d.attr("name"));c.attr("id",d.attr("id"));c.click(function(){var n=$(this).val();$(this).val("Loading...");$(this).showAllInCache();$(this).val(n);$(this).select()});var e=[];var i={};d.children("option").each(function(){var o=$(this).text();var n=$(this).attr("value");e.push(o);i[o]=n;i[n]=n;if(n==m){c.attr("value",o)}});if(m===""||m==="?"){c.attr("value","Click to Search or Select")}if(d.attr("name")=="dbkey"){e=e.sort(naturalSort)}var f={selectFirst:false,autoFill:false,mustMatch:false,matchContains:true,max:b,minChars:0,hideForLessThanMinChars:false};c.autocomplete(e,f);d.replaceWith(c);var k=function(){var o=c.attr("value");var n=i[o];if(n!==null&&n!==undefined){c.attr("value",n)}else{if(m!==""){c.attr("value",m)}else{c.attr("value","?")}}};c.parents("form").submit(function(){k()});$(document).bind("convert_dbkeys",function(){k()});if(d.attr("refresh_on_change")=="true
"){var h=d.attr("refresh_on_change_values"),l=d.attr("last_selected_value");if(h!==undefined){h=h.split(",")}var j=function(){var n=i[c.attr("value")];if(l!==n&&n!==null&&n!==undefined){if(h!==undefined&&$.inArray(n,h)===-1&&$.inArray(l,h)===-1){return}c.attr("value",n);$(window).trigger("refresh_on_change");c.parents("form").submit()}};c.bind("result",j);c.keyup(function(n){if(n.keyCode===13){j()}});c.keydown(function(n){if(n.keyCode===13){return false}})}})}function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefined){i=4}$("#"+d).live("click",function(){if($("#renaming-active").length>0){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({rows:i,cols:c}).text($.trim(k))}else{j=$("<input type='text'></input>").attr({value:$.trim(k),size:c})}j.attr("id","renaming-active");j.blur(function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]
=$(this).val();$(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){if(o!==""){l.text(o)}else{l.html("<em>None</em>")}if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}function init_history_items(d,a,c){var b=function(){try{var e=$.jStore.store("history_expand_state");if(e){for(var g in e){$("#"+g+" div.historyItemBody").show()}}}catch(f){$.jStore.remove("history_expand_state")}if($.browser.mozilla){$("div.historyItemBody").each(function(){if(!$(this).is(":visible")){$(this).find("pre.peek").css("overflow","hidden")}})}d.each(function(){var j=this.id,h=$(this).children("div.historyItemBody"),i=h.find("pre.peek");$(this).find(".historyItemTitleBar > .historyItemTitle").wrap("<a href='javascript:void(0);'></a>").click(function(){var k;if(h.is(":visible")){if($.browser.mozilla){i.css("overflow","hidden")}h.slideUp("fast");if(!c){k=$.jStore.store("history_expand_state");i
f(k){delete k[j];$.jStore.store("history_expand_state",k)}}}else{h.slideDown("fast",function(){if($.browser.mozilla){i.css("overflow","auto")}});if(!c){k=$.jStore.store("history_expand_state");if(k===undefined){k={}}k[j]=true;$.jStore.store("history_expand_state",k)}}return false})});$("#top-links > a.toggle").click(function(){var h=$.jStore.store("history_expand_state");if(h===undefined){h={}}$("div.historyItemBody:visible").each(function(){if($.browser.mozilla){$(this).find("pre.peek").css("overflow","hidden")}$(this).slideUp("fast");if(h){delete h[$(this).parent().attr("id")]}});$.jStore.store("history_expand_state",h)}).show()};if(a){b()}else{$.jStore.init("galaxy");$.jStore.engineReady(function(){b()})}}function commatize(b){b+="";var a=/(\d+)(\d{3})/;while(a.test(b)){b=b.replace(a,"$1,$2")}return b}function reset_tool_search(a){var c=$("#galaxy_tools").contents();if(c.length===0){c=$(document)}$(this).removeClass("search_active");c.find(".toolTitle").removeClass("searc
h_match");c.find(".toolSectionBody").hide();c.find(".toolTitle").show();c.find(".toolPanelLabel").show();c.find(".toolSectionWrapper").each(function(){if($(this).attr("id")!="recently_used_wrapper"){$(this).show()}else{if($(this).hasClass("user_pref_visible")){$(this).show()}}});c.find("#search-no-results").hide();c.find("#search-spinner").hide();if(a){var b=c.find("#tool-search-query");b.val("search tools");b.css("font-style","italic")}}var GalaxyAsync=function(a){this.url_dict={};this.log_action=(a===undefined?false:a)};GalaxyAsync.prototype.set_func_url=function(a,b){this.url_dict[a]=b};GalaxyAsync.prototype.set_user_pref=function(a,b){var c=this.url_dict[arguments.callee];if(c===undefined){return false}$.ajax({url:c,data:{pref_name:a,pref_value:b},error:function(){return false},success:function(){return true}})};GalaxyAsync.prototype.log_user_action=function(c,b,d){if(!this.log_action){return}var a=this.url_dict[arguments.callee];if(a===undefined){return false}$.ajax({ur
l:a,data:{action:c,context:b,params:d},error:function(){return false},success:function(){return true}})};$(document).ready(function(){$("select[refresh_on_change='true']").change(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");a.get(0).form.submit()});$("a[confirm]").click(function(){return confirm($(this).attr("confirm"))});if($.fn.tipsy){$(".tooltip").tipsy({gravity:"s"})}make_popup_menus();replace_big_select_inputs(20,1500)});
1
0