Esempio n. 1
0
        a, t, i, d, s = counter(query, refer)
        sc = 0
        if align.cigar[0][1] == 4:
            sc += align.cigar[0][0]
        if align.cigar[-1][1] == 4:
            sc += align.cigar[0][0]

        accuracy += a
        tot += t
        insertions += i
        deletions += d
        subs += s
        soft += sc

    errCnt = float(insertions + deletions + subs)
    stats = getStats(readLengths)
    space = str(max([len(str(x)) for x in stats.values()]) + 2)
    report = ("#Seqs  | {numSeqs:%d,}\n"
              "Min    | {min:%d,}\n"
              "1st Qu.| {FstQu:%d,}\n" + \
              "Median | {median:%d,}\n" + \
              "Mean   | {mean:%d,}\n" + \
              "3rd Qu.| {TrdQu:%d,}\n" + \
              "Max    | {max:%d,}\n" + \
              "Total  | {totalLength:%d,}\n" + \
              "n50    | {n50:%d,}\n" + \
              "n90    | {n90:%d,}\n" + \
              "n95    | {n95:%d,}\n").replace("%d", str(space))

    #print stats
    print "Read Stats"  #, json.dumps(getStats(readLengths), indent=4)
Esempio n. 2
0
#!/usr/bin/python

import argparse, json
from pbsuite.jelly.Jelly import JellyProtocol
from pbsuite.utils.FileHandlers import FastaFile, FastqFile
from pbsuite.utils.summarizeAssembly import getStats

USAGE = """Get statistics on fasta/fastq sequences recorded in a Protocol.xml"""

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description=USAGE, \
            formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument("xml", metavar="XML", type=str, \
                        help="Protocol.xml with inputs listed")
    args = parser.parse_args()
    protocol = JellyProtocol(args.xml)
    seqLengths = []
    for i in protocol.inputs:
        if i.endswith(".fasta"):
            f = FastaFile(i)
            for j in f.values():
                seqLengths.append(len(j))
        if i.endswith(".fastq"):
            f = FastqFile(i)
            for j in f.values():
                seqLengths.append(len(j.seq))
    print "Read Stats", json.dumps(getStats(seqLengths), indent=4)
Esempio n. 3
0
#!/usr/bin/env python

import argparse, json
from pbsuite.jelly.Jelly import JellyProtocol
from pbsuite.utils.FileHandlers import FastaFile, FastqFile
from pbsuite.utils.summarizeAssembly import getStats

USAGE = """Get statistics on fasta/fastq sequences recorded in a Protocol.xml"""

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description=USAGE, \
            formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument("xml", metavar="XML", type=str, \
                        help="Protocol.xml with inputs listed")
    args = parser.parse_args()
    protocol = JellyProtocol(args.xml)
    seqLengths = []
    for i in protocol.inputs:
        if i.endswith(".fasta"):
            f = FastaFile(i)
            for j in f.values():
                seqLengths.append(len(j))
        if i.endswith(".fastq"):
            f = FastqFile(i)
            for j in f.values():
                seqLengths.append(len(j.seq))
    print "Read Stats", json.dumps(getStats(seqLengths), indent=4)