cytoscape / RCy3

New version of RCy3, redesigned and collaboratively maintained by Cytoscape developer community
MIT License
50 stars 20 forks source link

Issues with getting edge table after creating Intact network #108

Closed risserlin closed 3 years ago

risserlin commented 3 years ago

I am not sure if this is an intact app issue or an RCy3 issue.

I run the following command using intact: "intact query includeSeedPartners=false seedTerms='Q8N157 Q7Z7M0 Q9Y2H0 Q15772 Q8TD84 Q9UKA4 Q14094 Q99607 P14598 Q9BVN2 Q8NFU7 Q13191 P52849 Q02846 Q9P267 Q14CZ8 Q5JSZ5 Q2M3G4 O95503 Q8IYY4 Q9UKN7 O14490 Q7L0Q8 Q96D71 Q6ZVL6 Q9H792 Q15751 Q8WZA2 Q6J9G0 Q5HYK7 Q07912 Q8TB24 Q5CZC0 Q6ZUJ8 Q5VST9 Q9H0J4 A1X283 A8MVU1 O95819 O43597 Q8N1I0 Q9UGU0 O60890 Q8NFA2 Q96P48 O60610 Q02880 O15240 Q13263 P58505 Q8WXE0 Q9BXX0 P78559 Q02246 O43426 Q05193 Q92630 Q9Y3Q4 Q96L96 P51841 Q9UFG5 Q8N5Q1 Q6ZNL6 Q14118 Q8N2R8 P57058 Q9H706 P10071 Q07889 O75553 Q6S9Z5 Q12870 P98082 O00750 Q9Y3Y4 O60292 Q9NRI5 Q6ZU52 Q9P1A6 Q5HYW2 O43184 Q07890 Q9NXN4 Q13332 Q9ULL5 O15056 O14654 Q6ZRI0 Q8TC05 Q75VX8 Q9ULD8 Q9BRK4 Q8NEN9 A6NI72 Q8NI17 Q9UBP9 Q86UU1 P22681 Q8NI99 Q9UJM3 Q96DX4'"

After creating the network I try and get the node and edge table. The node table works fine but I can't seem to get the edge table.

intact_edge_columns <- getTableColumns(table = "edge")

This returns: RCy3::cyrestGET, HTTP Error Code: 500 url=http://localhost:1234/v1/networks/207454/tables/defaultedge/columns/IntAct%20-%20Summary::#%20Summarized%20edges Error in cyrestGET(paste("networks", suid, "tables", tbl, "columns", col, :

I tried to get the table by SUID instead of using the default but that also didn't work .

AlexanderPico commented 3 years ago

I dissected the problem a bit by doing getting the list of columns as a separate step and then trying to import subsets of columns to narrow down the problematic content:

col.list <- getTableColumnNames(table="edge")
getTableColumns(table = "edge", columns = col.list[1:20])

This works, for example. But once I included column 21 in the set, then it failed. I could also successfully import columns 22:32. So, what's unique about column 21...

"IntAct - Summary::# Summarized edges"

Ah ha! It's the only one with a pound sign in it. I then renamed one of the other columns to include a pound sign, which caused it to fail. And I renamed column 21 to exclude the pound sign, which caused it to work.

So, that's the workaround for now: rename columns with # in their names. I'll try to fix where we might be parsing that incorrectly in RCy3 and then post an issue for py4cy as well.

Thanks for reporting!

AlexanderPico commented 3 years ago

Confirmed that having '#' anywhere in column name (even one without a namespace) in either node or edge tables caused this error.

AlexanderPico commented 3 years ago

Simple case to reproduce:

  1. Open YeastPerturbation.cys sample session
  2. Rename 'Degree' in Node Table to 'Degree#'
  3. Attempt getTableColumns(columns = "Degree#")

It fails in RCy3, but works in CyREST.

@yihangx Can you try to reproduce this using py4cy? If fails, then open a new issue in that repo pointing to this one. We'll fix them in sync.

AlexanderPico commented 3 years ago

In RCy3, the method produces this URL, which fails:

http://localhost:1234/v1/networks/14869/tables/defaultnode/columns/Degree#

While CyREST produces this URL, which works:

http://localhost:1234/v1/networks/14869/tables/defaultnode/columns/Degree%23

Looks like we need to encode pound signs in our column names! Likely also needed for network names, etc.

AlexanderPico commented 3 years ago

Additional testing showed that these non-alphanumeric characters throw an error:

# ? ; /

All others tested so far work just fine.

utils::URLencode(reserved=T) will encode a bunch of non-alphanums. This appears to work, even with the :: used in Cytoscape's namespace convention.

AlexanderPico commented 3 years ago

Adding URLencode to every function that passes column and network names would be a ton of changes, however. Error prone and hard to maintain/enforce going forward. Converting at the cyrestX functions makes more sense, but we have to split words among the functional / characters, encode and then reconstruct the operators. And we would mistake column names with / characters in them. So, it has to be done prior to these consolidating funcitons. Ugh...

Best solution at this point: fix for # ? ; cases at cyrestX functions and note that / will still break.

AlexanderPico commented 3 years ago

New code is available here on GitHub and dev release of Bioconductor.

bdemchak commented 3 years ago

py4cytoscape fails when column name contains "/" and get_table_columns() is called ... Adding this to py4cytoscape.