コード例 #1
0
ファイル: FastqError7.py プロジェクト: alicon/InternIsland
def write_results_to_file(fastq_dict, error_dict, opts):
    """Writes the result of the cloning/error adding to a file in the cwd

    :param defaultdict fastq_dict: original dictionary from file
    :param defaultdict error_dict: cloned/error dictionary
    :param args opts: the parsed arguments from the command line
    :return None: Writes to file only
    """
    outfile = open(opts.fastq.name[:-6] + '_FastqErrorResult.txt', 'w')
    for key in fastq_dict.keys():
        outfile.writelines("{} no errors:    {}\n".format(key, fastq_dict[key]))
        outfile.writelines("{} with errors:  {}\n\n".format(key, error_dict[key]))
    print blue(''\
               'Results written to {}'.format((''\
                '{}/{}_FastqErrorResult.txt'\
                '').format(os.getcwd(), opts.fastq.name[:-6])))
コード例 #2
0
ファイル: FastqError7.py プロジェクト: alicon/InternIsland
def main(args):
    """Main method

    :param args: arguments
    :return: None
    """
    print green('Running...')
    opts = parse_cmdline_params(args[1:])
    infile = opts.fastq
    fastq_dict = create_fastq_dict(infile, opts)
    error_dict = decide_if_error(fastq_dict)
    print yellow("[STATUS] Error dict created.")
    if raw_input(blue('Would you like results printed to the terminal? Answer y or n: ')) is 'y':
        print_results(fastq_dict, error_dict)
    if raw_input(blue('Would you like to write the results to a file? Answer y or n: ')) is 'y':
        write_results_to_file(fastq_dict, error_dict, opts)
    print green('Done')
コード例 #3
0
def write_results_to_file(fastq_dict, error_dict, opts):
    """Writes the result of the cloning/error adding to a file in the cwd

    :param defaultdict fastq_dict: original dictionary from file
    :param defaultdict error_dict: cloned/error dictionary
    :param args opts: the parsed arguments from the command line
    :return None: Writes to file only
    """
    outfile = open(opts.fastq.name[:-6] + '_FastqErrorResult.txt', 'w')
    for key in fastq_dict.keys():
        outfile.writelines("{} no errors:    {}\n".format(
            key, fastq_dict[key]))
        outfile.writelines("{} with errors:  {}\n\n".format(
            key, error_dict[key]))
    print blue(''\
               'Results written to {}'.format((''\
                '{}/{}_FastqErrorResult.txt'\
                '').format(os.getcwd(), opts.fastq.name[:-6])))
コード例 #4
0
def main(args):
    """Main method

    :param args: arguments
    :return: None
    """
    print green('Running...')
    opts = parse_cmdline_params(args[1:])
    infile = opts.fastq
    fastq_dict = create_fastq_dict(infile, opts)
    error_dict = decide_if_error(fastq_dict)
    print yellow("[STATUS] Error dict created.")
    if raw_input(
            blue(
                'Would you like results printed to the terminal? Answer y or n: '
            )) is 'y':
        print_results(fastq_dict, error_dict)
    if raw_input(
            blue(
                'Would you like to write the results to a file? Answer y or n: '
            )) is 'y':
        write_results_to_file(fastq_dict, error_dict, opts)
    print green('Done')