Closed bdemchak closed 1 year ago
Fixed.
This fix (https://github.com/cytoscape/RCy3/commit/0d3af3082b0d34bac0ce6864b60df2fe5fec0ffe) does not produce the desired output and it reverts the fix for #115 (https://github.com/cytoscape/RCy3/commit/7bdd634bfef6051056cd22d5643e717ca2ff5c4c), which attempted to fix #41.
We need to try again to cover all these cases and not leave prior test cases behind.
@yihangx Let's start with this code again and try to address Barry's request for a new param without breaking other use cases:
.edgeNameToEdgeSUID<-function(edge.names, network=NULL, base.url=.defaultBaseUrl) {
dict <- getTableColumns('edge',c('SUID','name'),'default',network, base.url)
test <- vapply(edge.names, function(x){x %in% dict[,'SUID']}, logical(1))
if(all(test)) #provided SUIDs already!
return(edge.names)
sorted.dict <- NULL
if(length(edge.names) == length(unique(edge.names))){ #unique edge names
sorted.dict <- dict[match(edge.names, dict$name), ]
} else { #multigraph: multiple edges with the same name
message("Finding unique SUIDs for edges with the same name...\n")
match_list <- list()
for(i in seq_along(edge.names)){ #perform match with removal
name_match <- dict[match(edge.names[[i]], dict$name),]
match_list[[i]] <- name_match
dict <- subset(dict, SUID != name_match$SUID)
}
sorted.dict <- do.call(rbind, match_list)
}
edge.SUIDs <- sorted.dict$SUID
return(edge.SUIDs)
}
When we settle on a fix, then let's apply it to .nodeNameToNodeSUID as well.
Can you supply a list of cases that should be satisfied once this fix is in and works? I'm not sure how to test py4cytoscape to make sure it's working.
In addition to the cases you provided when opening this ticket, the only other case I have is from #41
graph <- graph_from_data_frame(data.frame(v1 = rep("A", 2),
v1 = rep("B", 2),
type = c("E1", "E2")))
createNetworkFromIgraph(graph, "graph")
Should end up with two edges with the same name but with different type
values: E1 and E2
@yihangx This fix (https://github.com/cytoscape/RCy3/commit/0d3af3082b0d34bac0ce6864b60df2fe5fec0ffe) does not produce the desired output and it reverts the fix for https://github.com/cytoscape/RCy3/issues/115 (https://github.com/cytoscape/RCy3/commit/7bdd634bfef6051056cd22d5643e717ca2ff5c4c), which attempted to fix https://github.com/cytoscape/RCy3/issues/41.
We need to try again to cover all these cases and not leave prior test cases behind.
@AlexanderPico Sure. I am working on this one.
This is important in create_network_from_data_frames() and get_first_neighbors()