예제 #1
0
def matrix_from_cdf(cdffile, name):
    data = ANDI_reader(cdffile)
    print(name)
    data.info()
    tic = data.get_tic()
    noise_lvl = window_analyzer(tic)

    return build_intensity_matrix(data), noise_lvl
예제 #2
0
def matrix_from_cdf(cdffile):
    """
    Converrt ANDI files(.cdf) -> intensity matrices for processing & peak detection
    :param cdffile:
    :return: list of intensity matrices
    """
    data = ANDI_reader(cdffile)
    #data.info() # prints info about the data
    return build_intensity_matrix(data)
예제 #3
0
def matrix_from_cdf(cdffile, name):
    '''
    Intakes a .cdf file and produces an intensity matrix and a noise level .
    The noise level info is obtained by producing a tic and using the window_analyzer
    method to extract a noise approximation.

    @param cdffile: Absolutepath to a .cdf file to be processed
    @param name: file name associated with .cdf file
    @return: An intensity matrix and a corresponding noise level value
    '''
    data = ANDI_reader(cdffile)
    print(name)
    data.info()
    tic = data.get_tic()
    noise_lvl = window_analyzer(tic)
    print('nz=', noise_lvl)

    return build_intensity_matrix(data), noise_lvl
예제 #4
0
파일: proc.py 프로젝트: ma-bio21/pyms-test
"""proc.py
"""

import sys
sys.path.append("/x/PyMS/")

from pyms.GCMS.IO.ANDI.Function import ANDI_reader
from pyms.GCMS.Function import build_intensity_matrix
from pyms.Baseline.TopHat import tophat_im

# read the raw data
andi_file = "/x/PyMS/data/gc01_0812_066.cdf"
data = ANDI_reader(andi_file)

# build an intensity matrix object from the data
im = build_intensity_matrix(data)

# Use TopHat baseline correction on all IC's in the IM
print "Smoothing ..."
im_base_corr = tophat_im(im, struct="1.5m")
print "Done"

# find the IC for derivatisation product ion before smoothing
ic = im.get_ic_at_index(73)

# find the IC for derivatisation product ion after smoothing
ic_base_corr = im_base_corr.get_ic_at_index(73)

ic.write("output/ic.dat",minutes=True)
ic_base_corr.write("output/ic_smooth.dat",minutes=True)
예제 #5
0
from pyms.GCMS.IO.ANDI.Function import ANDI_reader
from pyms.GCMS.Function import build_intensity_matrix

from pyms.Display.Function import plot_ic

# read the raw data as a GCMS_data object
andi_file = "/x/PyMS/data/gc01_0812_066.cdf"
data = ANDI_reader(andi_file)


# IntensityMatrix
# must build intensity matrix before accessing any intensity matrix methods.

# default, float masses with interval (bin interval) of one from min mass
print "default intensity matrix, bin interval = 1, boundary +/- 0.5"
im = build_intensity_matrix(data)


#
# IonChromatogram
#

# get the ion chromatogram for some m/z channel (73)
ic = im.get_ic_at_mass(73)



plot_ic(ic, line_label = '73', plot_title = 'TIC and ICs for m/z = 73 & 147')

예제 #6
0
def matrix_from_cdf(cdffile):
    data = ANDI_reader(cdffile)
    #data.info() # prints info about the data
    return build_intensity_matrix(data)
예제 #7
0
파일: proc.py 프로젝트: jontay81/pyms-test
"""proc.py
"""

import sys
sys.path.append("/x/PyMS")

from pyms.GCMS.IO.JCAMP.Function import JCAMP_reader
from pyms.GCMS.Function import build_intensity_matrix

# read the raw data as a GCMS_data object
jcamp_file = "/x/PyMS/data/gc01_0812_066.jdx"
data = JCAMP_reader(jcamp_file)

# IntensityMatrix
# must build intensity matrix before accessing any intensity matrix methods.

# bin interval of 0.5, eg. for double charge ions
print "intensity matrix, bin interval = 0.5, boundary +/- 0.25"
im = build_intensity_matrix(data, 0.5, 0.25, 0.25)

print " -> size of intensity matrix (#scans, #bins):", im.get_size()

print " -> start mass:", im.get_min_mass()
print " -> end mass:", im.get_max_mass()

index = im.get_index_of_mass(73.3)
print " -> the index of the nearest mass to 73.3m/z is:", index
print " -> the nearest mass to 73.3m/z is:", im.get_mass_at_index(index)

#  e.g. /home/anahid/sample1.cdf

andi_file_1 = "The file with data from sample 1"
andi_file_2 = "The file with data from sample 2"


data_1 = ANDI_reader(andi_file_1)
data_2 = ANDI_reader(andi_file_2)


# IntensityMatrix
# must build intensity matrix before accessing any intensity matrix methods.

# default, float masses with interval (bin interval) of one from min mass
print "default intensity matrix, bin interval = 1, boundary +/- 0.5"
im_1 = build_intensity_matrix(data_1)
im_2 = build_intensity_matrix(data_2)


#
# quant_ion_mass is the ion you wish to compare between samples
#

quant_ion_mass = 104   #for example

# get the ion chromatogram for some m/z channel 
ic_1 = im_1.get_ic_at_mass(quant_ion_mass)
ic_2 = im_2.get_ic_at_mass(quant_ion_mass)

ics = [ic_1, ic_2]