示例#1
0
    def test_eq(self):
        r1 = Region(self.fai_path, 'chr22:1-10000')
        r2 = Region(self.fai_path, 'chr22:1-10000')
        self.assertTrue(r1 == r2)

        r3 = Region(self.fai_path, 'chr22')
        self.assertFalse(r2 == r3)
示例#2
0
    def test_lt(self):
        r1 = Region(self.fai_path, 'chr22:1-10000')
        r2 = Region(self.fai_path, 'chrHLA:1:2:3:4:1-10000')
        self.assertTrue(r1 < r2)

        r3 = Region(self.fai_path, 'chr22')
        self.assertTrue(r3 < r1)

        r4 = Region(self.fai_path, 'chr22:10000')
        self.assertTrue(r3 < r4)
        self.assertTrue(r1 < r4)
示例#3
0
 def test_short_region(self):
     regions = {'chr22': '100', 'chrHLA:1:2:3:4': '1000'}
     for chrom, start in regions.iteritems():
         r = Region(self.fai_path, ':'.join((chrom, str(start))))
         self.assertEqual(r.chrom, chrom)
         self.assertEqual(r.start, start)
         self.assertIsNone(r.end)
示例#4
0
 def test_chromosome_only(self):
     regions = ['chr22', 'chrHLA:1:2:3:4']
     for region in regions:
         r = Region(self.fai_path, region)
         self.assertEqual(r.chrom, region)
         self.assertIsNone(r.start)
         self.assertIsNone(r.end)
示例#5
0
 def test_long_region(self):
     regions = {'chr22': ('100', '999'), 'chrHLA:1:2:3:4': ('1000', '1100')}
     for chrom, positions in regions.iteritems():
         r = Region(self.fai_path, ':'.join(
             (chrom, '-'.join(map(str, positions)))))
         self.assertEqual(r.chrom, chrom)
         self.assertEqual(r.start, positions[0])
         self.assertEqual(r.end, positions[1])
示例#6
0
文件: postvqsr.py 项目: vifehe/yaps2
 def chromosome_key(task):
     reference_fai = os.path.join(
         '/gscmnt/ams1102/info/model_data/2869585698/build106942997',
         'all_sequences.fa.fai')
     return Region(reference_fai, task.params['in_chrom']).chrom
示例#7
0
 def chromosome_key(task):
     reference_fai = '/gscmnt/gc2802/halllab/ccdg_resources/genomes/human/GRCh38DH/all_sequences.fa.fai'
     return Region(reference_fai, task.params['in_chrom']).chrom
示例#8
0
 def test_sort(self):
     r1 = Region(self.fai_path, 'chr22:1-10000')
     r2 = Region(self.fai_path, 'chrHLA:1:2:3:4:1-10000')
     r3 = Region(self.fai_path, 'chr22:10001-20000')
     r4 = Region(self.fai_path, 'chr22:10001-20001')
     self.assertEqual([r1, r3, r4, r2], sorted([r4, r3, r2, r1]))
示例#9
0
 def test_hash(self):
     r1 = Region(self.fai_path, 'chr22:1-10000')
     r2 = Region(self.fai_path, 'chr22:1-10000')
     self.assertEqual(r1.__hash__(), r2.__hash__())
示例#10
0
 def test_end_lt(self):
     self.assertFalse(Region._end_lt('22', '10'))
     self.assertTrue(Region._end_lt('22', None))
     self.assertFalse(Region._end_lt(None, None))
     self.assertFalse(Region._end_lt(None, '1'))
     self.assertTrue(Region._end_lt('1', '10'))
示例#11
0
 def test_invalid_chromosome(self):
     with self.assertRaises(RuntimeError):
         r = Region(self.fai_path, 'gobbeldygook')