File: seed_processor_test.py

package info (click to toggle)
iva 1.0.8+ds-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,544 kB
  • ctags: 743
  • sloc: python: 5,665; perl: 2,754; java: 1,148; sh: 419; makefile: 34
file content (39 lines) | stat: -rw-r--r-- 1,643 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Copyright (c) 2014-2016 Genome Research Ltd.
#
# This file is part of IVA.
#
# IVA is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
import os
import filecmp
import pyfastaq
from iva import seed_processor

modules_dir = os.path.dirname(os.path.abspath(seed_processor.__file__))
data_dir = os.path.join(modules_dir, 'tests', 'data')

class TestSeedProcessor(unittest.TestCase):
    def _test_process_seeds(self):
        '''Test process_seeds'''
        in_fasta = os.path.join(data_dir, 'seed_processor_test.ref.fa')
        reads1 = os.path.join(data_dir, 'seed_processor_test.reads_1.fa')
        reads2 = os.path.join(data_dir, 'seed_processor_test.reads_2.fa')
        tmp_out = 'tmp.process_seeds.out'
        s = seed_processor.SeedProcessor(in_fasta, reads1, reads2, tmp_out, verbose=4, threads=1)
        s.process()
        reader = pyfastaq.sequences.file_reader(tmp_out)
        counter = 0
        for seq in reader:
            self.assertTrue(len(seq) > 470)
            counter += 1
        self.assertEqual(2, counter)
        os.unlink(tmp_out)