annotate evaluation.py @ 0:0a48b2db75e7 draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
author rnateam
date Sat, 27 Oct 2018 13:49:00 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
1 #!/usr/bin/env python
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
2 import glob
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
3 from os import system
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
4 import re
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
5 from sklearn import metrics
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
6 from shutil import make_archive
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
7 import sys
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
8 import fnmatch, os
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
9
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
10 def sh(script):
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
11 system("bash -c '%s'" % script)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
12
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
13 fasta_dir = sys.argv[1]
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
14 results_dir = sys.argv[2]
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
15 dataNames = os.path.join(fasta_dir,"data.names")
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
16
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
17 listOfClusters = []
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
18 listOfHeaders = []
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
19 headersNames = set()
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
20 idsNames = set()
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
21
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
22
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
23 names = os.listdir(results_dir)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
24 cluster_seqs_stats_files = fnmatch.filter(names, '*.cluster.all')
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
25 with open(dataNames, "r") as names:
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
26 for line2 in names:
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
27 splits2 = line2.split()
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
28 fullHeader = ''
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
29 if len(splits2) >= 6:
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
30 fullHeader = splits2[5]
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
31 headersNames.add(fullHeader)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
32 fullID = splits2[3]
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
33 idsNames.add(fullID)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
34
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
35 blackList = []
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
36 numberOfClusters = 0
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
37 for singleFile in sorted(cluster_seqs_stats_files):
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
38 singleFile = os.path.join(results_dir,singleFile)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
39 numberOfClusters += 1
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
40 with open(singleFile, "r") as f:
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
41 for line in f:
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
42 splits = line.split()
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
43 header = ''
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
44 idd = ''
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
45 if len(splits) >= 11:
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
46 header = splits[10]
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
47 idd = splits[8]
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
48 clustNum = splits[2]
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
49 listOfHeaders.append(header)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
50 listOfClusters.append(clustNum)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
51 if idd in idsNames: #header in headersNames:
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
52 blackList.append(idd)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
53
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
54 numberOfClusters += 1 # 1 cluster for all unassigned seqs
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
55 ignoreBlackList = False
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
56 with open(dataNames, "r") as names:
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
57 for line in names:
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
58 splits = line.split()
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
59 fullUniqeId = splits[3]
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
60 fullHeader = ''
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
61 fullID = ''
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
62 if len(splits) >= 6:
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
63 fullHeader = line.split()[5]
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
64 fullID = line.split()[3]
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
65 if ignoreBlackList or ( fullID not in blackList #fullHeader not in blackList
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
66 or len(fullHeader) == 0):
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
67 listOfHeaders.append(fullHeader)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
68 listOfClusters.append(str(numberOfClusters))
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
69 numberOfClusters += 1 # separate cluster for all unassigned seqs
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
70 # else:
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
71 # print ("Skip header", fullHeader)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
72
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
73 toWrite = ""
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
74 for i in range(len(listOfClusters)):
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
75 toWrite += "%s\t%s\n" % (listOfHeaders[i], listOfClusters[i])
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
76
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
77 with open(os.path.join(results_dir,"fullTab.tabular"), "w") as full:
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
78 full.write(toWrite)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
79
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
80
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
81 pattern = re.compile("^RF.*$")
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
82
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
83 if len(listOfHeaders) > 1: # and pattern.match(str(listOfHeaders[0])):
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
84
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
85 completeness_score = metrics.completeness_score(listOfHeaders, listOfClusters)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
86 homogeneity_score = metrics.homogeneity_score(listOfHeaders, listOfClusters)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
87 adjusted_rand_score = metrics.adjusted_rand_score(listOfHeaders, listOfClusters)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
88 adjusted_mutual_info_score = metrics.adjusted_mutual_info_score(listOfHeaders, listOfClusters)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
89 v_measure_score = metrics.v_measure_score(listOfHeaders, listOfClusters)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
90
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
91 toWrite = "completeness_score : {}\n".format(completeness_score)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
92 toWrite += "homogeneity_score : {}\n".format(homogeneity_score)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
93 toWrite += "adjusted_rand_score : {}\n".format(adjusted_rand_score)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
94 toWrite += "adjusted_mutual_info_score : {}\n".format(adjusted_mutual_info_score)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
95 toWrite += "v_measure_score : {}\n".format(v_measure_score)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
96
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
97
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
98 else:
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
99 toWrite = "completeness_score : NA \nhomogeneity_score : NA \nadjusted_rand_score : NA \nadjusted_mutual_info_score : NA \nv_measure_score : NA"
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
100
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
101 with open(os.path.join(results_dir,"evaluation.txt"), "w") as fOut:
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
102 fOut.write(toWrite)
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
103
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
104
0a48b2db75e7 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust/CollectResultsNoAlign commit 2a6fd70c1bcec36ffdf0bba2ec82489b39cfc84e
rnateam
parents:
diff changeset
105 make_archive('RESULTS', 'zip', root_dir=results_dir)