function  [xsel,linelabels] =...
    fillingridlines(xsel,prevG,currentG,labelpos,linelabels,whichdirection,sequence,Offset,diagonalline,sizey);

startpeak =    prevG+ whichdirection*1;
countpeak = currentG- whichdirection*1;

for k=startpeak:whichdirection:countpeak;
    yselpick = xsel(prevG) -   (k-prevG) * (xsel(prevG)- xsel(currentG))/(currentG-prevG);
    xsel(k) = yselpick;
    endpoint=diagonalline(round(yselpick));
    letter = sequence(k-Offset); nucleotidecolor = getnucleotidecolor( letter);
    
    linelabels(k,1) =plot( [0 endpoint],[yselpick yselpick]);
    linelabels(k,2) =plot( [endpoint endpoint],[yselpick sizey]);
    set(linelabels(k,:),'color',  nucleotidecolor);
    
end
