Dashboard and Visualisation
DashStats(net_row)
Formats network statistics for display in the dashboard.
Parameters: net_row (dict): A dictionary containing network statistics.
Returns: dict: A dictionary with formatted strings for display in the dashboard.
Source code in dsdp-lumping/viz_layout.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
DashboardLayout(elements, app, dash_stats, preloaded_options)
Defines the layout of the Dash application.
Parameters: elements (list): Cytoscape elements representing the network. app (Dash): The Dash application instance. dash_stats (dict): Network statistics formatted for display. preloaded_options (list): Options for preloaded datasets.
Returns: dash.html.Div: The layout of the application.
Source code in dsdp-lumping/viz_layout.py
241 242 243 244 245 246 247 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 276 277 278 279 280 281 282 283 284 285 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 |
|
GenCytoElements(G, colour_map, pos)
Generates Cytoscape-compatible elements for nodes and edges in a graph, including position and color information.
Parameters: G (networkx.Graph): The graph whose nodes and edges are to be converted. colour_map (dict): A dictionary mapping nodes to their assigned colors. pos (dict): A dictionary containing the x and y positions of each node.
Returns: list: A list of Cytoscape-compatible elements representing both nodes and edges.
Source code in dsdp-lumping/viz_layout.py
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 |
|
assign_colours(G, filename=None)
Assigns colors to nodes in a graph based on their orbit groups. If no filename is provided, it defaults to a predefined orbit colours file.
Parameters: G (networkx.Graph): The graph whose nodes will be colored. filename (str, optional): Path to the file containing orbit information. Defaults to None.
Returns: dict: A dictionary mapping each node to an assigned color in hexadecimal RGB format.
Source code in dsdp-lumping/viz_layout.py
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 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 |
|
get_preloaded_dataset()
Retrieves a list of preloaded dataset options for the dropdown menu.
Returns: list: A list of dictionaries, each containing the label and value of a preloaded dataset.
Source code in dsdp-lumping/viz_layout.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
main()
Main function to initialize and run the Dash application. Reads network data, generates Cytoscape elements, and sets up the application layout.
Source code in dsdp-lumping/viz_layout.py
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 |
|
normalize_node_id(node_id)
Normalizes the node ID by converting it to lowercase and stripping whitespace.
Parameters: node_id (str or int): The ID of the node to normalize.
Returns: str: The normalized node ID.
Source code in dsdp-lumping/viz_layout.py
145 146 147 148 149 150 151 152 153 154 155 |
|
read_netdat(filepath)
Reads network statistics from a JSON file.
Parameters: filepath (str or Path): The path to the JSON file containing network data.
Returns: dict: A dictionary with the network statistics if the file exists, otherwise None.
Source code in dsdp-lumping/viz_layout.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|
read_preloaded_nets(filename)
Reads preloaded network data from a CSV file.
Parameters: filename (str): The name of the file containing the preloaded network data.
Returns: pd.DataFrame: A DataFrame containing the source and target columns of the network.
Source code in dsdp-lumping/viz_layout.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
read_user_net(filepath)
Reads the user-uploaded network data from a CSV file.
Parameters: filepath (str or Path): The path to the CSV file containing user network data.
Returns: pd.DataFrame: A DataFrame containing the source and target columns of the network.
Source code in dsdp-lumping/viz_layout.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
toggle_preloaded_selection(data_source_choice)
Toggles the visibility of the preloaded dataset dropdown based on user selection.
Parameters: data_source_choice (str): The selected data source ('uploaded' or 'preloaded').
Returns: tuple: The display style and children elements of the preloaded dataset dropdown.
Source code in dsdp-lumping/viz_layout.py
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 375 376 377 378 379 |
|
update_elements(data_source_choice, selected_dataset)
Updates the network graph elements based on the selected data source and dataset.
Parameters: data_source_choice (str): The selected data source ('uploaded' or 'preloaded'). selected_dataset (str): The selected preloaded dataset filename.
Returns: list: A list of Cytoscape-compatible elements representing the network graph.
Source code in dsdp-lumping/viz_layout.py
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 |
|
update_graph(data_source_choice, selected_dataset)
Updates the scatter plot of rho vs number of nodes.
Parameters: data_source_choice (str): The selected data source ('uploaded' or 'preloaded'). selected_dataset (str): The selected preloaded dataset filename.
Returns: go.Figure: A Plotly figure object containing the scatter plot.
Source code in dsdp-lumping/viz_layout.py
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 |
|
update_network_statistics(data_source_choice, selected_dataset)
Updates the network statistics displayed in the dashboard.
Parameters: data_source_choice (str): The selected data source ('uploaded' or 'preloaded'). selected_dataset (str): The selected preloaded dataset filename.
Returns: tuple: A tuple of formatted strings for displaying network statistics.
Source code in dsdp-lumping/viz_layout.py
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
|