%Nodes_m5S.m

n=1;                                            % current node
  Node(n).type      = 'Initial';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).lpar      = 1;                        % left insertion parameter
  Node(n).rpar      = 1;    
  
n=2;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,3,2,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.04*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.04*ones(16,1); 0];     % right insertion parameters

n=3;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,3,2,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.04*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.04*ones(16,1); 0];     % right insertion parameters
 
n=4;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,2,3,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.04*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.04*ones(16,1); 0];     % right insertion parameters

n=5;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,3,2,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.04*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.04*ones(16,1); 0];     % right insertion parameters
  
n=6;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,3,2,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.04*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.04*ones(16,1); 0];     % right insertion parameters
  
n=7;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,2,3,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [1*ones(16,1); 0];        % left insertion parameters  
  Node(n).rpar      = [0.04*ones(16,1); 0];     % right insertion parameters
  
n=8;                                            % current node
   Node(n).type      = 'Junction';               % node type
   Node(n).nextnode  =  [9 26];                   % index of next node in tree
   Node(n).P         = ones(17,1);               % state to state transitions
   Node(n).PIns      = 1;                        % when no previous state
   Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
   Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters
   Node(n).minlength = 40;                       % min subsequence length
   Node(n).maxlength = 70;                       % max subsequence length

% 11-68 ---------------------------------------------------------

n=9;                                            % current node
  Node(n).type      = 'Initial';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).lpar      = 1;                        % left insertion parameter
  Node(n).rpar      = 1;                        % right insertion parameter
  
n=10; % add left insertions
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(12,1,3,0.01);
  Node(n).P         = ones(1,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters  

n=11;                                            % current node
  Node(n).type      = 'Motif';                  % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).P         = [0.05*ones(17,1) 0.95*ones(17,1)];
                                                % state to state transitions
  Node(n).PIns	    = [0.05 0.95];              % when no previous state
  Node(n).Left(1,:) = [1 2];                    % nucleotides to use on left
  Node(n).LIP       = [1];                      % probs for insertion possibs
  Node(n).Right(1,:)= [3 2 1];                      % nucleotides to use on right
  Node(n).RIP       = [1];                      % probs for insertion possibs
  Node(n).IBases(1,:)  = [1 5];
  Node(n).Score(:,:,1) = pIsoScore(1,3,2);
  Node(n).IBases(2,:)  = [2 4];
  Node(n).Score(:,:,2) = pIsoScore(1,2,3);
  Node(n).IBases(3,:)  = [3 5];
  Node(n).Score(:,:,3) = pIsoScore(-6,1,2);  
  
n=12;                                            % current node
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).P         = ones(17,1)*canonical;     % state to state transitions
  Node(n).PIns	    = canonical;                % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=13;                                            % current node
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).P         = ones(17,1)*canonical;     % state to state transitions
  Node(n).PIns	    = canonical;                % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=14;                                            % current node
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).P         = ones(17,1)*canonical;     % state to state transitions
  Node(n).PIns	    = canonical;                % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=15;                                            % current node
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).P         = ones(17,1)*canonical;     % state to state transitions
  Node(n).PIns	    = canonical;                % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=16;                                            % current node
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).P         = ones(17,1)*canonical;     % state to state transitions
  Node(n).PIns	    = canonical;                % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=17;                                            % current node
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).P         = ones(17,1)*canonical;     % state to state transitions
  Node(n).PIns	    = canonical;                % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=18;                                            % current node
  Node(n).type      = 'Motif';                  % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).P         = [0.05*ones(17,1) 0.95*ones(17,1)];
                                                % state to state transitions
  Node(n).PIns	    = [0.05 0.95];              % when no previous state
  Node(n).Left(1,:) = [1 4 5];                    % nucleotides to use on left
  Node(n).Left(2,:) = [1 3 4];     
  Node(n).Left(3,:) = [1 2 3];     
  Node(n).Left(4,:) = [1 5 6];     
  Node(n).LIP       = [ 0.025 0.025 0.9 0.025 0.025]; % probs for insertion possibs
  Node(n).Right(1,:)= [1];                      % nucleotides to use on right
  Node(n).RIP       = [1];                        % probs for insertion possibs
  Node(n).IBases(1,:)  = [1 2];
  Node(n).Score(:,:,1) = pIsoScore(6.0,3,2);
  Node(n).IBases(2,:)  = [3 4];
  Node(n).Score(:,:,2) = pIsoScore(1.0,2,3);

