Beispiel #1
0
im = build_intensity_matrix_i(data)

# Get the scan of a known TIC peak (at RT 31.17 minutes)
# get the index of the scan nearest to 31.17 minutes (converted to seconds)
scan_i = im.get_index_at_time(31.17*60.0)
# get the MassSpectrum Object
ms = im.get_ms_at_index(scan_i)

# create a Peak object
peak = Peak(31.17, ms, minutes=True)

print peak.get_UID()

# modify the range and null TMS ions
peak.crop_mass(60, 450)
peak.null_mass(73)
peak.null_mass(147)

# New UID after modification
print peak.get_UID()

# Create another peak from an isomer of the first peak (at RT 31.44 minutes)
scan_i = im.get_index_at_time(31.44*60.0)
ms = im.get_ms_at_index(scan_i)

peak2 = Peak(31.44, ms, minutes=True)
# modify the range and null TMS ions
peak2.crop_mass(60, 450)
peak2.null_mass(73)
peak2.null_mass(147)
Beispiel #2
0
index = im.get_index_of_mass(73.3)

print(index)


# ## Modifying a Peak Object
# 
# The Peak object has methods for modifying the mass spectrum. The mass range can
# be cropped to a smaller range with |crop_mass()|, and the intensity values for
# a single ion can be set to zero with |null_mass()|. For example, the mass range
# can be set from 60 to 450 |m/z|, and the ions related to sample preparation can
# be ignored by setting their intensities to zero as follows:

# In[9]:


peak.crop_mass(60, 450)
peak.null_mass(73)
peak.null_mass(147)


# The UID is automatically updated to reflect the changes:

# In[10]:


print(peak.UID)


# It is also possible to change the peak mass spectrum by setting the attribute |pyms.Peak.Class.Peak.mass_spectrum|.