GithubHelp home page GithubHelp logo

isabella232 / copycat-layout Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cytoscape/copycat-layout

0.0 0.0 0.0 1.94 MB

Map the locations of nodes (and the network view) from one network to another. Easily compare networks side by side by positioning the views similarly.

Home Page: http://apps.cytoscape.org/apps/copycatlayout

Python 4.25% Java 11.70% Jupyter Notebook 84.05%

copycat-layout's Introduction

Copycat layout

Now a core app in Cytoscape 3.6.0

Or you can download the app from the Cytoscape App Store

Copycat layout is an improvement upon the layoutSaver app, with several new features:

  1. Network view location and zoom are copied as well, for complete view alignment
  2. Option to select unmapped nodes
  3. CyREST functionality. Call Copycat in a Cytoscape Automation script

Copycat layout takes two networks and two node columns as input. The source networks is used as a reference layout. Nodes in the source network are paired with nodes in the target network, based on the node attribute specified. The default mapping column is the name column. Nodes in the target network are relocated to the XY coordinate of their partner node in the source network. Once all nodes have been moved, the view camera is adjusted to match that of the source. Optionally, unpaired nodes are selected, and other layouts (eg GridLayout) can be executed for better readability.

Take for example, the source and targets shown below. The target network is a near exact replica of the source, but a circular layout has been applied. You wouldn't be able to tell just by glancing at the networks because they looks so different.

Pre-copycat layout

Now apply Copycat layout, using the name column in both networks to map nodes. Selecting unmapped nodes will highlight the nodes that appeared in one network and not the other. Now we can quickly determine what the differences are between our source and target networks.

Post-copycat layout

Calling via CyREST

You can also call Copycat via its CyREST endpoint, in Python or R scripts Copycat 1.2.3 offers an endpoint at /v1/apply/layouts/copycat/{sourceViewSUID}/{targetViewSUID}, which can be called with the python requests module:

REST_PORT='1234'
REST_ENDPOINT = "http://localhost:{}/v1".format(REST_PORT)
import requests

sourceViewSUID = # Add source SUID
targetViewSUID = # Add target SUID

data = {
  "sourceColumn": "name",
  "targetColumn": "name",
  "selectUnmapped": True,
  "gridUnmapped": False
}
resp = requests.put("{}/apply/layouts/copycat/{}/{}".format(REST_ENDPOINT, \
            sourceViewSUID, targetViewSUID), params=data)
data = resp.json()['data']

print("Mapped {} nodes, left {} unmapped in the target network".format(data['mappedNodeCount'], data['unmappedNodeCount']))

copycat-layout's People

Contributors

brettjsettle avatar dotasek avatar keiono avatar scootermorris avatar

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.