Call Spots
Bleed Matrix
view_bleed_matrix
Diagnostic to plot bleed_matrix
. If config['call_spots']['bleed_matrix_method']
is 'single'
,
a single bleed_matrix
will be plotted. If it is 'separate'
, one will be shown for each round.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nb |
Notebook
|
Notebook containing experiment details. Must have run at least as far as |
required |
Source code in coppafish/plot/call_spots/bleed_matrix.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
view_bled_codes
Diagnostic to plot bleed_matrix
. If config['call_spots']['bleed_matrix_method']
is 'single'
,
a single bleed_matrix
will be plotted. If it is 'separate'
, one will be shown for each round.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nb |
Notebook
|
Notebook containing experiment details. Must have run at least as far as |
required |
Source code in coppafish/plot/call_spots/bleed_matrix.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
Spot Colors
view_codes
Diagnostic to compare spot_color
to bled_code
of predicted gene.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nb |
Notebook
|
Notebook containing experiment details. Must have run at least as far as |
required |
spot_no |
int
|
Spot of interest to be plotted. |
required |
method |
str
|
|
'anchor'
|
Source code in coppafish/plot/call_spots/spot_colors.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
|
view_spot
Diagnostic to show intensity of each color channel / round in neighbourhood of spot.
Will show a grid of n_use_channels x n_use_rounds
subplots.
Requires access to nb.file_names.tile_dir
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nb |
Notebook
|
Notebook containing experiment details. Must have run at least as far as |
required |
spot_no |
int
|
Spot of interest to be plotted. |
required |
method |
str
|
|
'anchor'
|
im_size |
int
|
Radius of image to be plotted for each channel/round. |
8
|
Source code in coppafish/plot/call_spots/spot_colors.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
|
view_intensity
Diagnostic to show how intensity is computed from spot_color
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nb |
Notebook
|
Notebook containing experiment details. Must have run at least as far as |
required |
spot_no |
int
|
Spot of interest to be plotted. |
required |
method |
str
|
|
'anchor'
|
Source code in coppafish/plot/call_spots/spot_colors.py
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
|
ColorPlotBase
This is the base class for plots with multiple subplots and with a slider to change the color axis and a button
to change the normalisation.
After initialising, the function change_norm()
should be run to plot normalised images.
This will change self.method
from 'raw'
to 'norm'
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
images |
List
|
|
required |
norm_factor |
Optional[Union[np.ndarray, List]]
|
|
required |
subplot_row_columns |
Optional[List]
|
|
None
|
fig_size |
Optional[Tuple]
|
|
None
|
subplot_adjust |
Optional[List]
|
|
None
|
cbar_pos |
Optional[List]
|
|
None
|
slider_pos |
Optional[List]
|
|
None
|
button_pos |
Optional[List]
|
|
None
|
Source code in coppafish/plot/call_spots/spot_colors.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|
Dot Product
view_score
This produces 4 plots on the first row, showing spot_color, residual, variance and weight squared (basically the normalised inverse variance).
The bottom row shows the contribution from background and genes to the variance.
The iteration as well as the alpha and beta parameters used to compute the weight can be changed through the text boxes.
If the weight plot is clicked on, the view_weight
plot will open for the current iteration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nb |
Notebook
|
Notebook containing at least the call_spots and ref_spots pages. |
required |
spot_no |
int
|
Spot of interest to be plotted. |
required |
method |
str
|
|
'omp'
|
g |
Optional[int]
|
Gene to view dot product calculation for.
If left as |
None
|
iter |
int
|
Iteration in OMP to view the dot product calculation for i.e. the number of genes
which have already been fitted ( |
0
|
omp_fit_info |
Optional[List]
|
This is a list containing |
None
|
check_weight |
bool
|
When this is |
False
|
Source code in coppafish/plot/call_spots/dot_product.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
|
Weight
view_weight
This produces at least 5 plots which show how the weight used in the dot product score was calculated.
The iteration as well as the alpha and beta parameters used to compute the weight can be changed with the text boxes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nb |
Notebook
|
Notebook containing at least the call_spots and ref_spots pages. |
required |
spot_no |
int
|
Spot of interest to be plotted. |
required |
method |
str
|
|
'omp'
|
iter |
int
|
Iteration in OMP to view the dot product calculation for i.e. the number of genes
which have already been fitted ( |
0
|
score_info |
Optional[List]
|
This is a list containing |
None
|
check_weight |
bool
|
When this is |
True
|
Source code in coppafish/plot/call_spots/weight.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
Background
view_background
This shows how the background coefficients were calculated.
The weighted dot product is equal to weight multiplied by dot product. Coefficient for background gene c is the sum over all rounds of weighted dot product in channel c.
Also shows residual after removing background.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nb |
Notebook
|
Notebook containing at least the call_spots and ref_spots pages. |
required |
spot_no |
int
|
Spot of interest to be plotted. |
required |
method |
str
|
|
'omp'
|
check |
bool
|
When this is |
True
|
track_info |
Optional[List]
|
To use when calling from |
None
|
Source code in coppafish/plot/call_spots/background.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
Gene Counts
gene_counts
This shows the number of reference spots assigned to each gene which pass the quality thresholding based on
the parameters score_thresh
and intensity_thresh
.
If nb
has the OMP page, then the number of omp spots will also be shown, where the quality thresholding is
based on score_omp_thresh
, score_omp_multiplier
and intensity_thresh
.
There will also be a second reference spots histogram, the difference with this is that the spots
were allowed to be assigned to some fake genes with bled_codes
specified through fake_bled_codes
.
Note
fake_bled_codes
have dimension n_fake x nbp_basic.n_rounds x nbp_basic.n_channels
not
n_fake x len(nbp_basic.use_rounds) x len(nbp_basic.use_channels)
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nb |
Notebook
|
Notebook containing at least |
required |
fake_bled_codes |
Optional[np.ndarray]
|
|
None
|
fake_gene_names |
Optional[List[str]]
|
|
None
|
score_thresh |
Optional[float]
|
Threshold for score for ref_spots. Can be changed with text box. |
None
|
intensity_thresh |
Optional[float]
|
Threshold for intensity. Can be changed with text box. |
None
|
score_omp_thresh |
Optional[float]
|
Threshold for score for omp_spots. Can be changed with text box. |
None
|
score_omp_multiplier |
Optional[float]
|
Can specify the value of score_omp_multiplier to use to compute omp score.
If |
None
|
Source code in coppafish/plot/call_spots/gene_counts.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
|
Score Calculation
background_fitting(nb, method)
Computes background using parameters in config file. Then removes this from the spot_colors
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nb |
Notebook
|
Notebook containing call_spots page |
required |
method |
str
|
'omp' or 'anchor', indicating which |
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
|
np.ndarray
|
|
np.ndarray
|
|
Source code in coppafish/plot/call_spots/score_calc.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
get_dot_product_score(spot_colors, bled_codes, spot_gene_no, dp_norm_shift, background_var)
Finds dot product score for each spot_color
given to the gene indicated by spot_gene_no
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
spot_colors |
np.ndarray
|
|
required |
bled_codes |
np.ndarray
|
|
required |
spot_gene_no |
Optional[np.ndarray]
|
|
required |
dp_norm_shift |
float
|
Normalisation constant for single round used for dot product calculation.
I.e. |
required |
background_var |
Optional[np.ndarray]
|
|
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
|
np.ndarray
|
|
Source code in coppafish/plot/call_spots/score_calc.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
Scaled K Means
view_scaled_k_means(nb, r=0, check=False)
Plot to show how scaled_k_means
was used to compute the bleed matrix.
There will be upto 3 columns, each with 2 plots.
The vector for dye \(d\) in the bleed_matrix
is computed from all the spot round vectors
whose dot product to the dye \(d\) vector was the highest.
The boxplots in the first row show these dot product values for each dye.
The second row then shows the bleed matrix at each stage of the computation.
The first column shows the initial bleed matrix. The second column shows the bleed matrix after running
scaled_k_means
once with a score threshold of 0. The third column shows the final bleed_matrix
after running
scaled_k_means
a second time with score_thresh
for dye \(d\) set to the median of the scores assigned to
dye \(d\) in the first run. Third column only present if config['call_spots']['bleed_matrix_anneal']==True
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nb |
Notebook
|
Notebook containing experiment details. Must have run at least as far as |
required |
r |
int
|
Round of bleed matrix to view. Only relevant if |
0
|
check |
bool
|
If True, will raise error if |
False
|
Source code in coppafish/plot/call_spots/scaled_k_means.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|