Commit 37656f88 authored by Mathieu Giraud's avatar Mathieu Giraud Committed by Vidjil Team

latex.py: display clones in a LaTeX table

parent ed895a6a
......@@ -159,7 +159,7 @@ class Window:
return obj
def latex(self, point=0):
return r" & & %s & %-50s \\ %% %s" % (self.d["reads"][0], self.d["name"], self.d["id"])
return r" & & %7d & %-50s \\ %% %s" % (self.d["reads"][0], self.d["name"] if 'name' in self.d else self.d["id"], self.d["id"])
### print essential info about Window
def __str__(self):
......
......@@ -7,7 +7,8 @@ import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--threshold', '-t', type=float, default=0.1, help='threshold (%(default)d)')
parser.add_argument('--min', '-m', type=int, default=1, help='minimal number of reads in the clone (%(default)d)')
parser.add_argument('--top', '-t', type=int, default=5, help='maximal number of clones to displlay (%(default)d)')
parser.add_argument('--verbose', '-v', action='store_true', help='verbose output')
parser.add_argument('file', nargs='+', help='''.vidjil files''')
......@@ -23,14 +24,16 @@ def main():
data = fuse.ListWindows()
data.load(i, False, verbose = args.verbose)
print ' ', i
out = []
for w in data:
if w.d['reads'][0] >= args.threshold:
print w.latex()
if w.d['reads'][0] >= args.min:
out += [(-w.d['reads'][0], w.latex())]
for bla, ltx in sorted(out[:args.top]):
print ltx
print r' \hline'
if __name__ =='__main__':
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment