本文整理汇总了Python中quick.application.ExternalTrackManager.ExternalTrackManager类的典型用法代码示例。如果您正苦于以下问题:Python ExternalTrackManager类的具体用法?Python ExternalTrackManager怎么用?Python ExternalTrackManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ExternalTrackManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: createRSquareGraph
def createRSquareGraph(cls, ldGraphTrackName, r2_threshold):
"""
Creates a dictionary of all pairs in a linked point track.
Variants in LD must have rsquare >= the rsquare threshold passed to the function.
:param ldGraphTrackName: linked point track, as chosen in tool (choices.ldtrack)
:param r2_threshold: Lower limit of square value
:return: Dictionary of all ld-pairs with sorted key = (rsid1, rsid2), value = rSquare
"""
from quick.application.ExternalTrackManager import ExternalTrackManager
from gold.origdata.GtrackGenomeElementSource import GtrackGenomeElementSource
fileName = ExternalTrackManager.extractFnFromGalaxyTN(ldGraphTrackName)
suffix = ExternalTrackManager.extractFileSuffixFromGalaxyTN(ldGraphTrackName)
gtSource = GtrackGenomeElementSource(fileName, suffix=suffix)
r2graph = {}
for ge in gtSource:
rsid = ge.id
edges = ge.edges
weights = ge.weights
for i in range(0, len(edges)):
ldRsid = edges[i]
r2 = weights[i]
if r2 >= float(r2_threshold):
cls.addEdge(r2graph, rsid, ldRsid, r2)
return r2graph
开发者ID:johhorn,项目名称:gwas-clustering,代码行数:31,代码来源:LDExpansions.py
示例2: execute
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. 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.
'''
try:
historyInputTN = choices[0].split(':') #from history
historyGalaxyFn = ExternalTrackManager.extractFnFromGalaxyTN( historyInputTN) #same as galaxyFn in execute of create benchmark..
randomStatic = RunSpecificPickleFile(historyGalaxyFn) #finds path to static file created for a previous history element, and directs to a pickle file
myInfo = randomStatic.loadPickledObject()
except:
return None
galaxyTN = myInfo[3].split(':')
myFileName = ExternalTrackManager.extractFnFromGalaxyTN(galaxyTN)
genome = myInfo[0]
gtrackSource = GtrackGenomeElementSource(myFileName, genome)
regionList = []
for obj in gtrackSource:
regionList.append(GenomeRegion(obj.genome, obj.chr, obj.start, obj.end))
extractor = TrackExtractor()
fn = extractor.extract(GenomeInfo.getSequenceTrackName(genome), regionList, galaxyFn, 'fasta')
开发者ID:Anderrb,项目名称:Dynamic-benchmark,代码行数:32,代码来源:Tool4.py
示例3: execute
def execute(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.
'''
resultLines = []
outputFile=open(galaxyFn,"w")
fnSource = ExternalTrackManager.extractFnFromGalaxyTN(choices[2].split(':'))
fnDB = ExternalTrackManager.extractFnFromGalaxyTN(choices[3].split(':'))
intersectingFactor = 'id' if choices[4] == 'Element id' else 'position'
colsToAdd = []
colsToAddDict = choices[5]
for key in colsToAddDict:
if colsToAddDict[key]:
colsToAdd.append(key)
genome = choices[1] if choices[0] == 'Yes' else None
try:
complementGtrackFileAndWriteToFile(fnSource, fnDB, galaxyFn, intersectingFactor, colsToAdd, genome)
except Exception, e:
import sys
print >> sys.stderr, e
开发者ID:Anderrb,项目名称:Dynamic-benchmark,代码行数:26,代码来源:ComplementTrackElementInformation.py
示例4: execute
def execute(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. 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.
'''
# get population format
if choices.format == 'File':
pop = [];
popfile = choices.population;
inFn = ExternalTrackManager.extractFnFromGalaxyTN(popfile.split(":"));
infile = open(inFn);
for line in infile:
pop.append(line.rstrip('\n'));
else:
pop = map(str.strip,choices.population.split(","));
# read in file
inFn = ExternalTrackManager.extractFnFromGalaxyTN(choices.vcf.split(":"));
data = open(inFn).read();
# convert and write to GTrack file
outfile = open(galaxyFn, 'w');
outfile.write(addHeader(choices.genome));
outfile.write(convertToGtrackFile(data, pop, choices.genome));
outfile.close();
开发者ID:tuvakt,项目名称:Fast-Parallel-Tools-for-Genome-wide-Analysis-of-Genomic-Divergence,代码行数:30,代码来源:ConvertVCFToGtrackTool.py
示例5: _collectTracks
def _collectTracks(self):
tracks = [self._track, self._track2]
if 'trackNameIntensity' in self._kwArgs:
assert not 'extraTracks' in self._kwArgs
self._kwArgs['extraTracks'] = self._kwArgs['trackNameIntensity']
if 'extraTracks' in self._kwArgs:
from gold.track.Track import PlainTrack
import re
from config.Config import MULTIPLE_EXTRA_TRACKS_SEPARATOR
extraTracks = self._kwArgs['extraTracks']
if type(extraTracks) == str:
extraTracks = extraTracks.split(MULTIPLE_EXTRA_TRACKS_SEPARATOR)
for extraT in extraTracks:
if type(extraT) == str:
#extraT = extraT.split('|')
#extraT = re.split('\^|\|',extraT)
extraT = convertTNstrToTNListFormat(extraT)
if type(extraT) == list:
#print 'TEMP1: ', extraT
from urllib import unquote
extraT = [unquote(part) for part in extraT]
from quick.application.ExternalTrackManager import ExternalTrackManager
if ExternalTrackManager.isGalaxyTrack(extraT):
extraT = ExternalTrackManager.getPreProcessedTrackFromGalaxyTN(self.getGenome(), extraT)
extraT = PlainTrack(extraT)
tracks.append(extraT)
return tracks
开发者ID:Anderrb,项目名称:Dynamic-benchmark,代码行数:29,代码来源:Statistic.py
示例6: execute
def execute(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.
'''
outputFile=open(galaxyFn,"w")
fnSource = ExternalTrackManager.extractFnFromGalaxyTN(choices[0].split(':'))
inputFile = open(ExternalTrackManager.extractFnFromGalaxyTN(choices[0].split(':')), 'r')
if choices[2] == 'Filter on exact values':
if choices[3]!='Select column..':
column = int(choices[3][7:])
filterSet = set([key for key,val in choices[4].items() if val])
for i in inputFile:
if i.split('\t')[column] in filterSet:
print>>outputFile, i
else:
for i in inputFile:
temptab = i.split('\t')
for index in range(len(temptab)):
locals()['c'+str(index)] = temptab[index]
if eval(choices[5]):
print>>outputFile, i
inputFile.close()
outputFile.close()
开发者ID:Anderrb,项目名称:Dynamic-benchmark,代码行数:28,代码来源:FilterHistoryElementOnCohosenValues.py
示例7: findOverrepresentedTFsFromGeneSet
def findOverrepresentedTFsFromGeneSet(genome, tfSource, ensembleGeneIdList,upFlankSize, downFlankSize, geneSource, galaxyFn):
#galaxyFn = '/usit/insilico/web/lookalike/galaxy_dist-20090924-dev/database/files/003/dataset_3347.dat'
#print 'overriding galaxyFN!: ', galaxyFn
galaxyId = extractIdFromGalaxyFn(galaxyFn)
uniqueWebPath = getUniqueWebPath(extractIdFromGalaxyFn(galaxyFn))
assert genome == 'hg18'
tfTrackNameMappings = TfInfo.getTfTrackNameMappings(genome)
tfTrackName = tfTrackNameMappings[tfSource]
#Get gene track
assert geneSource == 'Ensembl'
targetGeneRegsTempFn = uniqueWebPath + os.sep + 'geneRegs.bed'
geneRegsTrackName = GenomeInfo.getStdGeneRegsTn(genome)
geneRegsFn = getOrigFn(genome, geneRegsTrackName, '.category.bed')
GalaxyInterface.getGeneTrackFromGeneList(genome, geneRegsTrackName, ensembleGeneIdList, targetGeneRegsTempFn )
assert upFlankSize == downFlankSize == 0 #Should instead extend regions to include flanks
tcGeneRegsTempFn = uniqueWebPath + os.sep + 'tcGeneRegs.targetcontrol.bedgraph'
#Think this will be okay, subtraction not necessary as targets are put first:
controlGeneRegsTempFn = geneRegsFn
#print targetGeneRegsTempFn, controlGeneRegsTempFn, tcGeneRegsTempFn
GalaxyInterface.combineToTargetControl(targetGeneRegsTempFn, controlGeneRegsTempFn, tcGeneRegsTempFn)
#tcGeneRegsExternalTN = ['external'] +galaxyId + [tcGeneRegsTempFn]
tcGeneRegsExternalTN = ExternalTrackManager.createStdTrackName(galaxyId, 'tempTc')
#tcGeneRegsExternalTN = ['external'] +targetGalaxyId + [tcGeneRegsTempFn]
#tcGeneRegsExternalTN = ['galaxy', externalId, tcGeneRegsTempFn]
targetGeneRegsExternalTN = ExternalTrackManager.createStdTrackName(galaxyId, 'tempTc', '1')
controlGeneRegsExternalTN = ExternalTrackManager.createStdTrackName(galaxyId, 'tempTc', '0')
#pre-process
print 'Pre-processing file: %s, with trackname: %s ' % (tcGeneRegsTempFn, tcGeneRegsExternalTN)
ExternalTrackManager.preProcess(tcGeneRegsTempFn, tcGeneRegsExternalTN, 'targetcontrol.bedgraph',genome)
print 'Pre-processing TN: ', targetGeneRegsExternalTN
ExternalTrackManager.preProcess(targetGeneRegsTempFn, targetGeneRegsExternalTN, 'bed',genome)
print 'Pre-processing TN: ', controlGeneRegsExternalTN
ExternalTrackManager.preProcess(controlGeneRegsTempFn, controlGeneRegsExternalTN, 'bed',genome)
#print tcGeneRegsExternalTN
trackName1, trackName2 = tfTrackName, tcGeneRegsExternalTN
analysisDef = 'Categories differentially located in targets?: Which categories of track1-points fall more inside case than control track2-segments? [rawStatistic:=PointCountInsideSegsStat:]' +\
'[tf1:=SegmentToStartPointFormatConverter:] [tf2:=TrivialFormatConverter:]' +\
'-> DivergentRowsInCategoryMatrixStat'
regSpec, binSpec = '*','*'
#print 'skipping preproc!!'
#ExternalTrackManager.preProcess(tcGeneRegsExternalTN[-1], tcGeneRegsExternalTN, 'targetcontrol.bedgraph', genome)
#ExternalTrackManager.preProcess(targetGeneRegsTempFn, targetGeneRegsExternalTN, 'bed', genome)
GalaxyInterface.runManual([trackName1, trackName2], analysisDef, regSpec, binSpec, genome, printResults=True, printHtmlWarningMsgs=False)
开发者ID:Anderrb,项目名称:Dynamic-benchmark,代码行数:57,代码来源:TFsFromGenes.py
示例8: createLinkedPointTrack
def createLinkedPointTrack(cls, rsids, isUndirected, trackFn, r2):
from quick.webtools.clustering.CreateLDTrack import CreateLDTrack
from quick.application.ExternalTrackManager import ExternalTrackManager
# Create file for GTrack
galaxyTN = ExternalTrackManager.constructGalaxyTnFromSuitedFn(trackFn, fileEnding='gtrack', name='ld_graph')
fn = ExternalTrackManager.extractFnFromGalaxyTN(galaxyTN)
f = open(fn, 'w')
# Get LD information and create linked point track
ldDict = CreateLDTrack.getLDDict(r2)
expansionDict = CreateLDTrack.getExpansionDict(rsids, ldDict)
f.write(CreateLDTrack.formatLinkedPointTrack(expansionDict, isUndirected))
开发者ID:johhorn,项目名称:gwas-clustering,代码行数:13,代码来源:LDTrackGeneratorTool.py
示例9: getOptionsBox6
def getOptionsBox6(prevChoices):
if prevChoices[3]:
extraDbColumnsDict = OrderedDict()
fnSource = ExternalTrackManager.extractFnFromGalaxyTN(prevChoices[2].split(':'))
fnDB = ExternalTrackManager.extractFnFromGalaxyTN(prevChoices[3].split(':'))
gtrackDB = GtrackGenomeElementSource(fnDB)
gtrackSource = GtrackGenomeElementSource(fnSource)
extraDbColumns = [v for v in gtrackDB.getColumns() if not v in gtrackSource.getColumns()] #list(set(gtrackDBColumnSpec) - set(gtrackSourceColumnSpec))
for column in extraDbColumns:
extraDbColumnsDict[column] = False
return extraDbColumnsDict
开发者ID:Anderrb,项目名称:Dynamic-benchmark,代码行数:13,代码来源:ComplementTrackElementInformation.py
示例10: execute
def execute(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.
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.
'''
from time import time
startTime = time()
from quick.application.ExternalTrackManager import ExternalTrackManager
from quick.util.StaticFile import GalaxyRunSpecificFile
import os
motifFn = ExternalTrackManager.extractFnFromGalaxyTN( choices[0].split(':'))
observedFasta = ExternalTrackManager.extractFnFromGalaxyTN( choices[1].split(':'))
randomGalaxyTN = choices[2].split(':')
randomName = ExternalTrackManager.extractNameFromHistoryTN(randomGalaxyTN)
randomGalaxyFn = ExternalTrackManager.extractFnFromGalaxyTN( randomGalaxyTN)
randomStatic = GalaxyRunSpecificFile(['random'],randomGalaxyFn) #finds path to static file created for a previous history element (randomFn), and directs to a folder containing several files..
#print os.listdir(randomStatic.getDiskPath())
randomFastaPath = randomStatic.getDiskPath()
#motifFn, observedFasta, randomFastaPath = '/Users/sandve/egne_dokumenter/_faglig/NullModels/DnaSeqExample/liver.pwm', 'liver.fa', 'randomFastas'
testStatistic = choices[3]
if testStatistic == 'Average of max score per sequence':
scoreFunc = scoreMotifOnFastaAsAvgOfBestScores
elif testStatistic == 'Sum of scores across all positions of all sequences':
scoreFunc = scoreMotifOnFastaAsSumOfAllScores
elif testStatistic == 'Score of Frith et al. (2004)':
scoreFunc = lr4
elif testStatistic == 'Product of max per sequence':
scoreFunc = scoreMotifOnFastaAsProductOfBestScores
else:
raise
pvals = mcPvalFromMotifAndFastas(motifFn, observedFasta, randomFastaPath, scoreFunc)
print 'Pvals for motifs (%s) against observed (%s) vs random (%s - %s) sequences.' % (motifFn, observedFasta, randomName, randomFastaPath)
for motif,pval in sorted(pvals.items()):
print motif+'\t'+('%.4f'%pval)
from quick.util.StaticFile import GalaxyRunSpecificFile
from gold.application.RSetup import r, robjects
histStaticFile = GalaxyRunSpecificFile(['pvalHist.png'],galaxyFn)
#histStaticFile.openRFigure()
histStaticFile.plotRHist(pvals.values(), [x/40.0 for x in range(41)], 'Histogram of p-values', xlim=robjects.FloatVector([0.0, 1.0]))
#r.hist(robjects.FloatVector(pvals.values()), breaks=robjects.FloatVector([x/40.0 for x in range(41)]), xlim=robjects.FloatVector([0.0, 1.0]), main='Histogram of p-values' )
#histStaticFile.closeRFigure()
print histStaticFile.getLink('Histogram')
print 'Time (s):', time()-startTime
开发者ID:Anderrb,项目名称:Dynamic-benchmark,代码行数:50,代码来源:TestOverrepresentationOfPwmInDna.py
示例11: getRedirectURL
def getRedirectURL(choices):
genome = choices[0]
track1file = ExternalTrackManager.createSelectValueFromGalaxyTN(choices[1].split(':'))
track2file = ExternalTrackManager.createSelectValueFromGalaxyTN(choices[2].split(':'))
return createHyperBrowserURL(genome, trackName1=['galaxy'], trackName2=['galaxy'], \
track1file=track1file, track2file=track2file, \
analysis='Category pairs differentially co-located?', \
configDict={'Method of counting points': 'Only 1 count per bin (binary)',\
'Normalize counts': 'Differentially in both directions' if \
choices[3] == 'Both rows and columns (focusing on column differences)'\
else 'Differentially for points only',\
'P-value threshold for significance': '0.01'},\
method='__chrs__')
开发者ID:Anderrb,项目名称:Dynamic-benchmark,代码行数:14,代码来源:CreateRegulomeTool.py
示例12: execute
def execute(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.
'''
genome = choices[1] if choices[0] == 'Yes' else None
suffix = ExternalTrackManager.extractFileSuffixFromGalaxyTN(choices[2].split(':'))
inFn = ExternalTrackManager.extractFnFromGalaxyTN(choices[2].split(':'))
try:
standardizeGtrackFileAndWriteToFile(inFn, galaxyFn, genome, suffix=suffix)
except Exception, e:
import sys
print >> sys.stderr, e
开发者ID:Anderrb,项目名称:Dynamic-benchmark,代码行数:15,代码来源:ConvertToLinkedValuedSegments.py
示例13: getOptionsBoxFileContentsInfo
def getOptionsBoxFileContentsInfo(prevChoices):
if prevChoices.history or prevChoices.input:
if prevChoices.history:
inputFile = open(ExternalTrackManager.extractFnFromGalaxyTN(prevChoices.history.split(':')), 'r')
else:
inputFile = StringIO(prevChoices.input)
for i in xrange(TabularToGtrackTool._getNumSkipLines(prevChoices)):
inputFile.readline()
table = []
splitChar = TabularToGtrackTool._getSplitChar(prevChoices)
numCols = None
error = None
for i,line in enumerate(inputFile):
row = [x.strip() for x in line.strip().split(splitChar)]
if numCols == None:
numCols = len(row)
elif numCols != len(row):
numCols = max(numCols, len(row))
# error = 'Error: the number of columns varies over the rows of the tabular file.'
table.append(row)
if i == TabularToGtrackTool.NUM_ROWS_IN_TABLE:
break
numCols = max(len(row) for row in table) if len(table) > 0 else 0
if error is None:
if numCols > TabularToGtrackTool.NUM_COLUMN_FUNCTIONS:
error = 'Error: the tabular file has more columns than is allowed by the tool (%s > %s).' % (numCols, TabularToGtrackTool.NUM_COLUMN_FUNCTIONS)
return ('__hidden__', FileContentsInfo(table=table, numCols=numCols, error=error))
开发者ID:Anderrb,项目名称:Dynamic-benchmark,代码行数:33,代码来源:TabularToGtrackTool.py
示例14: execute
def execute(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.
'''
genome = choices.genome if choices.selectGenome == 'Yes' else None
onlyNonDefault = choices.allHeaders == 'Only non-default headers'
try:
if choices.history:
inFn = ExternalTrackManager.extractFnFromGalaxyTN(choices.history.split(':'))
expandHeadersOfGtrackFileAndWriteToFile(inFn, galaxyFn, genome, onlyNonDefault)
else:
if choices.whitespace == 'Keep whitespace exact':
input = choices.input
else:
input = ''
for line in choices.input.split(os.linesep):
line = line.strip()
if (line.startswith('###') and len(line) > 3 and line[3] != '#') \
or not line.startswith('#'):
line = line.replace(' ', '\t')
else:
line = line.replace('\t', ' ')
input += line + os.linesep
composer = expandHeadersOfGtrackFileAndReturnComposer('', genome, strToUseInsteadOfFn=input)
composer.composeToFile(galaxyFn, onlyNonDefault=onlyNonDefault)
except Exception, e:
import sys
print >> sys.stderr, e
开发者ID:Anderrb,项目名称:Dynamic-benchmark,代码行数:33,代码来源:ExpandGtrackHeaderTool.py
示例15: execute
def execute(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.
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.
'''
genome = choices[0]
trackName = choices[1].split(':')
galaxyOutTrackName = 'galaxy:hbfunction:%s:Create function track of distance to nearest segment' % galaxyFn
outTrackName = ExternalTrackManager.getStdTrackNameFromGalaxyTN(galaxyOutTrackName.split(':'))
if choices[2] == 'No transformation':
valTransformation = 'None'
elif choices[2] =='Logarithmic (log10(x))':
valTransformation = 'log10'
elif choices[2] == 'Fifth square root (x**0.2)':
valTransformation = 'power0.2'
analysisDef ='[dataStat=MakeDistanceToNearestSegmentStat] [valTransformation=%s][outTrackName=' % valTransformation \
+ '^'.join(outTrackName) + '] -> CreateFunctionTrackStat'
#userBinSource, fullRunArgs = GalaxyInterface._prepareRun(trackName, None, analysisDef, '*', '*', genome)
#
#for el in userBinSource:
# print el.chr, el.start, el.end
from quick.application.GalaxyInterface import GalaxyInterface
print GalaxyInterface.getHbFunctionOutputBegin(galaxyFn, withDebug=False)
GalaxyInterface.runManual([trackName], analysisDef, '*', '*', genome, username=username, printResults=False, printHtmlWarningMsgs=False)
#job = AnalysisDefJob(analysisDef, trackName, None, userBinSource).run()
print GalaxyInterface.getHbFunctionOutputEnd('A custom track has been created by finding the bp-distance to the nearest segment', withDebug=False)
开发者ID:Anderrb,项目名称:Dynamic-benchmark,代码行数:35,代码来源:CreateFunctionTrackAsDistanceToNearestSegments.py
示例16: execute
def execute(choices, galaxyFn=None, username=''):
#'Genome:','Source of seed TF:','Seed TF: ','Flank size: ', 'Source of potentially cooperative TFs:'
#genome
genome = choices[0]
seedSource = choices[1]
seedTfTnInput = choices[2]
if seedSource == 'TFBS from history':
seedFn = ExternalTrackManager.extractFnFromGalaxyTN(seedTfTnInput.split(':'))
else:
tfTrackNameMappings = TfInfo.getTfTrackNameMappings(genome)
seedTfTn = tfTrackNameMappings[seedSource] + [seedTfTnInput]
#tfTrackName = tfTrackNameMappings[tfSource] + [selectedTF]
seedFns = getOrigFns(genome, seedTfTn, '')
assert len(seedFns) == 1
seedFn = seedFns[0]
flankSize = choices[3]
flankSize = int(flankSize) if flankSize != '' else 0
cooperativeTfSource = choices[4]
#flankSize = int(choices[4])
#TFsFromGenes.findOverrepresentedTFsFromGeneSet('hg18', 'UCSC tfbs conserved', ['ENSGflankSizeflankSizeflankSizeflankSizeflankSize2flankSize8234','ENSGflankSizeflankSizeflankSizeflankSizeflankSize199674'],flankSize, flankSize, galaxyFn)
#TFsFromGenes.findOverrepresentedTFsFromGeneSet('hg18', tfSource, choices[5].split(','),flankSize, flankSize, 'Ensembl', galaxyFn)
#TFsFromRegions.findOverrepresentedTFsFromGeneSet(genome, tfSource, ensembleGeneIdList,upFlankSize, downFlankSize, geneSource, galaxyFn)
#TFsFromGenes.findTFsTargetingGenes('hg18', tfSource, choices[5].split(','),flankSize, flankSize, 'Ensembl', galaxyFn)
TFsFromRegions.findTFsOccurringInRegions(genome, cooperativeTfSource, seedFn, flankSize, flankSize, galaxyFn)
开发者ID:Anderrb,项目名称:Dynamic-benchmark,代码行数:28,代码来源:FindCooperativeTfsTool.py
示例17: _getHeaders
def _getHeaders(prevChoices):
numCols = TabularToGtrackTool._getFileContentsInfo(prevChoices).numCols
if prevChoices.columnSelection == 'Select individual columns':
header = []
for i in xrange(numCols):
if hasattr(prevChoices, 'column%s' % i):
colHeader = getattr(prevChoices, 'column%s' % i)
if colHeader is None or colHeader == '-- ignore --':
header.append('')
elif colHeader == '-- custom --':
header.append(getattr(prevChoices, 'customColumn%s' % i).strip())
else:
header.append(colHeader)
else:
header.append('')
return header
else:
genome = prevChoices.genome if prevChoices.selectGenome == 'Yes' else None
inFn = ExternalTrackManager.extractFnFromGalaxyTN(prevChoices.colSpecFile.split(':'))
try:
geSource = GtrackGenomeElementSource(inFn, genome=genome)
geSource.parseFirstDataLine()
return geSource.getColumns()[:numCols]
except Exception, e:
return []
开发者ID:Anderrb,项目名称:Dynamic-benchmark,代码行数:25,代码来源:TabularToGtrackTool.py
示例18: _getTempChromosomeNames
def _getTempChromosomeNames(galaxyTn):
if isinstance(galaxyTn, str):
galaxyTn = galaxyTn.split(":")
tempinfofile=ExternalTrackManager.extractFnFromGalaxyTN(galaxyTn)
abbrv=GenomeImporter.getGenomeAbbrv(tempinfofile)
return os.linesep.join(GenomeInfo(abbrv).sourceChrNames)
开发者ID:Anderrb,项目名称:Dynamic-benchmark,代码行数:7,代码来源:InstallGenomeTool.py
示例19: execute
def execute(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. 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.
'''
# Retrieve the pickled benchmark object from history
try:
historyInputTN = choices[0].split(':')
#same as galaxyFn in execute of create benchmark..
historyGalaxyFn = ExternalTrackManager.extractFnFromGalaxyTN(historyInputTN)
#finds path to static file created for a previous history element, and directs to a pickle file
randomStatic = RunSpecificPickleFile(historyGalaxyFn)
benchmarkSpecification = randomStatic.loadPickledObject()
except:
return None
genome = benchmarkSpecification[0]
benchmarkLevel = benchmarkSpecification[2]
regionTrackName = benchmarkSpecification[3]
benchmarkUtil = BenchmarkUtil(galaxyFn, genome)
if benchmarkLevel == 'Base pair probability level':
return benchmarkUtil.retrieveFeatureTrack(genome, galaxyFn, regionTrackName, benchmarkSpecification[5])
elif type(regionTrackName) is str: # If string, we're dealing with a single track so just retrieve it
return benchmarkUtil.retrieveTrack(regionTrackName, galaxyFn)
elif type(regionTrackName) is list: # If list, we're dealing with a benchmark suite which will have to be zipped
print benchmarkUtil.retrieveBenchmarkSuiteAsZipFile(regionTrackName)
else:
raise Exception('Invalid benchmark')
开发者ID:Anderrb,项目名称:Dynamic-benchmark,代码行数:35,代码来源:BenchmarkRetrievalTool.py
示例20: execute
def execute(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 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...'
tempinfofile=ExternalTrackManager.extractFnFromGalaxyTN(choices[0].split(":"))
abbrv=GenomeImporter.getGenomeAbbrv(tempinfofile)
gi = GenomeInfo(abbrv)
chrNamesInFasta=gi.sourceChrNames
chromNamesDict={}
chrDict = InstallGenomeTool._getRenamedChrDictWithSelection(choices)
for i, key in enumerate(chrDict.keys()):
if chrDict[key]:
chromNamesDict[chrNamesInFasta[i]]=key
print 'All chromosomes chosen: ' + str(chromNamesDict)
stdChrDict = InstallGenomeTool._getRenamedChrDictWithSelection(choices, stdChrs=True)
stdChrs = [x for x in stdChrDict if stdChrDict[x]]
print 'Standard chromosomes chosen: ' + ", ".join(stdChrs)
GenomeImporter.createGenome(abbrv, gi.fullName, chromNamesDict, stdChrs, username=username)
gi.installedBy = username
gi.timeOfInstallation = datetime.now()
gi.store()
开发者ID:Anderrb,项目名称:Dynamic-benchmark,代码行数:30,代码来源:InstallGenomeTool.py
注:本文中的quick.application.ExternalTrackManager.ExternalTrackManager类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论