diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipapy2_clustering.py	Fri May 16 08:01:15 2025 +0000
@@ -0,0 +1,50 @@
+from ipaPy2 import ipa
+from utils import CustomArgumentParser
+
+
+def main(input_dataset, Cthr, RTwin, Intmode, output_dataset):
+    write_func, file_path = output_dataset
+    clustered_df = ipa.clusterFeatures(
+        input_dataset, Cthr=Cthr, RTwin=RTwin, Intmode=Intmode
+    )
+    write_func(clustered_df, file_path)
+
+
+if __name__ == "__main__":
+    parser = CustomArgumentParser(
+        description=" Clustering MS1 features based on correlation across samples."
+    )
+    parser.add_argument(
+        "--input_dataset",
+        nargs=2,
+        action="load_data",
+        required=True,
+        help="The unclustered MS1 intensities file path.",
+    )
+
+    parser.add_argument(
+        "--Cthr",
+        type=float,
+        default=0.8,
+        help="Minimum correlation allowed in each cluster. Default value 0.8.",
+    )
+
+    parser.add_argument(
+        "--RTwin",
+        type=float,
+        default=1,
+        help=(
+            "Maximum difference in RT time between features in the same cluster."
+            " Default value 1."
+        ),
+    )
+
+    parser.add_argument(
+        "--Intmode",
+        type=str,
+        default="max",
+        choices=["max", "ave"],
+        help="intensity mode. Default 'max' or 'ave'.",
+    )
+    args = parser.parse_args()
+    main(args.input_dataset, args.Cthr, args.RTwin, args.Intmode, args.output_dataset)