def getTrackExtractionOptions(genome, trackName): from gtrackcore.track.core.Track import PlainTrack from gtrackcore.input.userbins.UserBinSource import MinimalBinSource from gtrackcore.extract.fileformats.FileFormatComposer import \ findMatchingFileFormatComposers, getComposerClsFromFileSuffix tf = PlainTrack(trackName).getTrackView( MinimalBinSource(genome)[0]).trackFormat extractionOptions = [] matchingComposers = findMatchingFileFormatComposers(tf) for composerInfo in matchingComposers: allOverlapRules = tf.getAllOverlapRules() for allowOverlaps in allOverlapRules: extractionOptions.append( \ (composerInfo.trackFormatName.capitalize() + \ ' ' + TrackExtractor.getFileFormatText(composerInfo.fileFormatName) + \ (', ' + (TrackExtractor.ALLOW_OVERLAPS_TRUE_TEXT if allowOverlaps else \ TrackExtractor.ALLOW_OVERLAPS_FALSE_TEXT) \ if len(allOverlapRules) > 1 else ''), \ composerInfo.fileSuffix) ) ti = TrackInfo(genome, trackName) if ti.fileType != '': try: extractionOptions.append( (TrackExtractor.ORIG_FILE_FORMAT_TEXT.capitalize() + \ ' ' + TrackExtractor.getFileSuffixText(ti.fileType), \ getComposerClsFromFileSuffix(ti.fileType).getDefaultFileNameSuffix())) except Exception, e: print 'Error:', e
def getTrackExtractionOptions(genome, trackName): from gtrackcore.track.core.Track import PlainTrack from gtrackcore.input.userbins.UserBinSource import MinimalBinSource from gtrackcore.extract.fileformats.FileFormatComposer import \ findMatchingFileFormatComposers, getComposerClsFromFileSuffix tf = PlainTrack(trackName).getTrackView(MinimalBinSource(genome)[0]).trackFormat extractionOptions = [] matchingComposers = findMatchingFileFormatComposers(tf) for composerInfo in matchingComposers: allOverlapRules = tf.getAllOverlapRules() for allowOverlaps in allOverlapRules: extractionOptions.append( \ (composerInfo.trackFormatName.capitalize() + \ ' ' + TrackExtractor.getFileFormatText(composerInfo.fileFormatName) + \ (', ' + (TrackExtractor.ALLOW_OVERLAPS_TRUE_TEXT if allowOverlaps else \ TrackExtractor.ALLOW_OVERLAPS_FALSE_TEXT) \ if len(allOverlapRules) > 1 else ''), \ composerInfo.fileSuffix) ) ti = TrackInfo(genome, trackName) if ti.fileType != '': try: extractionOptions.append( (TrackExtractor.ORIG_FILE_FORMAT_TEXT.capitalize() + \ ' ' + TrackExtractor.getFileSuffixText(ti.fileType), \ getComposerClsFromFileSuffix(ti.fileType).getDefaultFileNameSuffix())) except Exception, e: print 'Error:', e