nbl
navis.nbl.compress_scores
#
Compress scores.
This will not necessarily reduce the in-memory footprint but will lead to much smaller file sizes when saved to disk.
PARAMETER | DESCRIPTION |
---|---|
scores | TYPE: |
threshold |
TYPE: |
digits |
TYPE: |
RETURNS | DESCRIPTION |
---|---|
scores_comp | Copy of the original dataframe with the data cast to 32bit floats and the optional filters (see TYPE: |
Source code in navis/nbl/utils.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
|
navis.nbl.dendrogram
#
Plot dendrogram.
This is just a convenient thin wrapper around scipy's dendrogram function that lets you feed NBLAST scores directly. Note that this causes some overhead for very large NBLASTs.
PARAMETER | DESCRIPTION |
---|---|
x |
TYPE: |
method |
TYPE: |
**kwargs |
DEFAULT: |
RETURNS | DESCRIPTION |
---|---|
dendrogram | |
Source code in navis/nbl/utils.py
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 |
|
navis.nbl.extract_matches
#
Extract top matches from score matrix.
See N
, threshold
or percentage
for the criterion.
PARAMETER | DESCRIPTION |
---|---|
scores |
TYPE: |
N |
TYPE: |
threshold |
TYPE: |
percentage |
TYPE: |
single_cols |
TYPE: |
axis |
TYPE: |
distances |
TYPE: |
RETURNS | DESCRIPTION |
---|---|
pd.DataFrame | Note that the format is slightly different depending on the criterion. |
Source code in navis/nbl/utils.py
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 |
|
navis.nbl.make_clusters
#
Form flat clusters.
This is a thin wrapper around scipy.cluster.hierarchy.cut_tree
and scipy.cluster.hierarchy.fcluster
functions.
PARAMETER | DESCRIPTION |
---|---|
x |
TYPE: |
t |
TYPE: |
criterion |
TYPE: |
method |
TYPE: |
**kwargs |
DEFAULT: |
RETURNS | DESCRIPTION |
---|---|
clusters | |
Source code in navis/nbl/utils.py
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 |
|
navis.nbl.update_scores
#
Update score matrix by running only new query->target pairs.
PARAMETER | DESCRIPTION |
---|---|
queries | TYPE: |
targets | TYPE: |
scores_ex |
TYPE: |
nblast_func |
TYPE: |
**kwargs |
DEFAULT: |
RETURNS | DESCRIPTION |
---|---|
pandas.DataFrame | Updated scores. |
Examples:
Mostly for testing but also illustrates the principle:
>>> import navis
>>> import numpy as np
>>> nl = navis.example_neurons(n=5)
>>> dp = navis.make_dotprops(nl, k=5) / 125
>>> # Full NBLAST
>>> scores = navis.nblast(dp, dp, n_cores=1)
>>> # Subset and fill in
>>> scores2 = navis.nbl.update_scores(dp, dp,
... scores_ex=scores.iloc[:3, 2:],
... nblast_func=navis.nblast,
... n_cores=1)
>>> np.all(scores == scores2)
True
Source code in navis/nbl/utils.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 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 |
|