Skip to content

TypeError when using the exporting.spring_project function #889

@tejas-j

Description

@tejas-j

I've been trying to export my data to SPRING using the external export feature. I do all my processing in Seurat and then export a loom file to be read in scanpy and export to SPRING. I've been however getting the below error.

The notebook with the code and the loom file can be found here: https://github.com/tejas-j/seurat2spring

Is there a better way to achieve what I'm trying to do (data -> Seurat -> scanpy -> SPRING)

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-13-3b0044b18ade> in <module>
      1 import time
      2 t0 = time.time()
----> 3 sce.exporting.spring_project(data, './pbmc3k', 'draw_graph', subplot_name='force1', overwrite=True)
      4 print(time.time() - t0)

~/miniconda2/envs/py36/lib/python3.6/site-packages/scanpy/_exporting.py in spring_project(adata, project_dir, embedding_method, subplot_name, cell_groupings, custom_color_tracks, total_counts_key, overwrite)
    157     # Write continuous colors
    158     continuous_extras['Uniform'] = np.zeros(E.shape[0])
--> 159     write_color_tracks(continuous_extras, subplot_dir / 'color_data_gene_sets.csv')
    160 
    161     # Create and write a dictionary of color profiles to be used by the visualizer

~/miniconda2/envs/py36/lib/python3.6/site-packages/scanpy/_exporting.py in write_color_tracks(ctracks, fname)
    301     out = []
    302     for name,score in ctracks.items():
--> 303         line = name + ',' + ','.join(['%.3f' %x for x in score])
    304         out += [line]
    305     out = sorted(out,key=lambda x: x.split(',')[0])

~/miniconda2/envs/py36/lib/python3.6/site-packages/scanpy/_exporting.py in <listcomp>(.0)
    301     out = []
    302     for name,score in ctracks.items():
--> 303         line = name + ',' + ','.join(['%.3f' %x for x in score])
    304         out += [line]
    305     out = sorted(out,key=lambda x: x.split(',')[0])

TypeError: must be real number, not numpy.str_

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions