本文整理汇总了Python中utility.webqtlUtil.genRandStr函数的典型用法代码示例。如果您正苦于以下问题:Python genRandStr函数的具体用法?Python genRandStr怎么用?Python genRandStr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了genRandStr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: displaySingleSymbolResultPage
def displaySingleSymbolResultPage(self,primaryGeneSymbol=None, datasetFullName=None,tProbeSetFreezeId=None, TissueCorrMatrixObject =None,recordReturnNum=None,method=None,note=None,TissueCount =None):
formName = webqtlUtil.genRandStr("fm_")
form = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data',name= formName, submit=HT.Input(type='hidden'))
# the following hidden elements are required parameter in Class(PlotCorrelationPage). So we need to define them here.
form.append(HT.Input(type="hidden", name="action", value="disp"))
form.append(HT.Input(type="hidden", name="FormID", value="dispSingleTissueCorrelation"))
form.append(HT.Input(type="hidden", name="X_geneSymbol", value=""))
form.append(HT.Input(type="hidden", name="Y_geneSymbol", value=""))
form.append(HT.Input(type="hidden", name="ProbeSetID", value=""))
# RISet is not using in Tissue correlation, but is a required parameter in Class(PlotCorrelationPage). So we set dummy value(BXD).
form.append(HT.Input(type="hidden", name="RISet", value="BXD"))
form.append(HT.Input(type="hidden", name="ShowLine", value="1"))
form.append(HT.Input(type="hidden", name="TissueProbeSetFreezeId", value=tProbeSetFreezeId))
form.append(HT.Input(type="hidden", name="rankOrder", value=0))
traitList =[]
try:
symbolCorrDict, symbolPvalueDict = TissueCorrMatrixObject.calculateCorrOfAllTissueTrait(primaryTraitSymbol=primaryGeneSymbol,method=method)
except:
heading = "Tissue Correlation"
detail = ['Please use the official NCBI gene symbol.' ]
self.error(heading=heading,detail=detail)
return
symbolList0,geneIdDict,dataIdDict,ChrDict,MbDict,descDict,pTargetDescDict=TissueCorrMatrixObject.getTissueProbeSetXRefInfo(GeneNameLst=[])
# In case, upper case and lower case issue of symbol, mappedByTargetList function will update input geneSymbolLst based on database search result
tempPrimaryGeneSymbol =self.mappedByTargetList(primaryList=symbolList0,targetList=[primaryGeneSymbol])
primaryGeneSymbol =tempPrimaryGeneSymbol[0]
returnNum = self.getReturnNum(recordReturnNum)
symbolListSorted=[]
symbolList=[]
# get key(list) of symbolCorrDict(dict) based on sorting symbolCorrDict(dict) by its' value in desc order
symbolListSorted=sorted(symbolCorrDict, key=symbolCorrDict.get, reverse=True)
symbolList = self.mappedByTargetList(primaryList=symbolList0,targetList=symbolListSorted)
if returnNum==None:
returnNum =len(symbolList0)
IntroReturnNum ="All %d "%returnNum
else:
IntroReturnNum ="The Top %d" %returnNum
symbolList = symbolList[:returnNum]
pageTable = HT.TableLite(cellSpacing=0,cellPadding=0,width="100%", border=0, align="Left")
##############
# Excel file #
##############
filename= webqtlUtil.genRandStr("Corr_")
xlsUrl = HT.Input(type='button', value = 'Download Table', onClick= "location.href='/tmp/%s.xls'" % filename, Class='button')
# Create a new Excel workbook
workbook = xl.Writer('%s.xls' % (webqtlConfig.TMPDIR+filename))
headingStyle = workbook.add_format(align = 'center', bold = 1, border = 1, size=13, fg_color = 0x1E, color="white")
#There are 6 lines of header in this file.
worksheet = self.createExcelFileWithTitleAndFooter(workbook=workbook, datasetName=datasetFullName, returnNumber=returnNum)
newrow = 6
pageTable.append(HT.TR(HT.TD(xlsUrl,height=40)))
# get header part of result table and export excel file
tblobj = {}
tblobj['header'], worksheet = self.getTableHeader( method=method, worksheet=worksheet, newrow=newrow, headingStyle=headingStyle)
newrow += 1
# get body part of result table and export excel file
tblobj['body'], worksheet = self.getTableBody(symbolCorrDict=symbolCorrDict, symbolPvalueDict=symbolPvalueDict,symbolList=symbolList,geneIdDict=geneIdDict,ChrDict=ChrDict,MbDict=MbDict,descDict=descDict,pTargetDescDict=pTargetDescDict,primarySymbol=primaryGeneSymbol,TissueCount=TissueCount, formName=formName, worksheet=worksheet, newrow=newrow,method=method)
workbook.close()
# creat object for result table for sort function
objfile = open('%s.obj' % (webqtlConfig.TMPDIR+filename), 'wb')
cPickle.dump(tblobj, objfile)
objfile.close()
sortby = ("tissuecorr", "down")
div = HT.Div(webqtlUtil.genTableObj(tblobj=tblobj, file=filename, sortby=sortby, tableID = "sortable", addIndex = "1"), Id="sortable")
if method =="0":
IntroMethod="Pearson\'s r "
else:
IntroMethod="Spearman\'s rho "
Intro = HT.Blockquote('%s correlations ranked by the %s are displayed.' % (IntroReturnNum,IntroMethod),
' You can resort this list using the small arrowheads in the top row.')
Intro.append(HT.BR(),' Click the correlation values to generate scatter plots. Select the symbol to open NCBI Entrez.')
pageTable.append(HT.TR(HT.TD(div)))
form.append(HT.P(), HT.P(),pageTable)
corrHeading = HT.Paragraph('Tissue Correlation Table', Class="title")
TD_LR = HT.TD(height=200,width="100%",bgcolor='#eeeeee',align="left")
TD_LR.append(corrHeading,note,Intro, form, HT.P())
self.dict['body'] = str(TD_LR)
self.dict['js1'] = '<SCRIPT SRC="/javascript/correlationMatrix.js"></SCRIPT><BR>'
self.dict['title'] = 'Tissue Correlation Result'
return
开发者ID:OriginalPenguin,项目名称:genenetwork,代码行数:94,代码来源:TissueCorrelationPage.py
示例17: buildCanvas
#.........这里部分代码省略.........
colorIndex = BWs[20+int(50*adjustlrs/sugLRS)]
else:
if item.additive > 0:
colorIndex = int(80 + 50*(adjustlrs-sugLRS)/(sigLRS-sugLRS))
else:
colorIndex = int(50 - 50*(adjustlrs-sugLRS)/(sigLRS-sugLRS))
if colorIndex > 129:
colorIndex = 129
if colorIndex < 0:
colorIndex = 0
colorIndex = colors[colorIndex]
elif colorScheme == '2':
if item.additive > 0:
colorIndex = int(150 + 100*(adjustlrs/sigLRS))
else:
colorIndex = int(100 - 100*(adjustlrs/sigLRS))
if colorIndex > 249:
colorIndex = 249
if colorIndex < 0:
colorIndex = 0
colorIndex = finecolors[colorIndex]
else:
colorIndex = pid.white
if startHeight > 1:
canvas.drawRect(startWidth-drawStartPixel, startHeight, startWidth+10, startHeight+cellHeight,edgeColor=colorIndex, edgeWidth=0, fillColor=colorIndex)
else:
canvas.drawLine(startWidth-drawStartPixel, startHeight, startWidth+10, startHeight, Color=colorIndex)
if item.locus.name == nearest:
midpoint = [startWidth,startHeight-5]
startHeight+=cellHeight
#XZ, map link to trait name and band
COORDS = "%d,%d,%d,%d" %(startWidth-drawStartPixel,topHeight+40,startWidth+10,startHeight)
HREF = "javascript:showDatabase2('%s','%s','%s');" % (traitList[order[1]].db.name, traitList[order[1]].name, traitList[order[1]].cellid)
area = (COORDS, HREF, '%s' % names[order[1]])
areas.append(area)
if midpoint:
traitPixel = ((midpoint[0],midpoint[1]),(midpoint[0]-6,midpoint[1]+12),(midpoint[0]+6,midpoint[1]+12))
canvas.drawPolygon(traitPixel,edgeColor=pid.black,fillColor=pid.orange,closed=1)
if not chrname:
canvas.drawString(prechr,xoffset-20,(chrstart+startHeight)/2,font = chrnameFont,color=pid.dimgray)
chrname = 1
Ncol += 1
#draw Spectrum
startSpect = neworder[-1][0] + 30
startHeight = topHeight + 40+5+5+strWidth
if colorScheme == '0':
for i in range(100):
canvas.drawLine(startSpect+i,startHeight+20,startSpect+i,startHeight+40,color=colors100[i])
scaleFont=pid.Font(ttf="tahoma",size=10,bold=0)
canvas.drawLine(startSpect,startHeight+45,startSpect,startHeight+39,color=pid.black)
canvas.drawString('LRS = 0',startSpect,startHeight+55,font=scaleFont)
canvas.drawLine(startSpect+64,startHeight+45,startSpect+64,startHeight+39,color=pid.black)
canvas.drawString('Suggestive LRS',startSpect+64,startHeight+55,font=scaleFont)
canvas.drawLine(startSpect+99,startHeight+45,startSpect+99,startHeight+39,color=pid.black)
canvas.drawString('Significant LRS',startSpect+105,startHeight+40,font=scaleFont)
elif colorScheme == '1':
for i in range(50):
canvas.drawLine(startSpect+i,startHeight,startSpect+i,startHeight+40,color=BWs[20+i])
for i in range(50,100):
canvas.drawLine(startSpect+i,startHeight,startSpect+i,startHeight+20,color=colors[100-i])
canvas.drawLine(startSpect+i,startHeight+20,startSpect+i,startHeight+40,color=colors[30+i])
canvas.drawLine(startSpect,startHeight+45,startSpect,startHeight+39,color=pid.black)
canvas.drawString('LRS = 0',startSpect,startHeight+60,font=scaleFont)
canvas.drawLine(startSpect+50,startHeight+45,startSpect+50,startHeight+39,color=pid.black)
canvas.drawString('0.5*Suggestive LRS',startSpect+50,startHeight+ 60,font=scaleFont)
canvas.drawLine(startSpect+99,startHeight+45,startSpect+99,startHeight+39,color=pid.black)
canvas.drawString('Significant LRS',startSpect+105,startHeight+50,font=scaleFont)
textFont=pid.Font(ttf="verdana",size=18,bold=0)
canvas.drawString('%s +' % ppolar,startSpect+120,startHeight+ 35,font=textFont,color=pid.red)
canvas.drawString('%s +' % mpolar,startSpect+120,startHeight+ 15,font=textFont,color=pid.blue)
elif colorScheme == '2':
for i in range(100):
canvas.drawLine(startSpect+i,startHeight,startSpect+i,startHeight+20,color=finecolors[100-i])
canvas.drawLine(startSpect+i,startHeight+20,startSpect+i,startHeight+40,color=finecolors[150+i])
canvas.drawLine(startSpect,startHeight+45,startSpect,startHeight+39,color=pid.black)
canvas.drawString('LRS = 0',startSpect,startHeight+60,font=scaleFont)
canvas.drawLine(startSpect+99,startHeight+45,startSpect+99,startHeight+39,color=pid.black)
canvas.drawString('Significant LRS',startSpect+105,startHeight+50,font=scaleFont)
textFont=pid.Font(ttf="verdana",size=18,bold=0)
canvas.drawString('%s +' % ppolar,startSpect+120,startHeight+ 35,font=textFont,color=pid.red)
canvas.drawString('%s +' % mpolar,startSpect+120,startHeight+ 15,font=textFont,color=pid.blue)
filename= webqtlUtil.genRandStr("Heatmap_")
canvas.save(webqtlConfig.IMGDIR+filename, format='png')
if not sessionfile:
sessionfile = webqtlUtil.generate_session()
webqtlUtil.dump_session(permData, os.path.join(webqtlConfig.TMPDIR, sessionfile +'.session'))
self.filename=filename
self.areas=areas
self.sessionfile=sessionfile
开发者ID:OriginalPenguin,项目名称:genenetwork,代码行数:101,代码来源:Heatmap.py
示例18: __init__
#.........这里部分代码省略.........
E_NSBValue = float(E_NSB)
except:
E_NSBValue = -10000.0
tr.append(TDCell(HT.TD(E_NSB,align='center',Class=bkColor), E_NSB, E_NSBValue))
tr.append(TDCell(HT.TD(Average,align='center',Class=bkColor), Average, mean))
tr.append(TDCell(HT.TD(STDEV,align='center',Class=bkColor), STDEV, stdev))
try:
h2Value = float(h2)
except:
h2Value = -10000.0
tr.append(TDCell(HT.TD(h2,align='center',Class=bkColor), h2, h2Value))
tr.append(TDCell(HT.TD(Chr,align='left',Class=bkColor)))
tr.append(TDCell(HT.TD(Start,align='left',Class=bkColor)))
tr.append(TDCell(HT.TD(End,align='left',Class=bkColor)))
snp_td = HT.TD(align='left',Class=bkColor)
for one_snp_href in snp_collection:
snp_td.append(one_snp_href)
tr.append(TDCell(snp_td))
#07-27-2011:add by NL: show SNP results for different allele only
snpDiff_td= HT.TD(align='left', valign='top', Class=bkColor)
for one_snpDiff_href in snpDiff_collection:
snpDiff_td.append(one_snpDiff_href)
tr.append(TDCell(snpDiff_td))
tblobj['body'].append(tr)
# import cPickle
filename = webqtlUtil.genRandStr("Probe_")
objfile = open('%s.obj' % (webqtlConfig.TMPDIR+filename), 'wb')
cPickle.dump(tblobj, objfile)
objfile.close()
# NL, 07/27/2010. genTableObj function has been moved from templatePage.py to webqtlUtil.py;
div = HT.Div(webqtlUtil.genTableObj(tblobj=tblobj, file=filename, sortby=("", ""), tableID = "sortable", addIndex = "1"), Id="sortable")
#UCSC
_Species = webqtlDatabaseFunction.retrieveSpecies(cursor=self.cursor, RISet=fd.RISet)
if _Species == "rat":
thisurl = webqtlConfig.UCSC_BLAT % ('rat', 'rn3', blatsequence)
elif _Species == "mouse":
thisurl = webqtlConfig.UCSC_BLAT % ('mouse', 'mm9', blatsequence)
else:
thisurl = ""
if thisurl:
blatbutton = HT.Input(type='button' ,name='blatPM',value='Verify UCSC', onClick="window.open('%s','_blank')" % thisurl,Class="button")
else:
blatbutton = ""
#GenBank
genbankSeq = ""
if thisTrait.genbankid:
self.cursor.execute("SELECT Sequence FROM Genbank WHERE Id = '%s'" % thisTrait.genbankid )
genbankSeq = self.cursor.fetchone()
if genbankSeq:
genbankSeq = genbankSeq[0]
if genbankSeq:
if _Species == "rat":
thisurl2 = webqtlConfig.UCSC_BLAT % ('rat', 'rn3', genbankSeq)
if _Species == "mouse":
thisurl2 = webqtlConfig.UCSC_BLAT % ('mouse', 'mm9', genbankSeq)
开发者ID:OriginalPenguin,项目名称:genenetwork,代码行数:67,代码来源:ShowProbeInfoPage.py
示例19: run_rqtl_geno
def run_rqtl_geno(vals, dataset, method, model, permCheck, num_perm, do_control, control_marker, manhattan_plot, pair_scan):
geno_to_rqtl_function(dataset)
## Get pointers to some common R functions
r_library = ro.r["library"] # Map the library function
r_c = ro.r["c"] # Map the c function
plot = ro.r["plot"] # Map the plot function
png = ro.r["png"] # Map the png function
dev_off = ro.r["dev.off"] # Map the device off function
print(r_library("qtl")) # Load R/qtl
## Get pointers to some R/qtl functions
scanone = ro.r["scanone"] # Map the scanone function
scantwo = ro.r["scantwo"] # Map the scantwo function
calc_genoprob = ro.r["calc.genoprob"] # Map the calc.genoprob function
GENOtoCSVR = ro.r["GENOtoCSVR"] # Map the local GENOtoCSVR function
crossname = dataset.group.name
genofilelocation = locate(crossname + ".geno", "genotype")
crossfilelocation = TMPDIR + crossname + ".cross"
cross_object = GENOtoCSVR(genofilelocation, crossfilelocation) # TODO: Add the SEX if that is available
if manhattan_plot:
cross_object = calc_genoprob(cross_object)
else:
cross_object = calc_genoprob(cross_object, step=1, stepwidth="max")
cross_object = add_phenotype(cross_object, sanitize_rqtl_phenotype(vals)) # Add the phenotype
# Scan for QTLs
covar = create_covariates(control_marker, cross_object) # Create the additive covariate matrix
if pair_scan:
if do_control == "true":
logger.info("Using covariate"); result_data_frame = scantwo(cross_object, pheno = "the_pheno", addcovar = covar, model=model, method=method, n_cluster = 16)
else:
logger.info("No covariates"); result_data_frame = scantwo(cross_object, pheno = "the_pheno", model=model, method=method, n_cluster = 16)
pair_scan_filename = webqtlUtil.genRandStr("scantwo_") + ".png"
png(file=TEMPDIR+pair_scan_filename)
plot(result_data_frame)
dev_off()
return process_pair_scan_results(result_data_frame)
else:
if do_control == "true":
logger.info("Using covariate"); result_data_frame = scanone(cross_object, pheno = "the_pheno", addcovar = covar, model=model, method=method)
else:
logger.info("No covariates"); result_data_frame = scanone(cross_object, pheno = "the_pheno", model=model, method=method)
if num_perm > 0 and permCheck == "ON": # Do permutation (if requested by user)
if do_control == "true":
perm_data_frame = scanone(cross_object, pheno_col = "the_pheno", addcovar = covar, n_perm = num_perm, model=model, method=method)
else:
perm_data_frame = scanone(cross_object, pheno_col = "the_pheno", n_perm = num_perm, model=model, method=method)
perm_output, suggestive, significant = process_rqtl_perm_results(num_perm, perm_data_frame) # Functions that sets the thresholds for the webinterface
return perm_output, suggestive, significant, process_rqtl_results(result_data_frame)
else:
return process_rqtl_results(result_data_frame)
开发 |
请发表评论