def detect_one_run(run, args): infile = os.path.join(args.indir, run) print "processing GC-MS file:", infile # sys.stdout("processing GCSM run:", run) # load the input GC-MS file try: if args.ftype == 'CDF': from pyms.GCMS.IO.ANDI.Function import ANDI_reader data = ANDI_reader(infile) elif args.ftype == 'JDX': #data = JCAMP_reader(in_file) data = pyms.GCMS.IO.JCAMP.Function.JCAMP_OpenChrom_reader(infile) else: raise ValueError('can only load ANDI (CDF) or JDX files!') except: print "Failure to load input file ", infile else: data.trim(args.trimstart + "m", args.trimend + "m") # get TIC. Would prefer to get from smoothed IM but API is faulty! tic = data.get_tic() # integer mass im = build_intensity_matrix_i(data) # would be nice to do noise_mult*noise_level using the noise level AFTER smoothing, # but i can't seem to get the TIC for the smoothed IM. peak_list = call_peaks(im, tic, True, args) return peak_list, run
def detect_one_run(run, args): infile = os.path.join(args.indir, run) print "processing GC-MS file:", infile # sys.stdout("processing GCSM run:", run) # load the input GC-MS file try: if args.ftype == 'CDF': from pyms.GCMS.IO.ANDI.Function import ANDI_reader data = ANDI_reader(infile) elif args.ftype == 'JDX': #data = JCAMP_reader(in_file) data = pyms.GCMS.IO.JCAMP.Function.JCAMP_OpenChrom_reader(infile) else: raise ValueError('can only load ANDI (CDF) or JDX files!') except: print "Failure to load input file ", infile else: data.trim(args.trimstart+"m",args.trimend+"m") # get TIC. Would prefer to get from smoothed IM but API is faulty! tic = data.get_tic() # integer mass im = build_intensity_matrix_i(data) # would be nice to do noise_mult*noise_level using the noise level AFTER smoothing, # but i can't seem to get the TIC for the smoothed IM. peak_list = call_peaks(im, tic, True, args) return peak_list, run
def load_run(infile): try: if args.ftype == 'CDF': from pyms.GCMS.IO.ANDI.Function import ANDI_reader data = ANDI_reader(infile) elif args.ftype == 'JDX': #data = JCAMP_reader(in_file) data = pyms.GCMS.IO.JCAMP.Function.JCAMP_OpenChrom_reader(infile) else: raise ValueError('can only load ANDI (CDF) or JDX files!') except: print "Failure to load input file ", infile else: data.trim("4.0m", "20.0m") # get TIC. Would prefer to get from smoothed IM but API is faulty! tic = data.get_tic() # integer mass return build_intensity_matrix_i(data), tic
from pyms.GCMS.IO.ANDI.Function import ANDI_reader from pyms.GCMS.Function import build_intensity_matrix_i from pyms.Noise.SavitzkyGolay import savitzky_golay from pyms.Baseline.TopHat import tophat from pyms.Display.Class import Display from pyms.Peak.Function import peak_sum_area from pyms.Peak.IO import store_peaks from pyms.Deconvolution.BillerBiemann.Function import BillerBiemann, \ rel_threshold, num_ions_threshold from pyms.Simulator.Function import gcms_sim, add_gaussc_noise # read in raw data andi_file = "/x/PyMS/data/gc01_0812_066.cdf" data = ANDI_reader(andi_file) data.trim(4101, 4350) # Build Intensity Matrix real_im = build_intensity_matrix_i(data) n_scan, n_mz = real_im.get_size() # perform necessary pre filtering for ii in range(n_mz): ic = real_im.get_ic_at_index(ii) ic_smooth = savitzky_golay(ic) ic_bc = tophat(ic_smooth, struct="1.5m") real_im.set_ic_at_index(ii, ic_bc) # Detect Peaks peak_list = BillerBiemann(real_im, points=3, scans=2)
from pyms.GCMS.IO.ANDI.Function import ANDI_reader from pyms.GCMS.Function import build_intensity_matrix_i from pyms.Noise.SavitzkyGolay import savitzky_golay from pyms.Baseline.TopHat import tophat from pyms.Display.Class import Display from pyms.Peak.Function import peak_sum_area from pyms.Peak.IO import store_peaks from pyms.Deconvolution.BillerBiemann.Function import BillerBiemann, rel_threshold, num_ions_threshold from pyms.Simulator.Function import gcms_sim, add_gaussv_noise # read in raw data andi_file = "/x/PyMS/data/gc01_0812_066.cdf" data = ANDI_reader(andi_file) data.trim(4101, 4350) # Build Intensity Matrix real_im = build_intensity_matrix_i(data) n_scan, n_mz = real_im.get_size() # perform necessary pre filtering for ii in range(n_mz): ic = real_im.get_ic_at_index(ii) ic_smooth = savitzky_golay(ic) ic_bc = tophat(ic_smooth, struct="1.5m") real_im.set_ic_at_index(ii, ic_bc) # Detect Peaks
"""proc.py """ import sys sys.path.append("/x/PyMS") from pyms.GCMS.IO.ANDI.Function import ANDI_reader # read the raw data andi_file = "/x/PyMS/data/gc01_0812_066.cdf" data = ANDI_reader(andi_file) # info about raw data data.info() # trim data between scans 1000 and 2000 data.trim(1000, 2000) # info about trimmed raw data data.info() # reload data = ANDI_reader(andi_file) # trim data between retention times, 6.5 minutes to 21 minutes data.trim("6.5m", "21m") # info about trimmed raw data data.info()
from pyms.Noise.SavitzkyGolay import savitzky_golay from pyms.Baseline.TopHat import tophat from pyms.Peak.Class import Peak from pyms.Display.Class import Display from pyms.Deconvolution.BillerBiemann.Function import BillerBiemann, \ rel_threshold, num_ions_threshold # read in raw data andi_file = "/home/projects/PyMS_Projects/Metabolomic.Data/2010.01.28_DPI_dairy_waste_water/In/In_061108_Spring_1.CDF" data = ANDI_reader(andi_file) data.trim(6m, 21m) # Build Intensity Matrix im = build_intensity_matrix_i(data) n_scan, n_mz = im.get_size() # perform necessary pre filtering for ii in range(n_mz): ic = im.get_ic_at_index(ii) ic_smooth = savitzky_golay(ic) ic_bc = tophat(ic_smooth, struct="1.5m") im.set_ic_at_index(ii, ic_bc)
from pyms.GCMS.IO.ANDI.Function import ANDI_reader from pyms.GCMS.Function import build_intensity_matrix_i from pyms.Noise.SavitzkyGolay import savitzky_golay from pyms.Baseline.TopHat import tophat from pyms.Peak.IO import store_peaks from pyms.Deconvolution.BillerBiemann.Function import BillerBiemann, \ rel_threshold, num_ions_threshold # read in raw data andi_file = "/x/PyMS/data/gc01_0812_066.cdf" data = ANDI_reader(andi_file) data.trim("500s", "2000s") # Build Intensity Matrix im = build_intensity_matrix_i(data) n_scan, n_mz = im.get_size() # perform necessary pre filtering for ii in range(n_mz): ic = im.get_ic_at_index(ii) ic_smooth = savitzky_golay(ic) ic_bc = tophat(ic_smooth, struct="1.5m") im.set_ic_at_index(ii, ic_bc) # Detect Peaks peak_list = BillerBiemann(im, points=9, scans=2) print "Number of peaks found: ", len(peak_list)
from pyms.Noise.SavitzkyGolay import savitzky_golay from pyms.Baseline.TopHat import tophat from pyms.Peak.IO import store_peaks from pyms.Deconvolution.BillerBiemann.Function import BillerBiemann, \ rel_threshold, num_ions_threshold # read in raw data andi_file = "/x/PyMS/data/gc01_0812_066.cdf" data = ANDI_reader(andi_file) data.trim("500s", "2000s") # Build Intensity Matrix im = build_intensity_matrix_i(data) n_scan, n_mz = im.get_size() # perform necessary pre filtering for ii in range(n_mz): ic = im.get_ic_at_index(ii) ic_smooth = savitzky_golay(ic) ic_bc = tophat(ic_smooth, struct="1.5m") im.set_ic_at_index(ii, ic_bc) # Detect Peaks peak_list = BillerBiemann(im, points=9, scans=2)