Search in sources :

Example 6 with CyGroupManager

use of org.cytoscape.group.CyGroupManager in project cytoscape-impl by cytoscape.

the class GroupUtil method getExternalEdges.

public List<CyEdge> getExternalEdges(final CyNetwork network) {
    // Get all of our groups in this network
    final CyGroupManager groupMgr = serviceRegistrar.getService(CyGroupManager.class);
    Set<CyGroup> groupSet = groupMgr.getGroupSet(network);
    List<CyEdge> externalEdges = new ArrayList<>();
    for (CyGroup group : groupSet) {
        // Don't need to worry about this for expanded groups
        if (group.isCollapsed(network))
            externalEdges.addAll(group.getExternalEdgeList());
    }
    return externalEdges;
}
Also used : CyGroup(org.cytoscape.group.CyGroup) ArrayList(java.util.ArrayList) CyEdge(org.cytoscape.model.CyEdge) CyGroupManager(org.cytoscape.group.CyGroupManager)

Example 7 with CyGroupManager

use of org.cytoscape.group.CyGroupManager in project cytoscape-impl by cytoscape.

the class GroupUtil method prepareGroupsForSerialization.

public void prepareGroupsForSerialization(final Collection<CyNetwork> networks) {
    if (networks == null)
        return;
    addedNodes = new HashMap<>();
    for (CyNetwork net : networks) {
        if (!(net instanceof CySubNetwork))
            continue;
        // Get all of our groups
        final CyGroupManager groupMgr = serviceRegistrar.getService(CyGroupManager.class);
        Set<CyGroup> groupSet = groupMgr.getGroupSet(net);
        // For each group, save the list of external edges
        for (CyGroup group : groupSet) {
            updateExternalEdgeAttribute(group);
            updateCollapsedGroupsAttribute(group);
            updateGroupAttribute(net, group);
        }
    }
}
Also used : CyGroup(org.cytoscape.group.CyGroup) CyNetwork(org.cytoscape.model.CyNetwork) CySubNetwork(org.cytoscape.model.subnetwork.CySubNetwork) CyGroupManager(org.cytoscape.group.CyGroupManager)

Example 8 with CyGroupManager

use of org.cytoscape.group.CyGroupManager in project clusterMaker2 by RBVI.

the class CyActivator method start.

