本文整理汇总了Java中org.cytoscape.application.CyApplicationManager.getCurrentNetworkView方法的典型用法代码示例。如果您正苦于以下问题:Java CyApplicationManager.getCurrentNetworkView方法的具体用法?Java CyApplicationManager.getCurrentNetworkView怎么用?Java CyApplicationManager.getCurrentNetworkView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.cytoscape.application.CyApplicationManager
的用法示例。
在下文中一共展示了CyApplicationManager.getCurrentNetworkView方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeMap
import org.cytoscape.application.CyApplicationManager; //导入方法依赖的package包/类
public void makeMap (CyApplicationManager manager){
netMap=new HashMap<String,List<Double>>();
networkView = manager.getCurrentNetworkView();
network = manager.getCurrentNetwork();
nameNetwork = network.getRow(network).get("name", String.class);
//System.out.println("curr net 2 one" + network);
List<CyNode> nodes = network.getNodeList();
//networkView.setVisualProperty(BasicVisualLexicon.NETWORK_CENTER_X_LOCATION, 0.0);
//networkView.setVisualProperty(BasicVisualLexicon.NETWORK_CENTER_Y_LOCATION, 0.0);
for (CyNode node: nodes ){
String name = network.getRow(node).get("name", String.class);
nodeView= networkView.getNodeView(node) ;
List<Double> XY = new ArrayList<Double>();
Double xref = nodeView.getVisualProperty(BasicVisualLexicon.NODE_X_LOCATION);
Double yref = nodeView.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION);
XY.add(xref);
XY.add(yref);
netMap.put(name, XY);
}
}
示例2: checkNetwork
import org.cytoscape.application.CyApplicationManager; //导入方法依赖的package包/类
public static boolean checkNetwork(CyApplicationManager applicationManager) {
boolean result = false;
CyNetworkView view = applicationManager.getCurrentNetworkView();
CyNetwork network = applicationManager.getCurrentNetwork();
// Cannot continue if either of these is null.
if (network == null || view == null) {
JOptionPane.showMessageDialog(
null,
"No network and/or view to link to.",
"Missing network",
JDialog.ERROR);
} else {
result = true;
}
return result;
}
示例3: CreateAnnotationSetDialog
import org.cytoscape.application.CyApplicationManager; //导入方法依赖的package包/类
@Inject
public CreateAnnotationSetDialog(JFrame jFrame, CyApplicationManager appManager) {
super(jFrame, true);
setTitle("AutoAnnotate: Create Annotation Set");
this.networkView = appManager.getCurrentNetworkView();
setMinimumSize(new Dimension(500, 400));
}
示例4: addNodes
import org.cytoscape.application.CyApplicationManager; //导入方法依赖的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);
}
}
示例5: EasyModePanel
import org.cytoscape.application.CyApplicationManager; //导入方法依赖的package包/类
@Inject
public EasyModePanel(@Assisted CreateAnnotationSetDialog parent, CyApplicationManager appManager) {
this.networkView = appManager.getCurrentNetworkView();
this.parent = parent;
}
示例6: NormalModePanel
import org.cytoscape.application.CyApplicationManager; //导入方法依赖的package包/类
@Inject
public NormalModePanel(@Assisted CreateAnnotationSetDialog parent, CyApplicationManager appManager) {
this.networkView = appManager.getCurrentNetworkView();
this.parent = parent;
}
示例7: testExportThenImport
import org.cytoscape.application.CyApplicationManager; //导入方法依赖的package包/类
@Test
public void testExportThenImport(CyApplicationManager appManager, ModelManager modelManager, ModelTablePersistor persistor) {
CyNetworkView networkView = appManager.getCurrentNetworkView();
assertEquals(1, modelManager.getNetworkViewSets().size());
// We will export the model, then import it back, and the result should be the same as what we started with.
persistor.exportModel();
// clear the manager
NetworkViewAboutToBeDestroyedEvent event = new NetworkViewAboutToBeDestroyedEvent(mock(CyNetworkViewManager.class), networkView);
modelManager.handleEvent(event);
assertEquals(0, modelManager.getNetworkViewSets().size());
persistor.importModel();
assertEquals(1, modelManager.getNetworkViewSets().size());
NetworkViewSet nvs = modelManager.getNetworkViewSet(networkView);
List<AnnotationSet> annotationSets = new ArrayList<>(nvs.getAnnotationSets());
annotationSets.sort(Comparator.comparing(AnnotationSet::getName));
assertEquals(2, annotationSets.size());
AnnotationSet as1 = annotationSets.get(0);
assertEquals("as1", as1.getName());
assertEquals("lc1", as1.getLabelColumn());
assertTrue(as1.isActive());
AnnotationSet as2 = annotationSets.get(1);
assertEquals("as2", as2.getName());
assertEquals("lc2", as2.getLabelColumn());
assertFalse(as2.isActive());
DisplayOptions options = as2.getDisplayOptions();
assertEquals(10, options.getBorderWidth());
assertEquals(20, options.getFontScale());
assertEquals(30, options.getOpacity());
assertEquals(ShapeType.RECTANGLE, options.getShapeType());
assertFalse(options.isShowClusters());
assertFalse(options.isShowLabels());
assertTrue(options.isUseConstantFontSize());
List<Cluster> clusters = new ArrayList<>(as2.getClusters());
clusters.sort(Comparator.comparing(Cluster::getLabel));
assertEquals(2, clusters.size());
assertEquals("cluster1", clusters.get(0).getLabel());
assertEquals(10, clusters.get(0).getNodes().size());
assertEquals("cluster2", clusters.get(1).getLabel());
assertEquals(20, clusters.get(1).getNodes().size());
}
示例8: applyXYMap
import org.cytoscape.application.CyApplicationManager; //导入方法依赖的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.application.CyApplicationManager; //导入方法依赖的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);
}