Description of arrowhead

Home > BiKEGG > arrowhead.m

# arrowhead

## PURPOSE

arrowhead

## SYNOPSIS

function arrowhead(Xin1,Yin1,ArrowChek,McmCollect,ArWidth,flxDirect)

## DESCRIPTION

     arrowhead
     is a subfunction of NetDraw for drawing arrowheads on
     coordinates generated by ArrowheadProcess function.

     Inputs:
     Xin1, Yin1: Coordinates generated by  ArrowheadProcess.
     ArrowChek: Overlapping reactions' info.
     McmCollect: Colormapping info for flux carrying reactions.
     ArWidth: Arrow width
     flxDirect: Information on reaction directionality from ArrowheadProcess.

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- NetDraw NetDraw
- NetPoster NetPoster

## SOURCE CODE

    0001 function arrowhead(Xin1,Yin1,ArrowChek,McmCollect,ArWidth,flxDirect)
    0002 % arrowhead
    0003 % is a subfunction of NetDraw for drawing arrowheads on
    0004 % coordinates generated by ArrowheadProcess function.
    0005 %
    0006 % Inputs:
    0007 % Xin1, Yin1: Coordinates generated by  ArrowheadProcess.
    0008 % ArrowChek: Overlapping reactions' info.
    0009 % McmCollect: Colormapping info for flux carrying reactions.
    0010 % ArWidth: Arrow width
    0011 % flxDirect: Information on reaction directionality from ArrowheadProcess.
    0012
    0013 % O. Jamialahmadi
    0014 % TMU, Chem. Eng. Dept., Biotech. Group
    0015 % July 2016
    0016 %--------------------------------------------------------------------------
    0017
    0018 H = ones(numel(Xin1),1).*(2.5*ArWidth); % Arrowhead width
    0019 if ~isempty(ArrowChek)
    0020     for i1 = 1:size(ArrowChek,1)
    0021         if isempty(Xin1{ArrowChek(i1,1)})
    0022             continue
    0023         end
    0024         H(ArrowChek(i1,1)) = H(ArrowChek(i1,1))/(ArrowChek(i1,2));
    0025     end
    0026 end
    0027 if numel(McmCollect) == 1
    0028     McmCollect = ones(numel(Xin1),3).*McmCollect;
    0029 elseif size(McmCollect,1) == 1
    0030     TempMcm = ones(numel(Xin1),3);
    0031     TempMcm(:,1) = TempMcm(:,1).*McmCollect(1);
    0032     TempMcm(:,2) = TempMcm(:,2).*McmCollect(2);
    0033     TempMcm(:,3) = TempMcm(:,3).*McmCollect(3);
    0034     McmCollect = TempMcm;
    0035 end
    0036
    0037 for cnt1 = 1:numel(Xin1)
    0038     if isempty(Xin1{cnt1})
    0039         continue
    0040     end
    0041     if ~isempty(flxDirect)
    0042         Dirct = flxDirect.D{cnt1};
    0043         flx = flxDirect.F(cnt1);
    0044         if flx < -1e-6 && numel(Dirct) > 1
    0045             Dirct = Dirct.*-1;
    0046         end
    0047     end
    0048     Xin = Xin1{cnt1}; Yin = Yin1{cnt1};
    0049     Mcm = McmCollect(cnt1,:);
    0050     for cnt = 1:size(Xin,1)
    0051         X = Xin(cnt,:); Y = Yin(cnt,:); coorX = []; coorY =[];
    0052         if ~diff(Y)
    0053             coorX(1) = X(1); coorY(1) = Y(1) + H(cnt1);
    0054             coorX(2) = X(2); coorY(2) = Y(2);
    0055             coorX(3) = X(1); coorY(3) = Y(1) - H(cnt1);
    0056         else
    0057             LineSlope = diff(Y)/diff(X);
    0058             LineSlope = -1/LineSlope;
    0059             coorX(1) = X(1) + H(cnt1)*(1/sqrt(1+LineSlope^2));
    0060             coorY(1) = Y(1) + H(cnt1)*(LineSlope/sqrt(1+LineSlope^2));
    0061             coorX(2) = X(2); coorY(2) = Y(2);
    0062             coorX(3) = X(1) - H(cnt1)*(1/sqrt(1+LineSlope^2));
    0063             coorY(3) = Y(1) - H(cnt1)*(LineSlope/sqrt(1+LineSlope^2));
    0064         end
    0065         if ~isempty(flxDirect)
    0066             if numel(Dirct) == 1 % Irreversible
    0067                 patch(coorX,coorY,zeros(1,numel(coorX)),'EdgeColor','none',...
    0068                 'FaceColor',[Mcm(1),Mcm(2),Mcm(3)],'Parent',gca)
    0069             else
    0070               if Dirct(cnt) == 1
    0071                   patch(coorX,coorY,zeros(1,numel(coorX)),'EdgeColor','none',...
    0072                 'FaceColor',[Mcm(1),Mcm(2),Mcm(3)],'Parent',gca)
    0073               else
    0074                   patch(coorX,coorY,zeros(1,numel(coorX)),'EdgeColor',...
    0075                       [Mcm(1),Mcm(2),Mcm(3)],...
    0076                 'FaceColor',[1,1,1],'Parent',gca)
    0077               end
    0078             end
    0079         else
    0080             patch(coorX,coorY,zeros(1,numel(coorX)),'EdgeColor','none',...
    0081                 'FaceColor',[Mcm(1),Mcm(2),Mcm(3)],'Parent',gca)
    0082         end
    0083     end
    0084 end