diff COBRAxy/marea_cluster.py @ 309:38c9a958ea78 draft

Uploaded
author francesco_lapi
date Thu, 22 May 2025 16:03:37 +0000 (3 weeks ago)
parents 4a677fc67aeb
children 4599fb23f25b
line wrap: on
line diff
--- a/COBRAxy/marea_cluster.py	Tue May 20 16:01:21 2025 +0000
+++ b/COBRAxy/marea_cluster.py	Thu May 22 16:03:37 2025 +0000
@@ -59,14 +59,14 @@
     
     parser.add_argument('-el', '--elbow', 
                         type = str,
-                        default = 'false',
-                        choices = ['true', 'false'],
+                        default = 'False',
+                        choices = ['True', 'False'],
                         help = 'choose if you want to generate an elbow plot for kmeans')
     
     parser.add_argument('-si', '--silhouette', 
                         type = str,
-                        default = 'false',
-                        choices = ['true', 'false'],
+                        default = 'False',
+                        choices = ['True', 'False'],
                         help = 'choose if you want silhouette plots')
     
     parser.add_argument('-td', '--tool_dir',
@@ -75,7 +75,7 @@
                         help = 'your tool directory')
                         
     parser.add_argument('-ms', '--min_samples',
-                        type = float,
+                        type = int,
                         help = 'min samples for dbscan (optional)')
                         
     parser.add_argument('-ep', '--eps',
@@ -106,7 +106,7 @@
     Returns:
       None
     """
-    args = process_args(sys.argv)
+
     with open(args.out_log, 'a') as log:
         log.write(s + "\n\n")
     print(s)
@@ -213,8 +213,8 @@
         k_min (int): The minimum number of clusters to consider.
         k_max (int): The maximum number of clusters to consider.
         dataset (pandas.DataFrame): The dataset to perform clustering on.
-        elbow (str): Whether to generate an elbow plot for kmeans ('true' or 'false').
-        silhouette (str): Whether to generate silhouette plots ('true' or 'false').
+        elbow (str): Whether to generate an elbow plot for kmeans ('True' or 'False').
+        silhouette (str): Whether to generate silhouette plots ('True' or 'False').
         best_cluster (str): The file path to save the output of the best cluster.
 
     Returns:
@@ -224,12 +224,12 @@
         os.makedirs(args.output_path)
     
         
-    if elbow == 'true':
+    if elbow == 'True':
         elbow = True
     else:
         elbow = False
         
-    if silhouette == 'true':
+    if silhouette == 'True':
         silhouette = True
     else:
         silhouette = False
@@ -443,7 +443,7 @@
         k_min (int): The minimum number of clusters to consider.
         k_max (int): The maximum number of clusters to consider.
         best_cluster (str): The file path to save the output of the best cluster.
-        silhouette (str): Whether to generate silhouette plots ('true' or 'false').
+        silhouette (str): Whether to generate silhouette plots ('True' or 'False').
 
     Returns:
         None
@@ -477,7 +477,7 @@
         prefix = ''
         if (i + k_min == best):
             prefix = '_BEST'
-        if silhouette == 'true':
+        if silhouette == 'True':
             silhouette_draw(dataset, labels[i], i + k_min, f'{args.output_path}/silhouette_with_' + str(i + k_min) + prefix + '_clusters.png')
      
     for i in range(len(labels)):