コード例 #1
0
ファイル: test_renamepair.py プロジェクト: xuwei684/ngsutils
    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
ファイル: test_tag.py プロジェクト: xuwei684/ngsutils
    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')