   aln_after_filter_length           INT(10) UNSIGNED,
   aln_length                        INT(10) UNSIGNED,
   aln_num_residues                  INT(10) UNSIGNED,
-  aln_percent_identity              FLOAT(5,5)
+  aln_percent_identity              FLOAT(5,5),
   best_fit_model_family             VARCHAR(10),
   best_fit_model_parameter          VARCHAR(5),
   gene_count                        INT(10) UNSIGNED,
-  k_score                           FLOAT(5,5)
+  k_score                           FLOAT(5,5),
   k_score_rank                      INT(10) UNSIGNED, 
   mcoffee_scores_gene_align_id      INT(10) UNSIGNED,      
   aln_n_removed_columns             INT(10) UNSIGNED,
   aln_num_of_patterns               INT(10) UNSIGNED, 
-  aln_shrinking_factor                  FLOAT(2,5)
+  aln_shrinking_factor              FLOAT(2,2),
   spec_count                        INT(10) UNSIGNED,
-  tree_max_branch                   FLOAT(4,5)
-  tree_max_length                   FLOAT(4,5) 
+  tree_max_branch                   FLOAT(5,5),
+  tree_max_length                   FLOAT(5,5),
   tree_num_dup_nodes                INT(10) UNSIGNED,
   tree_num_leaves                   INT(10) UNSIGNED,
   tree_num_spec_nodes               INT(10) UNSIGNED,


) COLLATE=latin1_swedish_ci ENGINE=MyISAM;

# Populate the new table
INSERT INTO gene_tree_root_attr (root_id, aln_after_filter_length) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'after_filter_length';
INSERT INTO gene_tree_root_attr (root_id, aln_length) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'aln_length';
INSERT INTO gene_tree_root_attr (root_id, aln_num_residues) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'aln_num_residues';
INSERT INTO gene_tree_root_attr (root_id, aln_percent_identity) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'aln_percent_identity';
INSERT INTO gene_tree_root_attr (root_id, best_fit_model_family) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'best_fit_model_family';
INSERT INTO gene_tree_root_attr (root_id, best_fit_model_parameter) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'best_fit_model_parameter';
INSERT INTO gene_tree_root_attr (root_id, gene_count) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'gene_count';
INSERT INTO gene_tree_root_attr (root_id, k_score) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'k_score';
INSERT INTO gene_tree_root_attr (root_id, k_score_rank) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'k_score_rank';
INSERT INTO gene_tree_root_attr (root_id, mcoffee_scores_gene_align_id) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'mcoffee_scores';
INSERT INTO gene_tree_root_attr (root_id, aln_n_removed_columns) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'n_removed_columns';
INSERT INTO gene_tree_root_attr (root_id, aln_num_of_patterns) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'num_of_patterns';
INSERT INTO gene_tree_root_attr (root_id, aln_shrinking_factor) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'shrinking_factor';
INSERT INTO gene_tree_root_attr (root_id, spec_count) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'spec_count';
INSERT INTO gene_tree_root_attr (root_id, tree_max_branch) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'tree_max_branch';
INSERT INTO gene_tree_root_attr (root_id, tree_max_length) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'tree_max_length';
INSERT INTO gene_tree_root_attr (root_id, tree_num_dup_nodes) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'tree_num_dup_nodes';
INSERT INTO gene_tree_root_attr (root_id, tree_num_leaves) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'tree_num_leaves';
INSERT INTO gene_tree_root_attr (root_id, tree_num_spec_nodes) SELECT root_id, value FROM gene_tree_root_tag WHERE tag = 'tree_num_spec_nodes';

DELETE FROM gene_tree_root_tag WHERE tag IN ( 'after_filter_length','aln_length','aln_num_residues','aln_percent_identity','best_fit_model_family','best_fit_model_parameter','gene_count','k_score','k_score_rank','mcoffee_scores','n_removed_columns','num_of_patterns','shrinking_factor','spec_count','tree_max_branch','tree_max_length','tree_num_dup_nodes','tree_num_leaves','tree_num_spec_nodes')

#
# Description:
#   Add new _attr table that can be used to store information (tags)

-- MySQL should 'die' on warnings, ensuring data is not truncated
SET session sql_mode='TRADITIONAL';
