JonnyTran / OpenOmics

A bioinformatics API to interface with public multi-omics bio databases for wicked fast data integration.
https://openomics.readthedocs.io/en/latest/
MIT License
31 stars 13 forks source link

Unable to use load_data() for class Multiomics #165

Open piyushm27 opened 2 years ago

piyushm27 commented 2 years ago

Description

What I was trying to get done? I was trying to use the function load_data() of class Multiomics. Instead it gave the error elaborated below

What I Did

//The command that raised the error [Here, luad_data is an object of class Multiomics]:

X_multiomics, y = luad_data.load_data(omics="all", target=["pathologic_stage"])

//And it gave the below error:

~/*****/site-packages/openomics/multiomics.py in load_data(self, omics, target, pathologic_stages, histological_subtypes, predicted_subtypes, tumor_normal, samples_barcode) 251 252 # Filter y target column labels --> 253 y = y.filter(target) 254 y.dropna(axis=0, inplace=True) 255 matched_samples = y.index

AttributeError: 'tuple' object has no attribute 'filter'

I tried goiong through the function description for the arguments of the function given, and it seems I'm not passing absurd arguments.

I'm guessing that this error is raised becuase the y used in line 253 of multiomics.py is an tuple of an Index object (pandas.core.indexes.base.Index) and numpy.ndarray object instead of DataFrame object (pandas.core.frame.DataFrame).

JonnyTran commented 2 years ago

Hi @piyushm27 thanks for pointing this bug out. y in that function should be a DataFrame, so y = y.filter(target) shouldn't give an error and y shouldn't be a tuple. I will check the unit tests again to see nothing odds is happening.

Just to make sure, did you pass any values to these arguments, pathologic_stages, histological_subtypes, predicted_subtypes, tumor_normal?

Can you also check what's the output of luad_data.data["SAMPLES"]?

piyushm27 commented 2 years ago

Hi Nhat, Initially, I didn't send any values to these arguments for my purpose. But, used a combination of values for the arguments pathologic_satges and tumor_normal to trace the issue. I hope this helps.

Thanks. Regards.

Piyush Mathur Final Year Undergraduate Student Department of Bioscience and Bioengineering Indian Institute of Technology, Jodhpur

On Mon, Nov 8, 2021 at 11:53 AM Nhat (Jonny) Tran @.***> wrote:

Hi @piyushm27 https://github.com/piyushm27 thanks for pointing this bug out. y in that function should be a DataFrame, so y = y.filter(target) shouldn't give an error and y shouldn't be a tuple. I will check the unit tests again to see nothing odds is happening.

Just to make sure, did you pass any values to these arguments, pathologic_stages, histological_subtypes, predicted_subtypes, tumor_normal?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/BioMeCIS-Lab/OpenOmics/issues/165#issuecomment-962847840, or unsubscribe https://github.com/notifications/unsubscribe-auth/APMYXZEO7ZOBDGR4HNYQWDDUK5UHZANCNFSM5GO6SSGA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

anhdpham commented 2 years ago

I'm having the same problem after loading the example dataset. I think the problem is with the clinical data. If I only load the omics data I can use the luad_data.load_data(omics="all"), if I load the clinical data together with the omics data, I cannot even use luad_data.load_data(omics="all")

JonnyTran commented 2 years ago

Hi @anhdpham, thanks for pointing this out. I will dig further for a fix of this bug. Honestly the luad_data.load_data() functionality hasn't been updated since the first releases, so the code needs some rewriting.