Home > FR3DSource > zPlotOneNT.m

zPlotOneNT

PURPOSE ^

SYNOPSIS ^

function [void] = zPlotOneNT(NT,ViewParam)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [void] = zPlotOneNT(NT,ViewParam)
0002 
0003 X  = NT.Fit;
0004 
0005 if isfield(ViewParam,'Sugar'),
0006   Sugar = ViewParam.Sugar;
0007 else
0008   Sugar = 0;
0009 end
0010 
0011 if isfield(ViewParam,'LineStyle'),
0012   LS = ViewParam.LineStyle;
0013 else
0014   LS = '-';
0015 end
0016 
0017 if isfield(ViewParam,'LineThickness'),   
0018   LT = ViewParam.LineThickness;
0019 else
0020   LT = 2.0;                              % doesn't work for some reason!
0021 end
0022 
0023 if isfield(ViewParam,'LabelBases'),
0024   LB = ViewParam.LabelBases;
0025 else
0026   LB = 0;
0027 end
0028 
0029 if isfield(ViewParam,'LabelSugar'),
0030   LSugar = ViewParam.LabelSugar;
0031 else
0032   LSugar = 0;
0033 end
0034 
0035 switch NT.Code
0036   case 1,
0037     col = [1 0 0];   % A is red
0038   case 2,
0039     col = [1 0.8 0]; % C is yellow
0040   case 3,
0041     col = [0 1 0];   % G is green
0042   case 4, 
0043     col = [0 0 1];   % U is blue
0044   otherwise,
0045     col = [0 0 0];
0046 end
0047 
0048 gray = 0.5*[1 1 1];
0049 
0050 if isfield(ViewParam,'Color'),
0051   if length(ViewParam.Color) == 3,
0052     col = ViewParam.Color;
0053   end
0054 end
0055 
0056 if strcmp(LS,'-.'),
0057   col = 0.7*col;
0058   gray = 0.7*gray;
0059   LS = '-';
0060 end
0061 
0062 bc = gray;
0063 
0064 hold on 
0065 
0066 switch NT.Code
0067 case 1,
0068   i = [1 7 10 8 5 6];
0069   plot3(X(i,1),X(i,2),X(i,3),'Color',col,'LineWidth',2,'LineStyle',LS);
0070   i = [5 4 9 3 2 8];
0071   plot3(X(i,1),X(i,2),X(i,3),'Color',col,'LineWidth',2,'LineStyle',LS);
0072   i = [1 2];
0073   plot3(X(i,1),X(i,2),X(i,3),'Color',col,'LineWidth',2,'LineStyle',LS);
0074 
0075   i = [7 12];
0076   plot3(X(i,1),X(i,2),X(i,3),'Color',gray,'LineWidth',2,'LineStyle',LS);
0077   i = [15 6 14];
0078   plot3(X(i,1),X(i,2),X(i,3),'Color',gray,'LineWidth',2,'LineStyle',LS);
0079   i = [9 11];
0080   plot3(X(i,1),X(i,2),X(i,3),'Color',gray,'LineWidth',2,'LineStyle',LS);
0081 case 2,
0082   i = [1 7 8 5 6];
0083   plot3(X(i,1),X(i,2),X(i,3),'Color',col,'LineWidth',2,'LineStyle',LS);
0084   i = [5 4 2 3];
0085   plot3(X(i,1),X(i,2),X(i,3),'Color',col,'LineWidth',2,'LineStyle',LS);
0086   i = [1 2];
0087   plot3(X(i,1),X(i,2),X(i,3),'Color',col,'LineWidth',2,'LineStyle',LS);
0088 
0089   i = [7 10];
0090   plot3(X(i,1),X(i,2),X(i,3),'Color',gray,'LineWidth',2,'LineStyle',LS);
0091   i = [8 11];
0092   plot3(X(i,1),X(i,2),X(i,3),'Color',gray,'LineWidth',2,'LineStyle',LS);
0093   i = [12 6 13];
0094   plot3(X(i,1),X(i,2),X(i,3),'Color',gray,'LineWidth',2,'LineStyle',LS);
0095 case 3,
0096   i = [1 7 10 8 5 6];
0097   plot3(X(i,1),X(i,2),X(i,3),'Color',col,'LineWidth',2,'LineStyle',LS);
0098   i = [5 4 9 11];
0099   plot3(X(i,1),X(i,2),X(i,3),'Color',col,'LineWidth',2,'LineStyle',LS);
0100   i = [9 3 2 8];
0101   plot3(X(i,1),X(i,2),X(i,3),'Color',col,'LineWidth',2,'LineStyle',LS);
0102   i = [1 2];
0103   plot3(X(i,1),X(i,2),X(i,3),'Color',col,'LineWidth',2,'LineStyle',LS);
0104 
0105   i = [7 13];
0106   plot3(X(i,1),X(i,2),X(i,3),'Color',gray,'LineWidth',2,'LineStyle',LS);
0107   i = [4 12];
0108   plot3(X(i,1),X(i,2),X(i,3),'Color',gray,'LineWidth',2,'LineStyle',LS);
0109   i = [16 11 15];
0110   plot3(X(i,1),X(i,2),X(i,3),'Color',gray,'LineWidth',2,'LineStyle',LS);
0111 case 4,
0112   i = [1 7 8 5 6];
0113   plot3(X(i,1),X(i,2),X(i,3),'Color',col,'LineWidth',2,'LineStyle',LS);
0114   i = [5 4 2 3];
0115   plot3(X(i,1),X(i,2),X(i,3),'Color',col,'LineWidth',2,'LineStyle',LS);
0116   i = [1 2];
0117   plot3(X(i,1),X(i,2),X(i,3),'Color',col,'LineWidth',2,'LineStyle',LS);
0118 
0119   i = [7 12];
0120   plot3(X(i,1),X(i,2),X(i,3),'Color',gray,'LineWidth',2,'LineStyle',LS);
0121   i = [8 9];
0122   plot3(X(i,1),X(i,2),X(i,3),'Color',gray,'LineWidth',2,'LineStyle',LS);
0123   i = [4 11];
0124   plot3(X(i,1),X(i,2),X(i,3),'Color',gray,'LineWidth',2,'LineStyle',LS);
0125 end
0126 
0127 scatter3(X(1,1),X(1,2),X(1,3),28,col,'filled');   % glycosidic atom
0128 
0129 if Sugar == 1,
0130  if length(NT.Sugar(:,1)) == 13,   % for some reason, some have 9
0131   Z = [NT.Sugar; NT.Fit(1,:)];
0132 
0133   k = [14 1 7 6 8 9 10 12]; 
0134   plot3(Z(k,1),Z(k,2),Z(k,3),'Color',bc,'LineWidth',2,'LineStyle',LS);
0135   hold on
0136   k = [11 10]; 
0137   plot3(Z(k,1),Z(k,2),Z(k,3),'Color',bc,'LineWidth',2,'LineStyle',LS);
0138   k = [6 4 5]; 
0139   plot3(Z(k,1),Z(k,2),Z(k,3),'Color',bc,'LineWidth',2,'LineStyle',LS);
0140   k = [4 2 3]; 
0141   plot3(Z(k,1),Z(k,2),Z(k,3),'Color',bc,'LineWidth',2,'LineStyle',LS);
0142   k = [2 1]; 
0143   plot3(Z(k,1),Z(k,2),Z(k,3),'Color',bc,'LineWidth',2,'LineStyle',LS);
0144 
0145   % connect backbone, if distance is small enough
0146   if norm(Z(13,1)-Z(10,1)) < 6,       % O3' from previous nucleotide is known
0147     k = [10 13];
0148     plot3(Z(k,1),Z(k,2),Z(k,3),'Color',bc,'LineWidth',2,'LineStyle',LS);
0149   end  
0150 
0151   if LSugar > 0,
0152     A = {'C1*','C2*','O2*','C3*','O3*','C4*','O4*','C5*','O5*','P','O1P','O2P'};
0153     for j=1:12,
0154       text(Z(j,1)+0.1,Z(j,2),Z(j,3), A{j},'fontweight','bold','FontSize',LSugar);
0155     end
0156   end
0157  elseif length(NT.Sugar(:,1)) == 12,   % for some reason, some have 9
0158   Z = [NT.Sugar; NT.Fit(1,:)];
0159 
0160   k = [13 1 7 6 8 9 10 12]; 
0161   plot3(Z(k,1),Z(k,2),Z(k,3),'Color',bc,'LineWidth',2,'LineStyle',LS);
0162   hold on
0163   k = [11 10]; 
0164   plot3(Z(k,1),Z(k,2),Z(k,3),'Color',bc,'LineWidth',2,'LineStyle',LS);
0165   k = [6 4 5]; 
0166   plot3(Z(k,1),Z(k,2),Z(k,3),'Color',bc,'LineWidth',2,'LineStyle',LS);
0167   k = [4 2 3]; 
0168   plot3(Z(k,1),Z(k,2),Z(k,3),'Color',bc,'LineWidth',2,'LineStyle',LS);
0169   k = [2 1]; 
0170   plot3(Z(k,1),Z(k,2),Z(k,3),'Color',bc,'LineWidth',2,'LineStyle',LS);
0171 
0172   if LSugar > 0,
0173     A = {'C1*','C2*','O2*','C3*','O3*','C4*','O4*','C5*','O5*','P','O1P','O2P'};
0174     for j=1:12,
0175       text(Z(j,1)+0.1,Z(j,2),Z(j,3), A{j},'fontweight','bold','FontSize',LSugar);
0176     end
0177   end
0178  end
0179 end
0180 
0181 if LB > 0,
0182   text(X(1,1)+0.5,X(1,2),X(1,3)+0.5,[NT.Base NT.Number],'fontweight','bold','FontSize',LB);
0183 %  text(X(1,1)+0.5,X(1,2),X(1,3)+0.5,[NT.Base NT.Number],'fontweight','bold','FontSize',LB);
0184 end

Generated on Fri 03-Apr-2009 09:52:35 by m2html © 2003