Пример #1
0
    def getTrackView(self, region):
        allowOverlaps = self._trackFormatReq.allowOverlaps()
        borderHandling = self._trackFormatReq.borderHandling()
        assert allowOverlaps is not None
        assert borderHandling is not None

        origTrackView = self._getRawTrackView(region, borderHandling, allowOverlaps)

        if self.formatConverters is None:
            self.formatConverters = getFormatConverters(origTrackView.trackFormat, self._trackFormatReq)

        if self.formatConverters == []:
            raise IncompatibleTracksError(
                prettyPrintTrackName(self.trackName)
                + " with format: "
                + str(origTrackView.trackFormat)
                + ("(" + origTrackView.trackFormat._val + ")" if origTrackView.trackFormat._val else "")
                + " does not satisfy "
                + str(self._trackFormatReq)
            )

        if not self.formatConverters[0].canHandle(origTrackView.trackFormat, self._trackFormatReq):
            raise IncompatibleTracksError(
                getClassName(self.formatConverters[0])
                + " does not support conversion from "
                + str(origTrackView.trackFormat)
                + " to "
                + str(self._trackFormatReq)
            )
        return self.formatConverters[0].convert(origTrackView)
 def getTrackView(self, region):
     if self.formatConverters is None:
         self.formatConverters = getFormatConverters(self._tv.trackFormat, self._trackFormatReq)
     
     if self.formatConverters == []:
         raise IncompatibleTracksError('Track with format: '\
                                       + str(self._tv.trackFormat) +
                                       ('(' + self._tv.trackFormat._val + ')' if self._tv.trackFormat._val else '') + \
                                       ' does not satisfy ' + str(self._trackFormatReq))
     
     if not self.formatConverters[0].canHandle(self._tv.trackFormat, self._trackFormatReq):
         raise IncompatibleTracksError(getClassName(self.formatConverters[0]) +\
                                       ' does not support conversion from ' + str(self._tv.trackFormat) + \
                                       ' to ' + str(self._trackFormatReq))
     return self.formatConverters[0].convert(self._tv[region.start - self._tv.genomeAnchor.start : \
                                                      region.end - self._tv.genomeAnchor.start])