changeset 1:49795544dac7 draft

planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
author artbio
date Sun, 01 Apr 2018 18:28:24 -0400
parents e5e836936d60
children 9fa602bc29ec
files datatypes_conf.xml extract_transcript_to_gene_map_from_trinity.xml macros.xml rsem-bwt2.xml rsem.py rsem.xml
diffstat 6 files changed, 122 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/datatypes_conf.xml	Sat Mar 31 21:30:07 2018 -0400
+++ b/datatypes_conf.xml	Sun Apr 01 18:28:24 2018 -0400
@@ -5,6 +5,7 @@
     </datatype_files>
     <registration>
         <datatype extension="rsem_ref" type="galaxy.datatypes.rsem:RsemReference" display_in_upload="true"/>
+        <datatype extension="rsem_bt2_ref" type="galaxy.datatypes.rsem:RsemBt2Reference" display_in_upload="true"/>
         <datatype extension="rsem.genes.results" type="galaxy.datatypes.rsem:RsemGenesResults" display_in_upload="true"/>
         <datatype extension="rsem.isoforms.results" type="galaxy.datatypes.rsem:RsemIsoformsResults" display_in_upload="true"/>
         <datatype extension="rsem.ngvec" type="galaxy.datatypes.tabular:Tabular" subclass="True" display_in_upload="true"/>
--- a/extract_transcript_to_gene_map_from_trinity.xml	Sat Mar 31 21:30:07 2018 -0400
+++ b/extract_transcript_to_gene_map_from_trinity.xml	Sun Apr 01 18:28:24 2018 -0400
@@ -1,5 +1,8 @@
-<tool id="extract_transcript_to_gene_map_from_trinity" name="RSEM trinity fasta to gene map" version="0.4.0">
+<tool id="extract_transcript_to_gene_map_from_trinity" name="RSEM trinity fasta to gene map" version="@WRAPPER_VERSION@">
   <description>extract transcript to gene map from trinity</description>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
   <requirements>
     <requirement type="package" version="1.3.0">rsem</requirement>
   </requirements>
--- a/macros.xml	Sat Mar 31 21:30:07 2018 -0400
+++ b/macros.xml	Sun Apr 01 18:28:24 2018 -0400
@@ -1,5 +1,6 @@
 <?xml version="1.0"?>
   <macros>
+    <token name="@WRAPPER_VERSION@">0.5.1</token>
     <xml name="rsem_options">
         <param name="seedlength" type="integer" value="25" optional="true" label="Seed length used by the read aligner" help="Providing the correct value for this parameter is important for RSEM's accuracy if the data are single-end reads. RSEM uses this value for Bowtie's seed length parameter. The minimum value is 25. (Default:25)">
         </param>
--- a/rsem-bwt2.xml	Sat Mar 31 21:30:07 2018 -0400
+++ b/rsem-bwt2.xml	Sun Apr 01 18:28:24 2018 -0400
@@ -1,4 +1,4 @@
-<tool id="rsembowtie2" name="RSEM-Bowtie2" version="0.4.0">
+<tool id="rsembowtie2" name="RSEM-Bowtie2" version="@WRAPPER_VERSION@">
   <description></description>
     <macros>
         <import>macros.xml</import>
@@ -241,7 +241,7 @@
             <option value="self">Prepare RSEM Reference with this tool</option>
           </param>
           <when value="history">
-            <param name="rsem_ref" type="data" format="rsem_ref" label="RSEM reference" />
+            <param name="rsem_ref" type="data" format="rsem_bt2_ref" label="RSEM reference" />
           </when>
           <when value="self">
           </when>
@@ -321,7 +321,7 @@
   </inputs>
 
   <outputs>
-    <data format="rsem_ref" name="reference_file" label="RSEM ${job.reference_name} reference">
+    <data format="rsem_bt2_ref" name="reference_file" label="RSEM ${job.reference_name} reference">
       <filter>job['select_job'] == "index"</filter>
     </data>
     <data format="tabular" name="gene_abundances" label="${run_rsem.sample}.gene_abundances" from_work_dir="rsem_output.genes.results">
--- a/rsem.py	Sat Mar 31 21:30:07 2018 -0400
+++ b/rsem.py	Sun Apr 01 18:28:24 2018 -0400
@@ -172,3 +172,115 @@
                 dataset.metadata.reference_name = fname[:-4]
                 break
         self.regenerate_primary_file(dataset)
