changeset 14:3f9971a91096 draft

planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit e526b4e8bef4677b832e940bacb8969a18efc3e3
author yating-l
date Wed, 20 Jun 2018 17:24:45 -0400
parents 43a700afd457
children 6464399df918
files datatypes/interval/BedBlastAlignments.py datatypes/interval/BedBlatAlignments.py datatypes/interval/BigPsl.py datatypes/interval/BlastXml.py jbrowseArchiveCreator.xml tracks/CanvasFeatures.py tracks/HTMLFeatures.py tracks/TrackDb.py util/index/DatabaseIndex.py
diffstat 9 files changed, 59 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/datatypes/interval/BedBlastAlignments.py	Tue Jun 19 17:59:51 2018 -0400
+++ b/datatypes/interval/BedBlastAlignments.py	Wed Jun 20 17:24:45 2018 -0400
@@ -13,7 +13,7 @@
     def __init__(self, input_bed_blast_alignments_false_path, data_bed_blast_alignments):
 
         super(BedBlastAlignments, self).__init__(input_bed_blast_alignments_false_path, data_bed_blast_alignments)
-        #self.seqType = 1
+        self.seqType = 2
         #self.trackType = "G-OnRamp_plugin/BlastAlignment"
 
     def initSettings(self):
--- a/datatypes/interval/BedBlatAlignments.py	Tue Jun 19 17:59:51 2018 -0400
+++ b/datatypes/interval/BedBlatAlignments.py	Wed Jun 20 17:24:45 2018 -0400
@@ -13,7 +13,7 @@
     def __init__(self, input_bed_blast_alignments_false_path, data_bed_blast_alignments):
 
         super(BedBlatAlignments, self).__init__(input_bed_blast_alignments_false_path, data_bed_blast_alignments)
-        #self.seqType = 1
+        self.seqType = 1
         #self.trackType = "G-OnRamp_plugin/BlatAlignment"
 
     def initSettings(self):
--- a/datatypes/interval/BigPsl.py	Tue Jun 19 17:59:51 2018 -0400
+++ b/datatypes/interval/BigPsl.py	Wed Jun 20 17:24:45 2018 -0400
@@ -6,7 +6,6 @@
 
 from Interval import Interval
 from util.index.DatabaseIndex import DatabaseIndex
-from util.index.TrixIndex import TrixIndex
 from datatypes.validators.DataValidation import DataValidation
 from datatypes.converters.DataConversion import DataConversion
 
@@ -25,7 +24,10 @@
         
     def initSettings(self):
         super(BigPsl, self).initSettings()
-        self.extraSettings["glyph"] = "JBrowse/View/FeatureGlyph/Segments"  
+        self.extraSettings["glyph"] = "JBrowse/View/FeatureGlyph/Segments"
+        if "database" in self.trackSettings:
+            self.database_settings = DatabaseIndex(database=self.trackSettings["database"], seqType=self.seqType).setExtLink()
+            self.extraSettings["menuTemplate"] = self.database_settings
 
 
     def validateData(self):
--- a/datatypes/interval/BlastXml.py	Tue Jun 19 17:59:51 2018 -0400
+++ b/datatypes/interval/BlastXml.py	Wed Jun 20 17:24:45 2018 -0400
@@ -6,6 +6,7 @@
 
 from Interval import Interval
 from datatypes.converters.DataConversion import DataConversion
+from util.index.DatabaseIndex import DatabaseIndex
 from util import subtools
 
 
@@ -16,13 +17,18 @@
         self.inputFile = input_blast_alignments_false_path
         self.trackSettings = data_blast_alignments
         self.dataType = "blastxml"
+        self.seqType = 2
         #self.trackType = "G-OnRamp_plugin/BlatAlignment"
 
     def initSettings(self):
         super(BlastXml, self).initSettings()
         self.extraSettings["glyph"] = "JBrowse/View/FeatureGlyph/Segments"
         self.extraSettings["subfeatureClasses"] = "match_part"
-    
+        if "database" in self.trackSettings:
+            self.database_settings = DatabaseIndex(database=self.trackSettings["database"], seqType=self.seqType).setExtLink()
+            self.extraSettings["menuTemplate"] = self.database_settings
+
+
     def validateData(self):
         return
 
