File: plotAspec_2.inc

package info (click to toggle)
python-pymzml 2.5.2%2Brepack1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 27,792 kB
  • sloc: python: 6,495; pascal: 341; makefile: 233; sh: 30
file content (38 lines) | stat: -rwxr-xr-x 1,439 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
.. code-block:: python

	#!/usr/bin/env python3
	# -*- coding: utf-8 -*-
	"""
	This function shows how to plot a simple spectrum. It can be directly
	plotted via this script or using the python console
	Example of plotting a spectrum:
	>>> import pymzml, get_example_file
	>>> mzMLFile = 'profile-mass-spectrum.mzml'
	>>> get_example_file.open_example(mzMLFile)
	>>> run = pymzml.run.Reader("mzML_example_files/"+mzMLFile, MSn_Precision = 25e-6)
	>>> p = pymzml.plot.Factory()
	>>> for spec in run:
	>>>     p.newPlot()
	>>>     p.add(spec.peaks, color=(200,0,0), style='circles')
	>>>     p.add(spec.centroidedPeaks, color=(0,0,0), style='sticks')
	>>>     p.add(spec.reprofiledPeaks, color=(0,255,0), style='circles')
	>>>     p.save( filename="output/plotAspect.xhtml" , mzRange = [744.7,747] )
	"""

	import pymzml
	import get_example_file

	def main( file = None ):
	    mzMLFile = 'profile-mass-spectrum.mzml'
	    get_example_file.open_example(mzMLFile)
	    run = pymzml.run.Reader("mzML_example_files/"+mzMLFile, MSn_Precision = 25e-6)
	    p = pymzml.plot.Factory()
	    for spec in run:
	        p.newPlot()
	        p.add(spec.peaks, color=(200,0,0), style='squares')
	        p.add(spec.centroidedPeaks, color=(0,0,0), style='sticks')
	        p.add(spec.reprofiledPeaks, color=(25,0,200), style='circles')
	        p.save( filename="output/plotAspect.xhtml" , mzRange = [744.7,747] )

	if __name__ == '__main__':
	    main()