changeset 2:da11bfc10e81

Update to the new data table specification.
author Dave Bouvier <dave@bx.psu.edu>
date Wed, 04 Dec 2013 13:24:49 -0500
parents b01956f26c36
children 398329a94c99
files cufflinks_wrapper.py cufflinks_wrapper.xml tool-data/fasta_indexes.loc.sample tool-data/sam_fa_indices.loc.sample tool_data_table_conf.xml.sample
diffstat 5 files changed, 54 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/cufflinks_wrapper.py	Tue Oct 01 15:12:55 2013 -0400
+++ b/cufflinks_wrapper.py	Wed Dec 04 13:24:49 2013 -0500
@@ -10,20 +10,6 @@
     sys.stderr.write( "%s\n" % msg )
     sys.exit()
     
-# Copied from sam_to_bam.py:
-def check_seq_file( dbkey, cached_seqs_pointer_file ):
-    seq_path = ''
-    for line in open( cached_seqs_pointer_file ):
-        line = line.rstrip( '\r\n' )
-        if line and not line.startswith( '#' ) and line.startswith( 'index' ):
-            fields = line.split( '\t' )
-            if len( fields ) < 3:
-                continue
-            if fields[1] == dbkey:
-                seq_path = fields[2].strip()
-                break
-    return seq_path
-	
 def __main__():
     #Parse Command Line
     parser = optparse.OptionParser()
@@ -53,8 +39,7 @@
 
     # Bias correction options.
     parser.add_option( '-b', dest='do_bias_correction', action="store_true", help='Providing Cufflinks with a multifasta file via this option instructs it to run our new bias detection and correction algorithm which can significantly improve accuracy of transcript abundance estimates.')
-    parser.add_option( '', '--dbkey', dest='dbkey', help='The build of the reference dataset' )
-    parser.add_option( '', '--index_dir', dest='index_dir', help='GALAXY_DATA_INDEX_DIR' )
+    parser.add_option( '', '--index', dest='index', help='The path of the reference genome' )
     parser.add_option( '', '--ref_file', dest='ref_file', help='The reference dataset from the history' )
     
     # Global model.
@@ -83,22 +68,16 @@
     
     # If doing bias correction, set/link to sequence file.
     if options.do_bias_correction:
-        if options.ref_file != 'None':
+        if options.ref_file:
             # Sequence data from history.
             # Create symbolic link to ref_file so that index will be created in working directory.
             seq_path = "ref.fa"
             os.symlink( options.ref_file, seq_path )
         else:
-            # Sequence data from loc file.
-            cached_seqs_pointer_file = os.path.join( options.index_dir, 'sam_fa_indices.loc' )
-            if not os.path.exists( cached_seqs_pointer_file ):
-                stop_err( 'The required file (%s) does not exist.' % cached_seqs_pointer_file )
-            # If found for the dbkey, seq_path will look something like /galaxy/data/equCab2/sam_index/equCab2.fa,
-            # and the equCab2.fa file will contain fasta sequences.
-            seq_path = check_seq_file( options.dbkey, cached_seqs_pointer_file )
-            if seq_path == '':
-                stop_err( 'No sequence data found for dbkey %s, so bias correction cannot be used.' % options.dbkey  )
-    
+            if not os.path.exists( options.index ):
+                stop_err( 'Reference genome %s not present, request it by reporting this error.' % options.index )
+            seq_path = options.index
+
     # Build command.
     
     # Base; always use quiet mode to avoid problems with storing log output.
--- a/cufflinks_wrapper.xml	Tue Oct 01 15:12:55 2013 -0400
+++ b/cufflinks_wrapper.xml	Wed Dec 04 13:24:49 2013 -0500
@@ -1,4 +1,4 @@
-<tool id="cufflinks" name="Cufflinks" version="0.0.6">
+<tool id="cufflinks" name="Cufflinks" version="0.0.7">
     <!-- Wrapper supports Cufflinks versions v1.3.0 and newer -->
     <description>transcript assembly and FPKM (RPKM) estimates for RNA-Seq data</description>
     <requirements>
@@ -30,14 +30,12 @@
             
             ## Bias correction?
             #if $bias_correction.do_bias_correction == "Yes":
-	           -b
+                -b
                 #if $bias_correction.seq_source.index_source == "history":
                     --ref_file=$bias_correction.seq_source.ref_file
                 #else:
-                    --ref_file="None"
+                    --index=${bias_correction.seq_source.index.fields.path}
                 #end if
-                --dbkey=${input.metadata.dbkey} 
-                --index_dir=${GALAXY_DATA_INDEX_DIR}
             #end if
 
             ## Multi-read correct?
@@ -68,15 +66,15 @@
             <when value="No"></when>
             <when value="Use reference annotation">
                 <param format="gff3,gtf" name="reference_annotation_file" type="data" label="Reference Annotation" help="Gene annotation dataset in GTF or GFF3 format."/>