--- a/jbrowseArchiveCreator.xml	Tue Jun 19 17:59:51 2018 -0400
+++ b/jbrowseArchiveCreator.xml	Wed Jun 20 17:24:45 2018 -0400
@@ -1,4 +1,4 @@
-<tool id="jbrowse_hub" name="JBrowse Archive Creator" version="2.2.1">
+<tool id="jbrowse_hub" name="JBrowse Archive Creator" version="2.3.0">
     <description>
         This Galaxy tool is used to prepare your files to be ready for displaying on JBrowse with Apollo plugin
     </description>
@@ -108,20 +108,21 @@
                                                 $extra_data_dict)
             #end if
             #if $f.formatChoice.bedChoice.bed_select == "bed_blast_alignment_option"
-                ##set database = str($f.formatChoice.bedChoice.database)
-                ##silent $extra_data_dict.update({"database": $database})
+                #set database = str($f.formatChoice.bedChoice.database)
+                #silent $extra_data_dict.update({"database": $database})
                 #silent $prepare_json("BedBlastAlignments", $f.formatChoice.bedChoice.BED_blast_alignment, $index_track_final,
                                              $extra_data_dict)
             #end if
             #if $f.formatChoice.bedChoice.bed_select == "bed_blat_alignment_option"
-                ##set database = str($f.formatChoice.bedChoice.database)
-                ##silent $extra_data_dict.update({"database": $database})
+                #set database = str($f.formatChoice.bedChoice.database)
+                #silent $extra_data_dict.update({"database": $database})
                 #silent $prepare_json("BedBlatAlignments", $f.formatChoice.bedChoice.BED_blat_alignment, $index_track_final,
                                              $extra_data_dict)
             #end if
         #end if
         #if $f.formatChoice.format_select == "blastxml"
-            #silent $extra_data_dict.update({"nameIndex": str($f.formatChoice.nameIndex)})
+            #set database = str($f.formatChoice.database)
+            #silent $extra_data_dict.update({"database": $database, "nameIndex": str($f.formatChoice.nameIndex)})
             #silent $prepare_json("BlastXml", $f.formatChoice.BlastXML, $index_track_final,
                                             extra_data_dict)
         #end if
@@ -251,6 +252,12 @@
                                         type="data"
                                         label="Bed Blast Alignments (Bed12+12) File"
                                 />
+                                <param name="database" type="select" label="Protein database">
+                                    <option value="NCBI" selected="true">NCBI</option>
+                                    <option value="UniProt">UniProt</option>
+                                    <option value="FlyBase">FlyBase</option>
+                                    <option value="Others">Others</option>
+                                </param>
                                 <param name="nameIndex" type="boolean" checked="true" label="Do you want to builds name indexes for this track to enable search for a feature by name" />
                             </when>
                             <when value="bed_blat_alignment_option">
@@ -260,6 +267,10 @@
                                         type="data"
                                         label="Bed BLAT Alignments (bigPsl) File"
                                 />
+                                <param name="database" type="select" label="mRNA database">
+                                    <option value="NCBI" selected="true">NCBI</option>
+                                    <option value="Others">Others</option>
+                                </param>
                                 <param name="nameIndex" type="boolean" checked="true" label="Do you want to builds name indexes for this track to enable search for a feature by name" />
                             </when>
                         </conditional>
@@ -279,6 +290,12 @@
                                 type="data"
                                 label="Blast Alignments File"
                         />
+                        <param name="database" type="select" label="Protein database">
+                            <option value="NCBI" selected="true">NCBI</option>
+                            <option value="UniProt">UniProt</option>
+                            <option value="FlyBase">FlyBase</option>
+                            <option value="Others">Others</option>
+                        </param>
                         <param name="longLabel" type="text" size="30" value="Blast Alignment" label="Track label" />
                         <param name="track_color" type="color" label="Track color" value="#000000">
                             <sanitizer>
--- a/tracks/CanvasFeatures.py	Tue Jun 19 17:59:51 2018 -0400
+++ b/tracks/CanvasFeatures.py	Wed Jun 20 17:24:45 2018 -0400
@@ -35,6 +35,9 @@
         track['label'] = self.trackLabel
         track['category'] = self.extraSettings['category']
         track['style'] = self.extraSettings['style']
+        if "menuTemplate" in self.extraSettings:
+            track["menuTemplate"] = [{}, self.extraSettings["menuTemplate"]]
+            #self.track["menuTemplate"] += [{"label" : "View details"}, {"label" : "Highlight this gene"}, self.extraSettings["menuTemplate"]]
         extraConfigs = track
         return extraConfigs
 
