示例#1
0
def getTab(outfile, colnames, sample2row):
    f = open(outfile, 'w')
    iseqlib.writeDocumentStart(f)
    myTabHeader(f, colnames)
    tab(f, sample2row)
    label = ''
    captionStr = ''
    iseqlib.sidewaystableCloser(f, captionStr, label)
    iseqlib.writeDocumentEnd(f)
    f.close()
def printTexTab(clones, clone2hits, group2keywords, options, outbasename):
    outfile = "%s.tex" %outbasename
    f = open(outfile, 'w')
    iseqlib.writeDocumentStart(f)
    samples = ['AS1', 'AS2', 'AS3', 'AS4', 'AS5', 'H1', 'H2']
    myTabHeader(f, samples)
    tab(f, clones, clone2hits, group2keywords, options, samples)
    label = ''
    captionStr = ''
    #iseqlib.tableCloser(f, captionStr, label)
    iseqlib.sidewaystableCloser(f, captionStr, label)
    iseqlib.writeDocumentEnd(f)
    f.close()
def printTexTab(clones, clone2hits, group2keywords, options, outbasename):
    outfile = "%s.tex" % outbasename
    f = open(outfile, "w")
    iseqlib.writeDocumentStart(f)
    samples = ["AS1", "AS2", "AS3", "AS4", "AS5", "H1", "H2"]
    myTabHeader(f, samples)
    tab(f, clones, clone2hits, group2keywords, options, samples)
    label = ""
    captionStr = ""
    # iseqlib.tableCloser(f, captionStr, label)
    iseqlib.sidewaystableCloser(f, captionStr, label)
    iseqlib.writeDocumentEnd(f)
    f.close()
#---- main -----

field2index = {'%Cutoff':0, 'Clones1':1, 'Clones2':2, 'Overlap1':3, 'Overlap2':4, '%1overlap2':5, '%2overlap1':6, '%reads1overlap2':7, '%reads2overlap1':8}
cutoff2line = {}

for line in sys.stdin:
    line = line.strip('\n')
    if len(line) == 0:
        continue
    if line[0] == '#':
        line = line.lstrip('#')
        items = line.split('\t')
        for i, item in enumerate(items):
            field2index[item] = i
    else:
        items = line.split('\t')
        cutoffIndex = field2index['%Cutoff']
        cutoff = float(items[cutoffIndex])
        cutoff2line[cutoff] = line


iseqlib.writeDocumentStart(sys.stdout)
tabHeader(sys.stdout)
tab(sys.stdout, cutoff2line, field2index)
label=''
captionStr = ''
iseqlib.sidewaystableCloser(sys.stdout, captionStr, label)
iseqlib.writeDocumentEnd(sys.stdout)