+
+
+class RsemBt2Reference(Html):
+    """Class describing an RSEM reference"""
+    MetadataElement(name='reference_name', default='rsem_bt2_ref',
+                    desc='RSEM Bowtie2 Reference Name', readonly=True,
+                    visible=True, set_in_upload=True, no_value='rsem_bt2_ref')
+    file_ext = 'rsem_bt2_ref'
+    allow_datatype_change = False
+    composite_type = 'auto_primary_file'
+
+    def __init__(self, **kwd):
+        Html.__init__(self, **kwd)
+        """
+        Expecting files:
+        extra_files_path/<reference_name>.grp
+        extra_files_path/<reference_name>.ti
+        extra_files_path/<reference_name>.seq
+        extra_files_path/<reference_name>.transcripts.fa
+        Optionally includes files:
+        extra_files_path/<reference_name>.chrlist
+        extra_files_path/<reference_name>.idx.fa
+        extra_files_path/<reference_name>.n2g.idx.fa
+        extra_files_path/<reference_name>.1.bt2
+        extra_files_path/<reference_name>.2.bt2
+        extra_files_path/<reference_name>.3.bt2
+        extra_files_path/<reference_name>.4.bt2
+        extra_files_path/<reference_name>.rev.1.bt2
+        extra_files_path/<reference_name>.rev.2.bt2
+        """
+        self.add_composite_file('%s.grp', description='Group File',
+                                substitute_name_with_metadata='reference_name',
+                                is_binary=False)
+        self.add_composite_file('%s.ti', description='',
+                                substitute_name_with_metadata='reference_name',
+                                is_binary=False)
+        self.add_composite_file('%s.seq', description='',
+                                substitute_name_with_metadata='reference_name',
+                                is_binary=False)
+        self.add_composite_file('%s.transcripts.fa', description='',
+                                substitute_name_with_metadata='reference_name',
+                                is_binary=False)
+        self.add_composite_file('%s.chrlist', description='',
+                                substitute_name_with_metadata='reference_name',
+                                is_binary=False, optional=True)
+        self.add_composite_file('%s.idx.fa', description='',
+                                substitute_name_with_metadata='reference_name',
+                                is_binary=False, optional=True)
+        self.add_composite_file('%s.n2g.idx.fa', description='',
+                                substitute_name_with_metadata='reference_name',
+                                is_binary=False, optional=True)
+        self.add_composite_file('%s.1.bt2', description='',
+                                substitute_name_with_metadata='reference_name',
+                                is_binary=True, optional=True)
+        self.add_composite_file('%s.2.bt2', description='',
+                                substitute_name_with_metadata='reference_name',
+                                is_binary=True, optional=True)
+        self.add_composite_file('%s.3.bt2', description='',
+                                substitute_name_with_metadata='reference_name',
+                                is_binary=True, optional=True)
+        self.add_composite_file('%s.4.bt2', description='',
+                                substitute_name_with_metadata='reference_name',
+                                is_binary=True, optional=True)
+        self.add_composite_file('%s.rev.1.bt2', description='',
+                                substitute_name_with_metadata='reference_name',
+                                is_binary=True, optional=True)
+        self.add_composite_file('%s.rev.2.bt2', description='',
+                                substitute_name_with_metadata='reference_name',
+                                is_binary=True, optional=True)
+
+    def generate_primary_file(self, dataset=None):
+        """
+        This is called only at upload to write the file
+        cannot rename the datasets here - they come with
+        the default unfortunately
+        """
+
+    def regenerate_primary_file(self, dataset):
+        """
+        cannot do this until we are setting metadata
+        """
+        link_to_exts = ['.grp', '.ti', '.seq', '.fa', '.chrlist', '.log']
+        ref_name = dataset.metadata.reference_name
+        efp = dataset.extra_files_path
+        flist = os.listdir(efp)
+        rval = ['<html><head><title>%s</title></head><body><p/>RSEM \
+                 Reference   %s   files:<p/><ul>' % (dataset.name, ref_name)]
+        rvalb = []
+        for i, fname in enumerate(flist):
+            sfname = os.path.split(fname)[-1]
+            f, e = os.path.splitext(fname)
+            if e in link_to_exts:
+                rval.append('<li><a href="%s">%s</a></li>' % (sfname, sfname))
+            else:
+                rvalb.append('<li>%s</li>' % (sfname))
+        if len(rvalb) > 0:
+            rval += rvalb
+        rval.append('</ul></body></html>')
+        fh = file(dataset.file_name, 'w')
+        fh.write("\n".join(rval))
+        fh.write('\n')
+        fh.close()
+
+    def set_meta(self, dataset, **kwd):
+        Html.set_meta(self, dataset, **kwd)
+        efp = dataset.extra_files_path
+        flist = os.listdir(efp)
+        for i, fname in enumerate(flist):
+            if fname.endswith('.grp'):
+                dataset.metadata.reference_name = fname[:-4]
+                break
+        self.regenerate_primary_file(dataset)
--- a/rsem.xml	Sat Mar 31 21:30:07 2018 -0400
+++ b/rsem.xml	Sun Apr 01 18:28:24 2018 -0400
@@ -1,4 +1,4 @@
-<tool id="rsembowtie" name="RSEM-Bowtie" version="0.4.0">
+<tool id="rsembowtie" name="RSEM-Bowtie" version="@WRAPPER_VERSION@">
   <description></description>
     <macros>
         <import>macros.xml</import>