# plt.plot(trace[c], color='green') # plt.plot(trace[d], color='yellow') # plt.plot(trace[e], color='black') # plt.show() # converted_bp = convert_to_bp(1370, record.annotations['abif_raw'][e], dye) # print(converted_bp) # converted_index = convert_to_index(240.27, record.annotations['abif_raw'][e]) # print(converted_index) alelle = 288 height = [] index_of_peaks = [] data1 = list(record.annotations['abif_raw'][a]) for c in range(find_lower(record.annotations['abif_raw'][e], dye), find_upper(record.annotations['abif_raw'][e], dye)): converted_bp = convert_to_bp(c, record.annotations['abif_raw'][e], dye) in_range = converted_bp >= alelle - 1 and converted_bp <= alelle + 1 if in_range: index_of_peaks.append(c) height.append(data1[c]) elif converted_bp > alelle: break print(height) print(index_of_peaks) print(max(height)) print(convert_to_bp(1175, record.annotations['abif_raw'][e], dye)) # Make negative values in array zero
# for x in range(find_lower(record.annotations['abif_raw'][e], dye), find_upper(record.annotations['abif_raw'][e], dye)): # # print("#",end='') # converted_bp = convert_to_bp(x, record.annotations['abif_raw'][e], dye) # in_range = converted_bp >= alelle2 - 1.5 and converted_bp <= alelle2 + 1.5 # if in_range: # index_of_peaks.append(x) # height.append(data1[x]) # elif converted_bp > alelle2: # break # new_values2.append(max(height)) # new_values4.append(index_of_peaks[height.index(max(height))]) index_min = find_lower(record.annotations['abif_raw'][e], dye) index_max = find_upper(record.annotations['abif_raw'][e], dye) data = record.annotations['abif_raw'][a] height = [] index_of_peaks = [] for x in range(index_min, index_max): # print("#",end='') converted_bp = convert_to_bp(x, record.annotations['abif_raw'][e], dye) in_range = converted_bp >= alelle1 - 1.5 and converted_bp <= alelle1 + 1.5 if in_range: index_of_peaks.append(x) height.append(data[x]) elif converted_bp > alelle1+1.5: break alelle1_index = index_of_peaks[height.index(max(height))]
# converted_index = convert_to_index(240.27, record.annotations['abif_raw'][e], dye) # print(converted_index) alelle = 250 index = 3472 # alelle = 272 # index = 3696 height = [] index_of_peaks = [] data1 = list(record.annotations['abif_raw'][a]) converted_index = convert_to_bp(index, record.annotations['abif_raw'][e], dye) print(converted_index) print(find_lower(record.annotations['abif_raw'][e], dye)) print(find_upper(record.annotations['abif_raw'][e], dye)) # for c in range(find_lower(record.annotations['abif_raw'][e], dye), find_upper(record.annotations['abif_raw'][e], dye)): # converted_bp = convert_to_bp(c, record.annotations['abif_raw'][e], dye) # in_range = converted_bp >= alelle - 1.5 and converted_bp <= alelle + 1.5 # if in_range: # index_of_peaks.append(c) # height.append(data1[c]) # elif converted_bp > alelle + 1.5: # break # print(height) # print(index_of_peaks) # print(f'the peak of the alelle with length {alelle} bp is: {max(height)}')
dye = [ 500, 490, 450, 400, 350, 340, 300, 250, 200, 160, 150, 139, 100, 75, 50, 35 ] file = input('File to analyze: ') record = SeqIO.read(file + '.fsa', 'abi') data = record.annotations['abif_raw'][a] label = [] area_of_peaks = [] no_of_peaks = [] length = [] peaks = [] height = [] index_35 = find_lower(record.annotations['abif_raw']['DATA105'], dye) index_500 = find_upper(record.annotations['abif_raw']['DATA105'], dye) detected_peaks = fp.findpeaks(data, spacing=25, limit=25) for i in range(len(detected_peaks) - 1): lower_end_of_window = detected_peaks[i] - 80 upper_end_of_window = detected_peaks[i] + 20 if lower_end_of_window < index_35 or upper_end_of_window > index_500: continue peaks.append(detected_peaks[i]) area_of_peaks.append( np.trapz(data[lower_end_of_window:upper_end_of_window])) no_of_peaks.append( len(