| 1 |
.. code-block:: python |
| 2 |
|
| 3 |
#!/usr/bin/env python3 |
| 4 |
# -*- coding: utf-8 -*- |
| 5 |
""" |
| 6 |
This function shows how to plot a simple spectrum. It can be directly |
| 7 |
plotted via this script or using the python console |
| 8 |
Example of plotting a spectrum: |
| 9 |
>>> import pymzml, get_example_file |
| 10 |
>>> mzMLFile = 'profile-mass-spectrum.mzml' |
| 11 |
>>> get_example_file.open_example(mzMLFile) |
| 12 |
>>> run = pymzml.run.Reader("mzML_example_files/"+mzMLFile, MSn_Precision = 25e-6) |
| 13 |
>>> p = pymzml.plot.Factory() |
| 14 |
>>> for spec in run: |
| 15 |
>>> p.newPlot() |
| 16 |
>>> p.add(spec.peaks, color=(200,0,0), style='circles') |
| 17 |
>>> p.add(spec.centroidedPeaks, color=(0,0,0), style='sticks') |
| 18 |
>>> p.add(spec.reprofiledPeaks, color=(0,255,0), style='circles') |
| 19 |
>>> p.save( filename="output/plotAspect.xhtml" , mzRange = [744.7,747] ) |
| 20 |
""" |
| 21 |
|
| 22 |
import pymzml |
| 23 |
import get_example_file |
| 24 |
|
| 25 |
def main( file = None ): |
| 26 |
mzMLFile = 'profile-mass-spectrum.mzml' |
| 27 |
get_example_file.open_example(mzMLFile) |
| 28 |
run = pymzml.run.Reader("mzML_example_files/"+mzMLFile, MSn_Precision = 25e-6) |
| 29 |
p = pymzml.plot.Factory() |
| 30 |
for spec in run: |
| 31 |
p.newPlot() |
| 32 |
p.add(spec.peaks, color=(200,0,0), style='squares') |
| 33 |
p.add(spec.centroidedPeaks, color=(0,0,0), style='sticks') |
| 34 |
p.add(spec.reprofiledPeaks, color=(25,0,200), style='circles') |
| 35 |
p.save( filename="output/plotAspect.xhtml" , mzRange = [744.7,747] ) |
| 36 |
|
| 37 |
if __name__ == '__main__': |
| 38 |
main() |