File: polarity.py

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 (44 lines) | stat: -rwxr-xr-x 1,054 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
39
40
41
42
43
44
#!/usr/bin/env python
# -*- coding: utf-8 -*-


import pymzml
import get_example_file


def main():
    """
    Accessing positive or negative polarity of scan using obo 1.1.0

    usage:

        ./polarity.py

    """
    example_file = get_example_file.open_example("small.pwiz.1.1.mzML")
    run = pymzml.run.Reader(example_file, obo_version="1.1.0")
    for spec in run:
        negative_polarity = spec["negative scan"]
        if negative_polarity is None:
            negative_polarity = False
        if negative_polarity == "":
            negative_polarity = True
        positive_polarity = spec["positive scan"]
        if positive_polarity is None:
            positive_polarity = False
        if positive_polarity == "":
            positive_polarity = True
        else:
            positive_polarity = False
        print(
            "Polarity negative {0} - Polarity positive {1}".format(
                negative_polarity, positive_polarity
            )
        )
        exit(1)

    return


if __name__ == "__main__":
    main()