当前位置: 首页>>代码示例>>Python>>正文


Python webqtlUtil.genRandStr函数代码示例

本文整理汇总了Python中utility.webqtlUtil.genRandStr函数的典型用法代码示例。如果您正苦于以下问题:Python genRandStr函数的具体用法?Python genRandStr怎么用?Python genRandStr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了genRandStr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: plotNormalProbability

def plotNormalProbability(vals=None, RISet='', title=None, showstrains=0, specialStrains=[None], size=(750,500)):

    dataXZ = vals[:]
    dataXZ.sort(webqtlUtil.cmpOrder)
    dataLabel = []
    dataX = map(lambda X: X[1], dataXZ)

    showLabel = showstrains
    if len(dataXZ) > 50:
        showLabel = 0
    for item in dataXZ:
        strainName = webqtlUtil.genShortStrainName(RISet=RISet, input_strainName=item[0])
        dataLabel.append(strainName)

    dataY=Plot.U(len(dataX))
    dataZ=map(Plot.inverseCumul,dataY)
    c = pid.PILCanvas(size=(750,500))
    Plot.plotXY(c, dataZ, dataX, dataLabel = dataLabel, XLabel='Expected Z score', connectdot=0, YLabel='Trait value', title=title, specialCases=specialStrains, showLabel = showLabel)

    filename= webqtlUtil.genRandStr("nP_")
    c.save(webqtlConfig.IMGDIR+filename, format='gif')

    img=HT.Image('/image/'+filename+'.gif',border=0)

    return img
开发者ID:Brainiarc7,项目名称:genenetwork2,代码行数:25,代码来源:BasicStatisticsFunctions.py

示例2: addToTable

	def addToTable(self, traitNames, strainNames,strainIds, traitValues, SE, NStrain, fd):
		self.cursor.execute('delete Temp, TempData from Temp, TempData where Temp.DataId = TempData.Id and UNIX_TIMESTAMP()-UNIX_TIMESTAMP(CreateTime)>%d;' % webqtlConfig.MAXLIFE)
		
		i = 0
		for trait in traitNames:
			ct0 = time.localtime(time.time())
			ct = time.strftime("%B/%d %H:%M:%S",ct0)
			if trait == '':
				trait = "Unnamed Trait"
			user_ip = fd.remote_ip
			newDescription = '%s entered at %s from IP %s' % (trait,ct,user_ip)
			newProbeSetID = webqtlUtil.genRandStr('Usr_TMP_')
			
			self.cursor.execute('SelecT max(id) from TempData')
			try:
				DataId = self.cursor.fetchall()[0][0] + 1
			except:
				DataId = 1
			
			self.cursor.execute('Select Id  from InbredSet where Name = "%s"' % fd.RISet)
			InbredSetId = self.cursor.fetchall()[0][0]
					
			self.cursor.execute('insert into Temp(Name,description, createtime,DataId,InbredSetId,IP) values(%s,%s,Now(),%s,%s,%s)' ,(newProbeSetID, newDescription, DataId,InbredSetId,user_ip))
			
			for k in range(len(traitValues[i])):
				if traitValues[i][k] != None:
					self.cursor.execute('insert into TempData(Id, StrainId, value, SE, NStrain) values(%s, %s, %s, %s, %s)' , (DataId, strainIds[k], traitValues[i][k],SE[i][k],NStrain[i][k]))
			
			self.searchResult.append('Temp::%s'	% newProbeSetID)
			i += 1
开发者ID:avinashsivaraman,项目名称:genenetwork,代码行数:30,代码来源:BatchSubmitSelectionPage.py

示例3: plotBoxPlot

def plotBoxPlot(vals):

    valsOnly = []
    dataXZ = vals[:]
    for i in range(len(dataXZ)):
        valsOnly.append(dataXZ[i][1])

    plotHeight = 320
    plotWidth = 220
    xLeftOffset = 60
    xRightOffset = 40
    yTopOffset = 40
    yBottomOffset = 60

    canvasHeight = plotHeight + yTopOffset + yBottomOffset
    canvasWidth = plotWidth + xLeftOffset + xRightOffset
    canvas = pid.PILCanvas(size=(canvasWidth,canvasHeight))
    XXX = [('', valsOnly[:])]

    Plot.plotBoxPlot(canvas, XXX, offset=(xLeftOffset, xRightOffset, yTopOffset, yBottomOffset), XLabel= "Trait")
    filename= webqtlUtil.genRandStr("Box_")
    canvas.save(webqtlConfig.IMGDIR+filename, format='gif')
    img=HT.Image('/image/'+filename+'.gif',border=0)

    plotLink = HT.Span("More about ", HT.Href(text="Box Plots", url="http://davidmlane.com/hyperstat/A37797.html", target="_blank", Class="fs13"))

    return img, plotLink
