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

Implement deleteDuplicateEdges with ignoreDirection #130

Open
bdemchak opened this issue Apr 30, 2021 · 8 comments
Open

Implement deleteDuplicateEdges with ignoreDirection #130

bdemchak opened this issue Apr 30, 2021 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@bdemchak
Copy link
Contributor

py4cytoscape now has an extra parameter on delete_duplicate_edges ... it allows edge direction to be ignored.

The overall flow of the function was maintained, but important changes were made to allow different definitions of edge equivalence, and performance was improved considerably. (On my PC, executing the old structure on 3000 edges took about 11 minutes.)

I recommend that the same changes be made to the RCy3 version.

@bdemchak bdemchak added the enhancement New feature or request label Apr 30, 2021
@AlexanderPico AlexanderPico added this to the 2.11-dev milestone May 10, 2021
@yihangx
Copy link
Member

yihangx commented May 11, 2021

deleteDuplicateEdges is not working. Probably because the change of .edgeNameToEdgeSUID in RCy3.util.R.

@AlexanderPico
Copy link
Member

Fixed with 3348c65

@AlexanderPico AlexanderPico removed their assignment May 11, 2021
@yihangx
Copy link
Member

yihangx commented May 12, 2021

Added internal function first. Still working on this function.

@yihangx yihangx removed this from the 2.11-dev milestone May 13, 2021
@yihangx
Copy link
Member

yihangx commented May 28, 2021

Fixed.

@yihangx yihangx closed this as completed May 28, 2021
@yihangx yihangx reopened this May 28, 2021
@yihangx
Copy link
Member

yihangx commented Jun 3, 2021

Still not working.

@yihangx yihangx added this to the 2.12-rel milestone Jun 3, 2021
yihangx added a commit that referenced this issue Sep 28, 2021
yihangx added a commit that referenced this issue Sep 29, 2021
yihangx added a commit that referenced this issue Sep 29, 2021
@yihangx yihangx modified the milestones: 2.12-rel, 2.13-dev, 2.15-dev Sep 30, 2021
@AlexanderPico
Copy link
Member

@yihangx Still open or fixed?

@yihangx
Copy link
Member

yihangx commented Mar 24, 2022

This is still open. In py4cytoscape, it uses list comprehension there: https://github.com/cytoscape/py4cytoscape/blob/ad4ac43919d34c955d88ce07d5fc540a693b6700/py4cytoscape/network_selection.py#L788-L791
In R, there is no list comprehension, and I need to find an alternative way to do this.

@bdemchak
Copy link
Contributor Author

List comprehensions can be complex, but they still map to a simpler construct. For example:

all_edges = [build_sorted_edge_equivalents(x) for x in parse_edges(all_edges)]

maps to

all_edges = []
for x in parse_edges(all_edges):
  all_edges.append(build_sorted_edge_equivalents(x))

Likewise:

all_edges = [(x, None) for x in all_edges]

maps to

all_edges = []
for x in all_edges:
  all_edges.append((x, None))

Note that in this case, all_edges ends up as a list of tuples:

[(node1,node2), (node1,node3), (node2,node3)] ... for example.

A more complicated example:

dup_edge_suids = [get_edge_suids(unique_edge[0]) + get_edge_suids(unique_edge[1]) for unique_edge in edge_counter if edge_counter[unique_edge] > 1]

maps to:

dup_edge_suids = []
for unique_edge in edge_counter:
  if edge_counter[unique_edge] > 1:
    dup_edge_suids.append(unique_edge[1])

Comprehensions in Python are pretty convenient and concise. I don't know whether R has a similar construct.

@yihangx yihangx removed this from the 2.15-dev milestone Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants