def construct_path_ref_placements(path, segSeqD, raw_path_length, prev_seg_index_is_adj, next_seg_index_is_adj, cycle_seg_counts, aln_vect=None): if aln_vect is None: aln_vect = [] spacing_bp = seg_spacing * raw_path_length path_ref_placements = {} curr_start = 0.0 for ind, i in enumerate(path): seg_id_count = cycle_seg_counts[i[0]] seg_len = segSeqD[i[0]][2] - segSeqD[i[0]][1] seg_end = curr_start + seg_len padj, nadj = prev_seg_index_is_adj[ind], next_seg_index_is_adj[ind] curr_obj = vu.CycleVizElemObj(i[0], segSeqD[i[0]][0], segSeqD[i[0]][1], segSeqD[i[0]][2], i[1], curr_start, seg_end, seg_id_count, padj, nadj) path_ref_placements[ind] = curr_obj next_start = seg_end mod_ind = (ind + 1) % (len(prev_seg_index_is_adj)) if not prev_seg_index_is_adj[mod_ind]: next_start += spacing_bp curr_start = next_start total_length = next_start return path_ref_placements, total_length
def construct_cycle_ref_placements(cycle,segSeqD,raw_cycle_length,prev_seg_index_is_adj,isCycle,aln_vect = []): spacing_bp = seg_spacing*raw_cycle_length cycle_ref_placements = {} curr_start = 0.0 if isCycle else spacing_bp for ind,i in enumerate(cycle): seg_len = segSeqD[i[0]][2] - segSeqD[i[0]][1] seg_end = curr_start+seg_len curr_obj = vu.CycleVizElemObj(i[0],i[1],curr_start,seg_end) cycle_ref_placements[ind] = curr_obj next_start = seg_end mod_ind = (ind+1) % (len(prev_seg_index_is_adj)) if not prev_seg_index_is_adj[mod_ind]: next_start+=spacing_bp curr_start = next_start total_length = next_start return cycle_ref_placements,total_length