def get_changed_background_sig_idx(exposures, background_sigs): background_sigs_values = sub.get_items_from_index(exposures,background_sigs) temp_exposures = exposures[:] temp_exposures[:] = (value for value in temp_exposures if value != 0) # remove the background signatures with zero values background_sigs[:] = (value for value in background_sigs_values if value != 0) # get the new indices of the background signatures background_sigs = sub.get_indeces(temp_exposures, background_sigs_values) return background_sigs
def add_connected_sigs(background_sigs, allsigids): connected_sigs = [["SBS2", "SBS13"], ["SBS7a", "SBS7b", "SBS7c", "SBS7d"], ["SBS10a", "SBS10b"], ["SBS17a", "SBS17b"]] backround_sig_names = sub.get_items_from_index(allsigids, background_sigs) connect_the_sigs = [] for i in range(len(connected_sigs)): if len(set(connected_sigs[i]).intersection( set(backround_sig_names))) > 0: connect_the_sigs = connect_the_sigs + connected_sigs[i] backround_sig_names = list( set(backround_sig_names).union(set(connect_the_sigs))) background_sigs = sub.get_indeces(allsigids, backround_sig_names) background_sigs.sort() return background_sigs