Exemplo n.º 1
0
 def _handlePointsAndPartitions(self):
     if self.trackFormat.isDense() and not self.trackFormat.reprIsDense():
         self._startList = self._endList[:-1]
         self._endList = self._endList[1:]
         if self._valList != None:
             self._valList = self._valList[1:]
         if self._strandList != None:
             self._strandList = self._strandList[1:]
         if self._idList != None:
             self._idList = self._idList[1:]
         if self._edgesList != None:
             self._edgesList = self._edgesList[1:]
         if self._weightsList != None:
             self._weightsList = self._weightsList[1:]
         for key, extraList in self._extraLists.items():
             if extraList != None:
                 self._extraLists[key] = extraList[1:]
     if not self.trackFormat.isDense() and not self.trackFormat.isInterval():
         self._endList = VirtualPointEnd(self._startList)
Exemplo n.º 2
0
class TestVirtualPointEnd(unittest.TestCase):
    def setUp(self):
        self._array = array(range(100))
        self._vpe = VirtualPointEnd(self._array)
    
    def testIndexing(self):
        AssertList([x+1 for x in self._array], self._vpe, self.assertEqual)

    def _assertSlicing(self, i, j):
        AssertList([x+1 for x in self._array[i:j] ], self._vpe[i:j], self.assertEqual)

    def testSlicing(self):
        self._assertSlicing(10, 20)
        self._assertSlicing(10, 10)
        self._assertSlicing(0, 90)
        self._assertSlicing(10, 100)
        self._assertSlicing(0, 100)
        
    def testNumpyMethods(self):
        self.assertEqual(5050, self._vpe.sum())
Exemplo n.º 3
0
 def setUp(self):
     self._array = array(range(100))
     self._vpe = VirtualPointEnd(self._array)