def tearDownClass(cls): global rvsrc, rvfd, rvsize h = bs.munmap_binfile(rvsrc, rvfd, rvsize) if h != 0: assert False, "Error while closing the rsvk.10.bin memory-mapped file" global vrsrc, vrfd, vrsize h = bs.munmap_binfile(vrsrc, vrfd, vrsize) if h != 0: assert False, "Error while closing the vkrs.10.bin memory-mapped file"
def setup(): global mf bs.munmap_binfile(mf) inputfile = os.path.realpath( os.path.dirname(os.path.realpath(__file__)) + "/../../c/test/data/genoref.bin") mf, mfsize = bs.mmap_genoref_file(inputfile) if mfsize <= 0: assert False, "Unable to open the genoref.bin file"
def test_tearDown(self): global rvmf, rvmc, rvnrows h = bs.munmap_binfile(rvmf) if h != 0: assert False, "Error while closing the rsvk.10.bin memory-mapped file" global vrmf, vrmc, vrnrows h = bs.munmap_binfile(vrmf) if h != 0: assert False, "Error while closing the vkrs.10.bin memory-mapped file"
def setup(): global mf, mc, nrows bs.munmap_binfile(mf) inputfile = os.path.realpath( os.path.dirname(os.path.realpath(__file__)) + "/../../c/test/data/nrvk.10.bin") mf, mc, nrows = bs.mmap_nrvk_file(inputfile) if nrows <= 0: assert False, "Unable to open the nrvk.10.bin file"
def setup(): global src, fd, size, last if fd >= 0: pass bs.munmap_binfile(src, fd, size) 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"
def setup(): global mfsrc, mffd, mfsize, mflast, idx if mffd >= 0: pass bs.munmap_binfile(mfsrc, mffd, mfsize) 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)
def test_tearDown(self): global rvsrc, rvfd, rvsize h = bs.munmap_binfile(rvsrc, rvfd, rvsize) rvfd = -1 rvsize = 0 if h != 0: assert False, "Error while closing the rsvk.10.bin memory-mapped file" global vrsrc, vrfd, vrsize h = bs.munmap_binfile(vrsrc, vrfd, vrsize) vrfd = -1 vrsize = 0 if h != 0: assert False, "Error while closing the vkrs.10.bin memory-mapped file"
def test_tearDown(self): global mf h = bs.munmap_binfile(mf) mffd = -1 mfsize = 0 if h != 0: assert False, "Error while closing the nrvk.10.bin memory-mapped file"
def test_col_tearDown(self): global src, fd, size h = bs.munmap_binfile(src, fd, size) fd = -1 size = 0 if h != 0: assert False, "Error while closing the memory-mapped file"
def test_tearDown(self): global mfsrc, mffd, mfsize h = bs.munmap_binfile(mfsrc, mffd, mfsize) mffd = -1 mfsize = 0 if h != 0: assert False, "Error while closing the genoref.bin memory-mapped file"
def setup(): global rvmf, rvmc, rvnrows bs.munmap_binfile(rvmf) inputfile = os.path.realpath( os.path.dirname(os.path.realpath(__file__)) + "/../../c/test/data/rsvk.10.bin") rvmf, rvmc, rvnrows = bs.mmap_rsvk_file(inputfile, [4, 8]) if rvnrows <= 0: assert False, "Unable to open the rsvk.10.bin file" global vrmf, vrmc, vrnrows bs.munmap_binfile(vrmf) inputfile = os.path.realpath( os.path.dirname(os.path.realpath(__file__)) + "/../../c/test/data/vkrs.10.bin") vrmf, vrmc, vrnrows = bs.mmap_vkrs_file(inputfile, [8, 4]) if vrnrows <= 0: assert False, "Unable to open the vkrs.10.bin file"
def close(self): """Close all input files""" if self.genoref_mf is not None: pvk.munmap_binfile(self.genoref_mf) if self.nrvk_mf is not None: pvk.munmap_binfile(self.nrvk_mf) if self.rsvk_mf is not None: pvk.munmap_binfile(self.rsvk_mf) if self.vkrs_mf is not None: pvk.munmap_binfile(self.vkrs_mf)
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"
def test_tearDown(self): global mf h = bs.munmap_binfile(mf) if h != 0: assert False, "Error while closing the genoref.bin memory-mapped file"
def tearDownClass(cls): global src, fd, size h = bs.munmap_binfile(src, fd, size) if h != 0: assert False, "Error while closing the memory-mapped file"
vk.check_reference(mf, chrom=23, pos=0, ref='A') # 0 vk.flip_allele(b'ATCGMKRYBVDHWSNatcgmkrybvdhwsn') # b'TAGCKMYRVBHDWSNTAGCKMYRVBHDWSN' # Normalize a variant - this function should be used before generating a new VariantKey vk.normalize_variant(mf, chrom=13, pos=2, ref='CDE', alt='CFE') # (48, 3, b'D', b'F', 1, 1) # Return values are: code, POS, REF, ALT, REF length, ALT length # Create normalized VariantKey vk.normalized_variantkey(mf, chrom="13", pos=2, posindex=0, ref='CDE', alt='CFE') # (7493989787586955617, 48) vk.munmap_binfile(mf) # /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ # NRVK # ---- # Load the lookup table for non-reversible variantkeys. # The input binary files can be generated from a normalized VCF file using the resources/tools/nrvk.sh script. # The VCF file can be normalized using the `resources/tools/vcfnorm.sh` script. # This example uses the "c/test/data/nrvk.10.bin". mf, mc, nrows = vk.mmap_nrvk_file('nrvk.10.bin') if nrows <= 0: assert False, "Unable to open the nrvk.10.bin file"
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' # Normalize a variant - this function should be used before generating a new VariantKey print(vk.normalize_variant(mfsrc, mfidx, chrom=13, pos=2, ref='CDE', alt='CFE')) # (48, 3, b'D', b'F', 1, 1) # Return values are: code, POS, REF, ALT, REF length, ALT length vk.munmap_binfile(mfsrc, mffd, mfsize) # /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ # NRVK # ---- # Load the lookup table for non-reversible variantkeys. # The input binary files can be generated from a normalized VCF file using the resources/tools/vkhexbin.sh script. # The VCF file can be normalized using the `resources/tools/vcfnorm.sh` script. # This example uses the "c/test/data/vknr.10.bin". mfsrc, mffd, mfsize, mflast = vk.mmap_binfile('vknr.10.bin') if mffd < 0: assert False, "Unable to open the vknr.10.bin file" print(vk.find_ref_alt_by_variantkey(mfsrc, mflast, vk=0x2000c3521f1c15ab))
def tearDownClass(cls): global mf, mc, nrows h = bs.munmap_binfile(mf) if h != 0: assert False, "Error while closing the nrvk.10.bin memory-mapped file"
def tearDownClass(cls): global mfsrc, mffd, mfsize h = bs.munmap_binfile(mfsrc, mffd, mfsize) if h != 0: assert False, "Error while closing the genoref.bin memory-mapped file"