示例#1
0
 def setUpClass(cls):
     global rvmf, rvmc, rvnrows
     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 rvmmf, rvmmc, rvmnrows
     inputfile = os.path.realpath(
         os.path.dirname(os.path.realpath(__file__)) +
         "/../../c/test/data/rsvk.m.10.bin")
     rvmmf, rvmmc, rvmnrows = bs.mmap_rsvk_file(inputfile, [])
     if rvmnrows <= 0:
         assert False, "Unable to open the rsvk.m.10.bin file"
     global vrmf, vrmc, vrnrows
     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"
示例#2
0
vk.get_variantkey_chrom_endpos(mc, vk=0x2000c3521f1c15ab)
# 1073841836

vk.munmap_binfile(mf)


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


# RSIDVAR
# -------

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

vk.find_rv_variantkey_by_rsid(mc, 0, nrows, rsid=0X00000061)
# (9223656209074749440, 3)

vk.get_next_rv_variantkey_by_rsid(mc, 2, nrows, 0x00000061)
# (9223656209074749440, 3)

vk.munmap_binfile(mf)

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

# Load the lookup table for rsID to VariantKey.
# The input binary file can be generated using the resources/tools/rsvk.sh script.
示例#3
0
    def __init__(self,
                 genoref_file=None,
                 nrvk_file=None,
                 rsvk_file=None,
                 vkrs_file=None):
        """Instantiate a new VariantKey object.
        Load the support files if specified.

        Parameters
        ----------
        genoref_file : string
            Name and path of the binary file containing the genome reference (fasta.bin).
            This file can be generated from a FASTA file using the resources/tools/fastabin.sh script.
        nrvk_file : string
            Name and path of the binary file containing the non-reversible-VariantKey mapping (nrvk.bin).
            This file can be generated from a normalized VCF file using the resources/tools/nrvk.sh script.
        rsvk_file : string
            Name and path of the binary file containing the rsID to VariantKey mapping (rsvk.bin).
            This file can be generated using the resources/tools/rsvk.sh script.
        vkrs_file : string
            Name and path of the binary file containing the VariantKey to rsID mapping (vkrs.bin).
            This file can be generated using the resources/tools/vkrs.sh script.
        """

        self.genoref_mf = None
        self.genoref_size = 0
        self.nrvk_mf = None
        self.nrvk_mc = None
        self.nrvk_nrows = 0
        self.rsvk_mf = None
        self.rsvk_mc = None
        self.rsvk_nrows = 0
        self.vkrs_mf = None
        self.vkrs_mc = None
        self.vkrs_nrows = 0

        if genoref_file is not None:
            # Load the reference genome binary file.
            self.genoref_mf, self.genoref_size = pvk.mmap_genoref_file(
                genoref_file)
            if self.genoref_size <= 0:
                raise Exception('Unable to load the GENOREF file: {0}'.format(
                    genoref_file))

        if nrvk_file is not None:
            # Load the lookup table for non-reversible variantkeys.
            self.nrvk_mf, self.nrvk_mc, self.nrvk_nrows = pvk.mmap_nrvk_file(
                nrvk_file)
            if self.nrvk_nrows <= 0:
                raise Exception(
                    'Unable to load the NRVK file: {0}'.format(nrvk_file))

        if rsvk_file is not None:
            # Load the lookup table for rsID to VariantKey.
            self.rsvk_mf, self.rsvk_mc, self.rsvk_nrows = pvk.mmap_rsvk_file(
                rsvk_file, [4, 8])
            if self.rsvk_nrows <= 0:
                raise Exception(
                    'Unable to load the RSVK file: {0}'.format(rsvk_file))

        if vkrs_file is not None:
            # Load the lookup table for VariantKey ro rsID
            self.vkrs_mf, self.vkrs_mc, self.vkrs_nrows = pvk.mmap_vkrs_file(
                vkrs_file, [8, 4])
            if self.vkrs_nrows <= 0:
                raise Exception(
                    'Unable to load the VKRS file: {0}'.format(vkrs_file))