コード例 #1
0
def convertDataToWiggle(options, data):
    """ the annotWigDict is keyed on chromosome, then on annotationCount,
   annotationMax and xAxis. This will be pulled apart by chr keys in the 
   packData() function.
   """
    annotWigDict = {}
    for c in data.chrNames:
        thisChrNumBins = int(
            (float(data.chrLengthsByChrom[c]) / data.genomeLength) *
            options.numBins)
        annotWigDict[c] = {}
        d = annotDataOrNone(data.gffRecordsByChrom, c)
        if d is None:
            annotWigDict[c]['xAxis'] = numpy.zeros(shape=(thisChrNumBins))
            for t in [
                    'CDS', 'UTR', 'NXE', 'NGE', 'island', 'tandem', 'repeat'
            ]:
                annotWigDict[c][t +
                                'Count'] = numpy.zeros(shape=(thisChrNumBins))
                annotWigDict[c][t + 'Max'] = 0

            for i in xrange(0, thisChrNumBins):
                annotWigDict[c]['xAxis'][i] = (
                    (float(i) / (thisChrNumBins - 1.0)) *
                    float(data.chrLengthsByChrom[c]))
        else:
            annotWigDict[c] = objListToBinnedWiggle(d,
                                                    data.chrLengthsByChrom[c],
                                                    thisChrNumBins,
                                                    options.gff)
    data.annotWigDict = annotWigDict
コード例 #2
0
def convertDataToWiggle( options, data ):
   """ the mafWigDict is keyed on chromosome and then
   on either maf or xAxis. The dict will be pulled apart
   by chromosome in the packData() function.
   """
   mafWigDict = {}
   for c in data.chrNames:
      thisChrNumBins = int( math.floor( ( float( data.chrLengthsByChrom[ c ] ) / 
                                          data.genomeLength ) * 
                                        options.numBins ))
      mafWigDict[ c ] = {}
      d = mafDataOrNone( data.mafBlocksByChrom, c )
      if d is None:
         mafWigDict[ c ] = newMafWigDict( thisChrNumBins )
         mafWigDict[ c ] ['xAxis'] = objListUtility_xAxis( data.chrLengthsByChrom[c], thisChrNumBins )
      else:
         mafWigDict[ c ] = objListToBinnedWiggle( d, data.chrLengthsByChrom[ c ], 
                                                  thisChrNumBins, options.maf )
   data.mafWigDict = mafWigDict
コード例 #3
0
def convertDataToWiggle(options, data):
    """ the mafWigDict is keyed on chromosome and then
   on either maf or xAxis. The dict will be pulled apart
   by chromosome in the packData() function.
   """
    mafWigDict = {}
    for c in data.chrNames:
        thisChrNumBins = int(
            math.floor((float(data.chrLengthsByChrom[c]) / data.genomeLength) *
                       options.numBins))
        mafWigDict[c] = {}
        d = mafDataOrNone(data.mafBlocksByChrom, c)
        if d is None:
            mafWigDict[c] = newMafWigDict(thisChrNumBins)
            mafWigDict[c]['xAxis'] = objListUtility_xAxis(
                data.chrLengthsByChrom[c], thisChrNumBins)
        else:
            mafWigDict[c] = objListToBinnedWiggle(d, data.chrLengthsByChrom[c],
                                                  thisChrNumBins, options.maf)
    data.mafWigDict = mafWigDict
コード例 #4
0
def convertDataToWiggle( options, data ):
   """ the annotWigDict is keyed on chromosome, then on annotationCount,
   annotationMax and xAxis. This will be pulled apart by chr keys in the 
   packData() function.
   """
   annotWigDict = {}
   for c in data.chrNames:
      thisChrNumBins = int( ( float( data.chrLengthsByChrom[ c ] ) / data.genomeLength ) * options.numBins )
      annotWigDict[ c ] = {}
      d = annotDataOrNone( data.gffRecordsByChrom, c )
      if d is None:
         annotWigDict[ c ]['xAxis'] = numpy.zeros( shape = ( thisChrNumBins ))
         for t in [ 'CDS', 'UTR', 'NXE', 'NGE', 'island', 'tandem', 'repeat' ]:
            annotWigDict[ c ][ t + 'Count' ] = numpy.zeros( shape = ( thisChrNumBins ))
            annotWigDict[ c ][ t + 'Max' ]   = 0

         for i in xrange( 0, thisChrNumBins ):
            annotWigDict[c]['xAxis'][ i ] = ((float( i ) / ( thisChrNumBins - 1.0 )) * 
                                             float( data.chrLengthsByChrom[ c ] ) )
      else:
         annotWigDict[ c ] = objListToBinnedWiggle( d, data.chrLengthsByChrom[ c ], thisChrNumBins, options.gff )
   data.annotWigDict = annotWigDict