Line number | Message |
10 | The value assigned to variable 'discard' might be unused. |
26 | The variable 'centromeres' appears to change size on every loop iteration. Consider preallocating for speed. |
27 | The variable 'centromeres' appears to change size on every loop iteration. Consider preallocating for speed. |
28 | The variable 'centromeres' appears to change size on every loop iteration. Consider preallocating for speed. |
33 | Using ISEMPTY is usually faster than comparing LENGTH to 0. |
43 | The value assigned to variable 'discard' might be unused. |
59 | The variable 'chrSize' appears to change size on every loop iteration. Consider preallocating for speed. |
60 | The variable 'chrSize' appears to change size on every loop iteration. Consider preallocating for speed. |
61 | The variable 'chrSize' appears to change size on every loop iteration. Consider preallocating for speed. |
65 | Using ISEMPTY is usually faster than comparing LENGTH to 0. |
75 | The value assigned to variable 'discard' might be unused. |
114 | The variable 'annotations' appears to change size on every loop iteration. Consider preallocating for speed. |
115 | The variable 'annotations' appears to change size on every loop iteration. Consider preallocating for speed. |
116 | The variable 'annotations' appears to change size on every loop iteration. Consider preallocating for speed. |
117 | The variable 'annotations' appears to change size on every loop iteration. Consider preallocating for speed. |
118 | The variable 'annotations' appears to change size on every loop iteration. Consider preallocating for speed. |
119 | The variable 'annotations' appears to change size on every loop iteration. Consider preallocating for speed. |
120 | The variable 'annotations' appears to change size on every loop iteration. Consider preallocating for speed. |
121 | The variable 'annotations' appears to change size on every loop iteration. Consider preallocating for speed. |
139 | The value assigned to variable 'discard' might be unused. |
153 | If you are operating on scalar values, consider using STR2DOUBLE for faster performance. |
154 | If you are operating on scalar values, consider using STR2DOUBLE for faster performance. |
155 | If you are operating on scalar values, consider using STR2DOUBLE for faster performance. |
156 | If you are operating on scalar values, consider using STR2DOUBLE for faster performance. |
178 | The variable 'figure_details' appears to change size on every loop iteration. Consider preallocating for speed. |
179 | The variable 'figure_details' appears to change size on every loop iteration. Consider preallocating for speed. |
180 | The variable 'figure_details' appears to change size on every loop iteration. Consider preallocating for speed. |
181 | The variable 'figure_details' appears to change size on every loop iteration. Consider preallocating for speed. |
182 | The variable 'figure_details' appears to change size on every loop iteration. Consider preallocating for speed. |
183 | The variable 'figure_details' appears to change size on every loop iteration. Consider preallocating for speed. |
184 | The variable 'figure_details' appears to change size on every loop iteration. Consider preallocating for speed. |
185 | The variable 'figure_details' appears to change size on every loop iteration. Consider preallocating for speed. |
186 | If you are operating on scalar values, consider using STR2DOUBLE for faster performance. |
191 | If you are operating on scalar values, consider using STR2DOUBLE for faster performance. |
195 | Using ISEMPTY is usually faster than comparing LENGTH to 0. |
213 | If you are operating on scalar values, consider using STR2DOUBLE for faster performance. |
221 | The variable 'figure_details' appears to change size on every loop iteration. Consider preallocating for speed. |
time | calls | line |
---|
| | 1 | function [centromeres, chrSize, figure_details, annotations, figInfo_ploidy_default] = Load_genome_information(genomeDir)
|
| 2 | 2 | fprintf(['\nLoad_genome_information_1.m : Genome in use : [' genomeDir ']\n']);
|
| | 3 |
|
| | 4 | % Load centromere definition file.
|
| | 5 | % This is text file containing one header line and two columns.
|
| | 6 | % The two columns hold the start and end bp for the centromeres, with
|
| | 7 | % respect to each chromosome.
|
| 2 | 8 | centromeres = [];
|
| 2 | 9 | centromere_fid = fopen([genomeDir 'centromere_locations.txt'], 'r');
|
| 2 | 10 | discard = fgetl(centromere_fid);
|
| 2 | 11 | lines_analyzed = 0;
|
| 2 | 12 | fprintf(['\t' genomeDir '/centromere_locations.txt\n']);
|
| 2 | 13 | while not (feof(centromere_fid))
|
| 16 | 14 | lineData = fgetl(centromere_fid);
|
| 16 | 15 | lines_analyzed = lines_analyzed+1;
|
| 16 | 16 | cen_chr = sscanf(lineData, '%s',1);
|
| 16 | 17 | cen_start = sscanf(lineData, '%s',2);
|
| 16 | 18 | for i = 1:size(sscanf(lineData,'%s',1),2);
|
| 16 | 19 | cen_start(1) = [];
|
| 16 | 20 | end;
|
| 16 | 21 | cen_end = sscanf(lineData, '%s',3);
|
| 16 | 22 | for i = 1:size(sscanf(lineData,'%s',2),2);
|
| 32 | 23 | cen_end(1) = [];
|
| 32 | 24 | end;
|
0.01 | 16 | 25 | chr = str2double(cen_chr);
|
| 16 | 26 | centromeres(chr).chr = chr;
|
| 16 | 27 | centromeres(chr).start = str2double(cen_start);
|
| 16 | 28 | centromeres(chr).end = str2double(cen_end);
|
0.01 | 16 | 29 | fprintf(['\t\t|' lineData '\n']);
|
| 16 | 30 | end;
|
| 2 | 31 | fclose(centromere_fid);
|
| 2 | 32 | clear cen_start cen_end line lines_analyzed i ans cen_chr centromere_fid chromosome;
|
| 2 | 33 | if (length(centromeres) == 0)
|
| | 34 | error('[analyze_CNVs]: Centromere definition file is missing.');
|
| | 35 | end;
|
| | 36 |
|
| | 37 | % Load chromosome size definition file.
|
| | 38 | % This is text file containing one header line and two columns.
|
| | 39 | % The two columns hold the start and end bp for the centromeres, with
|
| | 40 | % respect to each chromosome.
|
| 2 | 41 | chrSize = [];
|
0.01 | 2 | 42 | chrSize_fid = fopen([genomeDir '/chromosome_sizes.txt'],'r');
|
| 2 | 43 | discard = fgetl(chrSize_fid);
|
| 2 | 44 | lines_analyzed = 0;
|
| 2 | 45 | fprintf(['\t' genomeDir '/chromosome_sizes.txt\n']);
|
| 2 | 46 | while not (feof(chrSize_fid))
|
| 16 | 47 | lineData = fgetl(chrSize_fid);
|
| 16 | 48 | lines_analyzed = lines_analyzed+1;
|
| 16 | 49 | size_chr = sscanf(lineData, '%s',1);
|
| 16 | 50 | size_size = sscanf(lineData, '%s',2);
|
| 16 | 51 | for i = 1:size(sscanf(lineData,'%s',1),2);
|
| 16 | 52 | size_size(1) = [];
|
| 16 | 53 | end;
|
| 16 | 54 | size_name = sscanf(lineData, '%s',3);
|
| 16 | 55 | for i = 1:size(sscanf(lineData,'%s',2),2);
|
| 126 | 56 | size_name(1) = [];
|
| 126 | 57 | end;
|
| 16 | 58 | chr = str2double(size_chr);
|
| 16 | 59 | chrSize(chr).chr = chr;
|
0.01 | 16 | 60 | chrSize(chr).size = str2double(size_size);
|
| 16 | 61 | chrSize(chr).name = size_name;
|
| 16 | 62 | fprintf(['\t\t|' lineData '\n']);
|
| 16 | 63 | end;
|
| 2 | 64 | fclose(chrSize_fid);
|
| 2 | 65 | if (length(chrSize) == 0)
|
| | 66 | error('[analyze_CNVs]: Chromosome size definition file is missing.');
|
| | 67 | end;
|
| | 68 |
|
| | 69 | % Load additional annotation location definition file.
|
| | 70 | % This is text file containing one header line and two columns.
|
| | 71 | % The two columns hold the start and end bp for the centromeres, with
|
| | 72 | % respect to each chromosome.
|
| 2 | 73 | annotations = [];
|
| 2 | 74 | annotations_fid = fopen([genomeDir '/annotations.txt'], 'r');
|
| 2 | 75 | discard = fgetl(annotations_fid);
|
| 2 | 76 | lines_analyzed = 0;
|
| 2 | 77 | annotations_count = 0;
|
| 2 | 78 | fprintf(['\t' genomeDir '/annotations.txt\n']);
|
| 2 | 79 | while not (feof(annotations_fid))
|
| | 80 | lineData = fgetl(annotations_fid);
|
| | 81 | if (strcmp(lineData(1),'#') == 0)
|
| | 82 | lines_analyzed = lines_analyzed+1;
|
| | 83 | annotations_chr = sscanf(lineData, '%s',1);
|
| | 84 | annotations_type = sscanf(lineData, '%s',2);
|
| | 85 | for i = 1:size(sscanf(lineData,'%s',1),2);
|
| | 86 | annotations_type(1) = [];
|
| | 87 | end;
|
| | 88 | annotations_start = sscanf(lineData, '%s',3);
|
| | 89 | for i = 1:size(sscanf(lineData,'%s',2),2);
|
| | 90 | annotations_start(1) = [];
|
| | 91 | end;
|
| | 92 | annotations_end = sscanf(lineData, '%s',4);
|
| | 93 | for i = 1:size(sscanf(lineData,'%s',3),2);
|
| | 94 | annotations_end(1) = [];
|
| | 95 | end;
|
| | 96 | annotations_name = sscanf(lineData, '%s',5);
|
| | 97 | for i = 1:size(sscanf(lineData,'%s',4),2);
|
| | 98 | annotations_name(1) = [];
|
| | 99 | end;
|
| | 100 | annotations_fillcolor = sscanf(lineData, '%s',6);
|
| | 101 | for i = 1:size(sscanf(lineData,'%s',5),2);
|
| | 102 | annotations_fillcolor(1) = [];
|
| | 103 | end;
|
| | 104 | annotations_edgecolor = sscanf(lineData, '%s',7);
|
| | 105 | for i = 1:size(sscanf(lineData,'%s',6),2);
|
| | 106 | annotations_edgecolor(1) = [];
|
| | 107 | end;
|
| | 108 | annotations_size = sscanf(lineData, '%s',8);
|
| | 109 | for i = 1:size(sscanf(lineData,'%s',7),2);
|
| | 110 | annotations_size(1) = [];
|
| | 111 | end;
|
| | 112 |
|
| | 113 | annotations_count = annotations_count+1;
|
| | 114 | annotations(annotations_count).chr = str2double(annotations_chr);
|
| | 115 | annotations(annotations_count).type = annotations_type;
|
| | 116 | annotations(annotations_count).start = str2double(annotations_start);
|
| | 117 | annotations(annotations_count).end = str2double(annotations_end);
|
| | 118 | annotations(annotations_count).name = annotations_name;
|
| | 119 | annotations(annotations_count).fillcolor = annotations_fillcolor;
|
| | 120 | annotations(annotations_count).edgecolor = annotations_edgecolor;
|
| | 121 | annotations(annotations_count).size = str2double(annotations_size);
|
| | 122 | fprintf(['\t\t|' lineData '\n']);
|
| | 123 | end;
|
| | 124 | end;
|
| 2 | 125 | fclose(annotations_fid);
|
| | 126 |
|
| | 127 | % Load figure definition file.
|
| | 128 | % This is text file containing one header line and seven columns.
|
| | 129 | % Chr # : Numerical designations of chromosomes. (0 is used for line defining figure key.)
|
| | 130 | % Chr label : The label to use for identifying the chromosome in the figure.
|
| | 131 | % Chr name : The full name of the chromosome.
|
| | 132 | % Chr posX : The X-position in % from left to right.
|
| | 133 | % Chr posY : The Y-position in % from bottom to top.
|
| | 134 | % Chr width : The width in %.
|
| | 135 | % Chr height : The height in %.
|
| 2 | 136 | figInfo_ploidy_default = 2.0;
|
| 2 | 137 | figure_details = [];
|
| 2 | 138 | figInfo_fid = fopen([genomeDir '/figure_definitions.txt'], 'r');
|
| 2 | 139 | discard = fgetl(figInfo_fid);
|
| 2 | 140 | lines_analyzed = 0;
|
0.01 | 2 | 141 | fprintf(['\t' genomeDir '/figure_definitions.txt\n']);
|
| 2 | 142 | while not (feof(figInfo_fid))
|
| 18 | 143 | lineData = fgetl(figInfo_fid);
|
| 18 | 144 | figInfo_chr = sscanf(lineData, '%s',1);
|
| 18 | 145 | figInfo_useChr = sscanf(lineData, '%s',2);
|
| 18 | 146 | for i = 1:size(sscanf(lineData,'%s',1),2);
|
| 18 | 147 | figInfo_useChr(1) = [];
|
| 18 | 148 | end;
|
| 18 | 149 | figInfo_label = sscanf(lineData, '%s',3);
|
| 18 | 150 | for i = 1:size(sscanf(lineData,'%s',2),2);
|
| 36 | 151 | figInfo_label(1) = [];
|
| 36 | 152 | end;
|
| 18 | 153 | if (str2num(figInfo_chr) > 0) || ...
|
| | 154 | (str2num(figInfo_useChr) > 0) || ...
|
| | 155 | ((str2num(figInfo_chr) == 0) && (strcmp(figInfo_label,'Key') == 1)) || ...
|
| | 156 | ((str2num(figInfo_chr) == 0) && (strcmp(figInfo_label,'Mito') == 1))
|
| 16 | 157 | lines_analyzed = lines_analyzed+1;
|
| 16 | 158 | figInfo_name = sscanf(lineData, '%s',4);
|
| 16 | 159 | for i = 1:size(sscanf(lineData,'%s',3),2);
|
| 96 | 160 | figInfo_name(1) = [];
|
| 96 | 161 | end;
|
| 16 | 162 | figInfo_posX = sscanf(lineData, '%s',5);
|
| 16 | 163 | for i = 1:size(sscanf(lineData,'%s',4),2);
|
0.01 | 512 | 164 | figInfo_posX(1) = [];
|
0.01 | 512 | 165 | end;
|
| 16 | 166 | figInfo_posY = sscanf(lineData, '%s',6);
|
| 16 | 167 | for i = 1:size(sscanf(lineData,'%s',5),2);
|
| 576 | 168 | figInfo_posY(1) = [];
|
| 576 | 169 | end;
|
| 16 | 170 | figInfo_width = sscanf(lineData, '%s',7);
|
| 16 | 171 | for i = 1:size(sscanf(lineData,'%s',6),2);
|
| 834 | 172 | figInfo_width(1) = [];
|
0.01 | 834 | 173 | end;
|
| 16 | 174 | figInfo_height = sscanf(lineData, '%s',8);
|
| 16 | 175 | for i = 1:size(sscanf(lineData,'%s',7),2);
|
| 854 | 176 | figInfo_height(1) = [];
|
0.02 | 854 | 177 | end;
|
| 16 | 178 | figure_details(lines_analyzed).chr = str2double(figInfo_chr);
|
| 16 | 179 | figure_details(lines_analyzed).label = figInfo_label;
|
| 16 | 180 | figure_details(lines_analyzed).name = figInfo_name;
|
| 16 | 181 | figure_details(lines_analyzed).useChr = figInfo_useChr;
|
0.02 | 16 | 182 | figure_details(lines_analyzed).posX = str2double(figInfo_posX);
|
| 16 | 183 | figure_details(lines_analyzed).posY = str2double(figInfo_posY);
|
| 16 | 184 | figure_details(lines_analyzed).width = figInfo_width;
|
| 16 | 185 | figure_details(lines_analyzed).height = str2double(figInfo_height);
|
| 2 | 186 | elseif ((str2num(figInfo_chr) == 0) && (strcmp(figInfo_label,'Ploidy') == 1))
|
| | 187 | figInfo_ploidy_default = sscanf(lineData, '%s',4);
|
| | 188 | for i = 1:size(sscanf(lineData,'%s',3),2);
|
| | 189 | figInfo_ploidy_default(1) = [];
|
| | 190 | end;
|
| | 191 | figInfo_ploidy_default = str2num(figInfo_ploidy_default);
|
| | 192 | end;
|
| 18 | 193 | fprintf(['\t\t|' lineData '\n']);
|
| 18 | 194 | end;
|
| 2 | 195 | if (length(figure_details) == 0)
|
| | 196 | error('[analyze_CNVs]: Figure display definition file is missing.');
|
| | 197 | end;
|
| | 198 |
|
| | 199 | %% figure out widths for chromosomes in figure.
|
| 2 | 200 | maxFigSize = 0;
|
| 2 | 201 | maxChrSize = 0;
|
| 2 | 202 | for i = 1:length(figure_details)
|
0.01 | 16 | 203 | fprintf(['Fig_chr : [' num2str(figure_details(i).chr) '|']);
|
| 16 | 204 | fprintf([figure_details(i).label '|']);
|
| 16 | 205 | fprintf([figure_details(i).name '|']);
|
0.01 | 16 | 206 | fprintf([num2str(figure_details(i).posX) '|']);
|
| 16 | 207 | fprintf([num2str(figure_details(i).posY) '|']);
|
| 16 | 208 | fprintf([figure_details(i).width '|']);
|
0.01 | 16 | 209 | fprintf([num2str(figure_details(i).height) ']\n']);
|
| | 210 |
|
| 16 | 211 | if (figure_details(i).chr > 0)
|
0.01 | 16 | 212 | if (strcmp(figure_details(i).width(1),'*') == 0)
|
| 2 | 213 | maxFigSize = str2num(figure_details(i).width);
|
| 2 | 214 | maxChrSize = chrSize(figure_details(i).chr).size;
|
| 2 | 215 | end;
|
| 16 | 216 | end;
|
| 16 | 217 | end;
|
| 2 | 218 | for i = 1:length(figure_details)
|
| 16 | 219 | if (figure_details(i).chr > 0)
|
0.01 | 16 | 220 | currentChrSize = chrSize(figure_details(i).chr).size;
|
| 16 | 221 | figure_details(i).width = currentChrSize/maxChrSize*maxFigSize;
|
| 16 | 222 | end;
|
| 16 | 223 | end;
|
| 2 | 224 | fclose(figInfo_fid);
|
| | 225 |
|
| 2 | 226 | end
|