-
Notifications
You must be signed in to change notification settings - Fork 0
/
SortChrom.m
22 lines (16 loc) · 878 Bytes
/
SortChrom.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function sortedChrom = SortChrom(x_blue,y_blue,ChromCore)
RealCordinates = BuildRealCordinates(ChromCore,x_blue,y_blue); %
ChromCorX = RealCordinates(1,:); % split X valuse
ChromCorY = RealCordinates(2,:); % split y values
VertexX = mean(ChromCorX); % find a Vertex
VertexY = mean(ChromCorY);
SeqX = ChromCorX(1:end); % assign to a valid sequence for sorting
SeqY = ChromCorY(1:end);
angles = atan2d((SeqY-VertexY) , (SeqX-VertexX)); % sort points based on vertex
[sortedAngles, sortIndexes] = sort(angles); % assign best indexes ( =points = genes)
sortedChrom = ChromCore(sortIndexes); % return sortIndexes ( = sortedChrom )
% XsortedCoordinated = RealCordinates(1,sortedChrom);
% YsortedCoordinated = RealCordinates(2,sortedChrom);
% plot(XsortedCoordinated,YsortedCoordinated)
x=2;
end