コード例 #1
0
           '%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')
コード例 #2
0
# 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')
    
コード例 #3
0
        '    median bin count: %.0f' %(np.median(colSums))
    )
# Extract combined bin data
logData += '\nCombined Samples:\n  Bin Data:\n%s\n%s\n' %(
    '    bin number: %s' %(genomeBins.binCount),
    '    bins below minimum: %s' %(sum(failedBins))
)
# Save log files
for prefix in prefixList:
    with open(prefix + '.matrixLog', 'w') as outFile:
        outFile.write(logData)
# Normalise matrices
if sum(failedBins) < genomeBins.binCount:
    # Loop through count matrices
    for prefix in prefixList:
        # Normalise matrix
        normMatrix, biasData = interactionMatrix.normaliseMatrix(
            prefix + '.countMatrix.gz', failedBins)
        # Save normalised interactions
        np.savetxt(prefix + '.normMatrix.gz', normMatrix, '%.6f', '\t',
            header = '\t'.join(genomeBins.binNames), comments = '')
        # Extract bin level data
        maskMatrix = analyseInteraction.maskMatrix(prefix + '.normMatrix.gz')
        maskMatrix.binDF['bias'] = biasData
        maskMatrix.binDirection()
        maskMatrix.binDistance()
        maskMatrix.binDF.to_csv(prefix + '.binData', '\t', '')
        # Extract global data
        distance = maskMatrix.combinedDistance(0.1)
        np.savetxt(prefix + '.dist.gz', distance, '%s', '\t')