GithubHelp home page GithubHelp logo

Hetionet to cytoscape problems about hetionet HOT 8 CLOSED

hetio avatar hetio commented on August 11, 2024
Hetionet to cytoscape problems

from hetionet.

Comments (8)

gsummer avatar gsummer commented on August 11, 2024 1

from hetionet.

dhimmel avatar dhimmel commented on August 11, 2024

@jromanowska cool query!

Unfortunately, I don't think @gsummer is actively maintaining cyNeo4j anymore. We've also run into the issue that cyNeo4j doesn't support exporting paths to Cytoscape (see cyNeo4j/cyNeo4j#14). We've engineered a partial workaround, where you append the following to a query returning paths:

WITH relationships(path) AS rels
UNWIND rels AS rel
RETURN DISTINCT startNode(rel) AS source, endNode(rel) AS target, rel AS relationship

So the following query should work with cyNeo4j:

MATCH path = allShortestPaths((node1:Gene)-[*..3]-(node2:PharmacologicClass))
WHERE
  node1.name = 'ESRRG' AND
  node2.name STARTS WITH 'Vitamin'
WITH relationships(path) AS rels
UNWIND rels AS rel
RETURN DISTINCT startNode(rel) AS source, endNode(rel) AS target, rel AS relationship

This will return all nodes and relationships in the matched paths. Note that the Neo4j browser shows all relationships between returned nodes by default (even if those relationships were not requested). This option is controlled by the AUTO-COMPLETE toggle. So Cytoscape will receive just the relationships in the paths, i.e. AUTO-COMPLETE set to OFF.

Also unfortunately, there is a separate cyNeo4j issue where nodes don't retain their labels (i.e. node types, see cyNeo4j/cyNeo4j#15). Therefore, you may need to do a little extra work to get reverse engineer the node types in Cytoscape.

Good luck! We'd love to see what you come up with.

from hetionet.

dhimmel avatar dhimmel commented on August 11, 2024

Also note that (in this instance), the above query can be simplified by removing allShortestPaths. Since the shortest path between ESRRG and a Vitamin* is 3, this is just returning all paths of length 3.

from hetionet.

jromanowska avatar jromanowska commented on August 11, 2024

That worked, thank you! I see I need to read more about Cypher then ;)

And by the way - have you tried visualizing your networks in R?

from hetionet.

jromanowska avatar jromanowska commented on August 11, 2024

@gsummer - great that you're still working a bit on this app. I'll give the dev version a try.

However, there is another issue - on Neo4j there is an "auto-complete" option, while this doesn't seem to be on when I use cyNeo4j, so when getting a union of two queries, there are many edges that are missing.

from hetionet.

dhimmel avatar dhimmel commented on August 11, 2024

@gsummer good to know about the dev version. Best of luck with your PhD. I know the terror/joy of the last few months of a dissertation. Happy to test whenever.

on Neo4j there is an "auto-complete" option, while this doesn't seem to be on when I use cyNeo4j

@jromanowska the AUTO-COMPLETE feature of the Neo4j Browser is a frontend "extra". Since cyNeo4j interacts solely via Cypher queries, I don't think an AUTO-COMPLETE feature would be appropriate for cyNeo4j (since AUTO-COMPLETE is not part of Cypher).

However, you can make your query return all relationships between your selected nodes (source):

MATCH path = (node1:Gene)-[*..3]-(node2:PharmacologicClass)
WHERE
  node1.name = 'ESRRG' AND
  node2.name STARTS WITH 'Vitamin'
WITH nodes(path) AS nodes
UNWIND nodes AS node_set
WITH collect(DISTINCT node_set) AS node_set
MATCH (n1)-[rel]->(n2)
WHERE 
  n1 in node_set AND
  n2 in node_set
RETURN DISTINCT startNode(rel) AS source, endNode(rel) AS target, rel AS relationship

from hetionet.

jromanowska avatar jromanowska commented on August 11, 2024

Forgot to write yesterday - it works, thank you! And thanks for explanation about the auto-complete option.

And btw, @gsummer - the developmental version of cyNeo4j works fine for me as well.

from hetionet.

dhimmel avatar dhimmel commented on August 11, 2024

Great!

from hetionet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.