File: has_peak.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 (31 lines) | stat: -rwxr-xr-x 686 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
.. code-block:: python

	#!/usr/bin/env python
	
	import pymzml
	import os
	
	
	def main():
	    """
	    Testscript to demonstrate functionality of function :py:func:`pymzml.spec.Spectrum.has_peak`
	
	    usage:
	
	        ./has_peak.py
	
	    """
	
	    example_file = os.path.join(
	        os.path.dirname(__file__), os.pardir, "tests", "data", "example.mzML"
	    )
	    mz_to_find = 820.7711792
	    run = pymzml.run.Reader(example_file)
	    for spectrum in run:
	        found_peaks = spectrum.has_peak(mz_to_find)
	        if found_peaks != []:
	            print("Found peaks: {0} in spectrum {1}".format(found_peaks, spectrum.ID))
	
	
	if __name__ == "__main__":
	    main()