comparison jbrowse2.py @ 55:469c0f6d87d7 draft

planemo upload for repository https://github.com/usegalaxy-eu/temporary-tools/tree/master/jbrowse2 commit 0553bb75a96ae401623face516c1cf6e1cfe743f
author fubar
date Sat, 16 Mar 2024 06:50:17 +0000
parents d6b0feb22584
children c0097a584a8a
comparison
equal deleted inserted replaced
54:d6b0feb22584 55:469c0f6d87d7
479 fl = fls[1] 479 fl = fls[1]
480 if len(fl.split()) > 1: 480 if len(fl.split()) > 1:
481 self.genome_firstcontig = fl.split()[0].strip() 481 self.genome_firstcontig = fl.split()[0].strip()
482 else: 482 else:
483 self.genome_firstcontig = fl 483 self.genome_firstcontig = fl
484 else: 484 else:
485 fl = urrlib.request.urlopen(faname+".fai").readline() 485 fl = urllib.request.urlopen(fapath+".fai").readline()
486 if fl: # is first row of the text fai so the first contig name 486 if fl: # is first row of the text fai so the first contig name
487 self.genome_firstcontig = fl.decode('utf8').strip().split()[0] 487 self.genome_firstcontig = fl.decode('utf8').strip().split()[0]
488 if self.config_json.get("assemblies", None): 488 if self.config_json.get("assemblies", None):
489 self.config_json["assemblies"] += assemblies 489 self.config_json["assemblies"] += assemblies
490 else: 490 else:
491 self.config_json["assemblies"] = assemblies 491 self.config_json["assemblies"] = assemblies
492 492
868 self.trackIdlist.append(tId) 868 self.trackIdlist.append(tId)
869 869
870 def add_cram(self, data, trackData, cram_index=None, **kwargs): 870 def add_cram(self, data, trackData, cram_index=None, **kwargs):
871 tId = trackData["label"] 871 tId = trackData["label"]
872 useuri = trackData["useuri"].lower() == "yes" 872 useuri = trackData["useuri"].lower() == "yes"
873 bindex = cram_index
874 if useuri: 873 if useuri:
875 url = data 874 url = data
876 else: 875 else:
877 fname = "%s.cram" % trackData["label"] 876 fname = "%s.cram" % trackData["label"]
878 dest = "%s/%s" % (self.outdir, fname) 877 dest = "%s/%s" % (self.outdir, fname)
879 bindex = fname + '.crai'
880 url = fname 878 url = fname
881 self.subprocess_check_call(["cp", data, dest]) 879 self.subprocess_check_call(["cp", data, dest])
882 if bindex is not None and os.path.exists(bindex): 880 if cram_index is not None and os.path.exists(cram_index):
883 if not os.path.exists(dest+'.crai'): 881 if not os.path.exists(dest+'.crai'):
884 # most probably made by galaxy and stored in galaxy dirs, need to copy it to dest 882 # most probably made by galaxy and stored in galaxy dirs, need to copy it to dest
885 self.subprocess_check_call( 883 self.subprocess_check_call(
886 ["cp", os.path.realpath(cram_index), dest + ".crai"] 884 ["cp", os.path.realpath(cram_index), dest + ".crai"]
887 ) 885 )
897 "assemblyNames": [self.genome_name], 895 "assemblyNames": [self.genome_name],
898 "adapter": { 896 "adapter": {
899 "type": "CramAdapter", 897 "type": "CramAdapter",
900 "cramLocation": {"uri": url}, 898 "cramLocation": {"uri": url},
901 "craiLocation": { 899 "craiLocation": {
902 "uri": bindex, 900 "uri": url + '.crai',
903 }, 901 },
904 "sequenceAdapter": self.genome_sequence_adapter, 902 "sequenceAdapter": self.genome_sequence_adapter,
905 }, 903 },
906 "displays": [ 904 "displays": [
907 { 905 {
1275 refName = None 1273 refName = None
1276 drdict = { 1274 drdict = {
1277 "reversed": False, 1275 "reversed": False,
1278 "assemblyName": self.genome_name, 1276 "assemblyName": self.genome_name,
1279 "start": 2000, 1277 "start": 2000,
1280 "end": 0, 1278 "end": 200000,
1281 "refName": "x", 1279 "refName": "x",
1282 } 1280 }
1283 1281
1284 if data.get("defaultLocation", ""): 1282 if data.get("defaultLocation", ""):
1285 ddl = data["defaultLocation"] 1283 ddl = data["defaultLocation"]