n=19;                                            % current node
  Node(n).type      = 'Motif';                  % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).P         = [0.05*ones(17,1) 0.95*ones(17,1)];
                                                % state to state transitions
  Node(n).PIns	    = [0.05 0.95];              % when no previous state
  Node(n).Left(1,:) = [1 2];                    % nucleotides to use on left
  Node(n).Left(2,:) = [1 3];     
  Node(n).LIP       = [0.9 0.1];                % probs for insertion possibs
  Node(n).Right(1,:)= [5 4 2 1];                % nucleotides to use on right
  Node(n).Right(2,:)= [4 3 2 1];                % nucleotides to use on right
  Node(n).RIP       = [0.9 0.1];                % probs for insertion possibs
  Node(n).IBases(1,:)  = [1 6];
  Node(n).Score(:,:,1) = pIsoScore(6.1,4,1);
  Node(n).IBases(2,:)  = [2 5];
  Node(n).Score(:,:,2) = pIsoScore(5.0,2,1);

n=20;                                            % current node
  Node(n).type      = 'Motif';                  % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).P         = [0.05*ones(17,1) 0.95*ones(17,1)];
                                                % state to state transitions
  Node(n).PIns	    = [0.05 0.95];              % when no previous state
  Node(n).Left(1,:) = [1];                      % nucleotides to use on left
  Node(n).LIP       = [1];                      % probs for insertion possibs
  Node(n).Right(1,:)= [3 2 1];                  % nucleotides to use on right
  Node(n).Right(2,:)= [4 3 1];                  % nucleotides to use on right
  Node(n).RIP       = [0.9 0.1];                % probs for insertion possibs
  Node(n).IBases(1,:)  = [1 4];
  Node(n).Score(:,:,1) = pIsoScore(5.0,2,1);
  Node(n).IBases(2,:)  = [3 4];
  Node(n).Score(:,:,2) = pIsoScore(9.0,1,1);
  Node(n).IBases(3,:)  = [1 2];
  Node(n).Score(:,:,3) = pIsoScore(1.0,2,3);

n=21;                                            % current node
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).P         = ones(17,1)*canonical;     % state to state transitions
  Node(n).PIns	    = canonical;                % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=22;                                            % current node
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).P         = ones(17,1)*canonical;     % state to state transitions
  Node(n).PIns	    = canonical;                % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=23;                                            % current node
  Node(n).type      = 'Motif';                  % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).P         = [0.05*ones(17,1) 0.95*ones(17,1)];
                                                % state to state transitions
  Node(n).PIns	    = [0.05 0.95];              % when no previous state
  Node(n).Left(1,:) = [1 3];                    % nucleotides to use on left
  Node(n).Left(2,:) = [1 4];     
  Node(n).LIP       = [0.1 0.9];                % probs for insertion possibs
  Node(n).Right(1,:)= [1];                      % nucleotides to use on right
  Node(n).RIP       = 1;                        % probs for insertion possibs
  Node(n).IBases(1,:)  = [1 3];
  Node(n).Score(:,:,1) = pIsoScore(1.0,4,1);
  Node(n).IBases(2,:)  = [2 3];
  Node(n).Score(:,:,2) = pIsoScore(-5.0,2,1);

