You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.
Please consider packaging the "seanie_matrix_convert.rb" with this repository so people can convert the output to a pairwise matrix for visualization in R.
The text was updated successfully, but these errors were encountered:
Here you go. If you include, I would change 2 things for use in R:
Output the self comparisons as 100 instead of 0.
For this aai, there are two matrices that would be useful. One for the one way hits (A->B on upper triangle, B->A on lower triangle), and one for the two way hits (output both upper and lower triangles of the matrix instead of leaving the lower triangle as 0's; the upper triangle in this case would be identical to the lower triangle).
# take 3 col dist matrix and spit out a dist matrix for R
dists = {}
all = []
File.open(ARGV.first).each_line.with_index do |line, lineno|
unless lineno.zero?
row, col, dist = line.chomp.split "\t"
dist = dist.to_f
all << row << col
unless dists.has_key? row
dists[row] = Hash.new 0
end
dists[row][col] = dist
end
end
all = all.uniq.sort
puts ["", all].flatten.join "\t"
all.each_with_index do |row, ridx|
row_name = all[ridx]
print row_name
all.each do |col|
dist = 0
dist = dists[row][col] if dists.has_key?(row)
printf "\t%s", dist
end
puts
end
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Please consider packaging the "seanie_matrix_convert.rb" with this repository so people can convert the output to a pairwise matrix for visualization in R.
The text was updated successfully, but these errors were encountered: