Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load_table_data changes the table #100

Open
carissableker opened this issue Mar 21, 2023 · 1 comment
Open

load_table_data changes the table #100

carissableker opened this issue Mar 21, 2023 · 1 comment

Comments

@carissableker
Copy link

Using p4c.load_table_data changes the input table (adding a row.names column. This is unexpected.
If the column needs to be added, maybe that should be done on a copy?

df = pd.DataFrame([
            ("AT1G02980", 10), 
            ("AT1G02980", 3), 
            ("AT1G02980", 1)], 
    columns=["name", "value"]).set_index("name")
df
         value
name            
AT1G02980     10
AT1G02907      3
AT1G02380      1

p4c.load_table_data(df)
'Success: Data loaded in defaultnode table'

df
           value  row.names
name                       
AT1G02980     10  AT1G02980
AT1G02980      3  AT1G02980
AT1G02980      1  AT1G02980
@bdemchak
Copy link
Collaborator

bdemchak commented Mar 21, 2023

Hi, Carissa --

This is a fair criticism, and I'm sorry for the confusion. (Thanks for using py4cytoscape!)

The structure and control flow for py4cytoscape was taken from RCy3 in large part. Having done that, it's quite possible that RCy3 has the same issue ... or not. I can see that the lines 304 & 308 of RCy3's Tables.R assign the 'data' dataframe an edited value in the same way as py4cytoscape's tables.py line 455.

I'm not sure how R works ... I'll find out whether those RCy3 assignments end up creating a local copy of the dataframe. If so, I can follow suit, too.

@AlexanderPico @yihangx ... can you take a look at this behavior in RCy3 and let me know??

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants