def execute(cls, choices, galaxyFn=None, username=''): basisTrackNameAsList = choices.basisTrack.split(':') extractionOptions = dict( GalaxyInterface.getTrackExtractionOptions(choices.genome, basisTrackNameAsList)) extractionFormat = extractionOptions[ choices.extFormatLbl] if extractionOptions else None gsuite = getGSuiteFromGalaxyTN(choices.gsuite) outGSuite = GSuite() for gsTrack in gsuite.allTracks(): # outputTrackFn = cls.extraGalaxyFn[gsTrack.title] # print '<br>\n<br>\n output track filename: ', outputTrackFn # print 'path: ', gsTrack.path # print 'parsed uri: ', gsTrack._parsedUri newTrackFileName = gsTrack.title + '.' + extractionFormat outGalaxyFn = ExternalTrackManager.createGalaxyFilesFn( galaxyFn, newTrackFileName) ensurePathExists(outGalaxyFn) uri = GalaxyGSuiteTrack.generateURI(galaxyFn, extraFileName=newTrackFileName) GalaxyInterface.parseExtFormatAndExtractTrackManyBins( choices.genome, basisTrackNameAsList, gsTrack.suffix, gsTrack.path, True, choices.extFormatLbl, outGalaxyFn) outGSuite.addTrack( GSuiteTrack(uri, title=gsTrack.title, fileFormat=gsTrack.fileFormat, trackType=gsTrack.trackType, genome=choices.genome, attributes=gsTrack.attributes)) GSuiteComposer.composeToFile(outGSuite, galaxyFn)
def _getAllOutputFormatsForTrack(genome, track): from quick.application.GalaxyInterface import GalaxyInterface trackOutputFormats = set() extractionOptions = \ GalaxyInterface.getTrackExtractionOptions( genome, track.trackName) for opt in extractionOptions: extFormat, suffix = opt formatInfo = FileFormatInfo( *TrackExtractor.getAttrsFromExtractionFormat(extFormat), suffix=suffix) trackOutputFormats.add(formatInfo) return trackOutputFormats
def getOptionsBoxExtFormatLbl(prevChoices): if prevChoices.genome and prevChoices.basisTrack: extrOpts = GalaxyInterface.getTrackExtractionOptions( prevChoices.genome, prevChoices.basisTrack.split(':')) return [x[0] for x in extrOpts if extrOpts]