comparison TrackHub.py @ 18:d786bca6a75d draft

planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 3007f4ce1d6e8ac8324970d355f028b9394e2a5f
author rmarenco
date Fri, 30 Sep 2016 18:33:03 -0400
parents c02720d1afee
children 7e8a8b732db3
comparison
equal deleted inserted replaced
17:c02720d1afee 18:d786bca6a75d
94 htmlMakoRendered = self.trackDbTemplate.render( 94 htmlMakoRendered = self.trackDbTemplate.render(
95 trackDbs=trackDbs 95 trackDbs=trackDbs
96 ) 96 )
97 trackDbFile.write(htmlMakoRendered) 97 trackDbFile.write(htmlMakoRendered)
98 98
99 logging.debug("We just added track {0} (in group {1})".format(trackDbObject.trackName,
100 trackDbObject.group_name.lower().replace(' ', '_')))
101
99 def addGroup(self, group_name="Default"): 102 def addGroup(self, group_name="Default"):
100 # If not already present in self.groups, add to groups.txt 103 # If not already present in self.groups, add to groups.txt
101 # Create the trackDb.txt file in the specie folder, if not exists 104 # Create the trackDb.txt file in the specie folder, if not exists
102 # Else append the new track 105 # Else append the new track
103 # TODO: Get this out of the function 106 # TODO: Get this out of the function
104 groupsTxtFilePath = os.path.join(self.mySpecieFolderPath, 'groups.txt') 107 groupsTxtFilePath = os.path.join(self.mySpecieFolderPath, 'groups.txt')
105 108
106 # If the group is already present, we don't need to add it 109 # If the group is already present, we don't need to add it
107 if group_name in self.groups: 110 if group_name in self.groups:
111 logging.debug("We DON'T add in {0} the group {1}".format(groupsTxtFilePath,
112 group_name))
108 return 113 return
109 114
110 # Append to trackDbTxtFilePath the trackDbTemplate populate with the newTrack object 115 # Append to trackDbTxtFilePath the trackDbTemplate populate with the newTrack object
111 with open(groupsTxtFilePath, 'a+') as groupFile: 116 with open(groupsTxtFilePath, 'a+') as groupFile:
112 # Add the group as well, if exists in trackDbObject 117 # Add the group as well, if exists in trackDbObject
113 118
114 htmlMakoRendered = self.groupsTemplate.render( 119 htmlMakoRendered = self.groupsTemplate.render(
115 label=group_name 120 label=group_name
116 ) 121 )
117 groupFile.write(htmlMakoRendered) 122 groupFile.write(htmlMakoRendered)
123 logging.debug("We just added in {0} the group {1}".format(groupsTxtFilePath,
124 group_name))
118 self.groups.add(group_name) 125 self.groups.add(group_name)
119 126
120 def terminate(self): 127 def terminate(self):
121 # Just a test to output a simple HTML 128 # Just a test to output a simple HTML
122 # TODO: Create a class to handle the file object 129 # TODO: Create a class to handle the file object