n_scan, n_mz = im.get_size() for ii in range(n_mz): ic = im.get_ic_at_index(ii) ic_smooth = savitzky_golay(ic) ic_base = tophat(ic_smooth, struct="1.5m") im.set_ic_at_index(ii, ic_base) # Load the experiment exper = load_expr(expr_file) # Load the peak list peak_list = exper.get_peak_list() # Pass Ion Chromatograms into a list of ICs n_mz = len(im.get_mass_list()) ic = [] for m in range(n_mz): ic.append(im.get_ic_at_index(m)) # Create a new display object, this time plot four ICs # and the TIC, as well as the peak list display = Display() display.plot_ics(ic) display.plot_peaks(peak_list, 'Peaks') display.do_plotting('ICs, and PyMS Detected Peaks')
# trim by relative intensity pl = rel_threshold(peak_list, r) # trim by threshold new_peak_list = num_ions_threshold(pl, n, t) print "Number of filtered peaks: ", len(new_peak_list) # TIC from raw data tic = data.get_tic() # save TIC to a file # Get Ion Chromatograms for all m/z channels n_mz = len(im.get_mass_list()) ic = [] # All plotting from here on for m in range(n_mz): ic.append(im.get_ic_at_index(m)) # Create a new display object, this time plot the ICs # and the TIC, as well as the peak list display = Display() display.plot_tic(tic, 'TIC') display.plot_ics(ic) display.plot_peaks(new_peak_list, 'PyMS peaks') display.do_plotting()
# trim by threshold new_peak_list = num_ions_threshold(pl, n, t) print "Number of filtered peaks: ", len(new_peak_list) # TIC from raw data tic = data.get_tic() # save TIC to a file # Get Ion Chromatograms for all m/z channels n_mz = len(im.get_mass_list()) ic = [] for m in range(n_mz): ic.append(im.get_ic_at_index(m)) # Create a new display object, this time plot the ICs # and the TIC, as well as the peak list display = Display() display.plot_tic(tic, 'TIC') display.plot_ics(ic) display.plot_peaks(new_peak_list, 'Peaks') display.do_plotting('TIC, and PyMS Detected Peaks')
ic_smooth2 = savitzky_golay(ic_smooth1) ic_bc = tophat(ic_smooth1, struct="1.5m") sim_im.set_ic_at_index(ii, ic_bc) ### Now detect peaks in the noisy simulated IntensityMatrix pre_peak_list = BillerBiemann(sim_im, points=3, scans=2) print "Number of peaks found in simulated data", len(pre_peak_list) ### Filter this peak list as for real_im r = 1 # minimum number of ions, n n = 3 # greater than or equal to threshold, t t = 10000 # trim by relative intensity spl = rel_threshold(pre_peak_list, r) # trim by threshold sim_peak_list = num_ions_threshold(spl, n, t) print "Number of filtered peaks in simulated data", len(sim_peak_list) ### Now display the ics and the filtered peak list from the simulated data ics = [] for i in range(n_mz): ics.append(sim_im.get_ic_at_index(i)) display = Display() display.plot_ics(ics) display.plot_peaks(sim_peak_list, 'Peaks') display.do_plotting('ICs, and PyMS Detected Peaks of Simulated Data')