Exemple #1
0
 def getOptionsBox2(prevChoices):
     stockDict = None
     with changedWorkingDir(
             '/usit/invitro/hyperbrowser/standardizedTracks/days/Company stocks/Historical prices/OSE/'
     ):
         stockDict = OrderedDict([(v, False) for v in glob.glob('*')])
     return stockDict
Exemple #2
0
    def getOptionsBox2(prevChoices):

        COMMON_MAPS_PATH = os.sep.join([MAPS_PATH, 'common'])
        resultList = ['-----  Select  -----', 'make new map id']

        with changedWorkingDir(COMMON_MAPS_PATH):
            resultList += sorted([v for v in glob('*') if v.find('.')<0])

        #return ['disease_tf_count', 'disease_tf_log', 'disease_tf_binary', 'disease_tf_count_noflanks', \
        #'tf_disease_count', 'tf_disease_log', 'tf_disease_binary', 'tf_disease_noflanks_count', \
        #'tf_barjoseph_disease_binary', 'tf_barjoseph_disease_1bpupstream_binary'] + ['tf_barjoseph_intogen_tissues_transcript_binary', 'tf_intogen_tissues_transcript_binary',
        #'tf_barjoseph_intogen_tumors_transcript_binary', 'tf_intogen_tumors_transcript_binary'] + ['tf_barjoseph_intogen_v1_tissues_transcript_binary', 'tf_intogen_v1_tissues_transcript_binary',
        #'tf_barjoseph_intogen_v1_tumors_transcript_binary', 'tf_intogen_v1_tumors_transcript_binary'] + ['tf_barjoseph_intogen_v2_tissues_transcript_binary', 'tf_intogen_v2_tissues_transcript_binary',
        #'tf_barjoseph_intogen_v2_tumors_transcript_binary', 'tf_intogen_v2_tumors_transcript_binary',
        #'tf_barjoseph_intogen_v2_tissues_copynumber_binary', 'tf_intogen_v2_tissues_copynumber_binary',
        #'tf_barjoseph_intogen_v2_tumors_copynumber_binary', 'tf_intogen_v2_tumors_copynumber_binary'] + ['tf_barjoseph_phenopedia_binary', 'tf_phenopedia_binary', 'tf_barjoseph_phenopedia_150_binary', 'tf_phenopedia_150_binary'] + ['disease_methylations_count', 'disease_mirna_count', 'disease_repeats_count', \
        #'histmod_disease_count', 'mirna_disease_count', 'repeats_disease_count'] + ['histone_tf_count', 'tf_histmod_count'] + ['go_tf_log', 'tf_geneontology_log', 'tf_geneontology_binary',
        #'tf_barjoseph_geneontology_1bpupstream_binary'] + ['tf_chrarms_count', 'histmod_chrarms_count', 'histmod_geneontology_count', 'gautvik', 'gautvik_least1000',
        #'gautvik_most1000', 'gautvik_mirna', '3d_lieberman', 'encode_gwas_vs_dhs', 'encode_tf_vs_tf', 'encode_gwas_vs_dhs', 'encode_tf_vs_tf']

        return resultList
class GenerateCircosImage(GeneralGuiTool):
    @staticmethod
    def getToolName():
        return "Generate Circos image"

    @staticmethod
    def getInputBoxNames():
        "Returns a list of names for input boxes, implicitly also the number of input boxes to display on page. Each such box will call function getOptionsBoxK, where K is in the range of 1 to the number of boxes"
        #can have two syntaxes: either a list of stings or a list of tuples where each tuple has two items(Name of box on webPage, name of getOptionsBox)
        return ['select history item', 'test']

    @staticmethod
    def getOptionsBox1():
        '''Returns a list of options to be displayed in the first options box
        Alternatively, the following have special meaning:
        '__genome__'
        '__track__'
        ('__history__','bed','wig','...')
        '''
        return '__history__', 'bed', 'bedgraph', 'category.bed'

    @staticmethod
    def getOptionsBox2(prevChoices):
        return prevChoices[0], 1, True

    #@staticmethod
    #def getOptionsBox4(prevChoices):
    #    return ['']

    #@staticmethod
    #def getDemoSelections():
    #    return ['testChoice1','..']

    @classmethod
    def execute(cls, choices, galaxyFn=None, username=''):

        histItem = choices[0].split(':')
        filSuffix = ExternalTrackManager.extractFileSuffixFromGalaxyTN(
            histItem)
        histFile = ExternalTrackManager.extractFnFromGalaxyTN(histItem)
        galaxyOutputFile = GalaxyRunSpecificFile(['circos.png'], galaxyFn)

        outputFn = galaxyOutputFile.getDiskPath(True)
        type = 'line' if filSuffix == 'bedgraph' else 'highlight'
        paramDict = {histFile: {'type': type, 'r0': '0.90r', 'r1': '1.0r'}}
        if type == 'line':
            try:
                vals = [
                    float(line.strip().split()[-1])
                    for line in open(histFile, 'r') if line.strip()[0] == 'c'
                ]
            except Exception, e:
                print e
            paramDict[histFile]['max'] = max(vals)
            paramDict[histFile]['min'] = min(vals)

        with changedWorkingDir('/usit/invitro/site/circos/circos-0.56/bin/'):

            command_line = cls.MakeCircosConfFile(paramDict, galaxyFn,
                                                  outputFn)
            print outputFn, command_line
            system(command_line)
            #import shlex, subprocess
            #args = shlex.split(command_line)
            #p = subprocess.call(args)
        '''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.
        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.
        '''
        print 'Executing...'