PayneLab/cptac

`get_clinical()` function now generates an erro

sgosline opened this issue · 2 comments

I upgrade the package and now cannot retrieve clinical data


In [1]: import cptac

In [2]: dat=cptac.Brca()

In [3]: dat.get_clinical()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[3], line 1
----> 1 dat.get_clinical()

File /opt/homebrew/lib/python3.10/site-packages/cptac/cancers/cancer.py:99, in Cancer.get_clinical(self, source, tissue_type, imputed)
     97 def get_clinical(self, source: str= None, tissue_type: str="both", imputed: bool=False) -> pd.DataFrame:
     98     """Get the clinical dataframe from the specified data source."""
---> 99     df = self.get_dataframe("clinical", source, tissue_type, imputed=imputed)
    100     df.columns = df.columns.str.split('/').str[-1] # Keep only the part after the slash
    101     return df

File /opt/homebrew/lib/python3.10/site-packages/cptac/cancers/cancer.py:682, in Cancer.get_dataframe(self, data_type, source, tissue_type, imputed)
    678 if not sources_for_data:
    679     raise DataFrameNotIncludedError(
    680         f"{data_type} datatype is not included in the {self._cancer_type} dataset. Use <cancer object>.list_data_sources() to see which data are available.")
--> 682 if len(sources_for_data) == 1:
    683     source = sources_for_data[0]
    684     warnings.warn(
    685         f"Using source {source} for {data_type} data as no other sources provide this data. To remove this warning, pass {source} as the source parameter.",
    686         ParameterWarning, stacklevel=3)

TypeError: object of type 'generator' has no len()
sabmel commented

We currently require a source to be passed in for any 'get' function. I believe we currently only have one source, 'mssm', for clinical so the call would be dat.get_clinical('mssm')

This works! I missed this change in the docs.