<s> '''<STR_LIT>''' <EOL> import sys <EOL> import csv <EOL> import CGAT . Experiment as E <EOL> import CGAT . IOTools as IOTools <EOL> def main ( argv = None ) : <EOL> """<STR_LIT>""" <EOL> if argv is None : <EOL> argv = sys . argv <EOL> parser = E . OptionParser ( <EOL> version = "<STR_LIT>" ) <EOL> parser . add_option ( <EOL> "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , type = "<STR_LIT:string>" , <EOL> help = "<STR_LIT>" ) <EOL> ( options , args ) = E . Start ( parser , add_csv_options = True ) <EOL> reader = csv . DictReader ( E . stdin , dialect = options . csv_dialect ) <EOL> if options . sort : <EOL> fields = options . sort . split ( "<STR_LIT:U+002C>" ) <EOL> else : <EOL> fields = None <EOL> writer = csv . DictWriter ( E . stdout , <EOL> fields , <EOL> dialect = options . csv_dialect , <EOL> lineterminator = options . csv_lineterminator , <EOL> extrasaction = '<STR_LIT:ignore>' ) <EOL> E . stdout . write ( "<STR_LIT:\t>" . join ( fields ) + "<STR_LIT:\n>" ) <EOL> for row in reader : <EOL> row = IOTools . convertDictionary ( row ) <EOL> writer . writerow ( row ) <EOL> E . Stop ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> sys . exit ( main ( sys . argv ) ) </s>