开发者ID:Brainiarc7,项目名称:genenetwork2,代码行数:27,代码来源:BasicStatisticsFunctions.py

示例4: run_plink

def run_plink(this_trait, dataset, species, vals, maf):
    plink_output_filename = webqtlUtil.genRandStr("%s_%s_"%(dataset.group.name, this_trait.name))

    gen_pheno_txt_file_plink(this_trait, dataset, vals, pheno_filename = plink_output_filename)

    plink_command = PLINK_COMMAND + ' --noweb --ped %s/%s.ped --no-fid --no-parents --no-sex --no-pheno --map %s/%s.map --pheno %s%s.txt --pheno-name %s --maf %s --missing-phenotype -9999 --out %s%s --assoc ' % (
        PLINK_PATH, dataset.group.name, PLINK_PATH, dataset.group.name,
        TMPDIR, plink_output_filename, this_trait.name, maf, TMPDIR,
        plink_output_filename)
    logger.debug("plink_command:", plink_command)

    os.system(plink_command)

    count, p_values = parse_plink_output(plink_output_filename, species)

    #for marker in self.dataset.group.markers.markers:
    #    if marker['name'] not in included_markers:
    #        logger.debug("marker:", marker)
    #        self.dataset.group.markers.markers.remove(marker)
    #        #del self.dataset.group.markers.markers[marker]

    logger.debug("p_values:", pf(p_values))
    dataset.group.markers.add_pvalues(p_values)

    return dataset.group.markers.markers
开发者ID:lyan6,项目名称:genenetwork2,代码行数:25,代码来源:plink_mapping.py

示例5: screePlot

    def screePlot(self, NNN=0, pearsonEigenValue=None):

        c1 = pid.PILCanvas(size=(700,500))
        Plot.plotXY(canvas=c1, dataX=range(1,NNN+1), dataY=pearsonEigenValue, rank=0, labelColor=pid.blue,plotColor=pid.red, symbolColor=pid.blue, XLabel='Factor Number', connectdot=1,YLabel='Percent of Total Variance %', title='Pearson\'s R Scree Plot')
        filename= webqtlUtil.genRandStr("Scree_")
        c1.save(webqtlConfig.IMGDIR+filename, format='gif')
        img=HT.Image('/image/'+filename+'.gif',border=0)
        
        return img
开发者ID:OriginalPenguin,项目名称:genenetwork,代码行数:9,代码来源:CorrelationMatrixPage.py

示例6: factorLoadingsPlot

 def factorLoadingsPlot(self, pearsonEigenVectors=None, traitList=None):
     
     traitname = map(lambda X:str(X.name), traitList)
     c2 = pid.PILCanvas(size=(700,500))
     Plot.plotXY(c2, pearsonEigenVectors[0],pearsonEigenVectors[1], 0, dataLabel = traitname, labelColor=pid.blue, plotColor=pid.red, symbolColor=pid.blue,XLabel='Factor (1)', connectdot=1, YLabel='Factor (2)', title='Factor Loadings Plot (Pearson)', loadingPlot=1)
     filename= webqtlUtil.genRandStr("FacL_")
     c2.save(webqtlConfig.IMGDIR+filename, format='gif')
     img = HT.Image('/image/'+filename+'.gif',border=0)
  
     return img
开发者ID:OriginalPenguin,项目名称:genenetwork,代码行数:10,代码来源:CorrelationMatrixPage.py

