Skip to content

Commit

Permalink
Updated documentation and example scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed May 17, 2020
1 parent 27467f8 commit d6b7720
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 119 deletions.
2 changes: 1 addition & 1 deletion doc-source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
'rtd': ('https://docs.readthedocs.io/en/latest/', None),
'sphinx': ('http://www.sphinx-doc.org/en/stable/', None),
'python': ('https://docs.python.org/3/', None),
"NumPy": ('https://docs.scipy.org/doc/numpy/', None),
"NumPy": ('https://numpy.org/doc/stable/', None),
"SciPy": ('https://docs.scipy.org/doc/scipy/reference', None),
"matplotlib": ('https://matplotlib.org', None),
"h5py": ('https://docs.h5py.org/en/latest/', None),
Expand Down
47 changes: 0 additions & 47 deletions pyms-demo/ipynb2py.py

This file was deleted.

13 changes: 2 additions & 11 deletions pyms-demo/jupyter/Peak.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,15 @@
}
},
{
"cell_type": "raw",
"cell_type": "markdown",
"source": [
"\n",
"Mass1-Mass2-Ratio-RT\n"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%% raw\n"
"name": "#%% md\n"
}
}
},
Expand Down Expand Up @@ -386,15 +386,6 @@
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
},
"pycharm": {
"stem_cell": {
"cell_type": "raw",
"source": [],
"metadata": {
"collapsed": false
}
}
}
},
"nbformat": 4,
Expand Down
30 changes: 15 additions & 15 deletions pyms-demo/scripts/IntensityMatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

jcamp_file = data_directory / "gc01_0812_066.jdx"
data = JCAMP_reader(jcamp_file)
data
print(data)


# Then the data can be converted to an |IntensityMatrix| using the function
Expand All @@ -41,15 +41,15 @@

im = build_intensity_matrix(data)

im
print(im)


# The size as the number of scans and the number of bins can be returned with:

# In[24]:


im.size
print(im.size)


# There are 9865 scans and 551 bins in this example.
Expand All @@ -61,21 +61,21 @@
# In[25]:


im.mass_list[:10]
print(im.mass_list[:10])


# The attributes |im.min_mass| and |im.max_mass| return the minimum and maximum mass:

# In[26]:


im.min_mass
print(im.min_mass)


# In[27]:


im.max_mass
print(im.max_mass)


# It is also possible to search for a particular mass, by finding the index of
Expand All @@ -88,7 +88,7 @@

index = im.get_index_of_mass(73.3)

index
print(index)


# The value of the closest mass can be returned by the method
Expand All @@ -113,21 +113,21 @@

im = build_intensity_matrix(data, 0.5, 0.25, 0.25)

im
print(im)


# The size of the intensity matrix will reflect the change in the number of bins:

# In[31]:


im.size
print(im.size)


# In[32]:


im.mass_list[:10]
print(im.mass_list[:10])


# In this example there are 9865 scans (as before), but 1101 bins.
Expand All @@ -140,7 +140,7 @@

index = im.get_index_of_mass(73.3)

index
print(index)


# In[34]:
Expand All @@ -162,19 +162,19 @@
from pyms.IntensityMatrix import build_intensity_matrix_i

im = build_intensity_matrix_i(data)
im
print(im)


# In[36]:


im.size
print(im.size)


# In[37]:


im.mass_list[:10]
print(im.mass_list[:10])


# The masses are now integers.
Expand All @@ -183,7 +183,7 @@


index = im.get_index_of_mass(73.3)
index
print(index)


# In[39]:
Expand Down
4 changes: 2 additions & 2 deletions pyms-demo/scripts/IntensityMatrix_Resizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@


im.crop_mass(60, 400)
im.min_mass
print(im.min_mass)


# In[31]:


im.max_mass
print(im.max_mass)


# It is also possible to set all intensities for a given mass to zero. This is
Expand Down
3 changes: 1 addition & 2 deletions pyms-demo/scripts/IonChromatogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# In[3]:


data.tic
print(data.tic)


# The |IonChromatogram| at index 0 can be obtained with:
Expand Down Expand Up @@ -72,4 +72,3 @@


im.get_ic_at_mass(73).is_tic()

2 changes: 1 addition & 1 deletion pyms-demo/scripts/MassSpectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

ms = im.get_ms_at_index(0)

ms
print(ms)


# In[4]:
Expand Down
12 changes: 7 additions & 5 deletions pyms-demo/scripts/Peak.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,28 +91,30 @@
# units as given when the Peak object was created). The format is:
#

Mass1-Mass2-Ratio-RT
#
# Mass1-Mass2-Ratio-RT
#

# For example:

# In[6]:


peak.rt
print(peak.rt)


# In[7]:


peak.UID
print(peak.UID)


# In[8]:


index = im.get_index_of_mass(73.3)

index
print(index)


# ## Modifying a Peak Object
Expand All @@ -136,7 +138,7 @@
# In[10]:


peak.UID
print(peak.UID)


# It is also possible to change the peak mass spectrum by setting the attribute |pyms.Peak.Class.Peak.mass_spectrum|.
3 changes: 1 addition & 2 deletions pyms-demo/scripts/Peak_Area_Estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

from pyms.BillerBiemann import num_ions_threshold
filtered_peak_list = num_ions_threshold(peak_list, n=3, cutoff=noise_level)
filtered_peak_list[:10]
print(filtered_peak_list[:10])


# Given a list of peaks, areas can be determined and added as follows:
Expand All @@ -70,4 +70,3 @@
for peak in peak_list:
area = peak_sum_area(im, peak)
peak.area = area

8 changes: 4 additions & 4 deletions pyms-demo/scripts/Peak_Detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

from pyms.BillerBiemann import BillerBiemann
peak_list = BillerBiemann(im)
peak_list[:10]
print(peak_list[:10])


# In[20]:
Expand All @@ -75,7 +75,7 @@


peak_list = BillerBiemann(im, points=9, scans=2)
peak_list[:10]
print(peak_list[:10])


# In[22]:
Expand Down Expand Up @@ -105,14 +105,14 @@

from pyms.BillerBiemann import rel_threshold, num_ions_threshold
pl = rel_threshold(peak_list, percent=2)
pl[:10]
print(pl[:10])


# In[24]:


new_peak_list = num_ions_threshold(pl, n=3, cutoff=10000)
new_peak_list[:10]
print(new_peak_list[:10])


# In[25]:
Expand Down
4 changes: 2 additions & 2 deletions pyms-demo/scripts/Peak_Filtering_Noise_Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
tic = data.tic

noise_level = window_analyzer(tic)
noise_level
print(noise_level)


# Filter the Peak listusing this noise value as the cutoff.
Expand All @@ -70,7 +70,7 @@

from pyms.BillerBiemann import num_ions_threshold
filtered_peak_list = num_ions_threshold(peak_list, n=3, cutoff=noise_level)
filtered_peak_list[:10]
print(filtered_peak_list[:10])


# In[4]:
Expand Down
5 changes: 2 additions & 3 deletions pyms-demo/scripts/comparing_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@

andi_file = data_directory / "gc01_0812_066.cdf"
data1 = ANDI_reader(andi_file)
data1
print(data1)


# In[12]:


jcamp_file = data_directory / "gc01_0812_066.jdx"
data2 = JCAMP_reader(jcamp_file)
data2
print(data2)


# To compare the two data sets, use the function |diff()|
Expand Down Expand Up @@ -68,4 +68,3 @@


diff(data1, data2)

Loading

0 comments on commit d6b7720

Please sign in to comment.