예제 #1
0
    def execute(cls, choices, galaxyFn=None, username=''):
        '''Is called when execute-button is pushed by web-user.
        Should print output as HTML to standard out, which will be directed to a results page in Galaxy history. If getOutputFormat is anything else than HTML, the output should be written to the file with path galaxyFn.gtr
        If needed, StaticFile can be used to get a path where additional files can be put (e.g. generated image files).
        choices is a list of selections made by web-user in each options box.
        '''

        extraParams = ['direction=' + cls.DIRECTION_DICT[choices.direction].parseFileArg,\
                       'allSubTypes=' + choices.allSubTypes,\
                       'subTypeDepth=' + choices.subTypeDepth]

        if len(cls._extraParams) > 0:
            for i in range(len(cls._extraParams)):
                paramName = choices[i * 2 + 9]
                param = paramName[:paramName.find('(')].strip()
                val = choices[i * 2 + 10].strip()
                if val != '':
                    extraParams.append(param + '=' + val)

        extraParams += [v.strip() for v in choices.kwArgs.split(',')
                        ] if choices.kwArgs.strip() != '' else []

        arguments = [choices.genome, choices.track, choices.parserClass
                     ] + extraParams
        print 'Running with these arguments: ', arguments

        StandTrackFiles.runParserClass(arguments, printUsageWhenError=False)

        try:
            if choices.file:
                filePathList = cls._getFilePathList(choices, input=False)
                filePath = cls._getFilePath(filePathList, choices)
                print ''
                print ''
                print '10 first lines of file: ' + filePath
                print ''
                fileObj = open(filePath, 'r')
                for i in range(10):
                    print fileObj.readline().strip()  #.replace('\n','<br>')
                fileObj.close()
        except:
            pass
    def execute(cls, choices, galaxyFn=None, username=''):

        genome, history = choices[:2]
        track, catColumn, numHeaderLines = choices[3], choices[4], choices[5]
        suffix, catSuffix = choices[6], choices[7]
        private = True if choices[-1]=='Yes' else False
        GalaxyInterface.integrateTrackFromHistory(genome, history.split(':'), track.split(':'), privateAccess=private, username=username)
        #ensurePathExists(NONSTANDARD_DATA_PATH+'/'+'/'.join( [genome]+track.split(':')+['fName.txt'] ) )
        StandTrackFiles.runParserClass([genome, track, 'PlainCopier', 'direction=std_to_coll', 'allSubTypes=False', 'subTypeDepth=1'], printUsageWhenError=False)
        StandTrackFiles.runParserClass([genome, track, 'SplitFileToSubDirs', 'direction=coll_to_coll', 'allSubTypes=False', \
                                        'subTypeDepth=1', 'subTypeCol='+catColumn, 'numHeaderLines='+numHeaderLines, \
                                        'suffix=.%s' % suffix, 'catSuffix=.%s' % catSuffix], printUsageWhenError=False)
        StandTrackFiles.runParserClass([genome, track, 'PlainCopier', 'direction=coll_to_std', 'allSubTypes=True', 'subTypeDepth=1'], printUsageWhenError=False)
        GalaxyInterface.startPreProcessing(genome, track, username)
예제 #3
0
 def _setExtraParams(prevChoices):
     paramList = StandTrackFiles.getFormattedParamList(
         prevChoices.parserClass,
         argStr='%s (Mandatory parameter)',
         kwArgStr='%s (default: %s)')
     StandardizeTrackFilesTool._extraParams = paramList
예제 #4
0
 def getOptionsBoxDescription(prevChoices):
     if prevChoices.parserClass:
         docString = StandTrackFiles.getParserClassDocString(
             prevChoices.parserClass)
         if docString:
             return (docString, len(docString.split('\n')), True)
예제 #5
0
 def getOptionsBoxParserClass(prevChoices):
     "Returns a list of options to be displayed in the first options box"
     if prevChoices.file or prevChoices.allSubTypes == 'True':
         #return [v[0] for v in getmembers(StandTrackFiles, isclass) if 'GeneralTrackDataModifier' in [c.__name__ for c in getmro(getattr(StandTrackFiles, v[0]))]]
         return StandTrackFiles.getParserClassList()
예제 #6
0
 def getOptionsBoxPrevRun(prevChoices):
     if prevChoices.file or prevChoices.allSubTypes == 'True':
         stored = StandTrackFiles.getStandTrackFileToolCache(
             prevChoices.genome, prevChoices.track.split(':'))
         if stored:
             return (stored, 1, True)
예제 #7
0
파일: Tool5.py 프로젝트: uio-bmi/track_rand
 def standardizeTrackData(genome, tn):
     import quick.extra.StandardizeTrackFiles as StandTrackFiles
     arguments = [genome, ':'.join(tn), 'SplitFileToSubDirs'
                  ] + ['direction=coll_to_std']
     print 'Running standardizer with these arguments: ' + str(arguments)
     StandTrackFiles.runParserClass(arguments, printUsageWhenError=False)