pinellolab / STREAM

STREAM: Single-cell Trajectories Reconstruction, Exploration And Mapping of single-cell data
http://stream.pinellolab.org
GNU Affero General Public License v3.0
168 stars 45 forks source link

`uns_key` has no default` #126

Open BioTechTimy opened 2 years ago

BioTechTimy commented 2 years ago

To recreate using https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSM3674239,

import stream
from scipy.io import mmread
import pandas as pd

name = 'GSM3674239_b1'
x = mmread('data/' + name + '.matrix.mtx')
gene_names = pd.read_csv('data/' + name +  '.genes.tsv', sep = '\t', header=None)
barcodes = pd.read_csv('data/' + name + '.barcodes.tsv', sep = '\t', header=None)
df = pd.DataFrame.sparse.from_spmatrix(x, index = gene_names.iloc[:, 1], 
                                                                       columns = name + '-bone-' + barcodes.iloc[:, 0])
df.to_pickle("df.pkl")
df_stream = stream.read('df.pkl')

Traceback

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-12-24a97f60ba4b> in <module>
----> 1 df_stream = stream.read('merged_df.pkl')
      2 #stream.cal_qc(df_stream,assay='rna')
      3 #stream.plot_qc(df_stream,jitter=0.3)

~/miniconda/envs/venv_stream/lib/python3.7/site-packages/stream/core.py in read(file_name, file_path, file_format, delimiter, workdir, file_sample, file_feature, **kwargs)
    185         f.close()
    186 
--> 187     if('workdir' not in adata.uns_keys()):
    188         set_workdir(adata,workdir=workdir)
    189     else:

~/miniconda/envs/venv_stream/lib/python3.7/site-packages/pandas/core/generic.py in __getattr__(self, name)
   5476         ):
   5477             return self[name]
-> 5478         return object.__getattribute__(self, name)
   5479 
   5480     def __setattr__(self, name: str, value) -> None:

AttributeError: 'DataFrame' object has no attribute 'uns_keys'

Thank you Timothy Daley

BioTechTimy commented 2 years ago

Any update on this? It seems like stream can't read in standard pandas data frames. Is there documentation that I can read for what the expected input should be?