def testLazyChemistryResolution(self):
        """
        The CmpH5Reader allows reading of files that have missing
        chemistry information---an exception will be thrown only upon
        attempts to access the information.  We need to retain this
        behavior for compatibility.  """
        oldCmpH5 = data.getCmpH5()

        C = CmpH5Reader(oldCmpH5) # no exception here

        with assert_raises(ChemistryLookupError):
            C.sequencingChemistry

        with assert_raises(ChemistryLookupError):
            C[0].sequencingChemistry
    def testLazyChemistryResolution(self):
        """
        The CmpH5Reader allows reading of files that have missing
        chemistry information---an exception will be thrown only upon
        attempts to access the information.  We need to retain this
        behavior for compatibility.  """
        oldCmpH5 = data.getCmpH5()

        C = CmpH5Reader(oldCmpH5) # no exception here

        with assert_raises(ChemistryLookupError):
            C.sequencingChemistry

        with assert_raises(ChemistryLookupError):
            C[0].sequencingChemistry
 def test___init__(self):
     cmpH5_format = CS.CmpH5Format(h.File(data.getCmpH5(), "r"))
     assert_equal(cmpH5_format.ALN_INFO, 'AlnInfo')
 def __init__(self):
     self.h5FileName = data.getCmpH5()
     self.cmpH5 = CmpH5Reader(self.h5FileName)
 def test_openFromH5File(self):
     cmpH5Filename = data.getCmpH5()
     c = CmpH5Reader(h5py.File(cmpH5Filename, "r"))
     EQ("1.2.0.SF", c.version)
 def __init__(self):
     cmpH5Filename = data.getCmpH5()
     self._inCmpH5 = CmpH5Reader(cmpH5Filename)
     self.hit0 = self._inCmpH5[0]
     self.hit1 = self._inCmpH5[1]
Example #7
0
 def test_get_cmp_h5(self):
     assert data.getCmpH5().endswith(".cmp.h5")
Example #8
0
 def test_openFromH5File(self):
     cmpH5Filename = data.getCmpH5()
     c = CmpH5Reader(h5py.File(cmpH5Filename, "r"))
     EQ("1.2.0.SF", c.version)
Example #9
0
 def __init__(self):
     cmpH5Filename = data.getCmpH5()
     self._inCmpH5 = CmpH5Reader(cmpH5Filename)
     self.hit0 = self._inCmpH5[0]
     self.hit1 = self._inCmpH5[1]
 def test_get_cmp_h5(self):
     assert data.getCmpH5().endswith(".cmp.h5")
 def setup_class(self):
     self.h5FileName = data.getCmpH5()
     self.cmpH5 = CmpH5Reader(self.h5FileName)
 def test_alignmentset_index(self):
     aln = AlignmentSet(upstreamData.getCmpH5(), strict=True)
     reads = aln.readsInRange(aln.refNames[0], 0, 1000)
     self.assertEqual(len(list(reads)), 2)
     self.assertEqual(len(list(aln)), 84)
     self.assertEqual(len(aln.index), 84)
    def test_len(self):
        # AlignmentSet
        aln = AlignmentSet(data.getXml(8), strict=True)
        self.assertEqual(len(aln), 92)
        self.assertEqual(aln._length, (92, 123588))
        self.assertEqual(aln.totalLength, 123588)
        self.assertEqual(aln.numRecords, 92)
        aln.totalLength = -1
        aln.numRecords = -1
        self.assertEqual(aln.totalLength, -1)
        self.assertEqual(aln.numRecords, -1)
        aln.updateCounts()
        self.assertEqual(aln.totalLength, 123588)
        self.assertEqual(aln.numRecords, 92)

        # AlignmentSet with filters
        aln = AlignmentSet(data.getXml(15), strict=True)
        self.assertEqual(len(aln), 40)
        self.assertEqual(aln._length, (40, 52023))
        self.assertEqual(aln.totalLength, 52023)
        self.assertEqual(aln.numRecords, 40)
        aln.totalLength = -1
        aln.numRecords = -1
        self.assertEqual(aln.totalLength, -1)
        self.assertEqual(aln.numRecords, -1)
        aln.updateCounts()
        self.assertEqual(aln.totalLength, 52023)
        self.assertEqual(aln.numRecords, 40)

        # AlignmentSet with cmp.h5
        aln = AlignmentSet(upstreamData.getCmpH5(), strict=True)
        self.assertEqual(len(aln), 84)
        self.assertEqual(aln._length, (84, 26103))
        self.assertEqual(aln.totalLength, 26103)
        self.assertEqual(aln.numRecords, 84)
        aln.totalLength = -1
        aln.numRecords = -1
        self.assertEqual(aln.totalLength, -1)
        self.assertEqual(aln.numRecords, -1)
        aln.updateCounts()
        self.assertEqual(aln.totalLength, 26103)
        self.assertEqual(aln.numRecords, 84)


        # SubreadSet
        sset = SubreadSet(data.getXml(10), strict=True)
        self.assertEqual(len(sset), 92)
        self.assertEqual(sset._length, (92, 124093))
        self.assertEqual(sset.totalLength, 124093)
        self.assertEqual(sset.numRecords, 92)
        sset.totalLength = -1
        sset.numRecords = -1
        self.assertEqual(sset.totalLength, -1)
        self.assertEqual(sset.numRecords, -1)
        sset.updateCounts()
        self.assertEqual(sset.totalLength, 124093)
        self.assertEqual(sset.numRecords, 92)

        # HdfSubreadSet
        # len means something else in bax/bas land. These numbers may actually
        # be correct...
        sset = HdfSubreadSet(data.getXml(17), strict=True)
        self.assertEqual(len(sset), 9)
        self.assertEqual(sset._length, (9, 128093))
        self.assertEqual(sset.totalLength, 128093)
        self.assertEqual(sset.numRecords, 9)
        sset.totalLength = -1
        sset.numRecords = -1
        self.assertEqual(sset.totalLength, -1)
        self.assertEqual(sset.numRecords, -1)
        sset.updateCounts()
        self.assertEqual(sset.totalLength, 128093)
        self.assertEqual(sset.numRecords, 9)

        # ReferenceSet
        sset = ReferenceSet(data.getXml(9), strict=True)
        self.assertEqual(len(sset), 59)
        self.assertEqual(sset.totalLength, 85774)
        self.assertEqual(sset.numRecords, 59)
        sset.totalLength = -1
        sset.numRecords = -1
        self.assertEqual(sset.totalLength, -1)
        self.assertEqual(sset.numRecords, -1)
        sset.updateCounts()
        self.assertEqual(sset.totalLength, 85774)
        self.assertEqual(sset.numRecords, 59)
 def __init__(self):
     self.h5FileName = data.getCmpH5()
     self.cmpH5 = CmpH5Reader(self.h5FileName)
 def test___init__(self):
     cmpH5_format = CS.CmpH5Format(h.File(data.getCmpH5(),"r"))
     assert_equal(cmpH5_format.ALN_INFO, 'AlnInfo')