示例#1
0
 def setUpClass(cls):
     global src, fd, size, last
     inputfile = os.path.realpath(
         os.path.dirname(os.path.realpath(__file__)) +
         "/../../c/test/data/test_data_col.bin")
     src, fd, size, last = bs.mmap_binfile(inputfile)
     if fd < 0 or size != 3765:
         assert False, "Unable to open the file"
示例#2
0
 def setUpClass(cls):
     global mfsrc, mffd, mfsize, mflast, idx
     inputfile = os.path.realpath(
         os.path.dirname(
             os.path.realpath(__file__)) +
         "/../../c/test/data/genoref.bin")
     mfsrc, mffd, mfsize, mflast = bs.mmap_binfile(inputfile)
     if mffd < 0:
         assert False, "Unable to open the genoref.bin file"
     idx = bs.load_genoref_index(mfsrc)
示例#3
0
 def setup():
     global rvsrc, rvfd, rvsize
     if rvfd >= 0:
         pass
     bs.munmap_binfile(rvsrc, rvfd, rvsize)
     inputfile = os.path.realpath(
         os.path.dirname(os.path.realpath(__file__)) +
         "/../../c/test/data/rsvk.10.bin")
     rvsrc, rvfd, rvsize, _ = bs.mmap_binfile(inputfile)
     if rvfd < 0 or rvsize != 120:
         assert False, "Unable to open the rsvk.10.bin file"
     global vrsrc, vrfd, vrsize
     if vrfd >= 0:
         pass
     bs.munmap_binfile(vrsrc, vrfd, vrsize)
     inputfile = os.path.realpath(
         os.path.dirname(os.path.realpath(__file__)) +
         "/../../c/test/data/vkrs.10.bin")
     vrsrc, vrfd, vrsize, _ = bs.mmap_binfile(inputfile)
     if vrfd < 0 or vrsize != 120:
         assert False, "Unable to open the vkrs.10.bin file"
示例#4
0
print(vk.variantkey_hex(13258623813950472192))
# b'b800181c910d8000'

print(vk.parse_variantkey_hex(b'b800181c910d8000'))
# 13258623813950472192

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

# GENOREF FUNCTIONS
# -----------------

# Load the reference genome binary file.
# The input reference binary files can be generated from a FASTA file using the resources/tools/fastabin.sh script.
# This example uses the "c/test/data/genoref.bin".
mfsrc, mffd, mfsize, mflast = vk.mmap_binfile('genoref.bin')
if mffd < 0:
    assert False, "Unable to open the genoref.bin file"

# Load the file index
mfidx = vk.load_genoref_index(mfsrc)

print(vk.get_genoref_seq(mfsrc, mfidx, chrom=23, pos=0))
# b'A'

print(vk.check_reference(mfsrc, mfidx, chrom=23, pos=0, ref='A'))
# 0

print(vk.flip_allele(b'ATCGMKRYBVDHWSNatcgmkrybvdhwsn'))
# b'TAGCKMYRVBHDWSNTAGCKMYRVBHDWSN'