--- a/tracks/HTMLFeatures.py	Tue Jun 19 17:59:51 2018 -0400
+++ b/tracks/HTMLFeatures.py	Wed Jun 20 17:24:45 2018 -0400
@@ -31,7 +31,11 @@
             self.extraSettings['config']['category'] = "Default group"
         else:
             self.extraSettings['config']['category'] = self.extraSettings['category']
-    
+
+        if "menuTemplate" in self.extraSettings:
+            self.extraSettings["clientConfig"]["menuTemplate"] = [{}, self.extraSettings["menuTemplate"]]
+            #self.extraSettings["clentConfig"]["menuTemplate"] += [{"label" : "View details"}, {"label" : "Highlight this gene"}, self.extraSettings["menuTemplate"]]
+
         extraConfigs['config'] = json.dumps(self.extraSettings["config"])
         extraConfigs['clientConfig'] = json.dumps(self.extraSettings["clientConfig"])
         return extraConfigs
--- a/tracks/TrackDb.py	Tue Jun 19 17:59:51 2018 -0400
+++ b/tracks/TrackDb.py	Wed Jun 20 17:24:45 2018 -0400
@@ -42,7 +42,7 @@
                 )
 
         self.track_db["nameIndex"] = self.extraSettings['nameIndex']
-        
+
         extraConfigs = self.prepareExtraSetting()
         self.logger.debug("Generate extraConfigs = %s", json.dumps(extraConfigs))
         self.track_db["options"] = extraConfigs
--- a/util/index/DatabaseIndex.py	Tue Jun 19 17:59:51 2018 -0400
+++ b/util/index/DatabaseIndex.py	Wed Jun 20 17:24:45 2018 -0400
@@ -7,38 +7,33 @@
     def __init__(self, database, **args):
         self.database = database
         self.seqType=args.get("seqType")
-        self.useIframe=args.get("useIframe")
-        self.iframeHeight=args.get("iframeHeight")
-        self.iframeWidth=args.get("iframeWidth")
+
 
     def setExtLink(self):
-        return self.setDatabaseLink(self.database, self.seqType, self.useIframe, self.iframeHeight, self.iframeWidth)
+        return self.setDatabaseLink(self.database, self.seqType)
 
     
-    def setDatabaseLink(self, database, seqType=None, useIframe=None, iframeHeight=None, iframeWidth=None):
+    def setDatabaseLink(self, database, seqType=None):
         database_settings = collections.OrderedDict()
+        database_settings.update({"label": "View feature details in the database",
+                                  "action": "iframeDialog",
+                                  "iconClass": "dijitIconDatabase",
+                                  "title": "feature {name}"})
+
         if "NCBI" in database:
             if not seqType:
-                database_settings["url"] = "https://www.ncbi.nlm.nih.gov/gquery/?term=$$"
+                database_settings["url"] = "https://www.ncbi.nlm.nih.gov/gquery/?term={name}"
             elif seqType == 2:
-                database_settings["url"] = "https://www.ncbi.nlm.nih.gov/protein/$$"
+                database_settings["url"] = "https://www.ncbi.nlm.nih.gov/protein/{name}"
             elif seqType == 1:
-                database_settings["url"] = "https://www.ncbi.nlm.nih.gov/nuccore/$$"
+                database_settings["url"] = "https://www.ncbi.nlm.nih.gov/nuccore/{name}"
             else:
                 raise Exception("Sequence Type {0} is not valid, should be either protein (seqType==2) or nucleotide (seqType==1). Stopping the application".format(seqType))
         elif "UniProt" in database:
-            database_settings["url"] = "http://www.uniprot.org/uniprot/$$"
+            database_settings["url"] = "http://www.uniprot.org/uniprot/{name}"
         elif "FlyBase" in database:
-            database_settings["url"] = "http://flybase.org/reports/$$"
+            database_settings["url"] = "http://flybase.org/reports/{name}"
         else:
-            database_settings["url"] = "https://www.ncbi.nlm.nih.gov/gquery/?term=$$"
-        database_settings["urlLabel"] = database + " Details:"
-        if useIframe or useIframe is None:
-            database_settings["iframeUrl"] = database_settings["url"]
-            if not iframeHeight:
-                iframeHeight = "600"
-            if not iframeWidth:
-                iframeWidth = "800"
-            database_settings["iframeOptions"] = "height= %s width= %s" % (iframeHeight, iframeWidth)
+            database_settings["url"] = "https://www.ncbi.nlm.nih.gov/gquery/?term={name}"
         return database_settings