Esempio n. 1
0
    def testLoadTrackView_Segments(self):
        id, edges, weights = getRandGraphLists(4)
        trackData = TrackData(
            {
                "start": [10, 210, 260, 410],
                "end": [20, 240, 310, 710],
                "val": list(getRandValList(4)),
                "strand": list(getRandStrandList(4)),
                "id": list(id),
                "edges": list(edges),
                "weights": list(weights),
                "a": ["A", "B", "C", "D"],
                "b": ["1.0", "2.0", "3.0", "4.0"],
                "leftIndex": [0, 1, 1, 1, 3, 3, 3, 3, 4],
                "rightIndex": [1, 1, 3, 3, 4, 4, 4, 4, 4],
            }
        )

        self._assertTrackViewLoading_Segments(trackData, [0], 0, 100)
        self._assertTrackViewLoading_Segments(trackData, [1, 2], 200, 300)
        self._assertTrackViewLoading_Segments(trackData, [0, 1, 2, 3], 0, 900)
        self._assertTrackViewLoading_Segments(trackData, [2, 3], 300, 700)

        self._assertTrackViewLoading_Segments(trackData, [3], 310, 700)
        self._assertTrackViewLoading_Segments(trackData, [2], 300, 410)
        self._assertTrackViewLoading_Segments(trackData, [], 310, 410)

        self._assertTrackViewLoading_Segments(trackData, [], 0, 0)
        self._assertTrackViewLoading_Segments(trackData, [], 300, 300)
        self._assertTrackViewLoading_Segments(trackData, [], 400, 400)
Esempio n. 2
0
 def _getTrackData_Numbers(self, size):
     id, edges, weights = getRandGraphLists(size, maxNumEdges=10)
     return TrackData(
         {
             "val": list(getRandValList(size)),
             "strand": list(getRandStrandList(size)),
             "id": list(id),
             "edges": list(edges),
             "weights": list(weights),
             "a": [str(x) for x in xrange(size)],
             "b": [str(x) for x in xrange(size, 0, -1)],
         }
     )