File: test_pbcore_io_unaligned_bam.py

package info (click to toggle)
python-pbcore 1.7.1%2Bgit20200430.a127b1e%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,404 kB
  • sloc: python: 23,243; xml: 2,504; makefile: 232; sh: 66
file content (44 lines) | stat: -rw-r--r-- 1,648 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
40
41
42
43
44
import pytest

from pbcore import data
from pbcore.io import BamReader
from pbcore.io.align._BamSupport import UnavailableFeature


class TestUnalignedBam:

    @classmethod
    def setup_class(cls):
        cls.bam = BamReader(data.getUnalignedBam())
        cls.bamRead0 = next(iter(cls.bam))

    def testInvalidOperations(self):

        # These kinds of things presently work.  Do we want them to
        # fail?

        # with assert_raises(UnavailableFeature):
        #     self.bamRead0.isForwardStrand
        # with assert_raises(UnavailableFeature):
        #     self.bamRead0.tStart

        # attempts to get read aligned or oriented
        with pytest.raises(UnavailableFeature):
            self.bamRead0.read(aligned=True, orientation="native")
        with pytest.raises(UnavailableFeature):
            self.bamRead0.read(aligned=False, orientation="genomic")
        with pytest.raises(UnavailableFeature):
            self.bamRead0.read()
        with pytest.raises(UnavailableFeature):
            self.bamRead0.InsertionQV(aligned=True, orientation="native")
        with pytest.raises(UnavailableFeature):
            self.bamRead0.InsertionQV(aligned=False, orientation="genomic")
        with pytest.raises(UnavailableFeature):
            self.bamRead0.InsertionQV()

    def testIpd(self):
        """Check that 'Ipd' feature is recognized correctly."""
        pfa = self.bam.baseFeaturesAvailable()
        assert pfa == frozenset(['Ipd', 'DeletionTag', 'MergeQV', 'SubstitutionQV',
                                 'InsertionQV', 'DeletionQV'])
        ipd = self.bamRead0.IPD(aligned=False, orientation="native")