# HG changeset patch # User jpayne # Date 1540930682 14400 # Node ID 1af2524f48b704eebd034c8cf18240a25884d03b # Parent 746091a787805b8a9ca9b42539d130100133e5a6 planemo upload diff -r 746091a78780 -r 1af2524f48b7 table-union.py --- a/table-union.py Fri Mar 09 11:14:02 2018 -0500 +++ b/table-union.py Tue Oct 30 16:18:02 2018 -0400 @@ -4,7 +4,7 @@ -def main(files): +def main(unionize=True, *files): header = [] items = [] possible_identity_headers = None @@ -15,6 +15,8 @@ for field in reader.fieldnames: if field not in set(header): header.append(field) + + #try to find identity columns in the files, to use to join if possible_identity_headers is None: possible_identity_headers = set(reader.fieldnames) @@ -30,7 +32,7 @@ # possible_identity_headers = set((possible_identity_headers.pop(), )) #if we found an identity column, then try to join rows - if possible_identity_headers: + if possible_identity_headers and unionize: key_column = possible_identity_headers.pop() keys = set([r[key_column] for r in items]) merged_rows = [] @@ -47,4 +49,4 @@ if __name__ == '__main__': - main(sys.argv[1:]) \ No newline at end of file + main(*sys.argv[1:]) \ No newline at end of file diff -r 746091a78780 -r 1af2524f48b7 table-union.xml --- a/table-union.xml Fri Mar 09 11:14:02 2018 -0500 +++ b/table-union.xml Tue Oct 30 16:18:02 2018 -0400 @@ -4,14 +4,32 @@ $combined_table ]]> - + + + + + + + + + + + + + + @@ -19,6 +37,8 @@ + + @@ -27,6 +47,13 @@ + + + + + + +