comparison autogenJB2.py @ 77:3dcda36b97b4 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit d03454f949af9f3fff638f6a3e52fe42bc96be3b-dirty
author fubar
date Mon, 01 Apr 2024 04:35:23 +0000
parents 2bdb748df098
children 5c295cc220ed
comparison
equal deleted inserted replaced
76:9e3eb6b26f85 77:3dcda36b97b4
41 ) 41 )
42 parser.add_argument("--outdir", help="Output directory", required=True) 42 parser.add_argument("--outdir", help="Output directory", required=True)
43 parser.add_argument("--version", "-V", action="version", version="%(prog)s 2.10.2") 43 parser.add_argument("--version", "-V", action="version", version="%(prog)s 2.10.2")
44 args = parser.parse_args() 44 args = parser.parse_args()
45 sessName = args.sessName 45 sessName = args.sessName
46 default_session_data = {}
46 # --trackmeta $jbrowseme[$key],$jbrowseme[$key].ext,'$key' 47 # --trackmeta $jbrowseme[$key],$jbrowseme[$key].ext,'$key'
47 trackList = [x.strip().split(",") for x in args.trackmeta if x > ""] 48 trackList = [x.strip().split(",") for x in args.trackmeta if x > ""]
48 refList = [x.strip().split(",") for x in args.referencemeta if x > ""] 49 refList = [x.strip().split(",") for x in args.referencemeta if x > ""]
49 if len(refList) > 0: 50 if len(refList) > 0:
50 listgenomes = [f for f in refList if f[1] in ["fasta", "fasta.gz"]] 51 listgenomes = [f for f in refList if f[1] in ["fasta", "fasta.gz"]]
74 }, 75 },
75 } 76 }
76 for i, x in enumerate(genome_paths) 77 for i, x in enumerate(genome_paths)
77 ], 78 ],
78 ) 79 )
79 logging.debug("#!!! paths=%s, genomes=%s" % (genome_paths, genomes)) 80 logging.debug("@@@ paths=%s, genomes=%s" % (genome_paths, genomes))
80 assref_name = jc.process_genomes(genomes[0]) 81 assref_name = jc.process_genomes(genomes[0])
81 default_session_data = { 82 if not default_session_data.get(assref_name, None):
82 "visibility": { 83 default_session_data[assref_name] = {
83 "default_on": [], 84 "tracks": [],
84 "default_off": [], 85 "style": {},
85 }, 86 "style_labels": {},
86 "style": {}, 87 "visibility": {
87 "style_labels": {}, 88 "default_on": [],
88 } 89 "default_off": [],
90 },
91 }
89 listtracks = trackList 92 listtracks = trackList
90 # foo.paf must have a foo_paf.fasta or fasta.gz to match 93 # foo.paf must have a foo_paf.fasta or fasta.gz to match
91 tnames = [x[2] for x in listtracks] 94 tnames = [x[2] for x in listtracks]
92 texts = [x[1] for x in listtracks] 95 texts = [x[1] for x in listtracks]
93 for i, track in enumerate(listtracks): 96 for i, track in enumerate(listtracks):
176 "vcf", 179 "vcf",
177 "maf", 180 "maf",
178 "bed", 181 "bed",
179 "hic" 182 "hic"
180 ]: 183 ]:
181 default_session_data["visibility"]["default_on"].append(key) 184 default_session_data[assref_name]["visibility"]["default_on"].append(key)
182 else: 185 else:
183 default_session_data["visibility"]["default_off"].append( 186 default_session_data[assref_name]["visibility"]["default_off"].append(
184 key 187 key
185 ) 188 )
186 if trext in ["gff", "gff3", "bed", "vcf", "maf", "blastxml"]: 189 if trext in ["gff", "gff3", "bed", "vcf", "maf", "blastxml"]:
187 ttype = "LinearBasicDisplay" 190 ttype = "LinearBasicDisplay"
188 if trext == "vcf": 191 if trext == "vcf":
190 style_json = { 193 style_json = {
191 "type": ttype, 194 "type": ttype,
192 "trackShowLabels": False, 195 "trackShowLabels": False,
193 "trackShowDescriptions": False, 196 "trackShowDescriptions": False,
194 } 197 }
195 default_session_data["style"][key] = style_json 198 default_session_data[assref_name]["style"][key] = style_json
199 default_session_data[assref_name]["tracks"].append(key)
196 # general_data = { 200 # general_data = {
197 # "analytics": root.find("metadata/general/analytics").text, 201 # "analytics": root.find("metadata/general/analytics").text,
198 # "primary_color": root.find("metadata/general/primary_color").text, 202 # "primary_color": root.find("metadata/general/primary_color").text,
199 # "secondary_color": root.find("metadata/general/secondary_color").text, 203 # "secondary_color": root.find("metadata/general/secondary_color").text,
200 # "tertiary_color": root.find("metadata/general/tertiary_color").text, 204 # "tertiary_color": root.find("metadata/general/tertiary_color").text,
214 jc.config_json["assemblies"] = assconf 218 jc.config_json["assemblies"] = assconf
215 logging.debug("+++assemblies=%s, gnames=%s" % (assconf, jc.genome_names)) 219 logging.debug("+++assemblies=%s, gnames=%s" % (assconf, jc.genome_names))
216 jc.write_config() 220 jc.write_config()
217 default_session_data.update({"session_name": sessName}) 221 default_session_data.update({"session_name": sessName})
218 track_conf.update(default_session_data) 222 track_conf.update(default_session_data)
219 jc.add_default_session(default_session_data) 223 # jc.add_default_session(default_session_data)
224 jc.add_defsess_to_index(default_session_data)
220 # jc.text_index() not sure what broke here. 225 # jc.text_index() not sure what broke here.
221 else: 226 else:
222 sys.stderr.write( 227 sys.stderr.write(
223 "!!!! Collection has no suitable trackfiles for autogenJB2 - nothing to process" 228 "!!!! Collection has no suitable trackfiles for autogenJB2 - nothing to process"
224 ) 229 )