Exemple #1
0
 def test_find_vr_rsid_by_variantkey_notfound(self):
     rx, first = bs.find_vr_rsid_by_variantkey(vrsrc, 0, 9,
                                               0xfffffffffffffff0)
     self.assertEqual(rx, 0)
     self.assertEqual(first, 10)
Exemple #2
0
 def test_find_vr_rsid_by_variantkey(self):
     for item, _, _, _, rsid, vkey in testData:
         rx, first = bs.find_vr_rsid_by_variantkey(vrsrc, 0, 9, vkey)
         self.assertEqual(rx, rsid)
         self.assertEqual(first, item)
Exemple #3
0
 def test_find_vr_rsid_by_variantkey_notfound(self):
     rx, first = bs.find_vr_rsid_by_variantkey(vrmc, 0, vrnrows,
                                               0xfffffffffffffff0)
     self.assertEqual(rx, 0)
     self.assertEqual(first, 9)
Exemple #4
0
vk.find_all_rv_variantkey_by_rsid(mc, 0, nrows, 0x00000003)
# [9223656209074749440, 9223656316446408704, 9223656367992733696]

vk.munmap_binfile(mf)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Load the lookup table for VariantKey ro rsID
# The input binary file can be generated using the resources/tools/vkrs.sh script.
# This example uses the "c/test/data/vkrs.10.bin".
mf, mc, nrows = vk.mmap_vkrs_file('vkrs.10.bin', [])
if nrows <= 0:
    assert False, "Unable to open the vkrs.10.bin file"

vk.find_vr_rsid_by_variantkey(mc, 0, nrows, vk=0X80010274003A0000)
# (97, 3)

vk.get_next_vr_rsid_by_variantkey(mc, 2, nrows, vk=0X80010274003A0000)
# (97, 3)

vk.find_all_vr_rsid_by_variantkey(mc, 0, nrows, vk=0X80010274003A0000)
# [97]

vk.find_vr_chrompos_range(mc, 0, nrows, 0X14, 0X000256C5, 0X000256CB)
# (9973, 7, 9)

vk.munmap_binfile(mf)


# /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Exemple #5
0
vk.munmap_binfile(mfsrc, mffd, mfsize)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Load the lookup table for VariantKey ro rsID
# The input binary file can be generated using the resources/tools/vkhexbin.sh script.
# This example uses the "c/test/data/vkrs.10.bin".
mfsrc, mffd, mfsize, mflast = vk.mmap_binfile('vkrs.10.bin')
if mffd < 0:
    assert False, "Unable to open the vkrs.10.bin file"

print(vk.get_vr_rsid(mfsrc, item=3))
# 97

print(vk.find_vr_rsid_by_variantkey(mfsrc, 0, 9, vk=0X80010274003A0000))
# (97, 3)

print(vk.find_vr_chrompos_range(mfsrc, 0, 9, 0X14, 0X000256C5, 0X000256CB))
# (9973, 7, 8)

vk.munmap_binfile(mfsrc, mffd, mfsize)

# /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

# REGIONKEY
# ---------

print(vk.encode_region_strand(-1))
# 2