def _createRandomizedNumpyArrays(self, binLen, starts, ends, vals, strands, ids, edges, weights, extras, origTrackFormat, region):
        if self._minimal:
            return numpy.array([]), None, None, None, None, None, None, OrderedDict()
        
        intensityTV = PlainTrack(self._trackNameIntensity).getTrackView(region)
        if len(intensityTV.valsAsNumpyArray())==0:
            raise InvalidRunSpecException('Error: No intensity data available for sampling randomized locations in region' + \
                                          str(region) + \
                                          '. Please check that the intensity track was created with the same main track that is being randomized in this analysis.')

        #intensityTV = PlainTrack(self._trackNameIntensity).getTrackView(self._origRegion) #Dependence on origRegion is not nice, but not a big problem..
        
        if intensityTV.trackFormat.isDense():
            assert intensityTV.trackFormat.isValued('number')
            return self._createRandomizedNumpyArraysFromIntensityFunction(binLen, starts, ends, vals, strands, ids, edges, weights, extras, intensityTV)
        else:
            raise NotImplementedError            
Esempio n. 2
0
    def _createRandomizedNumpyArrays(self, binLen, starts, ends, vals, strands,
                                     ids, edges, weights, extras,
                                     origTrackFormat, region):
        if self._minimal:
            return numpy.array(
                []), None, None, None, None, None, None, OrderedDict()

        intensityTV = PlainTrack(self._trackNameIntensity).getTrackView(region)
        if len(intensityTV.valsAsNumpyArray()) == 0:
            raise InvalidRunSpecException('Error: No intensity data available for sampling randomized locations in region' + \
                                          str(region) + \
                                          '. Please check that the intensity track was created with the same main track that is being randomized in this analysis.')

        #intensityTV = PlainTrack(self._trackNameIntensity).getTrackView(self._origRegion) #Dependence on origRegion is not nice, but not a big problem..

        if intensityTV.trackFormat.isDense():
            assert intensityTV.trackFormat.isValued('number')
            return self._createRandomizedNumpyArraysFromIntensityFunction(
                binLen, starts, ends, vals, strands, ids, edges, weights,
                extras, intensityTV)
        else:
            raise NotImplementedError