本文整理汇总了Python中quick.util.GenomeInfo.GenomeInfo.getChrList方法的典型用法代码示例。如果您正苦于以下问题:Python GenomeInfo.getChrList方法的具体用法?Python GenomeInfo.getChrList怎么用?Python GenomeInfo.getChrList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quick.util.GenomeInfo.GenomeInfo
的用法示例。
在下文中一共展示了GenomeInfo.getChrList方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from quick.util.GenomeInfo import GenomeInfo [as 别名]
# 或者: from quick.util.GenomeInfo.GenomeInfo import getChrList [as 别名]
def execute(cls, choices, galaxyFn=None, username=''):
start = time.time()
genome = choices[0]
trackName = choices[1].split(':')
outFn = galaxyFn
if choices[5] == 'Write to Standardised file':
outFn = createOrigPath(genome, choices[-1].split(':'), 'collapsed_result.bedgraph')
ensurePathExists(outFn[:outFn.rfind('/')+1])
combineMethod = choices[2]
category = choices[3] if choices[3] else ''
numSamples = choices[4] if choices[4] else '1'
analysisDef = 'dummy [combineMethod=%s] %s [numSamples=%s] -> ConvertToNonOverlappingCategorySegmentsPythonStat' % \
(combineMethod, '[category=%s]' % category if category != '' else '', numSamples) #'Python'
for regSpec in GenomeInfo.getChrList(genome):
res = GalaxyInterface.runManual([trackName], analysisDef, regSpec, '*', genome, username=username, \
printResults=False, printHtmlWarningMsgs=False)
from gold.origdata.TrackGenomeElementSource import TrackViewGenomeElementSource
from gold.origdata.BedComposer import CategoryBedComposer
for resDict in res.values():
tvGeSource = TrackViewGenomeElementSource(genome, resDict['Result'], trackName)
CategoryBedComposer(tvGeSource).composeToFile(outFn)
示例2: createNmerChains
# 需要导入模块: from quick.util.GenomeInfo import GenomeInfo [as 别名]
# 或者: from quick.util.GenomeInfo.GenomeInfo import getChrList [as 别名]
def createNmerChains(self, n):
for chr in GenomeInfo.getChrList(self._genome):
print 'Creating chains of nmers of length ', n, ' for chromosome ', chr
chrLen = GenomeInfo.getChrLen(self._genome,chr)
chrReg = GenomeRegion( self._genome, chr, 0, chrLen )
seqTV = PlainTrack( GenomeInfo.getSequenceTrackName(self._genome) ).getTrackView(chrReg)
#nmersAsInts = NmerAsIntSlidingWindow(n, FuncValTvWrapper(seqTV))
nmersAsInts = NmerAsIntSlidingWindow(n, seqTV.valsAsNumpyArray())
SameValueIndexChainsFactory.generate( nmersAsInts, chrLen, 4**n, self._createPath(n), chr )
示例3: execute
# 需要导入模块: from quick.util.GenomeInfo import GenomeInfo [as 别名]
# 或者: from quick.util.GenomeInfo.GenomeInfo import getChrList [as 别名]
def execute(cls, choices, galaxyFn=None, username=''):
start = time.time()
genome = choices[0]
trackName = choices[1].split(':')
#outFn = open(NONSTANDARD_DATA_PATH+'/hg19/Private/Sigven/resultat.bed','w')
analysisDef = '-> ConvertToNonOverlappingCategorySegmentsPythonStat' #'Python'
for regSpec in GenomeInfo.getChrList(genome):
res = GalaxyInterface.runManual([trackName], analysisDef, regSpec, '*', genome, username=username, \
printResults=False, printHtmlWarningMsgs=False)
from gold.origdata.TrackGenomeElementSource import TrackViewGenomeElementSource
from gold.origdata.BedComposer import CategoryBedComposer
for resDict in res.values():
tvGeSource = TrackViewGenomeElementSource(genome, resDict['Result'], trackName)
CategoryBedComposer(tvGeSource).composeToFile(outFn)
示例4: execute
# 需要导入模块: from quick.util.GenomeInfo import GenomeInfo [as 别名]
# 或者: from quick.util.GenomeInfo.GenomeInfo import getChrList [as 别名]
def execute(cls, choices, galaxyFn=None, username=''):
outputFile = open(galaxyFn, 'w')
genome = choices[0]
histItem = choices[2]
trackItem = choices[3]
chromRegsPath = GenomeInfo.getChrRegsFn(genome)
chrSizeDict = dict([ ( chrom, GenomeInfo.getChrLen(genome, chrom)) for chrom in GenomeInfo.getChrList(genome)])
geSource = headLinesStr = None
if choices[1] == 'History':
trackType = choices[2].split(':')[1]
username = ''.join([chr(random.randint(97,122)) for i in range(6)])
tempFn = createCollectedPath(genome, [], username+'_'.join([str(v) for v in time.localtime()[:6]])+'.'+trackType)
fnSource = ExternalTrackManager.extractFnFromGalaxyTN(choices[2].split(':'))
open(tempFn,'w').write(open(fnSource,'r').read())
if trackType in ['marked.bed', 'category.bed', 'bed']:
geSource = GenomeElementSorter(BedGenomeElementSource(tempFn, genome=genome)).__iter__()
elif trackType == 'gtrack':
geSource = GenomeElementSorter(GtrackGenomeElementSource(tempFn, genome=genome)).__iter__()
headLinesStr = geSource.getHeaderLines().replace('##','\n##')
cls.WriteExpandedElementsToFile(geSource, chrSizeDict, outputFile, headLinesStr, writeHeaderFlag=True)
os.remove(tempFn)
else:
writeHeaderFlag = True
for chrom in GenomeInfo.getChrList(genome):
gRegion = GenomeRegion(genome, chrom, 0, chrSizeDict[chrom])
plTrack = PlainTrack(trackItem.split(':'))
geSource = GenomeElementTvWrapper(plTrack.getTrackView(gRegion)).__iter__()
cls.WriteExpandedElementsToFile(geSource, chrSizeDict, outputFile, headLinesStr, writeHeaderFlag)
writeHeaderFlag = False
outputFile.close()
示例5: execute
# 需要导入模块: from quick.util.GenomeInfo import GenomeInfo [as 别名]
# 或者: from quick.util.GenomeInfo.GenomeInfo import getChrList [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: createGwTrack
# 需要导入模块: from quick.util.GenomeInfo import GenomeInfo [as 别名]
# 或者: from quick.util.GenomeInfo.GenomeInfo import getChrList [as 别名]
def createGwTrack(cls, genome, iterClass, *iterParams):
for chr in GenomeInfo.getChrList(genome):
cls.createChrTrack(genome, chr, iterClass, *iterParams)
示例7: __new__
# 需要导入模块: from quick.util.GenomeInfo import GenomeInfo [as 别名]
# 或者: from quick.util.GenomeInfo.GenomeInfo import getChrList [as 别名]
def __new__(cls, genome):
from gold.track.GenomeRegion import GenomeRegion
from quick.util.GenomeInfo import GenomeInfo
return [GenomeRegion(genome, GenomeInfo.getChrList(genome)[0], 0, 1)]
示例8: __iter__
# 需要导入模块: from quick.util.GenomeInfo import GenomeInfo [as 别名]
# 或者: from quick.util.GenomeInfo.GenomeInfo import getChrList [as 别名]
def __iter__(self):
for chr in GenomeInfo.getChrList(self.genome).__iter__():
yield CustomTrackCreatorPickleWrapper(self, chr)
示例9: createTrackGW
# 需要导入模块: from quick.util.GenomeInfo import GenomeInfo [as 别名]
# 或者: from quick.util.GenomeInfo.GenomeInfo import getChrList [as 别名]
def createTrackGW(cls, genome, inTrackName, outTrackName, windowSize, func, username):
cls._createTrackCommon(genome, inTrackName, outTrackName, windowSize, func, username, GenomeInfo.getChrList(genome))
示例10: execute
# 需要导入模块: from quick.util.GenomeInfo import GenomeInfo [as 别名]
# 或者: from quick.util.GenomeInfo.GenomeInfo import getChrList [as 别名]
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.
"""
print "Executing..."
genome = choices[0]
infile = choices[1]
windowSize = int(choices[2])
normquantile = float(choices[3])
percentile = float(choices[4])
inFn = ExternalTrackManager.extractFnFromGalaxyTN(infile.split(":"))
data = open(inFn, "r").read()
fetVals, addr = cls.preProcessPvalues(data, 2)
stddevs, addr = cls.preProcessPvalues(data, 3)
output = open(galaxyFn, "w")
# Tuva changed sorted elms to FALSE
output.write(
"##gtrack version: 1.0\n"
+ "##track type: segments\n"
+ "##uninterrupted data lines: true\n"
+ "##sorted elements: false\n"
+ "##no overlapping elements: true\n"
+ "###seqid\tstart\tend\n"
)
# Calculate limit for FET:
m = stats.cmedian(fetVals)
upperquant = stats.scoreatpercentile(stddevs, percentile)
qnorm = stats.norm.ppf(normquantile)
limit = m + qnorm * upperquant
print "Windows found", sum(fetVals >= limit)
print "percentile", percentile, "normquantile", normquantile
print "mean", m, "upperquant", upperquant, "qnorm", qnorm
print "Limit", limit
addrs = numpy.array(addr)
filteredaddrs = addrs[fetVals >= limit]
print GenomeInfo.getChrList(genome)
curchrom = ""
start = ""
end = sys.maxint
prevAddr = -1000000.0
for addr in filteredaddrs:
addrList = addr.split("\t")
if addrList[0] != curchrom or int(addrList[1]) - windowSize > prevAddr:
if curchrom != "":
newend = prevAddr + windowSize if prevAddr + windowSize < end else end
output.write(start + "\t" + str(newend) + "\n")
start = addr
curchrom = addrList[0]
end = int(GenomeInfo.getChrLen(genome, curchrom)) - 1
prevAddr = int(addr.split("\t")[1])
newend = prevAddr + windowSize if prevAddr + windowSize < end else end
output.write(start + "\t" + str(newend) + "\n")
output.close()
开发者ID:tuvakt,项目名称:Fast-Parallel-Tools-for-Genome-wide-Analysis-of-Genomic-Divergence,代码行数:64,代码来源:FilterFisherScores.py
示例11: execute
# 需要导入模块: from quick.util.GenomeInfo import GenomeInfo [as 别名]
# 或者: from quick.util.GenomeInfo.GenomeInfo import getChrList [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
示例12: _createNmerTrack
# 需要导入模块: from quick.util.GenomeInfo import GenomeInfo [as 别名]
# 或者: from quick.util.GenomeInfo.GenomeInfo import getChrList [as 别名]
def _createNmerTrack(self, nmerList, lowerOrder=None):
nmerLengths = list(set([len(nmer) for nmer in nmerList]))
assert len(nmerLengths)==1
chainOrder = lowerOrder if lowerOrder is not None else nmerLengths[0]
regionList = [GenomeRegion(self._genome, chr, 0, GenomeInfo.getChrLen(self._genome, chr) ) for chr in GenomeInfo.getChrList(self._genome)]
for region in regionList:
print '|',
chains = SameValueIndexChainsFactory.load(self._createPath(chainOrder), region.chr)
for nmer in nmerList:
if len(nmerList) > 1:
print '.',
if lowerOrder is not None:
nmerPrefix = nmer[0:chainOrder]
rawIndexGenerator = chains.getIndexGenerator(NmerTools.nmerAsInt(nmerPrefix))
indexGenerator = LowerOrderChainWrapper(rawIndexGenerator, nmerPrefix, nmer, self._genome, region.chr)
else:
indexGenerator = chains.getIndexGenerator(NmerTools.nmerAsInt(nmer))
#print 'Length of lower order chain: %i and %i' % (sum(1 for x in indexGenerator), sum(1 for x in indexGenerator))
#print 'Length of wrapped chain: %i and %i' % (sum(1 for x in wrappedIndexGenerator), sum(1 for x in wrappedIndexGenerator))
PreProcessCustomTrackJob(self._genome, self._createTrackName(nmer), [region], \
self._getNmerGeSourceForChr, finalize=False, preProcess=True, \
indexGenerator=indexGenerator).process()
for nmer in nmerList:
try:
PreProcessCustomTrackJob(self._genome, self._createTrackName(nmer), regionList, \
self._getNmerGeSourceForChr, preProcess=False, finalize=True, \
indexGenerator=[0]).process()
except EmptyGESourceError:
PreProcessCustomTrackJob(self._genome, self._createTrackName(nmer), [GenomeRegion(self._genome, regionList[0].chr, -1, 0)], \
self._getNmerGeSourceForChr, preProcess=True, finalize=True, \
indexGenerator=[-1]).process()
return
示例13: execute
# 需要导入模块: from quick.util.GenomeInfo import GenomeInfo [as 别名]
# 或者: from quick.util.GenomeInfo.GenomeInfo import getChrList [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)