示例7: __init__

    def __init__(self, start_vars, temp_uuid):

        #Currently only getting trait data for one trait, but will need
        #to change this to accept multiple traits once the collection page is implemented
        helper_functions.get_species_dataset_trait(self, start_vars)

        tempdata = temp_data.TempData(temp_uuid)
        
        self.samples = [] # Want only ones with values
        self.vals = []

        for sample in self.dataset.group.samplelist:
            value = start_vars['value:' + sample]
            self.samples.append(str(sample))
            self.vals.append(value)
 
        print("start_vars:", start_vars)
 
        self.set_options(start_vars)
 
        self.json_data = {}
 
        #if self.method == "qtl_reaper":
        self.json_data['lodnames'] = ['lod.hk']
        self.gen_reaper_results(tempdata)
        #else:
        #    self.gen_pylmm_results(tempdata)
        #self.gen_qtl_results(tempdata)

        #Get chromosome lengths for drawing the interval map plot
        chromosome_mb_lengths = {}
        self.json_data['chrnames'] = []
        for key in self.species.chromosomes.chromosomes.keys():
            self.json_data['chrnames'].append([self.species.chromosomes.chromosomes[key].name, self.species.chromosomes.chromosomes[key].mb_length])
            
            chromosome_mb_lengths[key] = self.species.chromosomes.chromosomes[key].mb_length
        
        #print("self.qtl_results:", self.qtl_results)
        
        print("JSON DATA:", self.json_data)
        
        #os.chdir(webqtlConfig.TMPDIR)
        json_filename = webqtlUtil.genRandStr(prefix="intmap_")
        json.dumps(self.json_data, webqtlConfig.TMPDIR + json_filename)
        
        self.js_data = dict(
            manhattan_plot = self.manhattan_plot,
            additive = self.additive,
            chromosomes = chromosome_mb_lengths,
            qtl_results = self.qtl_results,
            json_data = self.json_data
            #lrs_lod = self.lrs_lod,
        )
开发者ID:lomereiter,项目名称:genenetwork2old,代码行数:53,代码来源:interval_mapping.py

示例8: run_rqtl_plink

 def run_rqtl_plink(self):
     os.chdir("/home/zas1024/plink")
     
     output_filename = webqtlUtil.genRandStr("%s_%s_"%(self.dataset.group.name, self.this_trait.name))
     
     self.gen_pheno_txt_file_plink(pheno_filename = output_filename)
     
     rqtl_command = './plink --noweb --ped %s.ped --no-fid --no-parents --no-sex --no-pheno --map %s.map --pheno %s/%s.txt --pheno-name %s --maf %s --missing-phenotype -9999 --out %s%s --assoc ' % (self.dataset.group.name, self.dataset.group.name, webqtlConfig.TMPDIR, plink_output_filename, self.this_trait.name, self.maf, webqtlConfig.TMPDIR, plink_output_filename)
     
     os.system(rqtl_command)
     
     count, p_values = self.parse_rqtl_output(plink_output_filename)
开发者ID:lomereiter,项目名称:genenetwork2old,代码行数:12,代码来源:marker_regression.py

示例9: run_rqtl_plink

    def run_rqtl_plink(self):
        # os.chdir("") never do this inside a webserver!!

        output_filename = webqtlUtil.genRandStr("%s_%s_"%(self.dataset.group.name, self.this_trait.name))

        plink_mapping.gen_pheno_txt_file_plink(self.this_trait, self.dataset, self.vals, pheno_filename = output_filename)

        rqtl_command = './plink --noweb --ped %s.ped --no-fid --no-parents --no-sex --no-pheno --map %s.map --pheno %s/%s.txt --pheno-name %s --maf %s --missing-phenotype -9999 --out %s%s --assoc ' % (self.dataset.group.name, self.dataset.group.name, TMPDIR, plink_output_filename, self.this_trait.name, self.maf, TMPDIR, plink_output_filename)

        os.system(rqtl_command)

        count, p_values = self.parse_rqtl_output(plink_output_filename)
开发者ID:zsloan,项目名称:genenetwork2,代码行数:12,代码来源:marker_regression.py

示例10: plotBarGraph