public void start(BundleContext bc) {
    // See if we have a graphics console or not
    boolean haveGUI = true;
    CySwingApplication swingAppRef = getService(bc, CySwingApplication.class);
    if (swingAppRef == null) {
        // if haveGUI is false, we don't want to provide any hooks to the treeview
        haveGUI = false;
    }
    CyApplicationManager appRef = getService(bc, CyApplicationManager.class);
    CyServiceRegistrar serviceRegistrar = getService(bc, CyServiceRegistrar.class);
    CyGroupManager groupManager = getService(bc, CyGroupManager.class);
    CyGroupFactory groupFactory = getService(bc, CyGroupFactory.class);
    CyTableFactory tableFactory = getService(bc, CyTableFactory.class);
    CyTableManager tableManager = getService(bc, CyTableManager.class);
    // Create our context object.  This will probably keep track of all of the
    // registered clustering algorithms, settings, etc.
    ClusterManagerImpl clusterManager = new ClusterManagerImpl(appRef, serviceRegistrar, groupFactory, groupManager, tableFactory, tableManager);
    registerServiceListener(bc, clusterManager, "addClusterAlgorithm", "removeClusterAlgorithm", ClusterTaskFactory.class);
    registerServiceListener(bc, clusterManager, "addClusterVisualizer", "removeClusterVisualizer", ClusterVizFactory.class);
    registerServiceListener(bc, clusterManager, "addRankingAlgorithm", "removeRankingAlgorithm", RankFactory.class);
    // Register each of our algorithms
    // Attribute clusterers
    registerService(bc, new AttributeClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new AutoSOMETaskFactory(clusterManager, true), ClusterTaskFactory.class, new Properties());
    registerService(bc, new FeatureVectorTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new HierarchicalTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new KMeansTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new KMedoidTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new HopachPAMTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new PAMTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    // FIXME: FFT is seriously broken!
    registerService(bc, new FFTTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new DBSCANTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    /*
		 * Hold off on these until we get improve the performance sufficiently
		 * to allow them to be useful
		 */
    // registerService(bc, new BicFinderTaskFactory(clusterManager),
    // ClusterTaskFactory.class, new Properties());
    // registerService(bc, new BiMineTaskFactory(clusterManager),
    // ClusterTaskFactory.class, new Properties());
    registerService(bc, new ChengChurchTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    // Network clusterers
    registerService(bc, new NetworkClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new APClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new AutoSOMETaskFactory(clusterManager, false), ClusterTaskFactory.class, new Properties());
    registerService(bc, new FuzzifierTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new GLayClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new ConnectedComponentsTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new FCMClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new MCLClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new MCODEClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new SCPSClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new TransClustClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    // Cluster ranking
    registerService(bc, new MAATaskFactory(clusterManager), RankFactory.class, new Properties());
    registerService(bc, new MAMTaskFactory(clusterManager), RankFactory.class, new Properties());
    registerService(bc, new PRWPTaskFactory(clusterManager), RankFactory.class, new Properties());
    registerService(bc, new PRTaskFactory(clusterManager), RankFactory.class, new Properties());
    registerService(bc, new HITSTaskFactory(clusterManager), RankFactory.class, new Properties());
    // Filters
    registerService(bc, new FilterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new BestNeighborFilterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new CuttingEdgeFilterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new DensityFilterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new HairCutFilterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    // registerService(bc, new UITaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    // Visualizations
    registerService(bc, new NewNetworkViewFactory(clusterManager, false), ClusterVizFactory.class, new Properties());
    registerService(bc, new NewNetworkViewFactory(clusterManager, true), ClusterVizFactory.class, new Properties());
    registerService(bc, new HeatMapViewTaskFactory(clusterManager), ClusterVizFactory.class, new Properties());
    registerService(bc, new KnnViewTaskFactory(clusterManager), ClusterVizFactory.class, new Properties());
    registerService(bc, new BiclusterViewTaskFactory(clusterManager), ClusterVizFactory.class, new Properties());
    registerService(bc, new TreeViewTaskFactory(clusterManager), ClusterVizFactory.class, new Properties());
    registerService(bc, new CreateResultsPanelTaskFactory(clusterManager, true), ClusterVizFactory.class, new Properties());
    registerService(bc, new CreateRankingPanelTaskFactory(clusterManager, true), ClusterVizFactory.class, new Properties());
    registerService(bc, new DestroyResultsPanelTaskFactory(clusterManager, true), ClusterVizFactory.class, new Properties());
    registerService(bc, new DestroyRankingPanelTaskFactory(clusterManager, true), ClusterVizFactory.class, new Properties());
    // Dimensionality Reduction
    // registerService(bc, new PCAMenuTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new PCATaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new PCoATaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    registerService(bc, new tSNETaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
    {
        // Link Network Selections
        LinkSelectionTaskFactory linkTaskFactory = new LinkSelectionTaskFactory(clusterManager);
        Properties linkSelectionProps = new Properties();
        linkSelectionProps.setProperty(INSERT_SEPARATOR_BEFORE, "true");
        linkSelectionProps.setProperty(PREFERRED_MENU, "Apps.clusterMaker Visualizations");
        linkSelectionProps.setProperty(TITLE, "Link selection across networks");
        linkSelectionProps.setProperty(COMMAND, "linkSelection");
        linkSelectionProps.setProperty(COMMAND_NAMESPACE, "clusterviz");
        linkSelectionProps.setProperty(ENABLE_FOR, "networkAndView");
        linkSelectionProps.setProperty(IN_MENU_BAR, "true");
        linkSelectionProps.setProperty(MENU_GRAVITY, "100.0");
        registerService(bc, linkTaskFactory, NetworkTaskFactory.class, linkSelectionProps);
    }
    {
        // UnLink Network Selections
        UnlinkSelectionTaskFactory unlinkTaskFactory = new UnlinkSelectionTaskFactory(clusterManager);
        Properties unlinkSelectionProps = new Properties();
        unlinkSelectionProps.setProperty(PREFERRED_MENU, "Apps.clusterMaker Visualizations");
        unlinkSelectionProps.setProperty(TITLE, "Unlink selection across networks");
        unlinkSelectionProps.setProperty(COMMAND, "unlinkSelection");
        unlinkSelectionProps.setProperty(COMMAND_NAMESPACE, "clusterviz");
        unlinkSelectionProps.setProperty(ENABLE_FOR, "networkAndView");
        unlinkSelectionProps.setProperty(IN_MENU_BAR, "true");
        unlinkSelectionProps.setProperty(MENU_GRAVITY, "100.0");
        registerService(bc, unlinkTaskFactory, NetworkTaskFactory.class, unlinkSelectionProps);
    }
    // Commands
    // These task factories provide useful commands that only make sense in the context of REST or
    // the command interface
    {
        TaskFactory commandTaskFactory = new CommandTaskFactory(clusterManager, "hascluster");
        Properties props = new Properties();
        props.setProperty(COMMAND_NAMESPACE, "cluster");
        props.setProperty(COMMAND, CommandTaskFactory.HASCLUSTER);
        props.setProperty(COMMAND_DESCRIPTION, "Test to see if this network has a cluster of the requested type");
        registerService(bc, commandTaskFactory, TaskFactory.class, props);
    }
    {
        TaskFactory commandTaskFactory = new CommandTaskFactory(clusterManager, "getnetworkcluster");
        Properties props = new Properties();
        props.setProperty(COMMAND_NAMESPACE, "cluster");
        props.setProperty(COMMAND, CommandTaskFactory.GETNETWORKCLUSTER);
        props.setProperty(COMMAND_DESCRIPTION, "Get a cluster network cluster result");
        registerService(bc, commandTaskFactory, TaskFactory.class, props);
    }
    {
        TaskFactory commandTaskFactory = new CommandTaskFactory(clusterManager, "getcluster");
        Properties props = new Properties();
        props.setProperty(COMMAND_NAMESPACE, "cluster");
        props.setProperty(COMMAND, CommandTaskFactory.GETCLUSTER);
        props.setProperty(COMMAND_DESCRIPTION, "Get an attribute cluster result");
        registerService(bc, commandTaskFactory, TaskFactory.class, props);
    }
}
Also used : MCODEClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.MCODE.MCODEClusterTaskFactory) MAMTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.ranking.MAM.MAMTaskFactory) HITSTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.ranking.HITS.HITSTaskFactory) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar) BestNeighborFilterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.clusterFilters.BestNeighbor.BestNeighborFilterTaskFactory) FilterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.clusterFilters.FilterTaskFactory) DensityFilterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.clusterFilters.Density.DensityFilterTaskFactory) HairCutFilterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.clusterFilters.HairCut.HairCutFilterTaskFactory) CuttingEdgeFilterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.clusterFilters.CuttingEdge.CuttingEdgeFilterTaskFactory) FCMClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.FCM.FCMClusterTaskFactory) CyGroupFactory(org.cytoscape.group.CyGroupFactory) KMedoidTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.kmedoid.KMedoidTaskFactory) CySwingApplication(org.cytoscape.application.swing.CySwingApplication) HairCutFilterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.clusterFilters.HairCut.HairCutFilterTaskFactory) PCATaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.pca.PCATaskFactory) HopachPAMTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.hopach.HopachPAMTaskFactory) FuzzifierTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.Fuzzifier.FuzzifierTaskFactory) MAATaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.ranking.MAA.MAATaskFactory) MCLClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.MCL.MCLClusterTaskFactory) CuttingEdgeFilterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.clusterFilters.CuttingEdge.CuttingEdgeFilterTaskFactory) CyApplicationManager(org.cytoscape.application.CyApplicationManager) FFTTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.fft.FFTTaskFactory) HierarchicalTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.hierarchical.HierarchicalTaskFactory) KMeansTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.kmeans.KMeansTaskFactory) ChengChurchTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.ChengChurch.ChengChurchTaskFactory) GLayClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.GLay.GLayClusterTaskFactory) PCoATaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.pcoa.PCoATaskFactory) PAMTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.pam.PAMTaskFactory) HopachPAMTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.hopach.HopachPAMTaskFactory) NetworkClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.NetworkClusterTaskFactory) Properties(java.util.Properties) FeatureVectorTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.featureVector.FeatureVectorTaskFactory) PRTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.ranking.PR.PRTaskFactory) BestNeighborFilterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.clusterFilters.BestNeighbor.BestNeighborFilterTaskFactory) CyGroupManager(org.cytoscape.group.CyGroupManager) ConnectedComponentsTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.ConnectedComponents.ConnectedComponentsTaskFactory) TransClustClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.TransClust.TransClustClusterTaskFactory) AutoSOMETaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.autosome.AutoSOMETaskFactory) DBSCANTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.DBSCAN.DBSCANTaskFactory) AttributeClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.AttributeClusterTaskFactory) APClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.AP.APClusterTaskFactory) PRWPTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.ranking.PRWP.PRWPTaskFactory) SCPSClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.SCPS.SCPSClusterTaskFactory) CommandTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.commands.CommandTaskFactory) CyTableFactory(org.cytoscape.model.CyTableFactory) edu.ucsf.rbvi.clusterMaker2.internal.algorithms.tSNEWrapper.tSNETaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.tSNEWrapper.tSNETaskFactory) CyTableManager(org.cytoscape.model.CyTableManager) DensityFilterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.clusterFilters.Density.DensityFilterTaskFactory) NetworkTaskFactory(org.cytoscape.task.NetworkTaskFactory) HITSTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.ranking.HITS.HITSTaskFactory) AutoSOMETaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.autosome.AutoSOMETaskFactory) FCMClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.FCM.FCMClusterTaskFactory) KMeansTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.kmeans.KMeansTaskFactory) TransClustClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.TransClust.TransClustClusterTaskFactory) PCAMenuTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.pca.PCAMenuTaskFactory) FFTTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.fft.FFTTaskFactory) KMedoidTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.kmedoid.KMedoidTaskFactory) SCPSClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.SCPS.SCPSClusterTaskFactory) MCLClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.MCL.MCLClusterTaskFactory) NetworkClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.NetworkClusterTaskFactory) PCATaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.pca.PCATaskFactory) ChengChurchTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.ChengChurch.ChengChurchTaskFactory) APClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.AP.APClusterTaskFactory) edu.ucsf.rbvi.clusterMaker2.internal.algorithms.tSNEWrapper.tSNETaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.tSNEWrapper.tSNETaskFactory) DBSCANTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.DBSCAN.DBSCANTaskFactory) FeatureVectorTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.featureVector.FeatureVectorTaskFactory) HierarchicalTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.hierarchical.HierarchicalTaskFactory) PAMTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.pam.PAMTaskFactory) BestNeighborFilterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.clusterFilters.BestNeighbor.BestNeighborFilterTaskFactory) AttributeClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.AttributeClusterTaskFactory) ConnectedComponentsTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.ConnectedComponents.ConnectedComponentsTaskFactory) PRWPTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.ranking.PRWP.PRWPTaskFactory) FilterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.clusterFilters.FilterTaskFactory) ClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.api.ClusterTaskFactory) TaskFactory(org.cytoscape.work.TaskFactory) DensityFilterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.clusterFilters.Density.DensityFilterTaskFactory) HairCutFilterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.clusterFilters.HairCut.HairCutFilterTaskFactory) NetworkTaskFactory(org.cytoscape.task.NetworkTaskFactory) MAATaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.ranking.MAA.MAATaskFactory) FuzzifierTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.Fuzzifier.FuzzifierTaskFactory) PCoATaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.pcoa.PCoATaskFactory) GLayClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.GLay.GLayClusterTaskFactory) MAMTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.ranking.MAM.MAMTaskFactory) PRTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.ranking.PR.PRTaskFactory) CommandTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.commands.CommandTaskFactory) HopachPAMTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.hopach.HopachPAMTaskFactory) MCODEClusterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.MCODE.MCODEClusterTaskFactory) CuttingEdgeFilterTaskFactory(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.clusterFilters.CuttingEdge.CuttingEdgeFilterTaskFactory)

