def _determineHeaderLines(self, hbColumns, columns):
     self._setHeaderDict('track type', Gtrack.getTrackTypeFromColumnSpec(columns))
     self._setHeaderDict('value type', self._getGtrackValueType())
     self._setHeaderDict('value dimension', Gtrack.getGtrackValueDimension(self._geSource.getValDim()))
     self._setHeaderDict('undirected edges', self._geSource.hasUndirectedEdges())
     self._setHeaderDict('edge weights', ('weights' in hbColumns))
     self._setHeaderDict('edge weight type', self._getGtrackEdgeWeightType())
     self._setHeaderDict('edge weight dimension', Gtrack.getGtrackValueDimension(self._geSource.getEdgeWeightDim()))
     self._setHeaderDict('uninterrupted data lines', not self._hasMoreThanOneBoundingRegion())
     self._setHeaderDict('sorted elements', self._geSource.isSorted())
     self._setHeaderDict('no overlapping elements', self._geSource.hasNoOverlappingElements())
     self._setHeaderDict('circular elements', self._geSource.hasCircularElements())
     
     compliesToSubtype = False
     if self._USE_EXTENDED_GTRACK:
         self._setHeaderDict('fixed length', self._geSource.getFixedLength())
         self._setHeaderDict('fixed gap size', self._geSource.getFixedGapSize())
         self._setHeaderDict('fixed-size data lines', self._determineIfFixedSizeDataLines(columns))
         if self._headerDict['fixed-size data lines']:
             self._setHeaderDict('data line size', self._geSource.getValDim())
         
         hbColumns, columns = self._adjustColumnsAccordingToHeaderLines(hbColumns, columns)
         hbColumns, columns, compliesToSubtype = self._determineIfFileCompliesToSubtypes(hbColumns, columns)
         
     if not compliesToSubtype:                
         self._setHeaderDict('1-indexed', self._geSource.inputIsOneIndexed())
         self._setHeaderDict('end inclusive', self._geSource.inputIsEndInclusive())
     
     for header, val in self._forcedHeaderDict.iteritems():
         if header not in self._headerDict:
             self._headerDict[header] = val
     
     return hbColumns, columns
Esempio n. 2
0
    def _determineHeaderLines(self, hbColumns, columns):
        self._setHeaderDict('track type',
                            Gtrack.getTrackTypeFromColumnSpec(columns))
        self._setHeaderDict('value type', self._getGtrackValueType())
        self._setHeaderDict(
            'value dimension',
            Gtrack.getGtrackValueDimension(self._geSource.getValDim()))
        self._setHeaderDict('undirected edges',
                            self._geSource.hasUndirectedEdges())
        self._setHeaderDict('edge weights', ('weights' in hbColumns))
        self._setHeaderDict('edge weight type',
                            self._getGtrackEdgeWeightType())
        self._setHeaderDict(
            'edge weight dimension',
            Gtrack.getGtrackValueDimension(self._geSource.getEdgeWeightDim()))
        self._setHeaderDict('uninterrupted data lines',
                            not self._hasMoreThanOneBoundingRegion())
        self._setHeaderDict('sorted elements', self._geSource.isSorted())
        self._setHeaderDict('no overlapping elements',
                            self._geSource.hasNoOverlappingElements())
        self._setHeaderDict('circular elements',
                            self._geSource.hasCircularElements())

        compliesToSubtype = False
        if self._USE_EXTENDED_GTRACK:
            self._setHeaderDict('fixed length',
                                self._geSource.getFixedLength())
            self._setHeaderDict('fixed gap size',
                                self._geSource.getFixedGapSize())
            self._setHeaderDict('fixed-size data lines',
                                self._determineIfFixedSizeDataLines(columns))
            if self._headerDict['fixed-size data lines']:
                self._setHeaderDict('data line size',
                                    self._geSource.getValDim())

            hbColumns, columns = self._adjustColumnsAccordingToHeaderLines(
                hbColumns, columns)
            hbColumns, columns, compliesToSubtype = self._determineIfFileCompliesToSubtypes(
                hbColumns, columns)

        if not compliesToSubtype:
            self._setHeaderDict('1-indexed',
                                self._geSource.inputIsOneIndexed())
            self._setHeaderDict('end inclusive',
                                self._geSource.inputIsEndInclusive())

        for header, val in self._forcedHeaderDict.iteritems():
            if header not in self._headerDict:
                self._headerDict[header] = val

        return hbColumns, columns
 def _getGtrackValueDim(self, val, valTypeInfo, valueOrEdgeWeight):
     valLen = len(val.split(valTypeInfo.delim) if valTypeInfo.delim != '' else val)
     
     if valueOrEdgeWeight in self._valLenDict:
         if self._valLenDict[valueOrEdgeWeight] != valLen:
             self._valLenDict[valueOrEdgeWeight] = 0
     else:
         self._valLenDict[valueOrEdgeWeight] = valLen
     
     valDim = GtrackGenomeElementSource.getGtrackValueDimension(self._valLenDict[valueOrEdgeWeight])
         
     return valDim
Esempio n. 4
0
    def _getGtrackValueDim(self, val, valTypeInfo, valueOrEdgeWeight):
        valLen = len(
            val.split(valTypeInfo.delim) if valTypeInfo.delim != '' else val)

        if valueOrEdgeWeight in self._valLenDict:
            if self._valLenDict[valueOrEdgeWeight] != valLen:
                self._valLenDict[valueOrEdgeWeight] = 0
        else:
            self._valLenDict[valueOrEdgeWeight] = valLen

        valDim = GtrackGenomeElementSource.getGtrackValueDimension(
            self._valLenDict[valueOrEdgeWeight])

        return valDim