コード例 #1
0
        last = seq[size - 1].split(']')
        seq[size - 1] = last[0]
        #        print seq[size-1]
        for i in range(0, size):
            #            print temp
            temp.append(int(seq[i]))
#        print temp
        entries[key] = temp

for key in entries:
    #    print len(entries[key])
    name = key.split(' ')
    i = 0
    allMed = []
    while i < len(entries[key]) - k:
        #    for i in range(0, len(entries[key]) - k, k):
        seq = entries[key]
        frag = seq[i:i + k]
        #        print i, i+k, frag, len(frag)
        med = aabpPyLib.findMedian(frag)
        mean, std = aabpPyLib.meanStdDev(frag)
        print name[0], med, std
        allMed.append(med)
        i += k
    mean, std = aabpPyLib.meanStdDev(allMed)
    print name[0], aabpPyLib.findMedian(aabpPyLib.findLowestQuartile(allMed))

#print entries

print 'Finished!'
コード例 #2
0
#        print seq[size-1]
        for i in range(0, size):
#            print temp
            temp.append(int(seq[i]))
#        print temp
        entries[key] = temp

for key in entries:
#    print len(entries[key])
    name = key.split(' ')
    i = 0
    allMed = []
    while i < len(entries[key]) - k:
#    for i in range(0, len(entries[key]) - k, k):
        seq = entries[key]
        frag = seq[i:i+k]
#        print i, i+k, frag, len(frag)
        med = aabpPyLib.findMedian(frag)
        mean, std = aabpPyLib.meanStdDev(frag)
        print name[0], med, std
        allMed.append(med)
        i += k
    mean, std = aabpPyLib.meanStdDev(allMed)
    print name[0], aabpPyLib.findMedian(aabpPyLib.findLowestQuartile(allMed))


#print entries


print 'Finished!'
コード例 #3
0
# Author: A. Black P.

# Usage: python getSeqCoverageReal.py inputGene.fa inputReads.fa output.txt

import makeRandomTestData, os, random, sys, aabpPyLib


infileGeneName = sys.argv[1]
infileReadsName = sys.argv[2]
outfile = open(sys.argv[3], 'w')
genes = makeRandomTestData.inputFastaSeq(infileGeneName)
geneId = genes.keys()[0]
print geneId, len(genes[geneId])
geneLength = len(genes[geneId])
Coverage = [0] * geneLength
reads = makeRandomTestData.inputFastaSeq(infileReadsName)
for key in reads.keys():
    positionCut = key.split('Begin')
    parts = positionCut[1].split('End')
    print parts
    for i in range(int(parts[0]), int(parts[1])):
        Coverage[i] += 1

for i in range(0, geneLength):
    outfile.write(str(Coverage[i]) + '\n')

median = aabpPyLib.findMedian(Coverage)
print median

print 'Finished!'