comparison jbrowse.py @ 12:db5fe5a3176a draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 2bfbb5ae6b801e43355fdc3f964a5111fe3fe3a1
author iuc
date Mon, 06 Feb 2017 12:52:09 -0500
parents 4cbceec1d6b4
children 69c5e9c0add0
comparison
equal deleted inserted replaced
11:4cbceec1d6b4 12:db5fe5a3176a
156 r, g, b = self.BREWER_COLOUR_SCHEMES[self.brewer_colour_idx % len(self.BREWER_COLOUR_SCHEMES)] 156 r, g, b = self.BREWER_COLOUR_SCHEMES[self.brewer_colour_idx % len(self.BREWER_COLOUR_SCHEMES)]
157 self.brewer_colour_idx += 1 157 self.brewer_colour_idx += 1
158 return r, g, b 158 return r, g, b
159 159
160 def parse_menus(self, track): 160 def parse_menus(self, track):
161 trackConfig = {'menuTemplate': [{}, {}, {}]} 161 trackConfig = {'menuTemplate': [{}, {}, {}, {}]}
162 162
163 if 'menu' in track['menus']: 163 if 'menu' in track['menus']:
164 menu_list = [track['menus']['menu']] 164 menu_list = [track['menus']['menu']]
165 if isinstance(track['menus']['menu'], list): 165 if isinstance(track['menus']['menu'], list):
166 menu_list = track['menus']['menu'] 166 menu_list = track['menus']['menu']
433 def add_bigwig(self, data, trackData, wiggleOpts, **kwargs): 433 def add_bigwig(self, data, trackData, wiggleOpts, **kwargs):
434 dest = os.path.join('data', 'raw', trackData['label'] + '.bw') 434 dest = os.path.join('data', 'raw', trackData['label'] + '.bw')
435 cmd = ['ln', data, dest] 435 cmd = ['ln', data, dest]
436 self.subprocess_check_call(cmd) 436 self.subprocess_check_call(cmd)
437 437
438 url = os.path.join('raw', trackData['label'] + '.bw')
438 trackData.update({ 439 trackData.update({
439 "urlTemplate": os.path.join('..', dest), 440 "urlTemplate": url,
440 "storeClass": "JBrowse/Store/SeqFeature/BigWig", 441 "storeClass": "JBrowse/Store/SeqFeature/BigWig",
441 "type": "JBrowse/View/Track/Wiggle/Density", 442 "type": "JBrowse/View/Track/Wiggle/Density",
442 }) 443 })
443 444
444 trackData['type'] = wiggleOpts['type'] 445 trackData['type'] = wiggleOpts['type']
458 self.subprocess_check_call(cmd) 459 self.subprocess_check_call(cmd)
459 460
460 cmd = ['ln', '-s', os.path.realpath(bam_index), dest + '.bai'] 461 cmd = ['ln', '-s', os.path.realpath(bam_index), dest + '.bai']
461 self.subprocess_check_call(cmd) 462 self.subprocess_check_call(cmd)
462 463
464 url = os.path.join('raw', trackData['label'] + '.bam')
463 trackData.update({ 465 trackData.update({
464 "urlTemplate": os.path.join('..', dest), 466 "urlTemplate": url,
465 "type": "JBrowse/View/Track/Alignments2", 467 "type": "JBrowse/View/Track/Alignments2",
466 "storeClass": "JBrowse/Store/SeqFeature/BAM", 468 "storeClass": "JBrowse/Store/SeqFeature/BAM",
467 }) 469 })
468 470
469 self._add_track_json(trackData) 471 self._add_track_json(trackData)
485 cmd = ['bgzip', dest] 487 cmd = ['bgzip', dest]
486 self.subprocess_check_call(cmd) 488 self.subprocess_check_call(cmd)
487 cmd = ['tabix', '-p', 'vcf', dest + '.gz'] 489 cmd = ['tabix', '-p', 'vcf', dest + '.gz']
488 self.subprocess_check_call(cmd) 490 self.subprocess_check_call(cmd)
489 491
492 url = os.path.join('raw', trackData['label'] + '.vcf')
490 trackData.update({ 493 trackData.update({
491 "urlTemplate": os.path.join('..', dest + '.gz'), 494 "urlTemplate": url,
492 "type": "JBrowse/View/Track/HTMLVariants", 495 "type": "JBrowse/View/Track/HTMLVariants",
493 "storeClass": "JBrowse/Store/SeqFeature/VCFTabix", 496 "storeClass": "JBrowse/Store/SeqFeature/VCFTabix",
494 }) 497 })
495 self._add_track_json(trackData) 498 self._add_track_json(trackData)
496 499
562 for subkey in colourOptions['style']: 565 for subkey in colourOptions['style']:
563 outputTrackConfig['style'][subkey] = colourOptions['style'][subkey] 566 outputTrackConfig['style'][subkey] = colourOptions['style'][subkey]
564 else: 567 else:
565 outputTrackConfig[key] = colourOptions[key] 568 outputTrackConfig[key] = colourOptions[key]
566 569
567 menus = self.cs.parse_menus(track['conf']['options']) 570 if 'menus' in track['conf']['options']:
568 outputTrackConfig.update(menus) 571 menus = self.cs.parse_menus(track['conf']['options'])
572 outputTrackConfig.update(menus)
569 573
570 # import pprint; pprint.pprint(track) 574 # import pprint; pprint.pprint(track)
571 # import sys; sys.exit() 575 # import sys; sys.exit()
572 if dataset_ext in ('gff', 'gff3', 'bed'): 576 if dataset_ext in ('gff', 'gff3', 'bed'):
573 self.add_features(dataset_path, dataset_ext, outputTrackConfig, 577 self.add_features(dataset_path, dataset_ext, outputTrackConfig,