n=24;                                            % current node
  Node(n).type      = 'Motif';                  % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).P         = [0.05*ones(17,1) 0.95*ones(17,1)];
                                                % state to state transitions
  Node(n).PIns	    = [0.05 0.95];              % when no previous state
  Node(n).Left(1,:) = [1 2 3];                  % nucleotides to use on left
  Node(n).Left(2,:) = [1 3 4];                  % nucleotides to use on left
  Node(n).Left(3,:) = [1 2 4];                  % nucleotides to use on left
  Node(n).LIP       = [0.8 0.1 0.1];            % probs for insertion possibs
  Node(n).Right(1,:)= [4 3 2 1];                % nucleotides to use on right
  Node(n).RIP       = 1;                        % probs for insertion possibs
  Node(n).IBases(1,:)  = [1 4];
  Node(n).Score(:,:,1) = pIsoScore(1.0,2,3);
  Node(n).IBases(2,:)  = [2 6];
  Node(n).Score(:,:,2) = pIsoScore(5.0,1,1);
  Node(n).IBases(3,:)  = [3 5];
  Node(n).Score(:,:,3) = pIsoScore(10.0,4,1);
  Node(n).IBases(4,:)  = [4 7];
  Node(n).Score(:,:,4) = pIsoScore(6.0,3,2);

n=25;                                            % current node
  Node(n).type      = 'Hairpin';                % node type
  Node(n).subtype   = 'None';                   % nothing special
  Node(n).nextnode  = Inf;                      % index of next node in tree
  Node(n).P         = ones(17,1);               % state to state transitions
  Node(n).PIns      = 1;                        % when no previous state

%   % 69-112 ---------------------------------------------------------------------

 n=26;                                            % current node
  Node(n).type      = 'Initial';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).lpar      = 0.05;                     % left insertion parameter
  Node(n).rpar      = 0.05;                     % right insertion parameter

for n=27:28
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,4,4,0.01);    
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters  
end
  
n=29;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,2,3,0.02);    % slightly higher del prob
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

for n=30:32,
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,2,3,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters
end

n=33;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,2,3,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.04*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.04*ones(16,1); 0];     % right insertion parameters

n=34;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(10,3,1,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=35;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(8,1,1,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=36;                                            % current node
  Node(n).type      = 'Motif';                  % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Node(n).P         = [0.05*ones(17,1) 0.95*ones(17,1)];
                                                % state to state transitions
  Node(n).PIns	    = [0.05 0.95];              % when no previous state
  Node(n).Left(1,:) = [1 2];                    % nucleotides to use on left
  Node(n).LIP       = [1];                      % probs for insertion possibs
  Node(n).Right(1,:)= [1];                      % nucleotides to use on right
  Node(n).RIP       = [1];                      % probs for insertion possibs
  Node(n).IBases(1,:)  = [1 2];
  Node(n).Score(:,:,1) = pIsoScore(-9,3,4);
  Node(n).IBases(2,:)  = [2 3];
  Node(n).Score(:,:,2) = pIsoScore(-4,4,1);

n=37;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(10,1,3,0.01);
  Node(n).P         = ones(1,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=38;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,2,3,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=39;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,4,3,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=40;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,3,4,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=41;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,3,2,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=42;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,1,4,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=43;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,3,2,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [1*ones(16,1); 0];        % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=44;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,3,2,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=45;
  Node(n).type      = 'Basepair';                % node type
  Node(n).nextnode  = n+1;                      % index of next node in tree
  Score             = pIsoScore(1,2,3,0.01);
  Node(n).P         = ones(17,1)*Score;         % state to state transitions
  Node(n).PIns	    = Score;                    % when no previous state
  Node(n).lpar      = [0.01*ones(16,1); 0];     % left insertion parameters
  Node(n).rpar      = [0.01*ones(16,1); 0];     % right insertion parameters

n=46;                                           % current node
  Node(n).type      = 'Hairpin';                % node type
  Node(n).subtype   = 'GNRA';                   % GNRA loop
  Node(n).nextnode  = Inf;                      % index of next node in tree
  Node(n).P         = ones(17,1);               % state to state transitions
  Node(n).PIns      = 1;                        % when no previous state

  