-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCountMatch.jl
44 lines (40 loc) · 1.19 KB
/
CountMatch.jl
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#! /usr/bin/env julia
using PlotlyJS, CSV ;
function pairwise(x::String, y::String = x, op = ==)
broadcast(op, Iterators.Stateful(x), Iterators.Stateful(y))
end
function pairwise(x::Array{String,1}, y::Array{String,1} = x, op = ==)
sum.(pairwise.(x, permutedims(y), op))
end
function countmatch(infile)
indexfile = open(readlines,infile)
mismatchArray = pairwise(indexfile)
outfile_array = vcat(permutedims(["string";indexfile]), hcat(indexfile,mismatchArray))
CSV.write("PairwiseMatch.txt", outfile_array)
layout = Layout(
title = "Matches",
margin = attr(
l=100,
r=100,
b=100,
t=100,
pad=0
)
)
p = plot(
heatmap(
x = indexfile,
y = indexfile,
z=mismatchArray,
colorscale = :YlGnBu,
reversescale = true
),
layout
)
PlotlyJS.savehtml(
p,
split(ARGS[1], ".")[1]*".PairwiseMatch.html",
:embed
)
end
countmatch(ARGS[1])