Example #1
0
 def test_sort_by_size(self):
     '''Test sort_by_size'''
     infile = os.path.join(data_dir, 'tasks_test_sort_by_size.in.fa')
     tmpfile = 'tmp.sorted.fa'
     tasks.sort_by_size(infile, tmpfile)
     self.assertTrue(filecmp.cmp(os.path.join(data_dir, 'tasks_test_sort_by_size.out.fa'), tmpfile, shallow=False))
     tasks.sort_by_size(infile, tmpfile, smallest_first=True)
     self.assertTrue(filecmp.cmp(os.path.join(data_dir, 'tasks_test_sort_by_size.out.rev.fa'), tmpfile, shallow=False))
     os.unlink(tmpfile)
Example #2
0
 def test_sort_by_size(self):
     '''Test sort_by_size'''
     infile = os.path.join(data_dir, 'tasks_test_sort_by_size.in.fa')
     tmpfile = 'tmp.sorted.fa'
     tasks.sort_by_size(infile, tmpfile)
     self.assertTrue(filecmp.cmp(os.path.join(data_dir, 'tasks_test_sort_by_size.out.fa'), tmpfile, shallow=False))
     tasks.sort_by_size(infile, tmpfile, smallest_first=True)
     self.assertTrue(filecmp.cmp(os.path.join(data_dir, 'tasks_test_sort_by_size.out.rev.fa'), tmpfile, shallow=False))
     os.unlink(tmpfile)
Example #3
0
def run(description):
    parser = argparse.ArgumentParser(
        description = description,
        usage = 'fastaq sort_by_size [options] <infile> <outfile>')
    parser.add_argument('infile', help='Name of input file')
    parser.add_argument('outfile', help='Name of output file')
    parser.add_argument('-r', '--reverse', action='store_true', help='Sort by shortest first instead of the default of longest first')
    options = parser.parse_args()
    tasks.sort_by_size(
        options.infile,
        options.outfile,
        smallest_first=options.reverse
    )
Example #4
0
def run(description):
    parser = argparse.ArgumentParser(
        description=description,
        usage='fastaq sort_by_size [options] <infile> <outfile>')
    parser.add_argument('infile', help='Name of input file')
    parser.add_argument('outfile', help='Name of output file')
    parser.add_argument(
        '-r',
        '--reverse',
        action='store_true',
        help='Sort by shortest first instead of the default of longest first')
    options = parser.parse_args()
    tasks.sort_by_size(options.infile,
                       options.outfile,
                       smallest_first=options.reverse)