How to use the prophyle.prophyle_assignment.bitarray function in prophyle

To help you get started, we’ve selected a few prophyle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github prophyle / prophyle / prophyle / prophyle_assignment.py View on Github external
        hitmasks_dict = collections.defaultdict(lambda: bitarray(hitmask_empty))
        covmasks_dict = collections.defaultdict(lambda: bitarray(covmask_empty))
github prophyle / prophyle / prophyle / prophyle_assignment.py View on Github external
        hitmasks_dict = collections.defaultdict(lambda: bitarray(hitmask_empty))
        covmasks_dict = collections.defaultdict(lambda: bitarray(covmask_empty))
github prophyle / prophyle / prophyle / prophyle_assignment.py View on Github external
        covmasks_dict = collections.defaultdict(lambda: bitarray(covmask_empty))
github prophyle / prophyle / prophyle / prophyle_assignment.py View on Github external
def evaluate_single_assignment(self, nodename):
        """Evaluate a single assignment.

        Args:
            nodename (str): Name of the node for which we will compute characteristics.

        Returns:
            assignment (dict): Assignment dictionary.
        """

        #################################
        # A) Start with the current masks
        #################################
        hitmask = bitarray(self.hitmasks_dict[nodename])
        covmask = bitarray(self.covmasks_dict[nodename])

        node = self.tree_index.nodename_to_node[nodename]

        ##########################
        # B) Update from ancestors
        ##########################
        ancestors = self.tree_index.nodename_to_upnodenames[nodename] & self.hitmasks_dict.keys()
        for anc_nodename in ancestors:
            hitmask |= self.hitmasks_dict[anc_nodename]
            covmask |= self.covmasks_dict[anc_nodename]

        ##############################
        # C) Calculate characteristics
        ##############################
        hit = hitmask.count()
        cov = covmask.count()
github prophyle / prophyle / prophyle / prophyle_assignment.py View on Github external
def bitarray_block(alen, blen, pos):
        """Create a bitarray containing a block of one's.

        Args:
            alen (int): Array length.
            blen (int): Block length (within the array).
            pos (int): Position of the block (0-based).

        Return:
            bitarray (bitarray)
        """
        return bitarray(pos * "0" + blen * "1" + (alen - pos - blen) * "0")
github prophyle / prophyle / prophyle / prophyle_assignment.py View on Github external
def evaluate_single_assignment(self, nodename):
        """Evaluate a single assignment.

        Args:
            nodename (str): Name of the node for which we will compute characteristics.

        Returns:
            assignment (dict): Assignment dictionary.
        """

        #################################
        # A) Start with the current masks
        #################################
        hitmask = bitarray(self.hitmasks_dict[nodename])
        covmask = bitarray(self.covmasks_dict[nodename])

        node = self.tree_index.nodename_to_node[nodename]

        ##########################
        # B) Update from ancestors
        ##########################
        ancestors = self.tree_index.nodename_to_upnodenames[nodename] & self.hitmasks_dict.keys()
        for anc_nodename in ancestors:
            hitmask |= self.hitmasks_dict[anc_nodename]
            covmask |= self.covmasks_dict[anc_nodename]

        ##############################
        # C) Calculate characteristics
        ##############################
        hit = hitmask.count()
github prophyle / prophyle / prophyle / prophyle_assignment.py View on Github external
def evaluate_single_assignment(self, nodename):
        """Evaluate a single assignment.

        Args:
            nodename (str): Name of the node for which we will compute characteristics.

        Returns:
            assignment (dict): Assignment dictionary.
        """

        #################################
        # A) Start with the current masks
        #################################
        hitmask = bitarray(self.hitmasks_dict[nodename])
        covmask = bitarray(self.covmasks_dict[nodename])

        ##########################
        # B) Update from ancestors
        ##########################
        ancestors = self.tree_index.nodename_to_upnodenames[nodename] & self.hitmasks_dict.keys()
        for anc_nodename in ancestors:
            hitmask |= self.hitmasks_dict[anc_nodename]
            covmask |= self.covmasks_dict[anc_nodename]

        ##############################
        # C) Calculate characteristics
        ##############################
        hit = hitmask.count()
        cov = covmask.count()
        readlen = self.krakline_parser.readlen
        kcount = self.tree_index.nodename_to_kmercount[nodename]