Mercurial > repos > recetox > ipapy2_ms1_annotation
comparison ipapy2_clustering.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, Cthr, RTwin, Intmode, output_dataset): | |
6 write_func, file_path = output_dataset | |
7 clustered_df = ipa.clusterFeatures( | |
8 input_dataset, Cthr=Cthr, RTwin=RTwin, Intmode=Intmode | |
9 ) | |
10 write_func(clustered_df, file_path) | |
11 | |
12 | |
13 if __name__ == "__main__": | |
14 parser = CustomArgumentParser( | |
15 description=" Clustering MS1 features based on correlation across samples." | |
16 ) | |
17 parser.add_argument( | |
18 "--input_dataset", | |
19 nargs=2, | |
20 action="load_data", | |
21 required=True, | |
22 help="The unclustered MS1 intensities file path.", | |
23 ) | |
24 | |
25 parser.add_argument( | |
26 "--Cthr", | |
27 type=float, | |
28 default=0.8, | |
29 help="Minimum correlation allowed in each cluster. Default value 0.8.", | |
30 ) | |
31 | |
32 parser.add_argument( | |
33 "--RTwin", | |
34 type=float, | |
35 default=1, | |
36 help=( | |
37 "Maximum difference in RT time between features in the same cluster." | |
38 " Default value 1." | |
39 ), | |
40 ) | |
41 | |
42 parser.add_argument( | |
43 "--Intmode", | |
44 type=str, | |
45 default="max", | |
46 choices=["max", "ave"], | |
47 help="intensity mode. Default 'max' or 'ave'.", | |
48 ) | |
49 args = parser.parse_args() | |
50 main(args.input_dataset, args.Cthr, args.RTwin, args.Intmode, args.output_dataset) |