comparison jbrowse.py @ 44:87dc4ce42281 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse commit 00fb3ea114827e72a2ef344f490eb43a672aa492"
author iuc
date Thu, 22 Apr 2021 20:26:48 +0000
parents 8774b28235bb
children a6e57ff585c0
comparison
equal deleted inserted replaced
43:4542035c1075 44:87dc4ce42281
603 self._add_track_json(trackData) 603 self._add_track_json(trackData)
604 604
605 def add_bam(self, data, trackData, bamOpts, bam_index=None, **kwargs): 605 def add_bam(self, data, trackData, bamOpts, bam_index=None, **kwargs):
606 dest = os.path.join('data', 'raw', trackData['label'] + '.bam') 606 dest = os.path.join('data', 'raw', trackData['label'] + '.bam')
607 self.symlink_or_copy(os.path.realpath(data), dest) 607 self.symlink_or_copy(os.path.realpath(data), dest)
608 self.symlink_or_copy(os.path.realpath(bam_index), dest + '.bai') 608 if bam_index is not None:
609 # bai most probably made by galaxy and stored in galaxy dirs, need to copy it to dest
610 self.subprocess_check_call(['cp', os.path.realpath(bam_index), dest + '.bai'])
611 else:
612 # Can happen in exotic condition
613 # e.g. if bam imported as symlink with datatype=unsorted.bam, then datatype changed to bam
614 # => no index generated by galaxy, but there might be one next to the symlink target
615 # this trick allows to skip the bam sorting made by galaxy if already done outside
616 if os.path.exists(os.path.realpath(data) + '.bai'):
617 self.symlink_or_copy(os.path.realpath(data) + '.bai', dest)
618 else:
619 log.warn('Could not find a bam index (.bai file) for %s', data)
609 620
610 url = os.path.join('raw', trackData['label'] + '.bam') 621 url = os.path.join('raw', trackData['label'] + '.bam')
611 trackData.update({ 622 trackData.update({
612 "urlTemplate": url, 623 "urlTemplate": url,
613 "type": "JBrowse/View/Track/Alignments2", 624 "type": "JBrowse/View/Track/Alignments2",