comparison jbrowse2.py @ 34:2893ef33fba9 draft

planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 80b849766a962bac4bd0bb8cb69c118cc42699cd
author fubar
date Sun, 25 Feb 2024 04:18:53 +0000
parents fe48ed5810bd
children 15da358c3108
comparison
equal deleted inserted replaced
33:9aedb7f1cc77 34:2893ef33fba9
15 from collections import defaultdict 15 from collections import defaultdict
16 16
17 logging.basicConfig(level=logging.INFO) 17 logging.basicConfig(level=logging.INFO)
18 log = logging.getLogger("jbrowse") 18 log = logging.getLogger("jbrowse")
19 19
20 JB2VER = "v2.10.1" 20 JB2VER = "v2.10.2"
21 # version pinned for cloning 21 # version pinned for cloning
22 22
23 TODAY = datetime.datetime.now().strftime("%Y-%m-%d") 23 TODAY = datetime.datetime.now().strftime("%Y-%m-%d")
24 GALAXY_INFRASTRUCTURE_URL = None 24 GALAXY_INFRASTRUCTURE_URL = None
25 JB2REL = "v2.10.1" 25 JB2REL = "v2.10.1"
448 for i, genome_node in enumerate(self.genome_paths): 448 for i, genome_node in enumerate(self.genome_paths):
449 genome_name = genome_node["meta"]["dataset_dname"].strip() 449 genome_name = genome_node["meta"]["dataset_dname"].strip()
450 if len(genome_name.split()) > 1: 450 if len(genome_name.split()) > 1:
451 genome_name = genome_name.split()[0] 451 genome_name = genome_name.split()[0]
452 # spaces and cruft break scripts when substituted 452 # spaces and cruft break scripts when substituted
453 if genome_name not in self.genome_names: 453 if genome_name not in self.genome_names:
454 # ignore dupes - can have multiple pafs with same references? 454 # ignore dupes - can have multiple pafs with same references?
455 fapath = genome_node["path"] 455 fapath = genome_node["path"]
456 assem = self.make_assembly(fapath, genome_name) 456 assem = self.make_assembly(fapath, genome_name)
457 assemblies.append(assem) 457 assemblies.append(assem)
458 self.genome_names.append(genome_name) 458 self.genome_names.append(genome_name)
1013 self.trackIdlist.append(tId) 1013 self.trackIdlist.append(tId)
1014 1014
1015 def add_paf(self, data, trackData, pafOpts, **kwargs): 1015 def add_paf(self, data, trackData, pafOpts, **kwargs):
1016 tname = trackData["name"] 1016 tname = trackData["name"]
1017 tId = trackData["label"] 1017 tId = trackData["label"]
1018 pgnames = [x.strip() for x in pafOpts["genome_label"].split(',')] 1018 pgnames = [x.strip() for x in pafOpts["genome_label"].split(",")]
1019 pgpaths = [x.strip() for x in pafOpts["genome"].split(',')] 1019 pgpaths = [x.strip() for x in pafOpts["genome"].split(",")]
1020 passnames = [self.genome_name] # always first 1020 passnames = [self.genome_name] # always first
1021 for i, gname in enumerate(pgnames): 1021 for i, gname in enumerate(pgnames):
1022 if len(gname.split()) > 1: 1022 if len(gname.split()) > 1:
1023 gname = gname.split()[0] 1023 gname = gname.split()[0]
1024 # trouble from spacey names in command lines avoidance 1024 # trouble from spacey names in command lines avoidance
1025 if gname not in self.genome_names: 1025 if gname not in self.genome_names:
1026 passnames.append(gname) 1026 passnames.append(gname)
1027 # ignore if already there - eg for duplicates among pafs. 1027 # ignore if already there - eg for duplicates among pafs.
1028 asstrack = self.make_assembly(pgpaths[i], gname) 1028 asstrack = self.make_assembly(pgpaths[i], gname)
1029 self.genome_names.append(gname) 1029 self.genome_names.append(gname)
1030 if self.config_json.get("assemblies", None): 1030 if self.config_json.get("assemblies", None):
1031 self.config_json["assemblies"].append(asstrack) 1031 self.config_json["assemblies"].append(asstrack)
1032 else: 1032 else:
1124 extra_metadata, 1124 extra_metadata,
1125 ) in enumerate(track["trackfiles"]): 1125 ) in enumerate(track["trackfiles"]):
1126 # Unsanitize labels (element_identifiers are always sanitized by Galaxy) 1126 # Unsanitize labels (element_identifiers are always sanitized by Galaxy)
1127 for key, value in mapped_chars.items(): 1127 for key, value in mapped_chars.items():
1128 track_human_label = track_human_label.replace(value, key) 1128 track_human_label = track_human_label.replace(value, key)
1129 track_human_label = track_human_label.replace(" ","_") 1129 track_human_label = track_human_label.replace(" ", "_")
1130 outputTrackConfig = { 1130 outputTrackConfig = {
1131 "category": category, 1131 "category": category,
1132 "style": {}, 1132 "style": {},
1133 } 1133 }
1134 1134
1147 self.add_gff( 1147 self.add_gff(
1148 dataset_path, 1148 dataset_path,
1149 dataset_ext, 1149 dataset_ext,
1150 outputTrackConfig, 1150 outputTrackConfig,
1151 ) 1151 )
1152 elif dataset_ext in ("hic","juicebox_hic"): 1152 elif dataset_ext in ("hic", "juicebox_hic"):
1153 self.add_hic( 1153 self.add_hic(
1154 dataset_path, 1154 dataset_path,
1155 outputTrackConfig, 1155 outputTrackConfig,
1156 ) 1156 )
1157 elif dataset_ext in ("cool", "mcool", "scool"): 1157 elif dataset_ext in ("cool", "mcool", "scool"):
1538 "metadata/general/defaultLocation" 1538 "metadata/general/defaultLocation"
1539 ).text 1539 ).text
1540 default_session_data["session_name"] = root.find( 1540 default_session_data["session_name"] = root.find(
1541 "metadata/general/session_name" 1541 "metadata/general/session_name"
1542 ).text 1542 ).text
1543 jc.zipOut = root.find( 1543 jc.zipOut = root.find("metadata/general/zipOut").text == "true"
1544 "metadata/general/zipOut"
1545 ).text == "true"
1546 general_data = { 1544 general_data = {
1547 "analytics": root.find("metadata/general/analytics").text, 1545 "analytics": root.find("metadata/general/analytics").text,
1548 "primary_color": root.find("metadata/general/primary_color").text, 1546 "primary_color": root.find("metadata/general/primary_color").text,
1549 "secondary_color": root.find("metadata/general/secondary_color").text, 1547 "secondary_color": root.find("metadata/general/secondary_color").text,
1550 "tertiary_color": root.find("metadata/general/tertiary_color").text, 1548 "tertiary_color": root.find("metadata/general/tertiary_color").text,