Пример #1
0
    def testRename(self):
        read = MockRead('foo/1')

        ngsutils.bam.renamepair.read_renamepair(read, '/')

        self.assertEqual(read.qname, 'foo')  # update occurs in place
        assertIn(('ZN', '1'), read.tags)  # added tag
Пример #2
0
    def testRename(self):
        read = MockRead("foo/1")

        ngsutils.bam.renamepair.read_renamepair(read, "/")

        self.assertEqual(read.qname, "foo")  # update occurs in place
        assertIn(("ZN", "1"), read.tags)  # added tag
Пример #3
0
    def testNoClipping(self):
        read = MockRead('foo', 'AAAATTTTCCCGGG', 'AAAABBBBBBBCCC', tags=[('XA', 1)], tid=1, pos=1, cigar='14M')

        code = ngsutils.bam.removeclipping.read_removeclipping(read)
        self.assertEqual(code, 0)
        self.assertEqual(read.qname, 'foo')  # update occurs in place
        assertIn(('XA', 1), read.tags)  # added tag
        self.assertEqual(read.seq, 'AAAATTTTCCCGGG')
        self.assertEqual(read.qual, 'AAAABBBBBBBCCC')
Пример #4
0
    def testUnmapped(self):
        read = MockRead('foo', 'AAAATTTTCCCGGG', 'AAAABBBBBBBCCC', tags=[('XA', 1)])

        code = ngsutils.bam.removeclipping.read_removeclipping(read)
        self.assertEqual(code, 1)
        self.assertEqual(read.qname, 'foo')  # update occurs in place
        assertIn(('XA', 1), read.tags)  # added tag
        self.assertEqual(read.seq, 'AAAATTTTCCCGGG')
        self.assertEqual(read.qual, 'AAAABBBBBBBCCC')
Пример #5
0
    def testUnmapped(self):
        read = MockRead('foo',
                        'AAAATTTTCCCGGG',
                        'AAAABBBBBBBCCC',
                        tags=[('XA', 1)])

        code = ngsutils.bam.removeclipping.read_removeclipping(read)
        self.assertEqual(code, 1)
        self.assertEqual(read.qname, 'foo')  # update occurs in place
        assertIn(('XA', 1), read.tags)  # added tag
        self.assertEqual(read.seq, 'AAAATTTTCCCGGG')
        self.assertEqual(read.qual, 'AAAABBBBBBBCCC')
Пример #6
0
    def testNoClipping(self):
        read = MockRead('foo',
                        'AAAATTTTCCCGGG',
                        'AAAABBBBBBBCCC',
                        tags=[('XA', 1)],
                        tid=1,
                        pos=1,
                        cigar='14M')

        code = ngsutils.bam.removeclipping.read_removeclipping(read)
        self.assertEqual(code, 0)
        self.assertEqual(read.qname, 'foo')  # update occurs in place
        assertIn(('XA', 1), read.tags)  # added tag
        self.assertEqual(read.seq, 'AAAATTTTCCCGGG')
        self.assertEqual(read.qual, 'AAAABBBBBBBCCC')
Пример #7
0
    def testRemoveClipping(self):
        read = MockRead('foo', 'AAAATTTTCCCGGG', 'AAAABBBBBBBCCC', tags=[('XA', 1)], tid=1, pos=1, cigar='4S7M3S')

        code = ngsutils.bam.removeclipping.read_removeclipping(read)
        self.assertEqual(code, 2)
        self.assertEqual(read.qname, 'foo')  # update occurs in place
        assertIn(('XA', 1), read.tags)  # added tag
        assertIn(('ZA', 4), read.tags)  # added tag
        assertIn(('ZB', 3), read.tags)  # added tag
        assertIn(('ZC', 0.5), read.tags)  # added tag
        self.assertEqual(read.seq, 'TTTTCCC')
        self.assertEqual(read.qual, 'BBBBBBB')
Пример #8
0
    def testCufflinksXS(self):
        read1 = MockRead('foo',
                         tid=1,
                         pos=1,
                         is_reverse=True,
                         tags=[('ZZ', 1)])
        read2 = MockRead('bar', tid=1, pos=1, tags=[('ZZ', 1)])
        read3 = MockRead('baz', tags=[('ZZ', 1)])

        chain = _TestChain([
            read1,
            read2,
            read3,
        ])
        chain = ngsutils.bam.tag.CufflinksXS(chain)

        for r in chain.filter():
            assertIn(('ZZ', 1), r.tags)
            if r.qname == 'foo':
                assertIn(('XS', '-'), r.tags)
            elif r.qname == 'bar':
                assertIn(('XS', '+'), r.tags)
            elif r.qname == 'baz':
                assertNotIn(('XS', '+'), r.tags)
                assertNotIn(('XS', '-'), r.tags)
Пример #9
0
    def testRemoveClipping(self):
        read = MockRead('foo',
                        'AAAATTTTCCCGGG',
                        'AAAABBBBBBBCCC',
                        tags=[('XA', 1)],
                        tid=1,
                        pos=1,
                        cigar='4S7M3S')

        code = ngsutils.bam.removeclipping.read_removeclipping(read)
        self.assertEqual(code, 2)
        self.assertEqual(read.qname, 'foo')  # update occurs in place
        assertIn(('XA', 1), read.tags)  # added tag
        assertIn(('ZA', 4), read.tags)  # added tag
        assertIn(('ZB', 3), read.tags)  # added tag
        assertIn(('ZC', 0.5), read.tags)  # added tag
        self.assertEqual(read.seq, 'TTTTCCC')
        self.assertEqual(read.qual, 'BBBBBBB')