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