def _compute(self):
     kwArgs = copy(self._kwArgs)
     if 'rawStatistic' in kwArgs:
         del kwArgs['rawStatistic']
         
     matrixElRes = []
     tr1Subtypes = ProcTrackOptions.getSubtypes(self.getGenome(), self._track.trackName, True)
     assert len(tr1Subtypes) > 0
     for subtype1 in tr1Subtypes:#['0','1']:
         for subtype2 in ['0','1']:
             tn1 = self._track.trackName + [subtype1]
             tn2 = self._track2.trackName + [subtype2]
             if not os.path.exists(createDirPath(tn1,self.getGenome())) or not os.path.exists(createDirPath(tn2,self.getGenome())):
                 raise IncompatibleTracksError
             
             #print ','
             track1 = Track( tn1)
             track1.formatConverters = self._track.formatConverters
             track2 = Track( tn2)
             track2.formatConverters = self._track2.formatConverters
             #self._addChild(self._rawStatistic(self._region, track1, track2, **kwArgs) )
             matrixElRes.append( self._rawStatistic(self._region, track1, track2, **kwArgs).getResult() )
             ResultsMemoizer.flushStoredResults()
     
     #assert len(self._children) == 7
     #return dict(zip( '00,01,10,11'.split(','), [x.getResult() for x in self._children[3:]]))
     
     allChildRes = array(matrixElRes)
     #allChildRes = array([x.getResult() for x in self._children[3:]])
     allChildRes = allChildRes.reshape((-1,2))
     return OrderedDict([('Matrix', allChildRes.tolist()), ('Rows', tr1Subtypes), ('Cols', ['Case','Control'])])
    def _compute(self):
        kwArgs = copy(self._kwArgs)
        if 'rawStatistic' in kwArgs:
            del kwArgs['rawStatistic']

        matrixElRes = []
        tr1Subtypes = ProcTrackOptions.getSubtypes(self.getGenome(),
                                                   self._track.trackName, True)
        tr2Subtypes = ProcTrackOptions.getSubtypes(self.getGenome(),
                                                   self._track2.trackName,
                                                   True)
        assert len(tr1Subtypes) > 0, str(self._track.trackName)
        assert len(tr2Subtypes) > 0, str(self._track2.trackName)
        if 'minimal' in self._kwArgs:
            tr1Subtypes = tr1Subtypes[:1]
            tr2Subtypes = tr2Subtypes[:1]
        for subtype1 in tr1Subtypes:  #['0','1']:
            #for subtype2 in ['0','1']:
            for subtype2 in tr2Subtypes:
                #                print ','
                tn1 = self._track.trackName + [subtype1]
                tn2 = self._track2.trackName + [subtype2]
                if not os.path.exists(createDirPath(
                        tn1, self.getGenome())) or not os.path.exists(
                            createDirPath(tn2, self.getGenome())):
                    raise IncompatibleTracksError

                #print ','
                track1 = Track(tn1)
                track1.formatConverters = self._track.formatConverters
                track2 = Track(tn2)
                track2.formatConverters = self._track2.formatConverters
                #self._addChild(self._rawStatistic(self._region, track1, track2, **kwArgs) )
                matrixElRes.append(
                    self._rawStatistic(self._region, track1, track2,
                                       **kwArgs).getResult())
            ResultsMemoizer.flushStoredResults()

        #assert len(self._children) == 7
        #return dict(zip( '00,01,10,11'.split(','), [x.getResult() for x in self._children[3:]]))

        allChildRes = array(matrixElRes)
        #allChildRes = array([x.getResult() for x in self._children[3:]])
        allChildRes = allChildRes.reshape((len(tr1Subtypes), len(tr2Subtypes)))
        return {
            'Result':
            OrderedDict([('Matrix', allChildRes.tolist()),
                         ('Rows', tr1Subtypes), ('Cols', tr2Subtypes)])
        }
    def _createChildren(self):
        kwArgs = copy(self._kwArgs)
        if 'rawStatistic' in kwArgs:
            del kwArgs['rawStatistic']
        track2 = self._track2 if hasattr(self, '_track2') else None
        self._addChild(
            FormatSpecStat(self._region, self._track,
                           TrackFormatReq(dense=False, val='tc')))
        #self._track.formatConverters = 'Dummy' #to avoid check of tracks not being used..
        #self._track2.formatConverters = 'Dummy' #to avoid check of tracks not being used..
        #self._addChild( RawDataStat(self._region, self._track2, TrackFormatReq(dense=False, val='tc') ) )
        self._addChild(
            self._rawStatistic(
                self._region, self._track, track2, **
                kwArgs))  #This will actually compute, without any use for it.
        self._indexOfFirstSubCatChild = len(self._children)

        for subtype1 in ['0', '1']:
            #for subtype2 in ['0','1']:
            tn1 = self._track.trackName + [subtype1]
            if not os.path.exists(createDirPath(tn1, self.getGenome())):
                #logMessage('DID NOT EXIST.. '+createOrigPath(self.getGenome(),tn1))
                raise IncompatibleTracksError
            #else:
            #    logMessage('DID EXIST')
            track1 = Track(tn1)
            track1.formatConverters = self._track.formatConverters
            #track2 = Track( self._track2.trackName + [subtype2])
            #track2.formatConverters = self._track2.formatConverters
            self._addChild(
                self._rawStatistic(self._region, track1, track2, **kwArgs))
    def _createChildren(self):
        kwArgs = copy(self._kwArgs)
        if 'rawStatistic' in kwArgs:
            del kwArgs['rawStatistic']
        track2 = self._track2 if hasattr(self, '_track2') else None
        self._addChild( FormatSpecStat(self._region, self._track, TrackFormatReq(dense=False, val='tc') ) )
        #self._track.formatConverters = 'Dummy' #to avoid check of tracks not being used..
        #self._track2.formatConverters = 'Dummy' #to avoid check of tracks not being used..
        #self._addChild( RawDataStat(self._region, self._track2, TrackFormatReq(dense=False, val='tc') ) )
        self._addChild( self._rawStatistic(self._region, self._track, track2, **kwArgs) ) #This will actually compute, without any use for it. 
        self._indexOfFirstSubCatChild = len(self._children)

        for subtype1 in ['0','1']:
            #for subtype2 in ['0','1']:
            tn1 = self._track.trackName + [subtype1]
            if not os.path.exists(createDirPath(tn1, self.getGenome())):
                #logMessage('DID NOT EXIST.. '+createOrigPath(self.getGenome(),tn1))
                raise IncompatibleTracksError
            #else:
            #    logMessage('DID EXIST')
            track1 = Track( tn1)
            track1.formatConverters = self._track.formatConverters
            #track2 = Track( self._track2.trackName + [subtype2])
            #track2.formatConverters = self._track2.formatConverters
            self._addChild(self._rawStatistic(self._region, track1, track2, **kwArgs) )
 def _createChildren(self):
     kwArgs = copy(self._kwArgs)
     if 'rawStatistic' in kwArgs:
         del kwArgs['rawStatistic']
     self._addChild( RawDataStat(self._region, self._track, TrackFormatReq(dense=False, val='tc') ) )
     self._addChild( RawDataStat(self._region, self._track2, TrackFormatReq(dense=False, val='tc') ) )
     self._addChild( self._rawStatistic(self._region, self._track, self._track2, **kwArgs) )
     #try:
     for subtype1 in ['0','1']:
         for subtype2 in ['0','1']:
             tn1 = self._track.trackName + [subtype1]
             tn2 = self._track2.trackName + [subtype2]
             
             if not os.path.exists(createDirPath(tn1, self.getGenome())) or not os.path.exists(createDirPath(tn2,self.getGenome())):
                 raise IncompatibleTracksError
             track1 = Track( tn1)
             track1.formatConverters = self._track.formatConverters
             track2 = Track( tn2)
             track2.formatConverters = self._track2.formatConverters
             self._addChild(self._rawStatistic(self._region, track1, track2, **kwArgs) )
 def _createChildren(self):
     kwArgs = copy(self._kwArgs)
     if 'rawStatistic' in kwArgs:
         del kwArgs['rawStatistic']
     self._addChild( RawDataStat(self._region, self._track, TrackFormatReq(dense=False, val='tc') ) )
     self._addChild( RawDataStat(self._region, self._track2, TrackFormatReq(dense=False, val='tc') ) )
     self._addChild( self._rawStatistic(self._region, self._track, self._track2, **kwArgs) )
     #try:
     for subtype1 in ['0','1']:
         for subtype2 in ['0','1']:
             tn1 = self._track.trackName + [subtype1]
             tn2 = self._track2.trackName + [subtype2]
             
             if not os.path.exists(createDirPath(tn1, self.getGenome())) or not os.path.exists(createDirPath(tn2,self.getGenome())):
                 raise IncompatibleTracksError
             track1 = Track( tn1)
             track1.formatConverters = self._track.formatConverters
             track2 = Track( tn2)
             track2.formatConverters = self._track2.formatConverters
             self._addChild(self._rawStatistic(self._region, track1, track2, **kwArgs) )