コード例 #1
0
class FastaTestCase(unittest.TestCase):
    @classmethod
    def setUp(self):
        self.fasta = Fasta(testdata.PARSE_FASTA,
                           'test_fasta',
                           'test_aligner',
                           is_reference=False)

    def test_repr(self):
        expected = "Fasta(filepath='{0}', name='test_fasta', aligner='test_aligner', is_reference=False)".format(
            testdata.PARSE_FASTA)
        self.assertEqual(expected, repr(self.fasta))

    def test_identifier(self):
        expected = 'test_fasta::test_aligner'
        self.assertEqual(expected, self.fasta.identifier)

    def test_get_contig(self):
        """
        The following tests assume FastaContig is working.
        """
        # It should return the correct contig at any file position or in any order.
        contig0 = self.fasta.get_contig('contig0')
        contig2 = self.fasta.get_contig('contig2')
        contig1 = self.fasta.get_contig('contig1')

        self.assertEqual('contig0', contig0.name)
        self.assertEqual('contig1', contig1.name)
        self.assertEqual('contig2', contig2.name)

    def test_get_contig_empty(self):
        contig = self.fasta.get_contig('DoesNotExist')
        self.assertIsInstance(contig, EmptyContig)

    def test_yields_contigs_longest_to_shortest(self):
        expected = [
            'gi|129295|sp|P01013|OVAX_CHICK', '100CharacterContig',
            '90CharacterContig', '90CharacterContigNoBreak',
            '90CharacterContig2'
        ]
        for contig, expect in zip(self.fasta.contigs, expected):
            self.assertEqual(expect, contig.name)
コード例 #2
0
ファイル: analyze_test.py プロジェクト: SemiQuant/NASP
    def setUp(self):
        fasta = Fasta(testdata.PARSE_FASTA, 'test_data', None, False)
        ref_fasta = Fasta(testdata.PARSE_FASTA, 'test_data', None, True)

        self.analysis = GenomeAnalysis(10, .9)
        self.coroutine_fn = lambda *arg: (self.CoroutineMock(),
                                          self.CoroutineMock())
        self.dups_contig = fasta
        self.reference_contig = ref_fasta.get_contig(
            'ContigWithFilePositionOffset')
        self.sample_groups = ((fasta, fasta), (fasta, ), (fasta, fasta))
コード例 #3
0
ファイル: parse_test.py プロジェクト: TGenNorth/NASP
class FastaTestCase(unittest.TestCase):
    @classmethod
    def setUp(self):
        self.fasta = Fasta(testdata.PARSE_FASTA, 'test_fasta', 'test_aligner', is_reference=False)

    def test_repr(self):
        expected = "Fasta(filepath='{0}', name='test_fasta', aligner='test_aligner', is_reference=False)".format(
            testdata.PARSE_FASTA)
        self.assertEqual(expected, repr(self.fasta))

    def test_identifier(self):
        expected = 'test_fasta::test_aligner'
        self.assertEqual(expected, self.fasta.identifier)

    def test_get_contig(self):
        """
        The following tests assume FastaContig is working.
        """
        # It should return the correct contig at any file position or in any order.
        contig0 = self.fasta.get_contig('contig0')
        contig2 = self.fasta.get_contig('contig2')
        contig1 = self.fasta.get_contig('contig1')

        self.assertEqual('contig0', contig0.name)
        self.assertEqual('contig1', contig1.name)
        self.assertEqual('contig2', contig2.name)

    def test_get_contig_empty(self):
        contig = self.fasta.get_contig('DoesNotExist')
        self.assertIsInstance(contig, EmptyContig)

    def test_yields_contigs_longest_to_shortest(self):
        expected = [
            'gi|129295|sp|P01013|OVAX_CHICK',
            '100CharacterContig',
            '90CharacterContig',
            '90CharacterContigNoBreak',
            '90CharacterContig2'
        ]
        for contig, expect in zip(self.fasta.contigs, expected):
            self.assertEqual(expect, contig.name)
コード例 #4
0
ファイル: analyze_test.py プロジェクト: TGenNorth/NASP
    def setUp(self):
        fasta = Fasta(testdata.PARSE_FASTA, 'test_data', None, False)
        ref_fasta = Fasta(testdata.PARSE_FASTA, 'test_data', None, True)

        self.analysis = GenomeAnalysis(10, .9)
        self.coroutine_fn = lambda *arg: (self.CoroutineMock(), self.CoroutineMock())
        self.dups_contig = fasta
        self.reference_contig = ref_fasta.get_contig('ContigWithFilePositionOffset')
        self.sample_groups = (
            (
                fasta,
                fasta
            ), (
                fasta,
            ), (
                fasta,
                fasta
            )
        )