blob: f0a3afd30943c973ccc9828c10fc3e2975e8ed67 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/usr/bin/env ruby
require_relative "../../lazar/lib/similarity.rb"
independent_variables = []
smiles = []
ARGV.each do |f|
File.readlines(f).each do |l|
items = l.chomp.split ","
smiles << items.shift
independent_variables << items
end
end
dist = []
independent_variables.each_with_index do |v1,i|
dist << []
line = []
independent_variables.each_with_index do |v2,j|
if j > i
d = 1-Similarity.tanimoto([v1,v2])
dist[i][j] = d
elsif i == j
d = 0
else
d = dist[j][i]
end
line << d
end
puts ([smiles[i]]+line).join(",")
end
|