Example 9 with CyGroupManager

use of org.cytoscape.group.CyGroupManager in project cytoscape-impl by cytoscape.

the class CoSELayoutAlgorithmTask method layoutPartition.

@Override
public void layoutPartition(final LayoutPartition partition) {
    if (cancelled)
        return;
    final CyGroupManager groupManager = serviceRegistrar.getService(CyGroupManager.class);
    final CyNetwork network = networkView.getModel();
    // Create the CoSE model
    // (see http://www.cs.bilkent.edu.tr/~ivis/chilay/ChiLay-2.0-PG.pdf)
    cose = new CoSELayout();
    cose.addProgressListener(new ProgressListener() {

        @Override
        public void update(double value) {
            taskMonitor.setProgress(value);
        }
    });
    final LGraphManager gm = cose.getGraphManager();
    final LGraph root = gm.addRoot();
    // Index all LayoutNodes by CyNode for future reference
    final Map<CyNode, LayoutNode> layoutNodeMap = new HashMap<>();
    for (LayoutNode n : partition.getNodeList()) layoutNodeMap.put(n.getNode(), n);
    // Create all CoSE nodes
    final Map<CyNode, LNode> lNodeMap = new HashMap<>();
    for (LayoutNode n : partition.getNodeList()) {
        // If this node does not belong to a CyGroup, let's traverse its potential compound node tree.
        if (groupManager.getGroupsForNode(n.getNode(), network).isEmpty())
            traverseLNodeTree(n, root, cose, lNodeMap, layoutNodeMap, groupManager);
    }
    if (cancelled)
        return;
    // Create all CoSE edges
    final Map<CyEdge, LEdge> lEdgeMap = new HashMap<>();
    final Iterator<LayoutEdge> edgeIter = partition.edgeIterator();
    while (edgeIter.hasNext() && !cancelled) {
        final LayoutEdge e = edgeIter.next();
        createLEdge(e, cose, lNodeMap, lEdgeMap);
    }
    if (cancelled)
        return;
    // Run the layout
    try {
        cose.runLayout();
    } catch (Exception e) {
        logger.error("Error running CoSE Layout", e);
        return;
    }
    if (cancelled)
        return;
    // Move all Node Views to the new positions
    for (LayoutNode n : partition.getNodeList()) partition.moveNodeToLocation(n);
}
Also used : LayoutNode(org.cytoscape.view.layout.LayoutNode) HashMap(java.util.HashMap) LEdge(org.ivis.layout.LEdge) CyNetwork(org.cytoscape.model.CyNetwork) LGraphManager(org.ivis.layout.LGraphManager) LGraph(org.ivis.layout.LGraph) CyEdge(org.cytoscape.model.CyEdge) LayoutEdge(org.cytoscape.view.layout.LayoutEdge) ProgressListener(org.ivis.layout.ProgressListener) CyNode(org.cytoscape.model.CyNode) LNode(org.ivis.layout.LNode) CoSELayout(org.ivis.layout.cose.CoSELayout) CyGroupManager(org.cytoscape.group.CyGroupManager)

