Mercurial > repos > fubar > jbrowse2
comparison jbrowse2.py @ 29:f728cf0df71d draft
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit fe89199bded3f50aefb6958f0c4e85eede77ad81-dirty
author | fubar |
---|---|
date | Fri, 16 Feb 2024 00:04:37 +0000 |
parents | 9a5c409f33f4 |
children | 8f02a84ee278 |
comparison
equal
deleted
inserted
replaced
28:9a5c409f33f4 | 29:f728cf0df71d |
---|---|
562 """ | 562 """ |
563 tId = trackData["label"] | 563 tId = trackData["label"] |
564 # can be served - if public. | 564 # can be served - if public. |
565 # dsId = trackData["metadata"]["dataset_id"] | 565 # dsId = trackData["metadata"]["dataset_id"] |
566 # url = "%s/api/datasets/%s/display?to_ext=hic " % (self.giURL, dsId) | 566 # url = "%s/api/datasets/%s/display?to_ext=hic " % (self.giURL, dsId) |
567 hname = trackData["name"] | 567 hname = trackData["hic_url"] |
568 dest = os.path.join(self.outdir, hname) | |
569 cmd = ["cp", data, dest] | |
570 # these can be very big. | |
571 self.subprocess_check_call(cmd) | |
572 floc = { | 568 floc = { |
573 "uri": hname, | 569 "uri": hname, |
574 } | 570 } |
575 trackDict = { | 571 trackDict = { |
576 "type": "HicTrack", | 572 "type": "HicTrack", |
772 } | 768 } |
773 style_json = self._prepare_track_style(trackDict) | 769 style_json = self._prepare_track_style(trackDict) |
774 trackDict["style"] = style_json | 770 trackDict["style"] = style_json |
775 self.tracksToAdd.append(trackDict) | 771 self.tracksToAdd.append(trackDict) |
776 self.trackIdlist.append(tId) | 772 self.trackIdlist.append(tId) |
777 logging.info("#### wig trackData=%s" % str(trackData)) | |
778 | 773 |
779 def add_bam(self, data, trackData, bamOpts, bam_index=None, **kwargs): | 774 def add_bam(self, data, trackData, bamOpts, bam_index=None, **kwargs): |
780 tId = trackData["label"] | 775 tId = trackData["label"] |
781 fname = "%s.bam" % trackData["label"] | 776 fname = "%s.bam" % trackData["label"] |
782 dest = "%s/%s" % (self.outdir, fname) | 777 dest = "%s/%s" % (self.outdir, fname) |
1150 self.add_hic( | 1145 self.add_hic( |
1151 dataset_path, | 1146 dataset_path, |
1152 outputTrackConfig, | 1147 outputTrackConfig, |
1153 ) | 1148 ) |
1154 elif dataset_ext in ("cool", "mcool", "scool"): | 1149 elif dataset_ext in ("cool", "mcool", "scool"): |
1155 hic_path = os.path.join( | 1150 hic_url = "%s_%d.hic" % (track_human_label, i) |
1156 self.outdir, "%s_%d_%s.hic" % (track_human_label, i, dataset_ext) | 1151 hic_path = os.path.join(self.outdir, hic_url) |
1157 ) | |
1158 self.subprocess_check_call( | 1152 self.subprocess_check_call( |
1159 [ | 1153 [ |
1160 "hictk", | 1154 "hictk", |
1161 "convert", | 1155 "convert", |
1162 "-f", | 1156 "-f", |
1164 "hic", | 1158 "hic", |
1165 dataset_path, | 1159 dataset_path, |
1166 hic_path, | 1160 hic_path, |
1167 ] | 1161 ] |
1168 ) | 1162 ) |
1163 outputTrackConfig["hic_url"] = hic_url | |
1169 self.add_hic( | 1164 self.add_hic( |
1170 hic_path, | 1165 hic_path, |
1171 outputTrackConfig, | 1166 outputTrackConfig, |
1172 ) | 1167 ) |
1173 elif dataset_ext in ("bed",): | 1168 elif dataset_ext in ("bed",): |
1225 dataset_path, | 1220 dataset_path, |
1226 outputTrackConfig, | 1221 outputTrackConfig, |
1227 track["conf"]["options"]["paf"], | 1222 track["conf"]["options"]["paf"], |
1228 ) | 1223 ) |
1229 else: | 1224 else: |
1230 log.warn("Do not know how to handle %s", dataset_ext) | 1225 logging.warn("Do not know how to handle %s", dataset_ext) |
1231 # Return non-human label for use in other fields | 1226 # Return non-human label for use in other fields |
1232 yield outputTrackConfig["label"] | 1227 yield outputTrackConfig["label"] |
1233 | 1228 |
1234 def add_default_session(self, data): | 1229 def add_default_session(self, data): |
1235 """ | 1230 """ |
1290 else: | 1285 else: |
1291 logging.info( | 1286 logging.info( |
1292 "@@@ regexp could not match contig:start..end in the supplied location %s - please fix" | 1287 "@@@ regexp could not match contig:start..end in the supplied location %s - please fix" |
1293 % ddl | 1288 % ddl |
1294 ) | 1289 ) |
1295 | 1290 else: |
1291 drdict["refName"] = self.genome_firstcontig | |
1296 if drdict.get("refName", None): | 1292 if drdict.get("refName", None): |
1297 # TODO displayedRegions is not just zooming to the region, it hides the rest of the chromosome | 1293 # TODO displayedRegions is not just zooming to the region, it hides the rest of the chromosome |
1298 view_json["displayedRegions"] = [ | 1294 view_json["displayedRegions"] = [ |
1299 drdict, | 1295 drdict, |
1300 ] | 1296 ] |