Module Expr Str Import alias Import alias identifier Import alias identifier FunctionDef arguments args NameParam defaults NameLoad body Expr Str If CompareIs NameLoad NameLoad body Assign NameStore AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str keyword Str Expr Call AttributeLoad NameLoad attr keyword NameLoad keyword Str keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str If AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Num If CompareLt Call NameLoad NameLoad Num body Raise Call NameLoad Str Assign TupleStore NameStore NameStore NameStore TupleLoad ListLoad ListLoad ListLoad If AttributeLoad NameLoad attr body If CompareEq AttributeLoad NameLoad attr Str body Assign NameStore NameLoad orelse Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str If CompareNotEq Call NameLoad NameLoad Call NameLoad NameLoad body Raise Call NameLoad Str For NameStore NameLoad body If AttributeLoad NameLoad attr body Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Call NameLoad NameLoad Str keyword AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad NameLoad Str Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad If BoolOpAnd UnaryOpNot NameLoad NameLoad body Assign NameStore NameLoad orelse Assign NameStore NameLoad For NameStore Call NameLoad BinOpSub Call NameLoad NameLoad Num body Assign NameStore SubscriptLoad NameLoad Index NameLoad For NameStore Call NameLoad BinOpAdd NameLoad Num Call NameLoad NameLoad body Assign NameStore SubscriptLoad NameLoad Index NameLoad Assign TupleStore NameStore NameStore TupleLoad Call NameLoad NameLoad Call NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad NameLoad NameLoad Call NameLoad Call AttributeLoad NameLoad attr NameLoad Call NameLoad Call AttributeLoad NameLoad attr NameLoad Call NameLoad Call AttributeLoad NameLoad attr NameLoad Call NameLoad Call AttributeLoad NameLoad attr NameLoad If AttributeLoad NameLoad attr body If CompareEq Call NameLoad NameLoad Num body Assign TupleStore NameStore NameStore NameStore TupleLoad Num Num Num Assign TupleStore NameStore NameStore NameStore TupleLoad Num Num Num orelse If CompareEq Call NameLoad NameLoad Num body Assign TupleStore NameStore NameStore NameStore TupleLoad Num Num Num Assign TupleStore NameStore NameStore NameStore TupleLoad Num Num Num orelse Assign NameStore Call NameLoad Call AttributeLoad NameLoad attr NameLoad Assign TupleStore NameStore NameStore NameStore TupleLoad BinOpDiv NameLoad Call NameLoad Call NameLoad Call AttributeLoad NameLoad attr NameLoad BinOpDiv Call NameLoad Call AttributeLoad NameLoad attr NameLoad Call NameLoad NameLoad BinOpDiv Call NameLoad Call AttributeLoad NameLoad attr NameLoad Call NameLoad NameLoad Assign TupleStore NameStore NameStore TupleLoad BinOpDiv NameLoad Call NameLoad NameLoad BinOpDiv NameLoad Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpAdd Str BinOpMod Call AttributeLoad Str attr ListComp AttributeLoad NameLoad attr comprehension NameStore Call NameLoad Num TupleLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad NameLoad attr decorator_list If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr Call NameLoad AttributeLoad NameLoad attr
N/A N/A 
set_diff.py - compare contents of several files
===============================================

:Author: Andreas Heger
:Release: $Id$
:Date: |today|
:Tags: Python

Purpose
-------

pairwise comparison of multiple sets. 

The script outputs a tab-separated table with the following fields:

set1, set2: labels of sets that are compared
n1, n2: number of elements in the two sets
union: size of union of both sets
inter: size of the intersection of two sets
unique1: number of unique elements in set1
unique2: number of unique elements in set2

If the options --add-percent is given, the following columns are added:
pinter: intersection / union
punique1: unique1 / n1
punique1: unique2 / n2
pcov1: coverage of set1 by set2 = intersection / n1
pcov2: coverage of set2 by set1 intersection / n2
pcovmax: maximum coverage of either set = max(pcov1, pcov2)

Usage
-----

Example::

   python set_diff.py --help

Type::

   python set_diff.py --help

for command line help.

