Mercurial > repos > recetox > ipapy2_ms1_annotation
comparison ipapy2_map_isotope_patterns.py @ 0:7f84a8a5edde draft default tip
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
author | recetox |
---|---|
date | Fri, 16 May 2025 08:00:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:7f84a8a5edde |
---|---|
1 from ipaPy2 import ipa | |
2 from utils import CustomArgumentParser | |
3 | |
4 | |
5 def main(input_dataset, isoDiff, ppm, ionisation, isotope_ratio, output_dataset): | |
6 clustered_df = input_dataset | |
7 ipa.map_isotope_patterns( | |
8 clustered_df, | |
9 isoDiff=isoDiff, | |
10 ppm=ppm, | |
11 ionisation=ionisation, | |
12 MinIsoRatio=isotope_ratio, | |
13 ) | |
14 write_func, file_path = output_dataset | |
15 write_func(clustered_df, file_path) | |
16 | |
17 | |
18 if __name__ == "__main__": | |
19 parser = CustomArgumentParser(description="mapping isotope patterns in MS1 data.") | |
20 parser.add_argument( | |
21 "--input_dataset", | |
22 nargs=2, | |
23 action="load_data", | |
24 required=True, | |
25 help="A dataset containing clustered MS1 intensities.", | |
26 ) | |
27 parser.add_argument( | |
28 "--isoDiff", | |
29 type=float, | |
30 default=1, | |
31 help=( | |
32 "Default value 1. Difference between isotopes of charge 1, does " | |
33 " not need to be exact" | |
34 ), | |
35 ) | |
36 parser.add_argument( | |
37 "--ppm", | |
38 type=float, | |
39 default=100, | |
40 help=( | |
41 "Default value 100. Maximum ppm value allowed between 2 isotopes. " | |
42 " It is very high on purpose" | |
43 ), | |
44 ) | |
45 parser.add_argument( | |
46 "--ionisation", | |
47 type=int, | |
48 default=1, | |
49 choices=[1, -1], | |
50 help="Default value 1. positive = 1, negative = -1", | |
51 ) | |
52 parser.add_argument( | |
53 "--isotope_ratio", | |
54 type=float, | |
55 default=1, | |
56 help=( | |
57 "mininum intensity ratio expressed (Default value 1%). Only " | |
58 " isotopes with intensity higher than MinIsoRatio% of the main isotope " | |
59 " are considered." | |
60 ), | |
61 ) | |
62 args = parser.parse_args() | |
63 main( | |
64 args.input_dataset, | |
65 args.isoDiff, | |
66 args.ppm, | |
67 args.ionisation, | |
68 args.isotope_ratio, | |
69 args.output_dataset, | |
70 ) |