changeset 2:b8e32e577597 draft

planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust/CollectResults commit 9bc3c9b613d106098a78e16534897c88a3738c07
author rnateam
date Sat, 24 Dec 2016 18:08:36 -0500
parents ed8c7191b322
children 79b9117aef01
files evaluation.py glob_report.xml
diffstat 2 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/evaluation.py	Thu Dec 22 09:06:48 2016 -0500
+++ b/evaluation.py	Sat Dec 24 18:08:36 2016 -0500
@@ -1,6 +1,7 @@
 import glob
 from os import system
 import re
+from sklearn import metrics
 
 def sh(script):
     system("bash -c '%s'" % script)
@@ -46,3 +47,29 @@
     toWrite += listOfClasses[i] + "\t" + listOfClusters[i] + '\n'
 with open("RESULTS/fullTab.tabular", "w") as full:
     full.write(toWrite)
+
+
+listOfClasses = []
+listOfClusters = []
+pattern = re.compile("^RF.*$")
+
+
+if len(listOfClasses) > 0 and  pattern.match(str(listOfClasses[0])):
+    with open("RESULTS/fullTab.tabular", "r") as tabF:
+        for line in tabF.readlines():
+            listOfClasses.append(line.split()[0])
+            listOfClusters.append(line.split()[1])
+
+    completeness_score = metrics.completeness_score(listOfClasses, listOfClusters)
+    homogeneity_score = metrics.homogeneity_score(listOfClasses, listOfClusters)
+    adjusted_rand_score = metrics.adjusted_rand_score(listOfClasses, listOfClusters)
+    adjusted_mutual_info_score = metrics.adjusted_mutual_info_score(listOfClasses, listOfClusters)
+    v_measure_score = metrics.v_measure_score(listOfClasses, listOfClusters)
+
+    toWrite = "completeness_score : " + str(completeness_score) + "\n" + "homogeneity_score : " + str(homogeneity_score) + "\n" + "adjusted_rand_score : " +str(adjusted_rand_score)  + "\n" + "adjusted_mutual_info_score : " + str(adjusted_mutual_info_score)+ "\n" + "v_measure_score : " + str(v_measure_score)
+
+else:
+    toWrite = "completeness_score : NA \nhomogeneity_score : NA \nadjusted_rand_score : NA \nadjusted_mutual_info_score : NA \nv_measure_score : NA"
+
+with open("RESULTS/evaluation.txt", "w") as fOut:
+    fOut.write(toWrite)
--- a/glob_report.xml	Thu Dec 22 09:06:48 2016 -0500
+++ b/glob_report.xml	Sat Dec 24 18:08:36 2016 -0500
@@ -2,6 +2,7 @@
 	<requirements>
 		<requirement type="package" version="0.1">graphclust-wrappers</requirement>
 		<requirement type="package" version='0.5'>perl-array-utils</requirement>
+		<requirement type="package" version='0.18.1'>scikit-learn</requirement>
 	</requirements>
 	<stdio>
 		<exit_code range="1:" />
@@ -64,6 +65,7 @@
 		<data name="tableForEval" format="tabular" from_work_dir="RESULTS/fullTab.tabular" label="tableForEval"  />
 		<data name="final_soft" format="txt" from_work_dir="RESULTS/partitions/final_partition.soft" label="soft_part"   />
 		<data name="final_used_cmsearch" format="txt" from_work_dir="RESULTS/partitions/final_partition.used_cmsearch" label="final_partition_used_cmsearch"   />
+		<data name="evaluation" format="txt" from_work_dir="RESULTS/evaluation.txt" label="evaluation_of_clusters"   />
 		<collection name="clusters" type="list" label="CLUSTERS">
 			<discover_datasets pattern="(?P&lt;name&gt;^.*\.all$)" directory="RESULTS"  />
 		</collection>