diff TrackHub.py @ 38:d17f629f5486 draft

planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit e4c1d387db160a3bf4a1e8abc288bdffbbbe2818-dirty
author yating-l
date Fri, 06 Apr 2018 13:44:56 -0400
parents 07cc5384dd61
children 4a69515eed63
line wrap: on
line diff
--- a/TrackHub.py	Thu Feb 15 16:54:36 2018 -0500
+++ b/TrackHub.py	Fri Apr 06 13:44:56 2018 -0400
@@ -42,7 +42,7 @@
         # Init the Datatype 
         Datatype.pre_init(self.reference_genome, self.chromSizesFile,
                           self.extra_files_path, self.tool_directory,
-                          self.mySpecieFolderPath, self.myTracksFolderPath, self.myBinaryFolderPath, self.trackType)  
+                          self.mySpecieFolderPath, self.myTracksFolderPath, self.myFinalTracksFolderPath, self.myBinaryFolderPath, self.trackType)
 
         self._prepareRefseq()
         self.trackList = os.path.join(self.mySpecieFolderPath, "trackList.json")
@@ -66,8 +66,12 @@
         else: 
             if trackDbObject['trackType'] == 'HTMLFeatures':
                 self._customizeHTMLFeature(trackDbObject)
-            subtools.flatfile_to_json(trackDbObject['trackDataURL'], trackDbObject['dataType'], trackDbObject['trackType'], trackDbObject['trackLabel'], self.mySpecieFolderPath, trackDbObject['options'])
-
+                subtools.flatfile_to_json(trackDbObject['trackDataURL'], trackDbObject['dataType'], trackDbObject['trackType'], trackDbObject['trackLabel'], self.mySpecieFolderPath, trackDbObject['options'])
+            # Use Tabix index tracks by default for CanvasFeatures
+            # TODO: add support for HTMLFeatures
+            else:
+                subtools.generate_tabix_indexed_track(trackDbObject['trackDataURL'], trackDbObject['dataType'], self.myFinalTracksFolderPath)
+                subtools.add_track_json(self.trackList, trackDbObject['options'])
 
     def terminate(self, debug=False):
         """ Write html file """
@@ -163,23 +167,23 @@
             os.makedirs(myHubPath)
 
         # Create the specie folder
-        # TODO: Generate the name depending on the specie
         mySpecieFolderPath = os.path.join(myHubPath, self.genome_name)
         if not os.path.exists(mySpecieFolderPath):
             os.makedirs(mySpecieFolderPath)
         self.mySpecieFolderPath = mySpecieFolderPath
 
-        # We create the 2bit file while we just created the specie folder
-        #self.twoBitName = self.genome_name + ".2bit"
-        #self.two_bit_final_path = os.path.join(self.mySpecieFolderPath, self.twoBitName)
-        #shutil.copyfile(twoBitFile.name, self.two_bit_final_path)
-
-        # Create the folder tracks into the specie folder
+        # Create the folder named 'raw' inside the specie folder to place raw files
         tracksFolderPath = os.path.join(mySpecieFolderPath, "raw")
         if not os.path.exists(tracksFolderPath):
             os.makedirs(tracksFolderPath)
         self.myTracksFolderPath = tracksFolderPath
 
+        # Create the folder tracks into the specie folder
+        finalTracksFolderPath = os.path.join(mySpecieFolderPath, "tracks")
+        if not os.path.exists(finalTracksFolderPath):
+            os.makedirs(finalTracksFolderPath)
+        self.myFinalTracksFolderPath = finalTracksFolderPath
+
         myBinaryFolderPath = os.path.join(mySpecieFolderPath, 'bbi')
         if not os.path.exists(myBinaryFolderPath):
             os.makedirs(myBinaryFolderPath)