time | calls | line |
---|
| | 1 | function [linear_fig_height,linear_fig_width,linear_left_padding,linear_chr_gap,linear_chr_max_width,linear_height...
|
| | 2 | ,linear_base,rotate,linear_chr_font_size,linear_axis_font_size,linear_gca_font_size,stacked_fig_height,stacked_fig_width,...
|
| | 3 | stacked_chr_font_size,stacked_title_size,stacked_axis_font_size,gca_stacked_font_size,stacked_copy_font_size,max_chrom_label_size] = Load_size_info(chr_in_use,num_chrs,chr_label,chr_size)
|
| 2 | 4 | fprintf('\n---------------------------------Load_size_info.m started---------------------------------------------------\n');
|
| | 5 |
|
| | 6 | %% calculating data used to determine size
|
| | 7 |
|
| | 8 | % calculate the number of chrs used
|
| 2 | 9 | num_chrs_used = 0;
|
| 2 | 10 | for chr = 1:num_chrs
|
| 18 | 11 | if (chr_in_use(chr) == 1)
|
| 16 | 12 | num_chrs_used = num_chrs_used + 1;
|
| 16 | 13 | end;
|
| 18 | 14 | end;
|
| 2 | 15 | fprintf('num_chrs_used - %d\n',num_chrs_used);
|
| | 16 |
|
| | 17 | % calculating the maximum length of chromosome label size for the height of linear figure
|
| 2 | 18 | max_chrom_label_size = 1;
|
| 2 | 19 | for chr = 1:num_chrs
|
| 18 | 20 | if (chr_in_use(chr) == 1)
|
| 16 | 21 | if (numel(chr_label{chr}) > numel(max_chrom_label_size))
|
| 16 | 22 | max_chrom_label_size = numel(chr_label{chr});
|
| 16 | 23 | end;
|
| 16 | 24 | end;
|
| 18 | 25 | end;
|
| 2 | 26 | fprintf('max_chrom_label_size - %d\n',max_chrom_label_size);
|
| | 27 |
|
| | 28 | %% global definitions
|
| | 29 | % the default dpi used by the system, in matlab no screen mode before 2014 it's 72dpi, and in later versions 150dpi
|
| 2 | 30 | if verLessThan('matlab','8.4')
|
| | 31 | % -- Code to run in MATLAB R2014a and earlier here --
|
| | 32 | system_dpi = 72;
|
| 2 | 33 | else
|
| | 34 | % -- Code to run in MATLAB R2014b and later here --
|
| 2 | 35 | system_dpi = 150;
|
| 2 | 36 | end;
|
| 2 | 37 | fprintf('using %d dpi\n',system_dpi);
|
| | 38 |
|
| | 39 | %% linear figure
|
| 2 | 40 | fprintf('-----------------------------------Linear Figure -----------------------------------------------\n');
|
| | 41 | % setting size for linear figure
|
| 2 | 42 | linear_fig_plot_height = 130; % the height of each chromosom in the figure in px (including y-axis)
|
| 2 | 43 | linear_fig_charc_height = 20; % the size to be allocated in px for each character in the label
|
| | 44 |
|
| 2 | 45 | linear_fig_height_px = linear_fig_plot_height + linear_fig_charc_height*max_chrom_label_size; % the total height of the linear figure in px
|
| | 46 | % normalize height according to dpi
|
| 2 | 47 | linear_fig_height = linear_fig_height_px / system_dpi;
|
| | 48 |
|
| 2 | 49 | linear_fig_width_px = 2400;
|
| 2 | 50 | linear_fig_width = linear_fig_width_px / system_dpi;
|
| | 51 |
|
| | 52 | % base value in matlab (the scaling here is from 0 to 1 and represent
|
| | 53 | % relative position
|
| 2 | 54 | linear_left_padding = 0.02; % left margin
|
| 2 | 55 | linear_right_padding = 0.02; % right margin
|
| 2 | 56 | linear_total_gap = 0.07; % the size in precentage for total gap accross all figure
|
| 2 | 57 | linear_cartoon_height_px = 111; % the size of the chromosome cartoon in pixles (without y-axis) for proper scaling
|
| 2 | 58 | linear_chr_gap = linear_total_gap/(num_chrs-1); % gaps between chr subfigures.
|
| 2 | 59 | linear_chr_max_width = 1 - linear_total_gap - linear_left_padding - linear_right_padding; % width for all chromosomes across figure. 1.00 - leftMargin - rightMargin - subfigure gaps.
|
| 2 | 60 | linear_height = linear_cartoon_height_px/ linear_fig_height_px; % the size
|
| 2 | 61 | linear_base = 0.1;
|
| | 62 |
|
| | 63 | % setting rotation
|
| | 64 | % if there are more than5 charcters in label 90 degrees rotation, else
|
| | 65 | % rotating accroding to lowest chromosome size
|
| | 66 | % 45 degrees boundries
|
| 2 | 67 | lower_boundary = 0.10;
|
| 2 | 68 | upper_boundary = 0.25;
|
| | 69 | % removing zero enteries in chromosom sizes
|
| 2 | 70 | chr_size_cleaned = chr_size(chr_size ~= 0);
|
| | 71 | % calculate ration between smallest chromosome size to highest
|
| 2 | 72 | ratio = min(chr_size_cleaned)/max(chr_size_cleaned);
|
| 2 | 73 | rotate = 0;
|
| 2 | 74 | if (max_chrom_label_size > 5)
|
| | 75 | rotate = 90;
|
| 2 | 76 | elseif (lower_boundary <= ratio && ratio <= upper_boundary)
|
| | 77 | rotate = 45;
|
| 2 | 78 | elseif(ratio < lower_boundary)
|
| | 79 | rotate = 90;
|
| | 80 | end;
|
| | 81 |
|
| | 82 | % font definitions
|
| 2 | 83 | linear_axis_font_size = 10;
|
| 2 | 84 | linear_gca_font_size = 12;
|
| 2 | 85 | linear_chr_font_size = 12;
|
| | 86 |
|
| 2 | 87 | fprintf('linear figure paramters:\n');
|
| 2 | 88 | fprintf('height:%d px, width:%d px, rotate:%d\n',linear_fig_height_px,linear_fig_width_px,rotate);
|
0.01 | 2 | 89 | fprintf('chr font size:%d, axis font size:%d px, gca font size:%d\n',linear_chr_font_size,linear_axis_font_size,linear_gca_font_size);
|
| | 90 |
|
| | 91 | %% stacked figure %%
|
| 2 | 92 | fprintf('-----------------------------------Stacked Figure -----------------------------------------------\n');
|
| | 93 |
|
| 2 | 94 | stacked_plot_height = 205; % size in pixels of each cartoon height including gap
|
| 2 | 95 | stacked_fig_height_px = stacked_plot_height*num_chrs_used; % the total height of the linear figure in px
|
| | 96 | % normalize height according to dpi
|
| 2 | 97 | stacked_fig_height = stacked_fig_height_px / system_dpi;
|
| | 98 |
|
| 2 | 99 | stacked_fig_width_px = 2400;
|
| 2 | 100 | stacked_fig_width = stacked_fig_width_px / system_dpi;
|
| | 101 |
|
| | 102 | % if the matlab version is less then 2016a then use scaling since the font doesn't scale well
|
| 2 | 103 | if verLessThan('matlab','9.0')
|
| | 104 | % -- Code to run in MATLAB R2016a and earlier here --
|
| | 105 | % the size of the stacked title normalized to 8 chromosomes (that appear
|
| | 106 | % right), 8 is what appeared correct in candida albicans, just increasing size makes figure look not good
|
| 2 | 107 | stacked_title_size = 18*(8/num_chrs_used);
|
| | 108 | % the size of axis values in stacked figure
|
| 2 | 109 | stacked_axis_font_size = 10*(8/num_chrs_used);
|
| | 110 | % the size of gca font in stacked mode
|
| 2 | 111 | gca_stacked_font_size = 12*(8/num_chrs_used);
|
| | 112 | % the size of chromosome text in stacked figure
|
| 2 | 113 | stacked_chr_font_size = 16*(8/num_chrs_used);
|
| | 114 | % the size of the copy beside figure in stacked
|
| 2 | 115 | stacked_copy_font_size = 20*(8/num_chrs_used);
|
| | 116 | else
|
| | 117 | % -- Code to run in MATLAB R2016a and later here --
|
| | 118 | stacked_title_size = 18;
|
| | 119 | % the size of axis values in stacked figure
|
| | 120 | stacked_axis_font_size = 10;
|
| | 121 | % the size of gca font in stacked mode
|
| | 122 | gca_stacked_font_size = 12;
|
| | 123 | % the size of chromosome text in stacked figure
|
| | 124 | stacked_chr_font_size = 16;
|
| | 125 | % the size of the copy beside figure in stacked
|
| | 126 | stacked_copy_font_size = 20;
|
| | 127 | end;
|
| | 128 |
|
| | 129 |
|
| | 130 |
|
| 2 | 131 | fprintf('stacked figure paramters:\n');
|
| 2 | 132 | fprintf('height:%d px, width:%d px, title size:%d\n',stacked_fig_height_px,stacked_fig_width_px,stacked_title_size);
|
| 2 | 133 | fprintf('chr font size:%d, axis font size:%d px, gca font size:%d\n',stacked_chr_font_size,stacked_axis_font_size,gca_stacked_font_size);
|
| | 134 |
|
| | 135 |
|
| | 136 |
|
| 2 | 137 | fprintf('\n---------------------------------Load_size_info.m ended---------------------------------------------------\n');
|
| | 138 |
|
| | 139 |
|
| 2 | 140 | end
|