Example 10 with CyGroupManager

use of org.cytoscape.group.CyGroupManager in project cytoscape-impl by cytoscape.

the class NewNetworkSelectedNodesOnlyTaskFactoryTest method testObserver.

@Test
public void testObserver() throws Exception {
    NetworkViewTestSupport viewSupport = new NetworkViewTestSupport();
    NetworkTestSupport networkSupport = new NetworkTestSupport();
    CyNetworkFactory networkFactory = networkSupport.getNetworkFactory();
    UndoSupport undoSupport = mock(UndoSupport.class);
    CyRootNetworkManager crnf = new CyRootNetworkManagerImpl();
    CyNetworkViewFactory cnvf = viewSupport.getNetworkViewFactory();
    CyNetworkManager netmgr = mock(CyNetworkManager.class);
    CyNetworkViewManager networkViewManager = mock(CyNetworkViewManager.class);
    CyNetworkNaming naming = mock(CyNetworkNaming.class);
    VisualMappingManager vmm = mock(VisualMappingManager.class);
    CyApplicationManager appManager = mock(CyApplicationManager.class);
    CyEventHelper eventHelper = mock(CyEventHelper.class);
    CyGroupManager groupMgr = mock(CyGroupManager.class);
    RenderingEngineManager renderingEngineMgr = mock(RenderingEngineManager.class);
    CyLayoutAlgorithm defLayout = mock(CyLayoutAlgorithm.class);
    CyLayoutAlgorithmManager layoutMgr = mock(CyLayoutAlgorithmManager.class);
    when(layoutMgr.getDefaultLayout()).thenReturn(defLayout);
    CyServiceRegistrar serviceRegistrar = mock(CyServiceRegistrar.class);
    when(serviceRegistrar.getService(CyLayoutAlgorithmManager.class)).thenReturn(layoutMgr);
    NewNetworkSelectedNodesOnlyTaskFactoryImpl factory = new NewNetworkSelectedNodesOnlyTaskFactoryImpl(undoSupport, crnf, cnvf, netmgr, networkViewManager, naming, vmm, appManager, eventHelper, groupMgr, renderingEngineMgr, serviceRegistrar);
    CyNetwork network = networkFactory.createNetwork();
    CyNode node = network.addNode();
    network.getRow(node).set(CyNetwork.SELECTED, true);
    TaskObserver observer = mock(TaskObserver.class);
    TaskMonitor taskMonitor = mock(TaskMonitor.class);
    TaskIterator iterator = factory.createTaskIterator(network);
    while (iterator.hasNext()) {
        Task t = iterator.next();
        t.run(taskMonitor);
        if (t instanceof ObservableTask)
            observer.taskFinished((ObservableTask) t);
    }
    verify(observer, times(1)).taskFinished(any(ObservableTask.class));
}
Also used : CyEventHelper(org.cytoscape.event.CyEventHelper) Task(org.cytoscape.work.Task) ObservableTask(org.cytoscape.work.ObservableTask) CyNetwork(org.cytoscape.model.CyNetwork) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar) ObservableTask(org.cytoscape.work.ObservableTask) TaskIterator(org.cytoscape.work.TaskIterator) TaskMonitor(org.cytoscape.work.TaskMonitor) CyLayoutAlgorithm(org.cytoscape.view.layout.CyLayoutAlgorithm) CyNode(org.cytoscape.model.CyNode) CyGroupManager(org.cytoscape.group.CyGroupManager) CyRootNetworkManager(org.cytoscape.model.subnetwork.CyRootNetworkManager) CyNetworkViewManager(org.cytoscape.view.model.CyNetworkViewManager) RenderingEngineManager(org.cytoscape.view.presentation.RenderingEngineManager) CyRootNetworkManagerImpl(org.cytoscape.model.internal.CyRootNetworkManagerImpl) NetworkTestSupport(org.cytoscape.model.NetworkTestSupport) NetworkViewTestSupport(org.cytoscape.ding.NetworkViewTestSupport) UndoSupport(org.cytoscape.work.undo.UndoSupport) CyApplicationManager(org.cytoscape.application.CyApplicationManager) TaskObserver(org.cytoscape.work.TaskObserver) CyNetworkManager(org.cytoscape.model.CyNetworkManager) CyNetworkViewFactory(org.cytoscape.view.model.CyNetworkViewFactory) CyLayoutAlgorithmManager(org.cytoscape.view.layout.CyLayoutAlgorithmManager) CyNetworkNaming(org.cytoscape.session.CyNetworkNaming) CyNetworkFactory(org.cytoscape.model.CyNetworkFactory) VisualMappingManager(org.cytoscape.view.vizmap.VisualMappingManager) Test(org.junit.Test)

