function midPt = newPos(i,P)
global seq corner_g corner_t corner_a corner_c
%i is iteration, and the index of the current nucleotide in genetic sequence
%P is coordinates of initial point
if (seq(i)=='G' || seq(i)=='g')
    endPt=corner_g;
elseif (seq(i)=='T' || seq(i)=='t')
    endPt=corner_t;
elseif (seq(i)=='A' || seq(i)=='a')
    endPt=corner_a;
elseif (seq(i)=='C' || seq(i)=='c')
    endPt=corner_c;
else
    endPt=P; 
    %if text file has spaces, punctuations, or numbers, midPt will return 
    %the original P this effectively skips this iteration, as if it 
    %ignored the unreadable character
end

midPt=[(P(1)+endPt(1))/2,(P(2)+endPt(2))/2];
