Mercurial > repos > fubar > jbrowse2
comparison jbrowse2.py @ 109:27e9ddaaf325 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 9de1453a009c254ab11b16ae8a56cb5c22b131bf-dirty
author | fubar |
---|---|
date | Sat, 29 Jun 2024 07:22:18 +0000 |
parents | 5d1259b88c27 |
children | c017111e976a |
comparison
equal
deleted
inserted
replaced
108:5d1259b88c27 | 109:27e9ddaaf325 |
---|---|
672 trackDict = { | 672 trackDict = { |
673 "type": "HicTrack", | 673 "type": "HicTrack", |
674 "trackId": tId, | 674 "trackId": tId, |
675 "name": trackData["name"], | 675 "name": trackData["name"], |
676 "assemblyNames": [trackData["assemblyNames"]], | 676 "assemblyNames": [trackData["assemblyNames"]], |
677 "displays": [ | |
678 { | |
679 "type": "LinearHicDisplay", | |
680 "displayId": "%s-LinearHicDisplay" % tId, | |
681 } | |
682 ], | |
677 "category": [ | 683 "category": [ |
678 categ, | 684 categ, |
679 ], | 685 ], |
680 "adapter": {"type": "HicAdapter", "hicLocation": {"uri": uri}}, | 686 "adapter": {"type": "HicAdapter", "hicLocation": {"uri": uri}}, |
687 | |
681 } | 688 } |
682 self.tracksToAdd[trackData["assemblyNames"]].append(copy.copy(trackDict)) | 689 self.tracksToAdd[trackData["assemblyNames"]].append(copy.copy(trackDict)) |
683 self.trackIdlist.append(copy.copy(tId)) | 690 self.trackIdlist.append(tId) |
684 | 691 |
685 def add_maf(self, data, trackData): | 692 def add_maf(self, data, trackData): |
686 """ | 693 """ |
687 from https://github.com/cmdcolin/maf2bed | 694 from https://github.com/cmdcolin/maf2bed |
688 Note: Both formats start with a MAF as input, and note that your MAF file should contain the species name and chromosome name | 695 Note: Both formats start with a MAF as input, and note that your MAF file should contain the species name and chromosome name |
752 ], | 759 ], |
753 } | 760 } |
754 style_json = self._prepare_track_style(trackDict) | 761 style_json = self._prepare_track_style(trackDict) |
755 trackDict["style"] = style_json | 762 trackDict["style"] = style_json |
756 self.tracksToAdd[gname].append(copy.copy(trackDict)) | 763 self.tracksToAdd[gname].append(copy.copy(trackDict)) |
757 self.trackIdlist.append(copy.copy(tId)) | 764 self.trackIdlist.append(tId) |
758 if self.config_json.get("plugins", None): | 765 if self.config_json.get("plugins", None): |
759 self.config_json["plugins"].append(mafPlugin["plugins"][0]) | 766 self.config_json["plugins"].append(mafPlugin["plugins"][0]) |
760 else: | 767 else: |
761 self.config_json.update(mafPlugin) | 768 self.config_json.update(mafPlugin) |
762 | 769 |
826 ], | 833 ], |
827 } | 834 } |
828 style_json = self._prepare_track_style(trackDict) | 835 style_json = self._prepare_track_style(trackDict) |
829 trackDict["style"] = style_json | 836 trackDict["style"] = style_json |
830 self.tracksToAdd[trackData["assemblyNames"]].append(copy.copy(trackDict)) | 837 self.tracksToAdd[trackData["assemblyNames"]].append(copy.copy(trackDict)) |
831 self.trackIdlist.append(copy.copy(tId)) | 838 self.trackIdlist.append(tId) |
832 | 839 |
833 def add_bam(self, data, trackData, bam_indexes=None, **kwargs): | 840 def add_bam(self, data, trackData, bam_indexes=None, **kwargs): |
834 tId = trackData["label"] | 841 tId = trackData["label"] |
835 realFName = trackData["path"] | 842 realFName = trackData["path"] |
836 useuri = trackData["useuri"].lower() == "yes" | 843 useuri = trackData["useuri"].lower() == "yes" |
883 ], | 890 ], |
884 } | 891 } |
885 style_json = self._prepare_track_style(trackDict) | 892 style_json = self._prepare_track_style(trackDict) |
886 trackDict["style"] = style_json | 893 trackDict["style"] = style_json |
887 self.tracksToAdd[trackData["assemblyNames"]].append(copy.copy(trackDict)) | 894 self.tracksToAdd[trackData["assemblyNames"]].append(copy.copy(trackDict)) |
888 self.trackIdlist.append(copy.copy(tId)) | 895 self.trackIdlist.append(tId) |
889 | 896 |
890 def add_cram(self, data, trackData, cram_indexes=None, **kwargs): | 897 def add_cram(self, data, trackData, cram_indexes=None, **kwargs): |
891 tId = trackData["label"] | 898 tId = trackData["label"] |
892 realFName = trackData["path"] | 899 realFName = trackData["path"] |
893 categ = trackData["category"] | 900 categ = trackData["category"] |
949 ], | 956 ], |
950 } | 957 } |
951 style_json = self._prepare_track_style(trackDict) | 958 style_json = self._prepare_track_style(trackDict) |
952 trackDict["style"] = style_json | 959 trackDict["style"] = style_json |
953 self.tracksToAdd[trackData["assemblyNames"]].append(copy.copy(trackDict)) | 960 self.tracksToAdd[trackData["assemblyNames"]].append(copy.copy(trackDict)) |
954 self.trackIdlist.append(copy.copy(tId)) | 961 self.trackIdlist.append(tId) |
955 | 962 |
956 def add_vcf(self, data, trackData): | 963 def add_vcf(self, data, trackData): |
957 tId = trackData["label"] | 964 tId = trackData["label"] |
958 categ = trackData["category"] | 965 categ = trackData["category"] |
959 useuri = trackData["useuri"].lower() == "yes" | 966 useuri = trackData["useuri"].lower() == "yes" |
999 ], | 1006 ], |
1000 } | 1007 } |
1001 style_json = self._prepare_track_style(trackDict) | 1008 style_json = self._prepare_track_style(trackDict) |
1002 trackDict["style"] = style_json | 1009 trackDict["style"] = style_json |
1003 self.tracksToAdd[trackData["assemblyNames"]].append(copy.copy(trackDict)) | 1010 self.tracksToAdd[trackData["assemblyNames"]].append(copy.copy(trackDict)) |
1004 self.trackIdlist.append(copy.copy(tId)) | 1011 self.trackIdlist.append(tId) |
1005 | 1012 |
1006 def _sort_gff(self, data, dest): | 1013 def _sort_gff(self, data, dest): |
1007 # Only index if not already done | 1014 # Only index if not already done |
1008 if not os.path.exists(dest): | 1015 if not os.path.exists(dest): |
1009 cmd = "jbrowse sort-gff '%s' | bgzip -c > '%s'" % ( | 1016 cmd = "jbrowse sort-gff '%s' | bgzip -c > '%s'" % ( |
1062 ], | 1069 ], |
1063 } | 1070 } |
1064 style_json = self._prepare_track_style(trackDict) | 1071 style_json = self._prepare_track_style(trackDict) |
1065 trackDict["style"] = style_json | 1072 trackDict["style"] = style_json |
1066 self.tracksToAdd[trackData["assemblyNames"]].append(copy.copy(trackDict)) | 1073 self.tracksToAdd[trackData["assemblyNames"]].append(copy.copy(trackDict)) |
1067 self.trackIdlist.append(copy.copy(tId)) | 1074 self.trackIdlist.append(tId) |
1068 | 1075 |
1069 def add_bed(self, data, ext, trackData): | 1076 def add_bed(self, data, ext, trackData): |
1070 bedPlugin = {"name": "BedScorePlugin", "umdLoc": { "uri": "bedscoreplugin.js" } } | 1077 bedPlugin = {"name": "BedScorePlugin", "umdLoc": { "uri": "bedscoreplugin.js" } } |
1071 tId = trackData["label"] | 1078 tId = trackData["label"] |
1072 categ = trackData["category"] | 1079 categ = trackData["category"] |
1128 if self.config_json.get("plugins", None): | 1135 if self.config_json.get("plugins", None): |
1129 self.config_json["plugins"].append(bedPlugin) | 1136 self.config_json["plugins"].append(bedPlugin) |
1130 else: | 1137 else: |
1131 self.config_json["plugins"] = [bedPlugin,] | 1138 self.config_json["plugins"] = [bedPlugin,] |
1132 self.tracksToAdd[trackData["assemblyNames"]].append(copy.copy(trackDict)) | 1139 self.tracksToAdd[trackData["assemblyNames"]].append(copy.copy(trackDict)) |
1133 self.trackIdlist.append(copy.copy(tId)) | 1140 self.trackIdlist.append(tId) |
1134 | 1141 |
1135 def add_paf(self, data, trackData, pafOpts, **kwargs): | 1142 def add_paf(self, data, trackData, pafOpts, **kwargs): |
1136 tname = trackData["name"] | 1143 tname = trackData["name"] |
1137 tId = trackData["label"] | 1144 tId = trackData["label"] |
1138 url = tId | 1145 url = tId |
1210 "type": "LinearBasicDisplay", | 1217 "type": "LinearBasicDisplay", |
1211 "displayId": "%s-LinearBasicDisplay" % tId, | 1218 "displayId": "%s-LinearBasicDisplay" % tId, |
1212 } | 1219 } |
1213 trackDict["style"] = style_json | 1220 trackDict["style"] = style_json |
1214 self.tracksToAdd[trackData["assemblyNames"]].append(copy.copy(trackDict)) | 1221 self.tracksToAdd[trackData["assemblyNames"]].append(copy.copy(trackDict)) |
1215 self.trackIdlist.append(copy.copy(tId)) | 1222 self.trackIdlist.append(tId) |
1216 | 1223 |
1217 def process_annotations(self, track): | 1224 def process_annotations(self, track): |
1218 category = track["category"].replace("__pd__date__pd__", TODAY) | 1225 category = track["category"].replace("__pd__date__pd__", TODAY) |
1219 tt1 = ",/ :;\\" | 1226 tt1 = ",/ :;\\" |
1220 tt2 = "______" | 1227 tt2 = "______" |
1355 for track_conf in self.tracksToAdd[gnome]: | 1362 for track_conf in self.tracksToAdd[gnome]: |
1356 tId = track_conf["trackId"] | 1363 tId = track_conf["trackId"] |
1357 if tId in default_data[gnome]["visibility"]["default_on"]: | 1364 if tId in default_data[gnome]["visibility"]["default_on"]: |
1358 track_types[tId] = track_conf["type"] | 1365 track_types[tId] = track_conf["type"] |
1359 display = {"type": "linearBasicDisplay"} | 1366 display = {"type": "linearBasicDisplay"} |
1360 if "displays" in track_conf: | 1367 if track_conf.get("displays", None): |
1361 display["type"] = track_conf["displays"][0]["type"] | 1368 display["type"] = track_conf["displays"][0]["type"] |
1362 display["configuration"] = track_conf["displays"][0]["displayId"] | 1369 display["configuration"] = track_conf["displays"][0]["displayId"] |
1370 else: | |
1371 logging.debug("no display in track_conf for %s" % tId) | |
1363 if track_conf.get("style_labels", None): | 1372 if track_conf.get("style_labels", None): |
1364 # TODO fix this: it should probably go in a renderer block (SvgFeatureRenderer) but still does not work | 1373 # TODO fix this: it should probably go in a renderer block (SvgFeatureRenderer) but still does not work |
1365 # TODO move this to per track displays? | 1374 # TODO move this to per track displays? |
1366 style_data["labels"] = track_conf["style_labels"] | 1375 style_data["labels"] = track_conf["style_labels"] |
1367 tracks_data.append( | 1376 tracks_data.append( |