Aggregations

CyGroupManager (org.cytoscape.group.CyGroupManager)14 CyNetwork (org.cytoscape.model.CyNetwork)9 CyNetworkManager (org.cytoscape.model.CyNetworkManager)7 CyApplicationManager (org.cytoscape.application.CyApplicationManager)6 CyNode (org.cytoscape.model.CyNode)6 CyServiceRegistrar (org.cytoscape.service.util.CyServiceRegistrar)6 CyGroup (org.cytoscape.group.CyGroup)5 CyNetworkFactory (org.cytoscape.model.CyNetworkFactory)5 CyRootNetworkManager (org.cytoscape.model.subnetwork.CyRootNetworkManager)5 CyNetworkViewFactory (org.cytoscape.view.model.CyNetworkViewFactory)5 CyNetworkViewManager (org.cytoscape.view.model.CyNetworkViewManager)5 RenderingEngineManager (org.cytoscape.view.presentation.RenderingEngineManager)5 VisualMappingManager (org.cytoscape.view.vizmap.VisualMappingManager)5 CyEventHelper (org.cytoscape.event.CyEventHelper)4 CyLayoutAlgorithmManager (org.cytoscape.view.layout.CyLayoutAlgorithmManager)4 UndoSupport (org.cytoscape.work.undo.UndoSupport)4 CyGroupFactory (org.cytoscape.group.CyGroupFactory)3 CyNetworkNaming (org.cytoscape.session.CyNetworkNaming)3 NetworkViewTestSupport (org.cytoscape.ding.NetworkViewTestSupport)2 CyNetworkTableManager (org.cytoscape.model.CyNetworkTableManager)2