Mercurial > repos > recetox > ipapy2_gibbs_sampler_add
comparison ipapy2_MS1_annotation.py @ 0:428abc41a101 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:01:46 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:428abc41a101 |
|---|---|
| 1 from ipaPy2 import ipa | |
| 2 from utils import flattern_annotations, MSArgumentParser | |
| 3 | |
| 4 | |
| 5 def main( | |
| 6 input_dataset_database, | |
| 7 input_dataset_adduct, | |
| 8 ppm, | |
| 9 ratiosd, | |
| 10 ppmunk, | |
| 11 ratiounk, | |
| 12 ppmthr, | |
| 13 pRTNone, | |
| 14 pRTout, | |
| 15 output_dataset, | |
| 16 ncores, | |
| 17 ): | |
| 18 write_func, file_path = output_dataset | |
| 19 | |
| 20 annotations = ipa.MS1annotation( | |
| 21 input_dataset_database, | |
| 22 input_dataset_adduct, | |
| 23 ppm=ppm, | |
| 24 ratiosd=ratiosd, | |
| 25 ppmunk=ppmunk, | |
| 26 ratiounk=ratiounk, | |
| 27 ppmthr=ppmthr, | |
| 28 pRTNone=pRTNone, | |
| 29 pRTout=pRTout, | |
| 30 ncores=ncores, | |
| 31 ) | |
| 32 annotations_flat = flattern_annotations(annotations) | |
| 33 write_func(annotations_flat, file_path) | |
| 34 | |
| 35 | |
| 36 if __name__ == "__main__": | |
| 37 parser = MSArgumentParser(""" | |
| 38 Annotation of the dataset based on the MS1 information. Prior probabilities | |
| 39 are based on mass only, while post probabilities are based on mass, RT, | |
| 40 previous knowledge and isotope patterns. | |
| 41 """) | |
| 42 parser.add_argument( | |
| 43 "--input_dataset_database", | |
| 44 nargs=2, | |
| 45 action="load_data", | |
| 46 required=True, | |
| 47 help=( | |
| 48 "A dataset containing the MS1 data. Ideally obtained from" | |
| 49 " map_isotope_patterns" | |
| 50 ), | |
| 51 ) | |
| 52 parser.add_argument( | |
| 53 "--input_dataset_adducts", | |
| 54 nargs=2, | |
| 55 action="load_data", | |
| 56 required=True, | |
| 57 help="A dataset containing information on all possible adducts.", | |
| 58 ) | |
| 59 | |
| 60 args = parser.parse_args() | |
| 61 main( | |
| 62 args.input_dataset_database, | |
| 63 args.input_dataset_adducts, | |
| 64 args.ppm, | |
| 65 args.ratiosd, | |
| 66 args.ppmunk, | |
| 67 args.ratiounk, | |
| 68 args.ppmthr, | |
| 69 args.pRTNone, | |
| 70 args.pRTout, | |
| 71 args.output_dataset, | |
| 72 args.ncores, | |
| 73 ) |
