diff -r de44726f040b tools/ngs_rna/tophat_wrapper.xml
--- a/tools/ngs_rna/tophat_wrapper.xml	Thu Sep 29 14:21:44 2011 -0700
+++ b/tools/ngs_rna/tophat_wrapper.xml	Fri Sep 30 15:11:55 2011 -0700
@@ -53,7 +53,11 @@
                     ## 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
+                                #if $singlePaired.sParams.own_junctions.gene_model_ann.annotationSource.reference_annotation_file == "indexed":
+                                     -G "${ filter( lambda x: str( x[0] ) == str( $singlePaired.sParams.own_junctions.gene_model_ann.annotationSource.indices ), $__app__.tool_data_tables[ 'gtf_index' ].get_fields() )[0][-1] }"
+                                #else:
+                                     -G "${singlePaired.sParams.own_junctions.gene_model_ann.annotationSource.owngtfFile}"
+                                #end if
                         #end if
                         #if $singlePaired.sParams.own_junctions.raw_juncs.use_juncs == "Yes":
                             -j $singlePaired.sParams.own_junctions.raw_juncs.raw_juncs
@@ -112,7 +116,11 @@
                     ## 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
+                                #if $singlePaired.pParams.own_junctions.gene_model_ann.annotationSource.reference_annotation_file == "indexed":
+                                     -G "${ filter( lambda x: str( x[0] ) == str( $singlePaired.pParams.own_junctions.gene_model_ann.annotationSource.indices ), $__app__.tool_data_tables[ 'gtf_index' ].get_fields() )[0][-1] }"
+                                #else:
+                                     -G "${singlePaired.pParams.own_junctions.gene_model_ann.annotationSource.owngtfFile}"
+                                #end if
                         #end if
                         #if $singlePaired.pParams.own_junctions.raw_juncs.use_juncs == "Yes":
                             -j $singlePaired.pParams.own_junctions.raw_juncs.raw_juncs
@@ -216,7 +224,23 @@
                              </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."/>
+                               <conditional name="annotationSource">
+                                 <param name="reference_annotation_file" type="select" label="Please select a reference Aonnotation">
+                                   <option value="indexed">Use a built-in index</option>
+                                   <option value="history">Use one from the history</option>
+                                 </param>
+                                 <when value="indexed">
+                                   <param name="indices" type="select" label="Select genome for gtf annotation">
+                                     <options from_data_table="gtf_index">
+                                       <filter type="sort_by" column="3" />
+                                       <validator type="no_options" message="No indexes are available for the selected input dataset" />
+                                     </options>
+                                   </param>
+                                 </when>
+                                 <when value="history">
+                                   <param name="owngtfFile" type="data" format="gff3, gtf" label="Select a reference annotation file" />
+                                 </when>
+                               </conditional>
                              </when>
                           </conditional>
                           <conditional name="raw_juncs">
@@ -322,7 +346,23 @@
                              </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."/>
+                               <conditional name="annotationSource">
+                                 <param name="reference_annotation_file" type="select" label="Please select a reference Aonnotation">
+                                   <option value="indexed">Use a built-in index</option>
+                                   <option value="history">Use one from the history</option>
+                                 </param>
+                                 <when value="indexed">
+                                   <param name="indices" type="select" label="Select genome for gtf annotation">
+                                     <options from_data_table="gtf_index">
+                                       <filter type="sort_by" column="3" />
+                                       <validator type="no_options" message="No indexes are available for the selected input dataset" />
+                                     </options>
+                                   </param>
+                                 </when>
+                                 <when value="history">
+                                   <param name="owngtfFile" type="data" format="gff3, gtf" label="Select a reference annotation file" />
+                                 </when>
+                               </conditional>
                              </when>
                           </conditional>
                           <conditional name="raw_juncs">
