本文整理汇总了Python中quick.util.GenomeInfo.GenomeInfo.getContainingChrArms方法的典型用法代码示例。如果您正苦于以下问题:Python GenomeInfo.getContainingChrArms方法的具体用法?Python GenomeInfo.getContainingChrArms怎么用?Python GenomeInfo.getContainingChrArms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quick.util.GenomeInfo.GenomeInfo
的用法示例。
在下文中一共展示了GenomeInfo.getContainingChrArms方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getTrackView
# 需要导入模块: from quick.util.GenomeInfo import GenomeInfo [as 别名]
# 或者: from quick.util.GenomeInfo.GenomeInfo import getContainingChrArms [as 别名]
def getTrackView(self, region):
assert self._origRegion == region
allChrArmRegs = GenomeInfo.getContainingChrArms(region)
if len(allChrArmRegs) != 1:
raise CentromerError
chrArm = allChrArmRegs[0]
buffer = self._getIndepencyBufferSize(region)
sourceRegs = chrArm.exclude( copy(region).extend(-buffer).extend(buffer) )
assert len(sourceRegs) in [1,2]
if not any(len(sourceReg) >= self.MIN_SOURCE_TO_SAMPLE_SIZE_RATIO * len(region) for sourceReg in sourceRegs):
raise TooLargeBinError('Source region lengths of ' + str([len(x) for x in sourceRegs]) +
' are too small compared to region length of ' + str(len(region)) +
' according to MIN_SOURCE_TO_SAMPLE_SIZE_RATIO: ' + str(self.MIN_SOURCE_TO_SAMPLE_SIZE_RATIO))
if len(sourceRegs) == 1:
sourceReg = sourceRegs[0]
else:
firstSourceProportion = (len(sourceRegs[0])-len(region)) / sum(len(sourceRegs[i])-len(region) for i in range(2))
sourceReg = sourceRegs[0] if random.random() < firstSourceProportion else sourceRegs[1]
randOffset = random.randint( 0, len(sourceReg) - len(region) )
start = sourceReg.start + randOffset
end = start + len(region)
randRegion = GenomeRegion(region.genome, region.chr, start, end)
rawData = RawDataStat(randRegion, self._origTrack, self._trackFormatReq)
tv = rawData.getResult()
assert region != tv.genomeAnchor
return tv