annotate ipapy2_clustering.py @ 0:6a23970e8093 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:15 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
1 from ipaPy2 import ipa
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
2 from utils import CustomArgumentParser
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
3
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
4
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
5 def main(input_dataset, Cthr, RTwin, Intmode, output_dataset):
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
6 write_func, file_path = output_dataset
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
7 clustered_df = ipa.clusterFeatures(
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
8 input_dataset, Cthr=Cthr, RTwin=RTwin, Intmode=Intmode
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
9 )
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
10 write_func(clustered_df, file_path)
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
11
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
12
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
13 if __name__ == "__main__":
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
14 parser = CustomArgumentParser(
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
15 description=" Clustering MS1 features based on correlation across samples."
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
16 )
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
17 parser.add_argument(
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
18 "--input_dataset",
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
19 nargs=2,
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
20 action="load_data",
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
21 required=True,
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
22 help="The unclustered MS1 intensities file path.",
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
23 )
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
24
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
25 parser.add_argument(
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
26 "--Cthr",
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
27 type=float,
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
28 default=0.8,
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
29 help="Minimum correlation allowed in each cluster. Default value 0.8.",
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
30 )
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
31
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
32 parser.add_argument(
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
33 "--RTwin",
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
34 type=float,
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
35 default=1,
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
36 help=(
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
37 "Maximum difference in RT time between features in the same cluster."
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
38 " Default value 1."
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
39 ),
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
40 )
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
41
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
42 parser.add_argument(
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
43 "--Intmode",
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
44 type=str,
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
45 default="max",
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
46 choices=["max", "ave"],
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
47 help="intensity mode. Default 'max' or 'ave'.",
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
48 )
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
49 args = parser.parse_args()
6a23970e8093 planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ipapy2 commit 64b61ff2823b4f54868c0ab7a4c0dc49eaf2979a
recetox
parents:
diff changeset
50 main(args.input_dataset, args.Cthr, args.RTwin, args.Intmode, args.output_dataset)