示例#1
0
        '    no bin: %s' %(logArray[2])
    )
    # Find and process bins below minimum bin count
    colSums = countMatrix.sum(axis=0)
    binsBelowMin = colSums < args['<mincount>']
    failedBins = np.logical_or(failedBins, binsBelowMin)
    # Print bin data
    print '  Bin Data:\n%s\n%s\n%s\n%s' %(
        '    bin number: %s' %(genomeBins.binCount),
        '    bins below minimum: %s' %(sum(binsBelowMin)),
        '    mean bincount: %.0f' %(np.mean(colSums)),
        '    median bin count: %.0f' %(np.median(colSums))
    )
# Print combined bin data
print '\nCombined Samples:\n  Bin Data:\n%s\n%s' %(
    '    bin number: %s' %(genomeBins.binCount),
    '    bins below minimum: %s' %(sum(failedBins))
)
# Normalise matrices
if sum(failedBins) < genomeBins.binCount:
    # Loop through count matrices
    for files in matrixFileList:
        # Normalise matrix
        normMatrix, biasData = interactionMatrix.normaliseMatrix(
            files[0], failedBins)
        # Save interactions
        np.savetxt(files[1], np.array([genomeBins.binNames,biasData]).T,
            '%s', '\t')
        np.savetxt(files[2], normMatrix, '%.6f', '\t',
            header = '\t'.join(genomeBins.binNames), comments = '')
# Save interactions
np.savetxt(args.countMatrix, countMatrix, '%s', '\t',
    header = '\t'.join(genomeBins.binNames), comments = '')
# Print Interaction Data
print '\nInteraction Data\n\t%s\n\t%s\n\t%s\n\t%s' %(
    'total: %s' %(logArray[0]),
    'accepted: %s' %(logArray[3]),
    'no chromosome: %s' %(logArray[1]),
    'no bin: %s' %(logArray[2])
)
# Count number of bins above minimum
colSums = countMatrix.sum(axis=0)
binsAboveMin = sum(colSums >= args.minCount)
# Print bin data
print '\nBin Data\n\t%s\n\t%s\n\t%s\n\t%s' %(
    'total: %s' %(len(colSums)),
    'bins above minimum: %s' %(binsAboveMin),
    'mean count: %.0f' %(np.mean(colSums)),
    'median count: %.0f' %(np.median(colSums))
)
if binsAboveMin > 0:
    # Normalise matrix
    normMatrix, biasData = interactionMatrix.normaliseMatrix(
        countMatrix, args.minCount)
    # Save interactions
    np.savetxt(args.normMatrix, normMatrix, '%.6f', '\t',
        header = '\t'.join(genomeBins.binNames), comments = '')
    np.savetxt(args.biasFile, np.array([genomeBins.binNames,biasData]).T,
        '%s', '\t')