Beispiel #1
0
 def test_filter_reference_contigs(self):
     ds2 = ReferenceSet(data.getRef())
     self.assertEqual(len(list(ds2.refNames)), 59)
     filt = Filters()
     filt.addRequirement(id=[('==', 'E.faecalis.1')])
     ds2.addFilters(filt)
     self.assertEqual(str(ds2.filters), "( id == E.faecalis.1 )")
     self.assertEqual(len(ds2.refNames), 1)
     self.assertEqual(len(list(ds2.records)), 1)
     ds2.disableFilters()
     self.assertEqual(len(list(ds2.refNames)), 59)
     self.assertEqual(len(list(ds2.records)), 59)
     ds2.enableFilters()
     self.assertEqual(len(list(ds2.refNames)), 1)
     self.assertEqual(len(list(ds2.records)), 1)
Beispiel #2
0
 def test_filter_reference_contigs(self):
     ds2 = ReferenceSet(data.getRef())
     self.assertEqual(len(list(ds2.refNames)), 59)
     filt = Filters()
     filt.addRequirement(id=[('==', 'E.faecalis.1')])
     ds2.addFilters(filt)
     self.assertEqual(str(ds2.filters),
                      "( id == E.faecalis.1 )")
     self.assertEqual(len(ds2.refNames), 1)
     self.assertEqual(len(list(ds2.records)), 1)
     ds2.disableFilters()
     self.assertEqual(len(list(ds2.refNames)), 59)
     self.assertEqual(len(list(ds2.records)), 59)
     ds2.enableFilters()
     self.assertEqual(len(list(ds2.refNames)), 1)
     self.assertEqual(len(list(ds2.records)), 1)
Beispiel #3
0
    def test_loading_reference(self):
        log.info('Opening Reference')
        r = ReferenceSet(data.getRef()).toExternalFiles()[0]
        log.info('Done Opening Reference')
        log.info('Opening AlignmentSet')
        d = AlignmentSet(data.getBam(), referenceFastaFname=r)
        log.info('Done Opening AlignmentSet')
        bfile = openIndexedAlignmentFile(data.getBam(), referenceFastaFname=r)
        self.assertTrue(bfile.isReferenceLoaded)
        for res in d.resourceReaders():
            self.assertTrue(res.isReferenceLoaded)

        aln = AlignmentSet(data.getBam())
        aln.addReference(r)
        for res in aln.resourceReaders():
            self.assertTrue(res.isReferenceLoaded)
Beispiel #4
0
    def test_loading_reference(self):
        log.info('Opening Reference')
        r = ReferenceSet(data.getRef()).toExternalFiles()[0]
        log.info('Done Opening Reference')
        log.info('Opening AlignmentSet')
        d = AlignmentSet(data.getBam(), referenceFastaFname=r)
        log.info('Done Opening AlignmentSet')
        bfile = openIndexedAlignmentFile(data.getBam(),
                                         referenceFastaFname=r)
        self.assertTrue(bfile.isReferenceLoaded)
        for res in d.resourceReaders():
            self.assertTrue(res.isReferenceLoaded)

        aln = AlignmentSet(data.getBam())
        aln.addReference(r)
        for res in aln.resourceReaders():
            self.assertTrue(res.isReferenceLoaded)
 def test_filter_reference_contigs(self):
     ds2 = ReferenceSet(data.getRef())
     assert len(list(ds2.refNames)) == 59
     assert len(list(ds2.records)) == len(ds2.index)
     filt = Filters()
     filt.addRequirement(id=[('==', 'E.faecalis.1')])
     ds2.addFilters(filt)
     assert str(ds2.filters) == "( id == E.faecalis.1 )"
     assert len(ds2.refNames) == 1
     assert len(list(ds2.records)) == 1
     assert len(list(ds2.records)) == len(ds2.index)
     ds2.disableFilters()
     assert len(list(ds2.refNames)) == 59
     assert len(list(ds2.records)) == 59
     assert len(list(ds2.records)) == len(ds2.index)
     ds2.enableFilters()
     assert len(list(ds2.refNames)) == 1
     assert len(list(ds2.records)) == 1
     assert len(list(ds2.records)) == len(ds2.index)