jfnavarro / st_analysis

A toolset for analysis and visualisation of Spatial Transcriptomics datasets.
Other
18 stars 7 forks source link

Error importing st_tissue_recognition #44

Closed bvaldebenitom closed 3 years ago

bvaldebenitom commented 3 years ago

Hi!

I've tried using the "align_sections.py" script, and it gives "Error importing st_tissue_recognition".

When typing help, it gives

align_sections.py --help
Error importing st_tissue_recognition
usage: align_sections.py [-h] --counts COUNTS [COUNTS ...] --images IMAGES [IMAGES ...] [--coordinates COORDINATES [COORDINATES ...]] [--down-width [INT]] [--down-height [INT]] [--outdir OUTDIR]
                         [--debug] [--border] [--normalize] [--alignment-method [STR]]

When trying to use it with files:

Error importing st_tissue_recognition
Traceback (most recent call last):
  File "/usr/local/bin/align_sections.py", line 4, in <module>
    __import__('pkg_resources').run_script('stanalysis==0.6.5', 'align_sections.py')
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 651, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1448, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python3.9/site-packages/stanalysis-0.6.5-py3.9.egg/EGG-INFO/scripts/align_sections.py", line 795, in <module>
    main(args.counts,
  File "/usr/local/lib/python3.9/site-packages/stanalysis-0.6.5-py3.9.egg/EGG-INFO/scripts/align_sections.py", line 659, in main
    if len(coordinates) != len(counts_files):
TypeError: object of type 'NoneType' has no len()

Is there any test data to try the script in a way to guarantee its execution?

Thanks!

jfnavarro commented 3 years ago

Hi :)

I fixed that small error when using align_sections.py without spot coordinates. Note that you need to install the st_tissue_recognition library in order to use align_sections.py.

https://github.com/jfnavarro/st_tissue_recognition

I hope this helps!

Best, Jose

bvaldebenitom commented 3 years ago

Hi @jfnavarro

Thanks for the quick reply! It was helpful.

I updated the ST Analysis, and made extra sure of the installation of "st_tissue_recognition". I installed it, but now I noted that due to having several python versions in my computer, there were some problems. I solved those, and I got:

Computing masks for the images...
Centering images...
Performing alignment...
Transforming original images...
Transforming original counts matrices...
Traceback (most recent call last):
  File "/usr/local/bin/align_sections.py", line 4, in <module>
    __import__('pkg_resources').run_script('stanalysis==0.6.5', 'align_sections.py')
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 651, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1448, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python3.9/site-packages/stanalysis-0.6.5-py3.9.egg/EGG-INFO/scripts/align_sections.py", line 794, in <module>
    main(args.counts,
  File "/usr/local/lib/python3.9/site-packages/stanalysis-0.6.5-py3.9.egg/EGG-INFO/scripts/align_sections.py", line 759, in main
    for coord, name in zip(transformed_coordinates, coordinates):
UnboundLocalError: local variable 'transformed_coordinates' referenced before assignment

Best regards, Braulio.

jfnavarro commented 3 years ago

Could you update and try again?

bvaldebenitom commented 3 years ago

@jfnavarro I updated it and now it works.. Thanks a lot!!

jfnavarro commented 3 years ago

Great!