Esempio n. 1
0
    def __init__(self, geSource):
        self._geSource = self._decorateGESource(geSource)
        self._boundingRegionsAndGEsCorrespond = None

        self._areValsCategorical = TrackFormat.createInstanceFromGeSource(geSource).getValTypeName() == 'Category'
        self._areEdgeWeightsCategorical = TrackFormat.createInstanceFromGeSource(geSource).getWeightTypeName() == 'Category'
        self._valCategories = set()
        self._edgeWeightCategories = set()

        self._numElements = OrderedDefaultDict(int)
        self._maxStrLens = OrderedDefaultDict(partial(self._initMaxStrLens, self._getMaxStrLensKeys()))
        self._maxNumEdges = OrderedDefaultDict(int)

        self._hasCalculatedStats = False
Esempio n. 2
0
def evaluatePvalueAndNullDistributionList(observedAndMcSamplesTuple, tail, rawStatisticMainClassName):
    resultsDict = OrderedDict()
    #TODO: What is received is not a list of tuples, it is a tuple of the real result which is a
    # TrackStructure whose result is a list of raw values and list of such track structures.
    # Need to find a way to handle it.

    observedResult = observedAndMcSamplesTuple[0]
    mcSamplesTsList = observedAndMcSamplesTuple[1]
    #TODO: What about categorial ts results?
    isPairedTsResult = all([val.isPairedTs() for val in observedResult.values()])
    observedResultDict = OrderedDict()
    mcSamplesResultDict = OrderedDefaultDict(list)
    if isPairedTsResult:
        for pairedTs in observedResult.values():
            trackTitle = pairedTs['reference'].metadata['title']
            assert trackTitle not in observedResultDict, "%s already in observed results dict" % trackTitle
            observedResultDict[trackTitle] = pairedTs.result
        for mcSampleTs in mcSamplesTsList:
            for pairedTs in mcSampleTs.values():
                trackTitle = pairedTs['reference'].metadata['title']
                mcSamplesResultDict[trackTitle].append(pairedTs.result)
    else: #isFlat?
        raise Exception('not implemented yet!')

    for trackTitle, observation in observedResultDict.iteritems():
        resultsDict[trackTitle] = evaluatePvalueAndNullDistribution((observation, mcSamplesResultDict[trackTitle]), tail, rawStatisticMainClassName)

    return resultsDict
 def __init__(self, statistic=None):
     self._statClassList = [statistic] if statistic else []
     self._analysisParts = []
     self._analysisOptionsDict = OrderedDefaultDict(list)