Closed Biomamba closed 11 months ago
File ~/miniconda3/envs/stereopy/lib/python3.8/site-packages/stereopy-0.14.0b1-py3.8.egg/stereo/algorithm/ccd/html_report.py:22, in get_base64_encoded_img(path) 12 def get_base64_encoded_img(path): 13 """ 14 Get the base64-encoded representation of an image. 15 (...) 20 - str: A base64-encoded string representing the image. 21 """ ---> 22 data_uri = base64.b64encode(open(path, 'rb').read()).decode('utf-8') 23 return '"data:image/png;base64,{0}"'.format(data_uri)
FileNotFoundError: [Errno 2] No such file or directory: '/home/biomamba/miniconda3/envs/stereopy/lib/python3.8/site-packages/stereopy-0.14.0b1-py3.8.egg/stereo/algorithm/ccd/assets/favicon.ico'`
It seems to cause many bugs after I update the stereopy into version 0.04.0b1. Meanwhile, many fonctions also can't work in older version. It realy confused me. Cloud you please tell me how to solve it?
Dear author: I have met a new problem when I study the CCD workflow in stereopy-0.14.0b1. `ccd = data.tl.community_detection( annotation='sim anno', out_path='results/whole_brain', win_sizes='150', sliding_steps='50', scatter_thres=0.12, downsample_rate=80, cluster_algo='agglomerative', n_clusters=16, resolution=0.25, plotting=5, hide_plots=True ) File ~/miniconda3/envs/stereopy/lib/python3.8/site-packages/stereopy-0.14.0b1-py3.8.egg/stereo/algorithm/community_detection.py:769, in CommunityDetection.main(self, kwargs) 692 r""" 693 694 CCD divides the tissue using sliding windows by accommodating multiple window sizes, and enables the simultaneous analysis of multiple slices from the same tissue. CCD consists of the three main steps: (...) 764 :return: Object of CommunityDetection. 765 """ 767 assert type(self.stereo_exp_data) is AnnBasedStereoExpData, 768 "this method can only run with AnnBasedStereoExpData temporarily" --> 769 self._main([self.stereo_exp_data], kwargs) 770 return self
File ~/miniconda3/envs/stereopy/lib/python3.8/site-packages/stereopy-0.14.0b1-py3.8.egg/stereo/algorithm/ccd/utils.py:24, in timeit..timeit_wrapper(*args, kwargs) 21 @wraps(func) 22 def timeit_wrapper(*args, *kwargs): 23 start_time = time.perf_counter() ---> 24 result = func(args, kwargs) 25 end_time = time.perf_counter() 26 total_time = end_time - start_time
File ~/miniconda3/envs/stereopy/lib/python3.8/site-packages/stereopy-0.14.0b1-py3.8.egg/stereo/algorithm/community_detection.py:263, in _CommunityDetection._main(self, slices, annotation, **kwargs) 260 end_time = time.perf_counter() 262 self.params['execution_time'] = end_time - start_time --> 263 generate_report(self.params)
File ~/miniconda3/envs/stereopy/lib/python3.8/site-packages/stereopy-0.14.0b1-py3.8.egg/stereo/algorithm/ccd/utils.py:24, in timeit..timeit_wrapper(*args, kwargs) 21 @wraps(func) 22 def timeit_wrapper(*args, *kwargs): 23 start_time = time.perf_counter() ---> 24 result = func(args, kwargs) 25 end_time = time.perf_counter() 26 total_time = end_time - start_time
File ~/miniconda3/envs/stereopy/lib/python3.8/site-packages/stereopy-0.14.0b1-py3.8.egg/stereo/algorithm/ccd/html_report.py:413, in generate_report(params) 369 created_time = f"Report created at {commit_date}" 371 annotation_figure, communities_figure = annotation_and_communities_figures(params['out_path']) 373 htmlstr = f''' 374 375 376 377 378 381 382 411 412
Cell Communities Report --> 413 <link rel="icon" type="image/png" sizes="16x16" href={get_base64_encoded_img(f"{os.path.dirname(file)}/assets/favicon.ico")}/> 414 415 416 417418
419
420
Cell communities clustering report
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 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 471 472 473
Parameters used
Annotation {params['annotation']} Resolution {params['resolution']} Spot size {params['spot_size']} Total cells normalization {params['total_cell_norm']} Downsample rate {params['downsample_rate']} Entropy threshold {params['entropy_thres']} Scatteredness threshold {params['scatter_thres']} Window sizes {params['win_sizes']} Sliding steps {params['sliding_steps']}
470 Copy command
474
475
476
477
Overall
478
479
480
Cell type annotation:
481
482
483 484
485 486
487
488
Communities obtained:
489
490
491 492
493 494
495 <div class="centered testRemove" data-value={"remove" if params['plotting'] < 3 else "keep"}> 496
Cell mixtures for all slices:
497
498 <div class="centered testRemove" data-value={"remove" if params['plotting'] < 3 else "keep"}> 499 500 <img title="Showing the percentage of each cell type within obtained community and corresponding sums" src={all_slices_get_figure(params['out_path'], "total_cell_mixtures_table.png", params['plotting'])}> 501 502
503 <div class="centered testRemove" data-value={"remove" if params['plotting'] < 3 else "keep"}> 504
Cell type abundance:
505 506 <div class="centered testRemove" data-value={"remove" if params['plotting'] < 3 else "keep"}> 507 508 <img title="Percentage of specific cell types per slice" src={all_slices_get_figure(params['out_path'], "cell_abundance_all_slices.png", params['plotting'])}> 509 510 511 <div class="centered testRemove" data-value={"remove" if params['plotting'] < 3 else "keep"}> 512
Communities abundance:
513 514 <div class="centered testRemove" data-value={"remove" if params['plotting'] < 3 else "keep"}> 515 516 <img title="Percentage of cells in each community per slice" src={all_slices_get_figure(params['out_path'], "cluster_abundance_all_slices.png", params['plotting'])}> 517 518 519 <div class="centered testRemove" data-value={"remove" if params['plotting'] < 4 else "keep"}> 520
Cell percentage in communities:
521 </div class="centered testRemove"> 522 <div class="centered testRemove" data-value={"remove" if params['plotting'] < 4 else "keep"}> 523 524 <img title="Percentage of cells in each community per slice" src={all_slices_get_figure(params['out_path'], "cell_perc_in_community_per_slice.png", params['plotting'])}> 525 526 527
528 <div data-value={"remove" if params['plotting'] < 2 else "keep"}> 529
Per slice
530 531 <div class="testRemove" data-value={"remove" if params['plotting'] < 2 else "keep"}> 532 {per_slice_content(params['out_path'], params['plotting'])} 533 534
535 <div class="testRemove" data-value={"remove" if params['plotting'] < 3 else "keep"}> 536
Per community
537 538 <div class="centeredSmall" data-value={"remove" if params['plotting'] < 3 else "keep"}> 539 {per_community_content(params['out_path'], params['plotting'])} 540 541 542
{created_time}
543 544 545 546 ''' 548 with open(f"{params['out_path']}/report.html", "w") as f: 549 f.write(htmlstr) File ~/miniconda3/envs/stereopy/lib/python3.8/site-packages/stereopy-0.14.0b1-py3.8.egg/stereo/algorithm/ccd/html_report.py:22, in get_base64_encoded_img(path) 12 def get_base64_encoded_img(path): 13 """ 14 Get the base64-encoded representation of an image. 15 (...) 20 - str: A base64-encoded string representing the image. 21 """ ---> 22 data_uri = base64.b64encode(open(path, 'rb').read()).decode('utf-8') 23 return '"data:image/png;base64,{0}"'.format(data_uri)
FileNotFoundError: [Errno 2] No such file or directory: '/home/biomamba/miniconda3/envs/stereopy/lib/python3.8/site-packages/stereopy-0.14.0b1-py3.8.egg/stereo/algorithm/ccd/assets/favicon.ico'`
It seems to cause many bugs after I update the stereopy into version 0.04.0b1. Meanwhile, many fonctions also can't work in older version. It realy confused me. Cloud you please tell me how to solve it?
I have solved this problem by copying favicon.ico file to the corresponding directory.
Dear author:
I have met a new problem when I study the CCD workflow in stereopy-0.14.0b1. `ccd = data.tl.community_detection( annotation='sim anno', out_path='results/whole_brain', win_sizes='150', sliding_steps='50', scatter_thres=0.12, downsample_rate=80, cluster_algo='agglomerative', n_clusters=16, resolution=0.25, plotting=5, hide_plots=True ) File ~/miniconda3/envs/stereopy/lib/python3.8/site-packages/stereopy-0.14.0b1-py3.8.egg/stereo/algorithm/community_detection.py:769, in CommunityDetection.main(self, kwargs) 692 r""" 693 694 CCD divides the tissue using sliding windows by accommodating multiple window sizes, and enables the simultaneous analysis of multiple slices from the same tissue. CCD consists of the three main steps: (...) 764 :return: Object of CommunityDetection. 765 """ 767 assert type(self.stereo_exp_data) is AnnBasedStereoExpData, \ 768 "this method can only run with AnnBasedStereoExpData temporarily" --> 769 self._main([self.stereo_exp_data], kwargs) 770 return self
File ~/miniconda3/envs/stereopy/lib/python3.8/site-packages/stereopy-0.14.0b1-py3.8.egg/stereo/algorithm/ccd/utils.py:24, in timeit..timeit_wrapper(*args, kwargs)
21 @wraps(func)
22 def timeit_wrapper(*args, *kwargs):
23 start_time = time.perf_counter()
---> 24 result = func(args, kwargs)
25 end_time = time.perf_counter()
26 total_time = end_time - start_time
File ~/miniconda3/envs/stereopy/lib/python3.8/site-packages/stereopy-0.14.0b1-py3.8.egg/stereo/algorithm/community_detection.py:263, in _CommunityDetection._main(self, slices, annotation, **kwargs) 260 end_time = time.perf_counter() 262 self.params['execution_time'] = end_time - start_time --> 263 generate_report(self.params)
File ~/miniconda3/envs/stereopy/lib/python3.8/site-packages/stereopy-0.14.0b1-py3.8.egg/stereo/algorithm/ccd/utils.py:24, in timeit..timeit_wrapper(*args, kwargs)
21 @wraps(func)
22 def timeit_wrapper(*args, *kwargs):
23 start_time = time.perf_counter()
---> 24 result = func(args, kwargs)
25 end_time = time.perf_counter()
26 total_time = end_time - start_time
File ~/miniconda3/envs/stereopy/lib/python3.8/site-packages/stereopy-0.14.0b1-py3.8.egg/stereo/algorithm/ccd/html_report.py:413, in generate_report(params) 369 created_time = f"Report created at {commit_date}" 371 annotation_figure, communities_figure = annotation_and_communities_figures(params['out_path']) 373 htmlstr = f''' 374 <!DOCTYPE html> 375 376 377
378 381 382 411 412Cell communities clustering report
421422
Parameters used
476
Overall
478Cell type annotation:
481Communities obtained:
489Cell mixtures for all slices:
497Cell type abundance:
505