Home > FR3DSource > zWriteNucleotidePDB.m

zWriteNucleotidePDB

PURPOSE ^

zWriteNucleotidePDB(fid,NT,a,c,R,Sh) writes the atoms of nucleotide NT, with

SYNOPSIS ^

function [a] = zWriteNucleotidePDB(fid,NT,a,c,R,Sh)

DESCRIPTION ^

 zWriteNucleotidePDB(fid,NT,a,c,R,Sh) writes the atoms of nucleotide NT, with
 hydrogens, to the current file id.
 If specified, it rotates by R, shifts by sh, puts each c set off from
 the others by 20*c Angstroms

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % zWriteNucleotidePDB(fid,NT,a,c,R,Sh) writes the atoms of nucleotide NT, with
0002 % hydrogens, to the current file id.
0003 % If specified, it rotates by R, shifts by sh, puts each c set off from
0004 % the others by 20*c Angstroms
0005 
0006 function [a] = zWriteNucleotidePDB(fid,NT,a,c,R,Sh)
0007 
0008 if nargin < 4,
0009   c = 0;
0010 end
0011 
0012 if nargin < 5,
0013   c = 0;
0014   R = eye(3);
0015   Sh = [0 0 0];
0016 end
0017 
0018 x = mod(c,30);                       % shift along x axis
0019 y = mod(fix(c/30),30);               % shift along y axis
0020 z = mod(fix(c/900),900);             % shift along z axis
0021 
0022 Lim(1,:) = [10 8 11 8];       % number of base atoms, excluding hydrogen
0023 Lim(2,:) = [15 13 16 12];     % total number of atoms, including hydrogen
0024 Lim(3,:) = [13  9 14 10];     % locations of fictitious hydrogens
0025 
0026 A = {' N9' ' C4' ' N3' ' N1' ' C6' ' N6' ' C8' ' C5' ' C2' ' N7' ' H2' ' H8' ' H9' '1H6' '2H6'};
0027 C = {' N1' ' C2' ' O2' ' N3' ' C4' ' N4' ' C6' ' C5' ' H1' ' H6' ' H5' '1H4' '2H4'};
0028 G = {' N9' ' C4' ' N3' ' N1' ' C6' ' O6' ' C8' ' C5' ' C2' ' N7' ' N2' ' H1' ' H8' ' H9' '1H2' '2H2'};
0029 U = {' N1' ' C2' ' O2' ' N3' ' C4' ' O4' ' C6' ' C5' ' H5' ' H1' ' H3' ' H6'};
0030 S = {' C1*' ' C2*' ' O2*' ' C3*' ' O3*' ' C4*' ' O4*' ' C5*' ' O5*' ' P  ' ' O1P' ' O2P'};
0031 %      1     2     3     4     5     6     7     8     9     10  11    12
0032 SugarReorder = [10 11 12 9 8 6 7 4 5 2 3 1];
0033 
0034   for k = 1:min(12,length(NT.Sugar(:,1))),         % loop through sugar atoms
0035     j = SugarReorder(k);
0036     fprintf(fid, 'ATOM  %5d', a);
0037     fprintf(fid,' %3s', S{j});
0038     fprintf(fid, '   %1s', NT.Base);
0039     fprintf(fid, ' %1s', NT.Chain);
0040     fprintf(fid, '%4s    ', NT.Number);
0041     L = (NT.Sugar(j,:) - Sh)*R;
0042     L = L + 30*[x y z];
0043     fprintf(fid, '%8.3f', L);
0044     fprintf(fid, '%6.2f', 1);
0045     fprintf(fid, '%6.2f\n', 99.99);
0046     a = a + 1;
0047   end
0048   for j = 1:Lim(2,NT.Code),                    % loop through base atoms and H
0049     if j ~= Lim(3,NT.Code),
0050       fprintf(fid, 'ATOM  %5d', a);
0051       switch NT.Code,
0052         case 1, fprintf(fid,' %3s', A{j});
0053         case 2, fprintf(fid,' %3s', C{j});
0054         case 3, fprintf(fid,' %3s', G{j});
0055         case 4, fprintf(fid,' %3s', U{j});
0056       end
0057       fprintf(fid, '    %1s', NT.Base);
0058       fprintf(fid, ' %1s',  NT.Chain);
0059       fprintf(fid, '%4s    ',   NT.Number);
0060       L = (NT.Fit(j,:) - Sh)*R;
0061       L = L + 30*[x y z];                        % shift 20 Angstroms
0062       fprintf(fid, '%8.3f', L);                  % write atom location
0063       fprintf(fid, '%6.2f', 1);
0064       fprintf(fid, '%6.2f\n', 99.99);
0065       a = a + 1;
0066     end
0067   end

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