# Path: covest/data.py
# def sample_reads(src_reads_file, dest_reads_file, factor):
#     prob = 1.0 / factor
#     with open(dest_reads_file, 'w') as f:
#         for read_id, read in load_reads(src_reads_file):
#             if random.random() < prob:
#                 f.write('>{}\n'.format(read_id))
#                 f.write('{}\n'.format(read))


import argparse
from covest.data import sample_reads
#! /usr/bin/env python3

BASES = ['A', 'C', 'G', 'T', ]

DEFAULT_FACTOR = 2


if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Subsample reads randomly form other reads')
    parser.add_argument('-f', '--factor', type=float,
                        default=DEFAULT_FACTOR, help='Factor')
    parser.add_argument('reads', help='Reads file')
    parser.add_argument('output', help='Output file')

    args = parser.parse_args()


# Path: covest/data.py
# def sample_reads(src_reads_file, dest_reads_file, factor):
#     prob = 1.0 / factor
#     with open(dest_reads_file, 'w') as f:
#         for read_id, read in load_reads(src_reads_file):
#             if random.random() < prob:
#                 f.write('>{}\n'.format(read_id))
#                 f.write('{}\n'.format(read))


# Path: bin/read_sampler.py
import argparse
from covest.data import sample_reads

#! /usr/bin/env python3

BASES = ['A', 'C', 'G', 'T', ]

DEFAULT_FACTOR = 2


if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Subsample reads randomly form other reads')
    parser.add_argument('-f', '--factor', type=float,
                        default=DEFAULT_FACTOR, help='Factor')
    parser.add_argument('reads', help='Reads file')
    parser.add_argument('output', help='Output file')

    args = parser.parse_args()


    sample_reads(args.output, args.reads, args.factor)