-            	</when>
-	        <when value="Use reference annotation guide">
+            </when>
+            <when value="Use reference annotation guide">
                 <param format="gff3,gtf" name="reference_annotation_guide_file" type="data" label="Reference Annotation" help="Gene annotation dataset in GTF or GFF3 format."/>
-                </when>
+            </when>
         </conditional>
         <conditional name="bias_correction">
             <param name="do_bias_correction" type="select" label="Perform Bias Correction" help="Bias detection and correction can significantly improve accuracy of transcript abundance estimates.">
                 <option value="No" selected="true">No</option>
-		            <option value="Yes">Yes</option>
+                <option value="Yes">Yes</option>
             </param>
             <when value="Yes">
                 <conditional name="seq_source">
@@ -84,7 +82,14 @@
                     <option value="cached"  selected="true">Locally cached</option>
                     <option value="history">History</option>
                   </param>
-                  <when value="cached"></when>
+                  <when value="cached">
+                    <param name="index" type="select" label="Using reference genome">
+                      <options from_data_table="fasta_indexes">
+                        <filter type="data_meta" ref="input" key="dbkey" column="1" />
+                        <validator type="no_options" message="No reference genome is available for the build associated with the selected input dataset" />
+                      </options>
+                    </param>
+                  </when>
                   <when value="history">
                       <param name="ref_file" type="data" format="fasta" label="Using reference file" />
                   </when>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool-data/fasta_indexes.loc.sample	Wed Dec 04 13:24:49 2013 -0500
@@ -0,0 +1,29 @@
+#This is a sample file distributed with Galaxy that enables tools
+#to use a directory of Samtools indexed sequences data files.  You will need
+#to create these data files and then create a sam_fa_new_indices.loc file
+#similar to this one (store it in this directory) that points to
+#the directories in which those files are stored. The sam_fa_new_indices.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 hg19 Canonical indexed stored in
+#
+# /depot/data2/galaxy/hg19/sam/,
+#
+#then the sam_fa_new_indices.loc entry would look like this:
+#
+#hg19canon	hg19	Human (Homo sapiens): hg19 Canonical	/depot/data2/galaxy/hg19/sam/hg19canon.fa
+#
+#and your /depot/data2/galaxy/hg19/sam/ directory
+#would contain hg19canon.fa and hg19canon.fa.fai files.
+#
+#Your sam_fa_new_indices.loc file should include an entry per line for
+#each index set you have stored.  The file in the path does actually
+#exist, but it should never be directly used. Instead, the name serves
+#as a prefix for the index file.  For example:
+#
+#hg18canon	hg18	Human (Homo sapiens): hg18 Canonical	/depot/data2/galaxy/hg18/sam/hg18canon.fa
+#hg18full	hg18	Human (Homo sapiens): hg18 Full	/depot/data2/galaxy/hg18/sam/hg18full.fa
+#hg19canon	hg19	Human (Homo sapiens): hg19 Canonical	/depot/data2/galaxy/hg19/sam/hg19canon.fa
+#hg19full	hg19	Human (Homo sapiens): hg19 Full	/depot/data2/galaxy/hg19/sam/hg19full.fa
--- a/tool-data/sam_fa_indices.loc.sample	Tue Oct 01 15:12:55 2013 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#This is a sample file distributed with Galaxy that enables tools
-#to use a directory of Samtools indexed sequences data files.  You will need
-#to create these data files and then create a sam_fa_indices.loc file 
-#similar to this one (store it in this directory) that points to 
-#the directories in which those files are stored. The sam_fa_indices.loc 
-#file has this format (white space characters are TAB characters):
-#
-#index	<seq>	<location>
-#
-#So, for example, if you had hg18 indexed stored in 
-#/depot/data2/galaxy/sam/, 
-#then the sam_fa_indices.loc entry would look like this:
-#
-#index	hg18	/depot/data2/galaxy/sam/hg18.fa
-#
-#and your /depot/data2/galaxy/sam/ directory
-#would contain hg18.fa and hg18.fa.fai files:
-#
-#-rw-r--r--  1 james    universe 830134 2005-09-13 10:12 hg18.fa
-#-rw-r--r--  1 james    universe 527388 2005-09-13 10:12 hg18.fa.fai
-#
-#Your sam_fa_indices.loc file should include an entry per line for 
-#each index set you have stored.  The file in the path does actually
-#exist, but it should never be directly used. Instead, the name serves
-#as a prefix for the index file.  For example:
-#
-#index	hg18	/depot/data2/galaxy/sam/hg18.fa
-#index	hg19	/depot/data2/galaxy/sam/hg19.fa
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_data_table_conf.xml.sample	Wed Dec 04 13:24:49 2013 -0500
@@ -0,0 +1,4 @@
+    <table name="fasta_indexes" comment_char="#">
+        <columns>value, dbkey, name, path</columns>
+        <file path="tool-data/fasta_indexes.loc" />
+    </table>