本文整理汇总了Java中org.cytoscape.view.model.CyNetworkView.getNodeView方法的典型用法代码示例。如果您正苦于以下问题:Java CyNetworkView.getNodeView方法的具体用法?Java CyNetworkView.getNodeView怎么用?Java CyNetworkView.getNodeView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.cytoscape.view.model.CyNetworkView
的用法示例。
在下文中一共展示了CyNetworkView.getNodeView方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: forNodes
import org.cytoscape.view.model.CyNetworkView; //导入方法依赖的package包/类
public static CoordinateData forNodes(CyNetworkView networkView, Collection<CyNode> nodes) {
double xmin = 100000000;
double xmax = -100000000;
double ymin = 100000000;
double ymax = -100000000;
Map<CyNode,double[]> coordinates = new HashMap<>();
Map<CyNode,Double> radii = new HashMap<>();
for(CyNode node : nodes) {
View<CyNode> nodeView = networkView.getNodeView(node);
if(nodeView != null) {
double x = nodeView.getVisualProperty(BasicVisualLexicon.NODE_X_LOCATION);
double y = nodeView.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION);
double radius = nodeView.getVisualProperty(BasicVisualLexicon.NODE_WIDTH);
coordinates.put(node, new double[]{x,y});
radii.put(node, radius);
xmin = Double.min(xmin, x);
xmax = Double.max(xmax, x);
ymin = Double.min(ymin, y);
ymax = Double.max(ymax, y);
}
}
return new CoordinateData(xmin, xmax, ymin, ymax, coordinates, radii);
}
示例2: processCallResponse
import org.cytoscape.view.model.CyNetworkView; //导入方法依赖的package包/类
@Override
public void processCallResponse(ExtensionCall call, Object callRetValue) {
List<Double> values = (List<Double>)callRetValue;
CyTable defNodeTab = currNet.getDefaultNodeTable();
CyNetworkView networkView = getPlugin().getCyNetViewMgr().getNetworkViews(currNet).iterator().next();
for(int i = 0; i < (values.size() / 3); ++i){
Long neoid = values.get(i*3).longValue();
Double x = values.get(i*3+1);
Double y = values.get(i*3+2);
Set<CyNode> nodeSet = CyUtils.getNodesWithValue(currNet, defNodeTab, "neoid", neoid);
CyNode n = nodeSet.iterator().next();
View<CyNode> nodeView = networkView.getNodeView(n);
nodeView.setVisualProperty(BasicVisualLexicon.NODE_X_LOCATION, x);
nodeView.setVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION, y);
CyUtils.updateVisualStyle(getPlugin().getVisualMappingManager(), networkView, currNet);
}
}
示例3: addNodes
import org.cytoscape.view.model.CyNetworkView; //导入方法依赖的package包/类
/**
* @desc - Adds nodes to the protein network from the information returned by the Slim* run.
* @param uniprotIDs - list of all Uniprot IDs input to the returned run.
* @param nodeIds - map linking all selected Uniprot IDs to their CyNodes, for easy access to the network.
* @param newNetwork - CyNetwork of the network being altered.
* @param networkViewManager - NetworkViewManager for the network being altered. Initialised in CyActivator.
* @param manager - CyApplicationManager for the network being altered. Initialised in CyActivator.
*/
public void addNodes (List<String> uniprotIDs, Map<String, CyNode> nodeIds, CyNetwork newNetwork,
CyNetworkViewManager networkViewManager, CyApplicationManager manager) {
// Add network view
final Collection<CyNetworkView> views = networkViewManager.getNetworkViews(newNetwork);
CyNetworkView myView = null;
if(views.size() != 0) {
myView = views.iterator().next();
}
if (myView == null) {
// create a new view for my network
myView = networkViewFactory.createNetworkView(newNetwork);
networkViewManager.addNetworkView(myView);
} else {
System.out.println("networkView already existed.");
}
CyNetworkView networkView = manager.getCurrentNetworkView();
for (Object o : nodeIds.entrySet()) {
Map.Entry pairs = (Map.Entry) o;
CyNode node = (CyNode) pairs.getValue();
View<CyNode> nodeView = networkView.getNodeView(node);
nodeView.setLockedValue(BasicVisualLexicon.NODE_SHAPE, NodeShapeVisualProperty.ELLIPSE);
nodeView.setLockedValue(BasicVisualLexicon.NODE_BORDER_PAINT, Color.BLACK);
nodeView.setLockedValue(BasicVisualLexicon.NODE_SIZE, 60.0);
}
}
示例4: isHidden
import org.cytoscape.view.model.CyNetworkView; //导入方法依赖的package包/类
private static boolean isHidden(CyNode node, CyNetworkView networkView) {
View<CyNode> nodeView = networkView.getNodeView(node);
return isHidden(nodeView);
}
示例5: processCallResponse
import org.cytoscape.view.model.CyNetworkView; //导入方法依赖的package包/类
@Override
public void processCallResponse(ExtensionCall call, Object callRetValue) {
List<Double> values = (List<Double>)callRetValue;
CyTable defNodeTab = currNet.getDefaultNodeTable();
CyNetworkView networkView = getPlugin().getCyNetViewMgr().getNetworkViews(currNet).iterator().next();
for(int i = 0; i < (values.size() / 3); ++i){
Long neoid = values.get(i*3).longValue();
Double x = values.get(i*3+1);
Double y = values.get(i*3+2);
Set<CyNode> nodeSet = CyUtils.getNodesWithValue(currNet, defNodeTab, "neoid", neoid);
CyNode n = nodeSet.iterator().next();
View<CyNode> nodeView = networkView.getNodeView(n);
nodeView.setVisualProperty(BasicVisualLexicon.NODE_X_LOCATION, x);
nodeView.setVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION, y);
CyUtils.updateVisualStyle(getPlugin().getVisualMappingManager(), networkView, currNet);
}
}
示例6: serializeNetwork
import org.cytoscape.view.model.CyNetworkView; //导入方法依赖的package包/类
protected final void serializeNetwork(final CyNetwork network, final CyNetworkView view, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonProcessingException {
// Write array
final List<CyNode> nodes = network.getNodeList();
final List<CyEdge> edges = network.getEdgeList();
final Map<CyNode, Long> node2Index = new HashMap<CyNode, Long>();
jgen.useDefaultPrettyPrinter();
jgen.writeStartObject();
long index = 0;
jgen.writeArrayFieldStart(NODE);
for (final CyNode node : nodes) {
jgen.writeStartObject();
jgen.writeStringField(ID, node.getSUID().toString());
if(view != null) {
// View is available. Pick (x,y)
final View<CyNode> nodeView = view.getNodeView(node);
jgen.writeNumberField(X, nodeView.getVisualProperty(BasicVisualLexicon.NODE_X_LOCATION));
jgen.writeNumberField(Y, nodeView.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION));
}
// Write CyRow in "data" field
jgen.writeObject(network.getRow(node));
jgen.writeEndObject();
node2Index.put(node, index);
index++;
}
jgen.writeEndArray();
jgen.writeArrayFieldStart(EDGE);
for (final CyEdge edge : edges) {
jgen.writeStartObject();
jgen.writeStringField(ID, edge.getSUID().toString());
jgen.writeNumberField(SOURCE, node2Index.get(edge.getSource()));
jgen.writeNumberField(TARGET, node2Index.get(edge.getTarget()));
// Write CyRow in "data" field
jgen.writeObject(network.getRow(edge));
jgen.writeEndObject();
}
jgen.writeEndArray();
jgen.writeEndObject();
}
示例7: generateNetworkView
import org.cytoscape.view.model.CyNetworkView; //导入方法依赖的package包/类
protected CyNetworkView generateNetworkView() throws Exception {
final CyNetwork network1 = support.getNetwork();
CyNode n1 = network1.addNode();
CyNode n2 = network1.addNode();
CyNode n3 = network1.addNode();
// Not connected
CyNode n4 = network1.addNode();
CyNode n5 = network1.addNode();
suid2nodeMap.put(n1.getSUID(), n1);
suid2nodeMap.put(n2.getSUID(), n2);
suid2nodeMap.put(n3.getSUID(), n3);
suid2nodeMap.put(n4.getSUID(), n4);
suid2nodeMap.put(n5.getSUID(), n5);
CyEdge e1 = network1.addEdge(n1, n2, true);
CyEdge e2 = network1.addEdge(n2, n3, true);
CyEdge e3 = network1.addEdge(n1, n3, true);
CyEdge e1self = network1.addEdge(n1, n1, true);
suid2edgeMap.put(e1.getSUID(), e1);
suid2edgeMap.put(e2.getSUID(), e2);
suid2edgeMap.put(e3.getSUID(), e3);
suid2edgeMap.put(e1self.getSUID(), e1self);
network1.getRow(n1).set(CyNetwork.NAME, "n1");
network1.getRow(n2).set(CyNetwork.NAME, "n2: 日本語テスト");
network1.getRow(n3).set(CyNetwork.NAME, "n3");
network1.getRow(n4).set(CyNetwork.NAME, "n4: Alone");
network1.getRow(n5).set(CyNetwork.NAME, "n5");
network1.getDefaultNodeTable().createColumn("DoubleTest", Double.class, false);
network1.getDefaultNodeTable().createColumn("IntTest", Integer.class, false);
network1.getDefaultNodeTable().createListColumn("StringListTest", String.class, false);
network1.getRow(n1).set("DoubleTest", 10.2d);
network1.getRow(n1).set("IntTest", 3);
List<String> list = new ArrayList<String>();
list.add("a");
list.add("b");
network1.getRow(n1).set("StringListTest", list);
network1.getRow(e1).set(CyNetwork.NAME, "e1");
network1.getRow(e2).set(CyNetwork.NAME, "エッジ2");
network1.getRow(e3).set(CyNetwork.NAME, "e3");
network1.getRow(e1self).set(CyNetwork.NAME, "e1self");
final CyNetworkView view = support.getNetworkViewFactory().createNetworkView(network1);
// Create some visual properties
final View<CyNode> view1 = view.getNodeView(n1);
view1.setVisualProperty(BasicVisualLexicon.NODE_X_LOCATION, 50d);
view1.setVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION, 50d);
assertEquals(5, view.getModel().getNodeCount());
assertEquals(4, view.getModel().getEdgeCount());
return view;
}
示例8: applyXYMap
import org.cytoscape.view.model.CyNetworkView; //导入方法依赖的package包/类
public void applyXYMap(Map<String,List<Double>> xyMap, CyNetwork currNetwork, CyApplicationManager manager){
CyNetworkView currNetworkView2 = manager.getCurrentNetworkView();
List<CyNode> currNodes = currNetwork.getNodeList();
for (CyNode node:currNodes){
String nName=currNetwork.getRow(node).get("name", String.class);
for (Map.Entry<String, List<Double>> entry : xyMap.entrySet()) {
String key = entry.getKey();
if (key.equals(nName)){
List<Double> values = entry.getValue();
View<CyNode> currNodeView= currNetworkView2.getNodeView(node) ;
currNodeView.setVisualProperty(BasicVisualLexicon.NODE_X_LOCATION, values.get(0));
currNodeView.setVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION, values.get(1));
}
}
}
currNetworkView2.updateView();
currNetworkView2.fitContent();
}
示例9: doMyLayout
import org.cytoscape.view.model.CyNetworkView; //导入方法依赖的package包/类
public void doMyLayout (double pourcentage){
undoSlider.setPourcentage(pourcentage);
//System.out.println("LIST in do Layout " );
//dMet.getNetworkList(adapter);
final CyApplicationManager manager = adapter.getCyApplicationManager();
final CyNetworkManager netmanager = adapter.getCyNetworkManager();
CyNetworkView currNetworkView = manager.getCurrentNetworkView();
//System.out.println(" do layout p " + pourcentage);
CyNetwork currNetwork = manager.getCurrentNetwork();
//CyTable myreftable = myrefnetwork.getDefaultNodeTable();
List<CyNode> currNodes = currNetwork.getNodeList();
for (CyNode pcaNode:currNodes){
String pcaName = currNetwork.getRow(pcaNode).get("name", String.class);
//System.out.println("name " + pcaName);
for (Map.Entry<String, List<Double>> pcaEntry : netMap2.entrySet()) {
String pcaKey = pcaEntry.getKey();
// to be given by user p%
for (Map.Entry<String, List<Double>> currEntry : currNetMap.entrySet()) {
String currKey = currEntry.getKey();
//System.out.println("pcaKey " + pcaKey);
//System.out.println("currKey " + currKey);
if ((pcaKey.equals(currKey)) && (pcaKey.equals(pcaName))) {
//System.out.println("pcaKey " + pcaKey);
//System.out.println("currKey " + currKey);
List<Double> pcaValues = pcaEntry.getValue();
Double xpca = pcaValues.get(0);
Double ypca = pcaValues.get(1);
List<Double> currValues = currEntry.getValue();
Double xcurr = currValues.get(0);
Double ycurr = currValues.get(1);
dMet.computePoint (xpca, ypca, xcurr, ycurr, pourcentage);
Double xNew=dMet.xNew;
Double yNew=dMet.yNew;
View<CyNode> pcaNodeView= currNetworkView.getNodeView(pcaNode) ;
pcaNodeView.setVisualProperty(BasicVisualLexicon.NODE_X_LOCATION, xNew);
pcaNodeView.setVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION, yNew);
}
}
}
}
currNetworkView.updateView();
currNetworkView.fitContent();
//AbstractCyEdit myCyEdit = new UndoSlider();
//undo.postEdit(myCyEdit);
}