Command line options
--------------------

 N/A sys N/A CGAT.Experiment E N/A CGAT.IOTools IOTools main N/A N/A argv N/A None N/A N/A script main.

    parses command line options in sys.argv, unless *argv* is given.
     N/A N/A argv None N/A N/A argv N/A sys argv N/A parser N/A N/A E OptionParser version %prog version: $Id: set_diff.py 2782 2009-09-10 11:40:29Z andreas $ N/A N/A N/A parser add_option -p --add-percent dest add_percent action store_true help add percentage information to each line. N/A N/A N/A parser add_option -t --header-names dest headers type string help comma separated list of headers. If empty or set to '-', filenames are used. N/A N/A N/A parser add_option --skip-header dest add_header action store_false help do not add header to flat format. N/A N/A N/A parser add_option --output-with-header dest write_header action store_true help write header and exit. N/A N/A N/A parser add_option --with-title dest with_title action store_true help use column titles in input data [%default]. N/A N/A N/A parser add_option --no-title dest with_title action store_false help there are no titles in input data [%default]. N/A N/A N/A parser set_defaults add_percent False percent_format %5.2f headers None add_header True write_header False with_title True N/A N/A options args N/A N/A E Start parser N/A N/A options add_header N/A N/A N/A N/A N/A options stdout write set1	set2	n1	n2	union	inter	unique1	unique2 N/A N/A options add_percent N/A N/A N/A N/A N/A options stdout write 	pinter	punique1	punique2	pcov1	pcov2	pcovmax N/A N/A N/A N/A options stdout write N/A N/A options write_header N/A N/A N/A N/A sys exit 0 N/A N/A N/A len args 2 N/A N/A N/A ValueError please supply at least two filenames. N/A N/A headers titles sets N/A N/A N/A N/A N/A N/A options headers N/A N/A N/A N/A options headers - N/A N/A headers args N/A N/A headers N/A N/A N/A options headers split , N/A N/A N/A len headers N/A len args N/A N/A N/A ValueError please supply the same number of headers as there are filenames. N/A f args N/A N/A N/A options with_title N/A N/A N/A title data N/A N/A IOTools readList N/A open f r with_title N/A options with_title N/A N/A N/A titles append title N/A N/A data N/A N/A IOTools readList N/A open f r N/A N/A N/A sets append N/A set data N/A N/A N/A headers titles N/A N/A headers titles N/A N/A headers args N/A x N/A range N/A N/A len sets 1 N/A N/A set1 N/A sets N/A x N/A y N/A range N/A x 1 N/A len sets N/A N/A set2 N/A sets N/A y N/A N/A l1 l2 N/A N/A len set1 N/A len set2 N/A N/A N/A N/A options stdout write N/A %s	%s	%i	%i	%i	%i	%i	%i N/A N/A headers N/A x N/A headers N/A y l1 l2 N/A len N/A N/A set1 union set2 N/A len N/A N/A set1 intersection set2 N/A len N/A N/A set1 difference set2 N/A len N/A N/A set2 difference set1 N/A N/A options add_percent N/A N/A N/A N/A len set1 0 N/A N/A N/A ri r1 r2 N/A 0 1 0 N/A N/A c1 c2 cm N/A 1 0 0 N/A N/A N/A N/A len set2 0 N/A N/A N/A ri r1 r2 N/A 0 0 1 N/A N/A c1 c2 cm N/A 0 1 0 N/A N/A i N/A len N/A N/A set1 intersection set2 N/A N/A ri r1 r2 N/A N/A i N/A float N/A len N/A N/A set1 union set2 N/A N/A len N/A N/A set1 difference set2 N/A float l1 N/A N/A len N/A N/A set2 difference set1 N/A float l2 N/A N/A c1 c2 N/A N/A i N/A float l1 N/A i N/A float l2 N/A cm N/A max c1 c2 N/A N/A N/A N/A options stdout write N/A N/A N/A N/A join N/A N/A options percent_format N/A z N/A range 6 N/A ri r1 r2 c1 c2 cm N/A N/A N/A N/A options stdout write N/A N/A N/A E Stop N/A N/A N/A __name__ __main__ N/A N/A N/A N/A sys exit N/A main N/A sys argv