Mercurial > repos > rnateam > graphclust_postprocessing
diff evaluation.py @ 17:f93c868203cc draft default tip
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResults commit 4406735e44aba20859c252be39f4e99df28c7a92
author | rnateam |
---|---|
date | Sat, 27 Oct 2018 13:23:06 -0400 |
parents | 79df97a1bc0f |
children |
line wrap: on
line diff
--- a/evaluation.py Fri Feb 23 10:46:41 2018 -0500 +++ b/evaluation.py Sat Oct 27 13:23:06 2018 -0400 @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python import glob from os import system import re @@ -12,7 +12,7 @@ fasta_dir = sys.argv[1] results_dir = sys.argv[2] -dataNames = fasta_dir+"/data.names" +dataNames = os.path.join(fasta_dir,"data.names") listOfClusters = [] listOfHeaders = [] @@ -54,7 +54,7 @@ numberOfClusters += 1 # 1 cluster for all unassigned seqs ignoreBlackList = False with open(dataNames, "r") as names: - for line in names.readlines(): + for line in names: splits = line.split() fullUniqeId = splits[3] fullHeader = '' @@ -72,9 +72,9 @@ toWrite = "" for i in range(len(listOfClusters)): - toWrite += listOfHeaders[i] + "\t" + listOfClusters[i] + '\n' - -with open(results_dir+"/fullTab.tabular", "w") as full: + toWrite += "%s\t%s\n" % (listOfHeaders[i], listOfClusters[i]) + +with open(os.path.join(results_dir,"fullTab.tabular"), "w") as full: full.write(toWrite) @@ -88,7 +88,11 @@ adjusted_mutual_info_score = metrics.adjusted_mutual_info_score(listOfHeaders, listOfClusters) v_measure_score = metrics.v_measure_score(listOfHeaders, 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) + toWrite = "completeness_score : {}\n".format(completeness_score) + toWrite += "homogeneity_score : {}\n".format(homogeneity_score) + toWrite += "adjusted_rand_score : {}\n".format(adjusted_rand_score) + toWrite += "adjusted_mutual_info_score : {}\n".format(adjusted_mutual_info_score) + toWrite += "v_measure_score : {}\n".format(v_measure_score) else: