diff TrackHub.py @ 66:4ca7cbf2d9b8 draft

planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 159730602ff500b59aefc7080fb49b726c88d655-dirty
author yating-l
date Tue, 26 Sep 2017 16:44:58 -0400
parents 3e0c61b52a06
children 39a32cb31623
line wrap: on
line diff
--- a/TrackHub.py	Wed Aug 09 16:40:21 2017 -0400
+++ b/TrackHub.py	Tue Sep 26 16:44:58 2017 -0400
@@ -6,12 +6,13 @@
 import tempfile
 import shutil
 import zipfile
+from mako.lookup import TemplateLookup
 
 # Internal dependencies
-from Datatype import Datatype
+from datatypes.Datatype import Datatype
 from util import subtools
 
-from mako.lookup import TemplateLookup
+
 
 
 class TrackHub(object):
@@ -19,7 +20,6 @@
 
     def __init__(self, inputFastaFile, user_email, outputFile, extra_files_path, tool_directory):
         super(TrackHub, self).__init__()
-
         self.rootAssemblyHub = None
 
         self.mySpecieFolderPath = None
@@ -68,7 +68,7 @@
         Datatype.pre_init(self.reference_genome, self.two_bit_final_path, self.chromSizesFile,
                           self.extra_files_path, self.tool_directory,
                           self.mySpecieFolderPath, self.myTracksFolderPath)
-
+    '''
     def createZip(self):
         for root, dirs, files in os.walk(self.rootAssemblyHub):
             # Get all files and construct the dir at the same time
@@ -76,29 +76,29 @@
                 self.outputZip.write(os.path.join(root, file))
 
         self.outputZip.close()
-
+    '''
     def addTrack(self, trackDbObject=None):
         # Create the trackDb.txt file in the specie folder, if not exists
         # Else append the new track
         # TODO: Get this out of the function
         trackDbTxtFilePath = os.path.join(self.mySpecieFolderPath, 'trackDb.txt')
-
         # Append to trackDbTxtFilePath the trackDbTemplate populate with the newTrack object
         with open(trackDbTxtFilePath, 'a+') as trackDbFile:
             trackDbs = [trackDbObject]
 
             # TODO: The addGroup does not belong here. Move it when the group becomes more than just a label
             # Add the group as well, if exists in trackDbObject
-            self.addGroup(trackDbObject.group_name)
+            self.addGroup(trackDbObject["group"])
 
             htmlMakoRendered = self.trackDbTemplate.render(
                 trackDbs=trackDbs
             )
             trackDbFile.write(htmlMakoRendered)
 
-        logging.debug("We just added track {0} (in group {1})".format(trackDbObject.trackName,
-                                                                  trackDbObject.group_name.lower().replace(' ', '_')))
-
+        #logging.debug("We just added track {0} (in group {1})".format(trackDbObject.trackName,
+        #                                                          trackDbObject.group_name.lower().replace(' ', '_')))
+        logging.debug("We just added track {0} (in group {1})".format(trackDbObject.get("track"),
+                                                                  trackDbObject.get("group").lower().replace(' ', '_')))
     def addGroup(self, group_name="Default"):
         # If not already present in self.groups, add to groups.txt
         # Create the trackDb.txt file in the specie folder, if not exists
@@ -168,6 +168,7 @@
             )
             htmlOutput.write(htmlMakoRendered)
 
+
     def __createAssemblyHub__(self, extra_files_path):
         # Get all necessaries infos first
         # 2bit file creation from input fasta