Mercurial > repos > fubar > jbrowse2
comparison jbrowse2.py @ 31:cb4b32ca9968 draft
planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 48bc917d34af182e9158915862c8a35723660919-dirty
author | fubar |
---|---|
date | Fri, 23 Feb 2024 07:15:42 +0000 |
parents | 8f02a84ee278 |
children | fe48ed5810bd |
comparison
equal
deleted
inserted
replaced
30:8f02a84ee278 | 31:cb4b32ca9968 |
---|---|
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 fapath = genome_node["path"] | 453 if genome_name not in self.genome_names: |
454 assem = self.make_assembly(fapath, genome_name) | 454 # ignore dupes - can have multiple pafs with same references? |
455 assemblies.append(assem) | 455 fapath = genome_node["path"] |
456 self.genome_names.append(genome_name) | 456 assem = self.make_assembly(fapath, genome_name) |
457 if self.genome_name is None: | 457 assemblies.append(assem) |
458 self.genome_name = ( | 458 self.genome_names.append(genome_name) |
459 genome_name # first one for all tracks - other than paf | 459 if self.genome_name is None: |
460 ) | 460 self.genome_name = ( |
461 self.genome_firstcontig = None | 461 genome_name # first one for all tracks - other than paf |
462 fl = open(fapath, "r").readline().strip().split(">") | 462 ) |
463 if len(fl) > 1: | 463 self.genome_firstcontig = None |
464 fl = fl[1] | 464 fl = open(fapath, "r").readline().strip().split(">") |
465 if len(fl.split()) > 1: | 465 if len(fl) > 1: |
466 self.genome_firstcontig = fl.split()[0].strip() | 466 fl = fl[1] |
467 else: | 467 if len(fl.split()) > 1: |
468 self.genome_firstcontig = fl | 468 self.genome_firstcontig = fl.split()[0].strip() |
469 else: | |
470 self.genome_firstcontig = fl | |
469 if self.config_json.get("assemblies", None): | 471 if self.config_json.get("assemblies", None): |
470 self.config_json["assemblies"] += assemblies | 472 self.config_json["assemblies"] += assemblies |
471 else: | 473 else: |
472 self.config_json["assemblies"] = assemblies | 474 self.config_json["assemblies"] = assemblies |
473 | 475 |
1011 self.trackIdlist.append(tId) | 1013 self.trackIdlist.append(tId) |
1012 | 1014 |
1013 def add_paf(self, data, trackData, pafOpts, **kwargs): | 1015 def add_paf(self, data, trackData, pafOpts, **kwargs): |
1014 tname = trackData["name"] | 1016 tname = trackData["name"] |
1015 tId = trackData["label"] | 1017 tId = trackData["label"] |
1016 pgname = pafOpts["genome_label"] | 1018 pgnames = [x.strip() for x in pafOpts["genome_label"].split(',')] |
1017 if len(pgname.split()) > 1: | 1019 pgpaths = [x.strip() for x in pafOpts["genome"].split(',')] |
1018 pgname = pgname.split()[ | 1020 passnames = [self.genome_name] # always first |
1019 0 | 1021 for i, gname in enumerate(pgnames): |
1020 ] # trouble from spacey names in command lines avoidance | 1022 if len(gname.split()) > 1: |
1021 asstrack = self.make_assembly(pafOpts["genome"], pgname) | 1023 gname = gname.split()[0] |
1022 self.genome_names.append(pgname) | 1024 # trouble from spacey names in command lines avoidance |
1023 if self.config_json.get("assemblies", None): | 1025 if gname not in self.genome_names: |
1024 self.config_json["assemblies"].append(asstrack) | 1026 passnames.append(gname) |
1025 else: | 1027 # ignore if already there - eg for duplicates among pafs. |
1026 self.config_json["assemblies"] = [ | 1028 asstrack = self.make_assembly(pgpaths[i], gname) |
1027 asstrack, | 1029 self.genome_names.append(gname) |
1028 ] | 1030 if self.config_json.get("assemblies", None): |
1031 self.config_json["assemblies"].append(asstrack) | |
1032 else: | |
1033 self.config_json["assemblies"] = [ | |
1034 asstrack, | |
1035 ] | |
1029 url = "%s.paf" % (trackData["label"]) | 1036 url = "%s.paf" % (trackData["label"]) |
1030 dest = "%s/%s" % (self.outdir, url) | 1037 dest = "%s/%s" % (self.outdir, url) |
1031 self.symlink_or_copy(os.path.realpath(data), dest) | 1038 self.symlink_or_copy(os.path.realpath(data), dest) |
1032 trackDict = { | 1039 trackDict = { |
1033 "type": "SyntenyTrack", | 1040 "type": "SyntenyTrack", |
1034 "trackId": tId, | 1041 "trackId": tId, |
1035 "assemblyNames": [self.genome_name, pgname], | 1042 "assemblyNames": passnames, |
1036 "name": tname, | 1043 "name": tname, |
1037 "adapter": { | 1044 "adapter": { |
1038 "type": "PAFAdapter", | 1045 "type": "PAFAdapter", |
1039 "pafLocation": {"uri": url}, | 1046 "pafLocation": {"uri": url}, |
1040 "assemblyNames": [self.genome_name, pgname], | 1047 "assemblyNames": [self.genome_name, pgname], |
1531 "metadata/general/defaultLocation" | 1538 "metadata/general/defaultLocation" |
1532 ).text | 1539 ).text |
1533 default_session_data["session_name"] = root.find( | 1540 default_session_data["session_name"] = root.find( |
1534 "metadata/general/session_name" | 1541 "metadata/general/session_name" |
1535 ).text | 1542 ).text |
1543 jc.zipOut = root.find( | |
1544 "metadata/general/zipOut" | |
1545 ).text == "true" | |
1536 general_data = { | 1546 general_data = { |
1537 "analytics": root.find("metadata/general/analytics").text, | 1547 "analytics": root.find("metadata/general/analytics").text, |
1538 "primary_color": root.find("metadata/general/primary_color").text, | 1548 "primary_color": root.find("metadata/general/primary_color").text, |
1539 "secondary_color": root.find("metadata/general/secondary_color").text, | 1549 "secondary_color": root.find("metadata/general/secondary_color").text, |
1540 "tertiary_color": root.find("metadata/general/tertiary_color").text, | 1550 "tertiary_color": root.find("metadata/general/tertiary_color").text, |