本文整理汇总了Python中quick.application.ExternalTrackManager.ExternalTrackManager.getPreProcessedTrackFromGalaxyTN方法的典型用法代码示例。如果您正苦于以下问题:Python ExternalTrackManager.getPreProcessedTrackFromGalaxyTN方法的具体用法?Python ExternalTrackManager.getPreProcessedTrackFromGalaxyTN怎么用?Python ExternalTrackManager.getPreProcessedTrackFromGalaxyTN使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quick.application.ExternalTrackManager.ExternalTrackManager
的用法示例。
在下文中一共展示了ExternalTrackManager.getPreProcessedTrackFromGalaxyTN方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _collectTracks
# 需要导入模块: from quick.application.ExternalTrackManager import ExternalTrackManager [as 别名]
# 或者: from quick.application.ExternalTrackManager.ExternalTrackManager import getPreProcessedTrackFromGalaxyTN [as 别名]
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
示例2: execute
# 需要导入模块: from quick.application.ExternalTrackManager import ExternalTrackManager [as 别名]
# 或者: from quick.application.ExternalTrackManager.ExternalTrackManager import getPreProcessedTrackFromGalaxyTN [as 别名]
def execute(cls, choices, galaxyFn=None, username=''):
import time
start = time.clock()
# HTML settings
from gold.result.HtmlCore import HtmlCore
htmlCore = HtmlCore()
htmlCore.divBegin(style=cls.HTML_STYLE)
# Set debug environment
cls._setDebugModeIfSelected(choices)
# Print tool information
cls.htmlClusterTitle(cls.getToolName(), htmlCore)
cls.htmlClusterSubtext(choices.distanceMeasure, cls.CLUSTER_LIST, choices.linkageCriterion, htmlCore)
htmlCore.line('Threshold of r<sup>2</sup>: ' + choices.rSquare)
# Analysis environment
gSuite = getGSuiteFromGalaxyTN(choices.gSuite)
analysisBins = GlobalBinSource(gSuite.genome)
analysisSpec = AnalysisSpec(ExpandTrackAndMatchStat)
splitName = choices.ldTrack.split(":")
trackName = ExternalTrackManager.getPreProcessedTrackFromGalaxyTN(gSuite.genome, splitName)
linkedPointTrack = Track(trackName)
# Find distance/correlation matrix
labels = []
distDict = cls.createDistDict(cls.CLUSTER_LIST)
size = gSuite.numTracks()
for i in range(0, size):
gSuiteTrack1 = gSuite.getTrackFromIndex(i)
labels.append(gSuiteTrack1.title)
for j in range(i + 1, size):
gSuiteTrack2 = gSuite.getTrackFromIndex(j)
track1 = Track(gSuiteTrack1.trackName)
track2 = Track(gSuiteTrack2.trackName)
count = doAnalysis(analysisSpec, analysisBins, [track1, track2, linkedPointTrack]).getGlobalResult()
cls.updateDistDict(distDict, count)
# Cluster and print plots
cls.printDistPlots(distDict, labels, choices.distanceMeasure, choices.linkageCriterion, galaxyFn, htmlCore)
cls.htmlClusterTime(str(time.clock() - start), htmlCore)
htmlCore.divEnd()
print htmlCore
示例3: execute
# 需要导入模块: from quick.application.ExternalTrackManager import ExternalTrackManager [as 别名]
# 或者: from quick.application.ExternalTrackManager.ExternalTrackManager import getPreProcessedTrackFromGalaxyTN [as 别名]
def execute(cls, choices, galaxyFn=None, username=''):
from gold.origdata.TrackGenomeElementSource import TrackViewListGenomeElementSource
from gold.origdata.GtrackComposer import StdGtrackComposer
genome = choices[0]
if choices[1] == 'Track':
trackName = choices[2].split(':')
else:
trackName = ExternalTrackManager.getPreProcessedTrackFromGalaxyTN(genome, choices[2].split(':'))
outFn = galaxyFn
if choices[4] == 'Write to Standardised file':
outFn = createOrigPath(genome, choices[-1].split(':'), 'collapsed_result.bedgraph')
ensurePathExists(outFn[:outFn.rfind('/')+1])
threshold = choices[3]
analysisDef = 'dummy [threshold=%s] -> ForEachSegmentDistToNearestInSameTrackStat' % threshold #'Python'
res = GalaxyInterface.runManual([trackName], analysisDef, '*', '*', genome, username=username, \
printResults=False, printHtmlWarningMsgs=False)
tvGeSource = TrackViewListGenomeElementSource(genome, [x['Result'] for x in res.values()], trackName)
StdGtrackComposer(tvGeSource).composeToFile(outFn)
示例4: execute
# 需要导入模块: from quick.application.ExternalTrackManager import ExternalTrackManager [as 别名]
# 或者: from quick.application.ExternalTrackManager.ExternalTrackManager import getPreProcessedTrackFromGalaxyTN [as 别名]
def execute(cls, choices, galaxyFn=None, username=''):
from quick.application.ExternalTrackManager import ExternalTrackManager
genome = choices[0]
preProcTN1 = ExternalTrackManager.getPreProcessedTrackFromGalaxyTN(genome, choices[2].split(':')) if choices[1] == 'History' else choices[2].split(':')
chrSizeDict = dict([ ( chrom, GenomeInfo.getChrLen(genome, chrom)) for chrom in GenomeInfo.getChrList(genome)])
trackType = choices[3].split(':')[1]
fnSource = ExternalTrackManager.extractFnFromGalaxyTN(choices[3].split(':'))
if trackType in ['marked.bed', 'category.bed', 'bed']:
geSource = GenomeElementSorter(BedGenomeElementSource(fnSource, genome=genome)).__iter__()
elif trackType == 'gtrack':
geSource = GenomeElementSorter(GtrackGenomeElementSource(fnSource, genome=genome)).__iter__()
#headLinesStr = geSource.getHeaderLines().replace('##','\n##')
else:
raise InvalidFormatError('The Binning must be of the following formats: gtrack, marked.bed, category.bed ,bed ...')
cls.PrintResultToHistItem( galaxyFn, geSource, preProcTN1, genome, username)
示例5: execute
# 需要导入模块: from quick.application.ExternalTrackManager import ExternalTrackManager [as 别名]
# 或者: from quick.application.ExternalTrackManager.ExternalTrackManager import getPreProcessedTrackFromGalaxyTN [as 别名]
def execute(cls, choices, galaxyFn=None, username=''):
from quick.application.GalaxyInterface import GalaxyInterface
fileformat = choices[9];
outputFile = open(galaxyFn, "w")
if fileformat == "html":
print GalaxyInterface.getHtmlBeginForRuns(galaxyFn)
print GalaxyInterface.getHtmlForToggles(withRunDescription=False)
t = calendar.timegm(time.gmtime())
htmlfile = GalaxyRunSpecificFile(["css", str(t)], galaxyFn);
genome = choices[0]
track1 = choices[1].split(":")
track2 = choices[2].split(":")
tn1 = ExternalTrackManager.getPreProcessedTrackFromGalaxyTN(genome, track1)
tn2 = ExternalTrackManager.getPreProcessedTrackFromGalaxyTN(genome, track2)
compare = choices[3] != "Count individual SNP-differences in window"
if choices[4] == "Classical MDS":
mds = 0;
elif choices[4] == "SMACOF":
mds = 1;
else:
mds = 2;
windowSize = int(choices[5])
windowStep = int(choices[6])
mcTreshold = int(choices[7])
mcRuns = int(choices[8])
outputFile.write("#seqid\tstart\tscore\tp\n")
if fileformat == "html":
text = "#seqid\tstart\tscore\tp\n";
print "chrs:"+str(GenomeInfo.getChrList(genome))
reg = "*"
bins = "*"
analysisDef = "Dummy: dummy name ([wStep=%g] [wSize=%s] [func=%s] [mds=%s] [mcT=%s] [mcR=%s])-> CategoryClusterSeparationStat" % (windowStep, windowSize, compare, mds, mcTreshold, mcRuns)
userBinSource = GalaxyInterface._getUserBinSource(reg, bins, genome)
result = GalaxyInterface.runManual([tn1, tn2], analysisDef, reg, bins, genome, galaxyFn=galaxyFn)
for key in result.getAllRegionKeys():
chrom = str(key).split(":")[0];
r = result[key];
if 'Result' not in r.keys():
print "skipping chr:", chrom, r;
continue;
r = r['Result'];
scores = r[0];
stddev = r[1];
for i in range(len(scores)):
if scores[i] != 0:
pos = i*windowStep;
if fileformat == "tabular":
outputFile.write("%s\t%s\t%s\t%s\n" % (str(chrom), pos, str(scores[i]), str(stddev[i])))
else:
text += "%s\t%s\t%s\t%s\n" % (str(chrom), pos, str(scores[i]), str(stddev[i]));
if fileformat == "html":
htmlfile.writeTextToFile(text);
print htmlfile.getLink("Result file");
print GalaxyInterface.getHtmlEndForRuns()
outputFile.close();
开发者ID:tuvakt,项目名称:Fast-Parallel-Tools-for-Genome-wide-Analysis-of-Genomic-Divergence,代码行数:66,代码来源:ClusterSeparationScore.py
示例6: execute
# 需要导入模块: from quick.application.ExternalTrackManager import ExternalTrackManager [as 别名]
# 或者: from quick.application.ExternalTrackManager.ExternalTrackManager import getPreProcessedTrackFromGalaxyTN [as 别名]
def execute(cls, choices, galaxyFn=None, username=""):
from quick.application.GalaxyInterface import GalaxyInterface
fileformat = choices[6]
outputFile = open(galaxyFn, "w")
if fileformat == "html":
print GalaxyInterface.getHtmlBeginForRuns(galaxyFn)
print GalaxyInterface.getHtmlForToggles(withRunDescription=False)
t = calendar.timegm(time.gmtime())
htmlfile = GalaxyRunSpecificFile(["fet", str(t)], galaxyFn)
genome = choices[0]
track1 = choices[1].split(":")
track2 = choices[2].split(":")
tn1 = ExternalTrackManager.getPreProcessedTrackFromGalaxyTN(genome, track1)
tn2 = ExternalTrackManager.getPreProcessedTrackFromGalaxyTN(genome, track2)
windowSize = int(choices[3])
windowStep = int(choices[4])
percentile = float(choices[5])
# results = {}
# TODO: why this?
# tr = Track(tn1)
# tr.addFormatReq(TrackFormatReq(dense=False, allowOverlaps=True))
outputFile.write("#seqid\tstart\tscore\tstddev\n")
if fileformat == "html":
text = "#seqid\tstart\tscore\tstddev\n"
print "chrs:", str(GenomeInfo.getChrList(genome))
reg = "*"
bins = "*"
analysisDef = "Dummy: dummy name ([wStep=%g] [wSize=%g] [percentile=%g])-> FisherExactScoreStat" % (
windowStep,
windowSize,
percentile,
)
userBinSource = GalaxyInterface._getUserBinSource(reg, bins, genome)
result = GalaxyInterface.runManual([tn1, tn2], analysisDef, reg, bins, genome, galaxyFn=galaxyFn)
for key in result.getAllRegionKeys():
chrom = str(key).split(":")[0]
r = result[key]
if "Result" not in r.keys():
print "skipping chr:", chrom, r
continue
r = r["Result"]
scores = r[0]
stddev = r[1]
for i in range(len(scores)):
if scores[i] != 0:
pos = i * windowStep
# if choices[5] == "html":
# print "%s\t%s\t%s\t%s\n" % (str(chrom), pos, str(scores[i]), str(stddev[i]))
if fileformat == "tabular":
outputFile.write("%s\t%s\t%s\t%s\n" % (str(chrom), pos, str(scores[i]), str(stddev[i])))
else:
text += "%s\t%s\t%s\t%s\n" % (str(chrom), pos, str(scores[i]), str(stddev[i]))
if fileformat == "html":
htmlfile.writeTextToFile(text)
print htmlfile.getLink("Result file")
print GalaxyInterface.getHtmlEndForRuns()
outputFile.close()
开发者ID:tuvakt,项目名称:Fast-Parallel-Tools-for-Genome-wide-Analysis-of-Genomic-Divergence,代码行数:70,代码来源:FisherExactTestSNPTool.py