Mercurial > repos > yating-l > jbrowsearchivecreator
comparison 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 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 37:43909f065bee | 38:d17f629f5486 | 
|---|---|
| 40 # Set all the missing variables of this class, and create physically the folders/files | 40 # Set all the missing variables of this class, and create physically the folders/files | 
| 41 self.rootAssemblyHub = self.__createAssemblyHub__(extra_files_path=extra_files_path) | 41 self.rootAssemblyHub = self.__createAssemblyHub__(extra_files_path=extra_files_path) | 
| 42 # Init the Datatype | 42 # Init the Datatype | 
| 43 Datatype.pre_init(self.reference_genome, self.chromSizesFile, | 43 Datatype.pre_init(self.reference_genome, self.chromSizesFile, | 
| 44 self.extra_files_path, self.tool_directory, | 44 self.extra_files_path, self.tool_directory, | 
| 45 self.mySpecieFolderPath, self.myTracksFolderPath, self.myBinaryFolderPath, self.trackType) | 45 self.mySpecieFolderPath, self.myTracksFolderPath, self.myFinalTracksFolderPath, self.myBinaryFolderPath, self.trackType) | 
| 46 | 46 | 
| 47 self._prepareRefseq() | 47 self._prepareRefseq() | 
| 48 self.trackList = os.path.join(self.mySpecieFolderPath, "trackList.json") | 48 self.trackList = os.path.join(self.mySpecieFolderPath, "trackList.json") | 
| 49 self._createTrackList() | 49 self._createTrackList() | 
| 50 | 50 | 
| 64 elif trackDbObject['dataType'].lower() == 'bigwig': | 64 elif trackDbObject['dataType'].lower() == 'bigwig': | 
| 65 subtools.add_track_json(self.trackList, trackDbObject['options']) | 65 subtools.add_track_json(self.trackList, trackDbObject['options']) | 
| 66 else: | 66 else: | 
| 67 if trackDbObject['trackType'] == 'HTMLFeatures': | 67 if trackDbObject['trackType'] == 'HTMLFeatures': | 
| 68 self._customizeHTMLFeature(trackDbObject) | 68 self._customizeHTMLFeature(trackDbObject) | 
| 69 subtools.flatfile_to_json(trackDbObject['trackDataURL'], trackDbObject['dataType'], trackDbObject['trackType'], trackDbObject['trackLabel'], self.mySpecieFolderPath, trackDbObject['options']) | 69 subtools.flatfile_to_json(trackDbObject['trackDataURL'], trackDbObject['dataType'], trackDbObject['trackType'], trackDbObject['trackLabel'], self.mySpecieFolderPath, trackDbObject['options']) | 
| 70 | 70 # Use Tabix index tracks by default for CanvasFeatures | 
| 71 # TODO: add support for HTMLFeatures | |
| 72 else: | |
| 73 subtools.generate_tabix_indexed_track(trackDbObject['trackDataURL'], trackDbObject['dataType'], self.myFinalTracksFolderPath) | |
| 74 subtools.add_track_json(self.trackList, trackDbObject['options']) | |
| 71 | 75 | 
| 72 def terminate(self, debug=False): | 76 def terminate(self, debug=False): | 
| 73 """ Write html file """ | 77 """ Write html file """ | 
| 74 self._indexName() | 78 self._indexName() | 
| 75 if not debug: | 79 if not debug: | 
| 161 myHubPath = os.path.join(extra_files_path, "myHub") | 165 myHubPath = os.path.join(extra_files_path, "myHub") | 
| 162 if not os.path.exists(myHubPath): | 166 if not os.path.exists(myHubPath): | 
| 163 os.makedirs(myHubPath) | 167 os.makedirs(myHubPath) | 
| 164 | 168 | 
| 165 # Create the specie folder | 169 # Create the specie folder | 
| 166 # TODO: Generate the name depending on the specie | |
| 167 mySpecieFolderPath = os.path.join(myHubPath, self.genome_name) | 170 mySpecieFolderPath = os.path.join(myHubPath, self.genome_name) | 
| 168 if not os.path.exists(mySpecieFolderPath): | 171 if not os.path.exists(mySpecieFolderPath): | 
| 169 os.makedirs(mySpecieFolderPath) | 172 os.makedirs(mySpecieFolderPath) | 
| 170 self.mySpecieFolderPath = mySpecieFolderPath | 173 self.mySpecieFolderPath = mySpecieFolderPath | 
| 171 | 174 | 
| 172 # We create the 2bit file while we just created the specie folder | 175 # Create the folder named 'raw' inside the specie folder to place raw files | 
| 173 #self.twoBitName = self.genome_name + ".2bit" | |
| 174 #self.two_bit_final_path = os.path.join(self.mySpecieFolderPath, self.twoBitName) | |
| 175 #shutil.copyfile(twoBitFile.name, self.two_bit_final_path) | |
| 176 | |
| 177 # Create the folder tracks into the specie folder | |
| 178 tracksFolderPath = os.path.join(mySpecieFolderPath, "raw") | 176 tracksFolderPath = os.path.join(mySpecieFolderPath, "raw") | 
| 179 if not os.path.exists(tracksFolderPath): | 177 if not os.path.exists(tracksFolderPath): | 
| 180 os.makedirs(tracksFolderPath) | 178 os.makedirs(tracksFolderPath) | 
| 181 self.myTracksFolderPath = tracksFolderPath | 179 self.myTracksFolderPath = tracksFolderPath | 
| 180 | |
| 181 # Create the folder tracks into the specie folder | |
| 182 finalTracksFolderPath = os.path.join(mySpecieFolderPath, "tracks") | |
| 183 if not os.path.exists(finalTracksFolderPath): | |
| 184 os.makedirs(finalTracksFolderPath) | |
| 185 self.myFinalTracksFolderPath = finalTracksFolderPath | |
| 182 | 186 | 
| 183 myBinaryFolderPath = os.path.join(mySpecieFolderPath, 'bbi') | 187 myBinaryFolderPath = os.path.join(mySpecieFolderPath, 'bbi') | 
| 184 if not os.path.exists(myBinaryFolderPath): | 188 if not os.path.exists(myBinaryFolderPath): | 
| 185 os.makedirs(myBinaryFolderPath) | 189 os.makedirs(myBinaryFolderPath) | 
| 186 self.myBinaryFolderPath = myBinaryFolderPath | 190 self.myBinaryFolderPath = myBinaryFolderPath | 