def plotBarGraph(identification='', RISet='', vals=None, type="name"):

    this_identification = "unnamed trait"
    if identification:
        this_identification = identification

    if type=="rank":
        dataXZ = vals[:]
        dataXZ.sort(webqtlUtil.cmpOrder)
        title='%s' % this_identification
    else:
        dataXZ = vals[:]
        title='%s' % this_identification

    tvals = []
    tnames = []
    tvars = []
    for i in range(len(dataXZ)):
        tvals.append(dataXZ[i][1])
        tnames.append(webqtlUtil.genShortStrainName(RISet=RISet, input_strainName=dataXZ[i][0]))
        tvars.append(dataXZ[i][2])
    nnStrain = len(tnames)

    sLabel = 1

    ###determine bar width and space width
    if nnStrain < 20:
        sw = 4
    elif nnStrain < 40:
        sw = 3
    else:
        sw = 2

    ### 700 is the default plot width minus Xoffsets for 40 strains
    defaultWidth = 650
    if nnStrain > 40:
        defaultWidth += (nnStrain-40)*10
    defaultOffset = 100
    bw = int(0.5+(defaultWidth - (nnStrain-1.0)*sw)/nnStrain)
    if bw < 10:
        bw = 10

    plotWidth = (nnStrain-1)*sw + nnStrain*bw + defaultOffset
    plotHeight = 500
    #print [plotWidth, plotHeight, bw, sw, nnStrain]
    c = pid.PILCanvas(size=(plotWidth,plotHeight))
    Plot.plotBarText(c, tvals, tnames, variance=tvars, YLabel='Value', title=title, sLabel = sLabel, barSpace = sw)

    filename= webqtlUtil.genRandStr("Bar_")
    c.save(webqtlConfig.IMGDIR+filename, format='gif')
    img=HT.Image('/image/'+filename+'.gif',border=0)

    return img
开发者ID:Brainiarc7,项目名称:genenetwork2,代码行数:53,代码来源:BasicStatisticsFunctions.py

示例11: __init__

    def __init__(self, start_vars, temp_uuid):

        # Currently only getting trait data for one trait, but will need
        # to change this to accept multiple traits once the collection page is implemented
        helper_functions.get_species_dataset_trait(self, start_vars)

        tempdata = temp_data.TempData(temp_uuid)

        self.samples = []  # Want only ones with values
        self.vals = []

        for sample in self.dataset.group.samplelist:
            value = start_vars["value:" + sample]
            self.samples.append(str(sample))
            self.vals.append(value)

        print("start_vars:", start_vars)

        self.set_options(start_vars)

        self.score_type = "LRS"
        self.cutoff = 3

        self.json_data = {}
        self.json_data["lodnames"] = ["lod.hk"]
        self.gen_reaper_results(tempdata)

        # Get chromosome lengths for drawing the interval map plot
        chromosome_mb_lengths = {}
        self.json_data["chrnames"] = []
        for key in self.species.chromosomes.chromosomes.keys():
            self.json_data["chrnames"].append(
                [self.species.chromosomes.chromosomes[key].name, self.species.chromosomes.chromosomes[key].mb_length]
            )

            chromosome_mb_lengths[key] = self.species.chromosomes.chromosomes[key].mb_length

        print("JSON DATA:", self.json_data)

        json_filename = webqtlUtil.genRandStr(prefix="intmap_")
        json.dumps(self.json_data, webqtlConfig.TMPDIR + json_filename)

        self.js_data = dict(
            result_score_type=self.score_type,
            manhattan_plot=self.manhattan_plot,
            chromosomes=chromosome_mb_lengths,
            qtl_results=self.qtl_results,
            json_data=self.json_data,
        )
开发者ID:ethanwillis,项目名称:genenetwork2,代码行数:49,代码来源:interval_mapping.py

示例12: run_plink

def run_plink(this_trait, dataset, species, vals, maf):
    plink_output_filename = webqtlUtil.genRandStr("%s_%s_"%(dataset.group.name, this_trait.name))
    gen_pheno_txt_file(dataset, vals)

    plink_command = PLINK_COMMAND + ' --noweb --bfile %s/%s --no-pheno --no-fid --no-parents --no-sex --maf %s --out %s%s --assoc ' % (
        flat_files('mapping'), dataset.group.name, maf, TMPDIR, plink_output_filename)
    logger.debug("plink_command:", plink_command)

    os.system(plink_command)

    count, p_values = parse_plink_output(plink_output_filename, species)

    logger.debug("p_values:", p_values)
    dataset.group.markers.add_pvalues(p_values)

    return dataset.group.markers.markers
开发者ID:genenetwork,项目名称:genenetwork2,代码行数:16,代码来源:plink_mapping.py

