Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
hitmasks_dict = collections.defaultdict(lambda: bitarray(hitmask_empty))
covmasks_dict = collections.defaultdict(lambda: bitarray(covmask_empty))
hitmasks_dict = collections.defaultdict(lambda: bitarray(hitmask_empty))
covmasks_dict = collections.defaultdict(lambda: bitarray(covmask_empty))
covmasks_dict = collections.defaultdict(lambda: bitarray(covmask_empty))
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()
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")
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()
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]