def action(arguments):
    """
    Given one more more sequence files, determine if the file is an alignment,
    the maximum sequence length and the total number of sequences.  Provides
    different output formats including tab (tab-delimited), csv and align
    (aligned as if part of a borderless table).
    """
    # Ignore SIGPIPE, for head support
    common.exit_on_sigpipe()
    common.exit_on_sigint()

    handle = arguments.destination_file
    output_format = arguments.output_format
    if not output_format:
        try:
            output_format = 'align' if handle.isatty() else 'tab'
        except AttributeError:
            output_format = 'tab'

    writer_cls = _WRITERS[output_format]

    ssf = partial(summarize_sequence_file, file_type = arguments.input_format)

    # if only one thread, do not use the multithreading so parent process
    # can be terminated using ctrl+c
    if arguments.threads > 1:
        pool = multiprocessing.Pool(processes=arguments.threads)
        summary = pool.imap(ssf, arguments.source_files)
    else:
        summary = (ssf(f) for f in arguments.source_files)

    with handle:
        writer = writer_cls(arguments.source_files, summary, handle)
        writer.write()
def action ( arguments ) : common . exit_on_sigpipe ( ) common . exit_on_sigint ( ) handle = arguments . destination_file output_format = arguments . output_format if not output_format : try : output_format = 'align' if handle . isatty ( ) else 'tab' except AttributeError : output_format = 'tab' writer_cls = _WRITERS [ output_format ] ssf = partial ( summarize_sequence_file , file_type = arguments . input_format ) if arguments . threads > 1 : pool = multiprocessing . Pool ( processes = arguments . threads ) summary = pool . imap ( ssf , arguments . source_files ) else : summary = ( ssf ( f ) for f in arguments . source_files ) with handle : writer = writer_cls ( arguments . source_files , summary , handle ) writer . write ( )
Given one more more sequence files, determine if the file is an alignment,
    the maximum sequence length and the total number of sequences.  Provides
    different output formats including tab (tab-delimited), csv and align
    (aligned as if part of a borderless table).