示例13: factorLoadingsPlot

 def factorLoadingsPlot(self, pearsonEigenVectors=None, traitList=None):
     traitname = map(lambda X:str(X.name), traitList)
     c2 = pid.PILCanvas(size=(700,500))
     if type(pearsonEigenVectors[0][0]).__name__ == 'complex':
         pearsonEigenVectors_0 = self.removeimag_array(values=pearsonEigenVectors[0])
     else:
         pearsonEigenVectors_0 = pearsonEigenVectors[0]
     if type(pearsonEigenVectors[1][0]).__name__ == 'complex':
         pearsonEigenVectors_1 = self.removeimag_array(values=pearsonEigenVectors[1])
     else:
         pearsonEigenVectors_1 = pearsonEigenVectors[1]
     Plot.plotXY(c2, pearsonEigenVectors_0,pearsonEigenVectors_1, 0, dataLabel = traitname, labelColor=pid.blue, plotColor=pid.red, symbolColor=pid.blue,XLabel='Factor (1)', connectdot=1, YLabel='Factor (2)', title='Factor Loadings Plot (Pearson)', loadingPlot=1)
     filename= webqtlUtil.genRandStr("FacL_")
     c2.save(webqtlConfig.IMGDIR+filename, format='gif')
     img = HT.Image('/image/'+filename+'.gif',border=0)
  
     return img
开发者ID:genenetwork,项目名称:genenetwork,代码行数:17,代码来源:CorrelationMatrixPage.py

示例14: run_plink

    def run_plink(self):
        plink_output_filename = webqtlUtil.genRandStr("%s_%s_" % (self.dataset.group.name, self.this_trait.name))

        self.gen_pheno_txt_file_plink(pheno_filename=plink_output_filename)

        plink_command = (
            PLINK_COMMAND
            + " --noweb --ped %s/%s.ped --no-fid --no-parents --no-sex --no-pheno --map %s/%s.map --pheno %s%s.txt --pheno-name %s --maf %s --missing-phenotype -9999 --out %s%s --assoc "
            % (
                PLINK_PATH,
                self.dataset.group.name,
                PLINK_PATH,
                self.dataset.group.name,
                webqtlConfig.TMPDIR,
                plink_output_filename,
                self.this_trait.name,
                self.maf,
                webqtlConfig.TMPDIR,
                plink_output_filename,
            )
        )
        print("plink_command:", plink_command)

        os.system(plink_command)

        count, p_values = self.parse_plink_output(plink_output_filename)

        # for marker in self.dataset.group.markers.markers:
        #    if marker['name'] not in included_markers:
        #        print("marker:", marker)
        #        self.dataset.group.markers.markers.remove(marker)
        #        #del self.dataset.group.markers.markers[marker]

        print("p_values:", pf(p_values))

        self.dataset.group.markers.add_pvalues(p_values)

        return self.dataset.group.markers.markers
开发者ID:ethanwillis,项目名称:genenetwork2,代码行数:38,代码来源:marker_regression.py

示例15: run_plink

    def run_plink(self):
    
        os.chdir("/home/zas1024/plink")
        
        plink_output_filename = webqtlUtil.genRandStr("%s_%s_"%(self.dataset.group.name, self.this_trait.name))
        
        self.gen_pheno_txt_file_plink(pheno_filename = plink_output_filename)
        
        plink_command = './plink --noweb --ped %s.ped --no-fid --no-parents --no-sex --no-pheno --map %s.map --pheno %s/%s.txt --pheno-name %s --maf %s --missing-phenotype -9999 --out %s%s --assoc ' % (self.dataset.group.name, self.dataset.group.name, webqtlConfig.TMPDIR, plink_output_filename, self.this_trait.name, self.maf, webqtlConfig.TMPDIR, plink_output_filename)
        
        os.system(plink_command)

        count, p_values = self.parse_plink_output(plink_output_filename)
        #gemma_command = './gemma -bfile %s -k output_%s.cXX.txt -lmm 1 -o %s_output' % (
        #                                                                                         self.dataset.group.name,
        #                                                                                         self.dataset.group.name,
        #                                                                                         self.dataset.group.name)
        #print("gemma_command:" + gemma_command)
        #
        #os.system(gemma_command)
        #
        #included_markers, p_values = self.parse_gemma_output()
        #
        #self.dataset.group.get_specified_markers(markers = included_markers)
        
        #for marker in self.dataset.group.markers.markers:
        #    if marker['name'] not in included_markers:
        #        print("marker:", marker)
        #        self.dataset.group.markers.markers.remove(marker)
        #        #del self.dataset.group.markers.markers[marker]
        
        print("p_values:", pf(p_values))
        
        self.dataset.group.markers.add_pvalues(p_values)

        return self.dataset.group.markers.markers
开发者ID:lomereiter,项目名称:genenetwork2old,代码行数:36,代码来源:marker_regression_old.py


注:本文中的utility.webqtlUtil.genRandStr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。