automation when task factory already exists

41 views
Skip to first unread message

lauren...@gmail.com

unread,
Feb 3, 2021, 9:48:20 PMFeb 3
to cytoscape-app-dev
Hi Again everyone,

I am looking to automate certain functions of my app, but I am slightly confused about the process due to my app's architecture.

I am interested in automating my FCAlgorithmTask.



I believe the app is built with tunables, but I am having difficulty following the tutorials in the context of my app, which has many functions, utils, and algorithms. The only thing i can figure out is that perhaps i need to register a taskfactory property for the FCRunnerTask since it implements and Observable Task?  FCRunnerTask also already has its own TaskFactory file

Anways, i have attempted registering the task factory properties in the CyActivator, but with no success (see below).
Any guidance appreciated, thank you!

 Properties FCRunnerTaskFactoryProps = new Properties();

    FCRunnerTaskFactoryProps.setProperty(COMMAND_NAMESPACE, "ocsana+");

    FCRunnerTaskFactoryProps.setProperty(COMMAND, "fc");

    FCRunnerTaskFactoryProps.setProperty(COMMAND_DESCRIPTION, "Execute FC on network");

    FCRunnerTaskFactoryProps.setProperty(PREFERRED_MENU, "ocsana+");

FCRunnerTaskFactoryProps.setProperty(IN_CONTEXT_MENU, "true");

    FCRunnerTaskFactoryProps.setProperty("title", "Selected Nodes");

    FCRunnerTaskFactoryProps.setProperty(ENABLE_FOR,ENABLE_FOR_NETWORK);

    registerAllServices(bc, fcmenu, FCRunnerTaskFactoryProps);


Scooter Morris

unread,
Feb 4, 2021, 11:33:32 AMFeb 4
to cytoscape-app-dev
Hi!

That should certainly work.  When you say that you are having no success, can you elaborate?  If you bring up the command console and type "help", does ocsana+ show up as a namespace, and if it does, does "help ocsana+" show the "fc" command?  As far as the Tunables, your FCAlgorithmTask should define the Tunables that they should then automagically be exposed to the command-line interface (as well as through CyREST).

-- scooter

lauren...@gmail.com

unread,
Feb 4, 2021, 2:07:28 PMFeb 4
to cytoscape-app-dev
Hi Scooter,

If i bring up the command console and type help, ocsana+ does not show up. 

lauren

Scooter Morris

unread,
Feb 11, 2021, 10:42:52 AMFeb 11
to cytoscape-app-dev
OK, so that means that it's not getting registered.  Two things to try:
1) Try just doing a "help" in the command console and see if "ocsana+" or any derivation shows up.  I'm wondering if the "+" might be causing problems.
2) You are using "registerAllServices" -- try being more specific -- register(bc, fcmenu, TaskFactory.class, FCRunnerTaskFactoryProps);

-- scooter

lauren...@gmail.com

unread,
Jun 22, 2021, 12:21:07 PMJun 22
to cytoscape-app-dev
Hi Scooter,

sorry for the delay-got busy in other projects.

1. I typed help into command console and neither "ocsana+" nor any derivation appeared. I also removed the "+" from the command namespace and menu which also did not help.
2. if i switched to registerServices from registerAllServices, the app fails to launch when cytoscape is started. is perhaps the issue that i have multiple task factories to register from CyActivator? see below:

OCSANAResultsPanel resultsPanel =
            new OCSANAResultsPanel(cySwingApplication);
        registerService(bc, resultsPanel, CytoPanelComponent.class, new Properties());

        OCSANAControlPanel controlPanel =
            new OCSANAControlPanel(cyApplicationManager, cyControlPanel, resultsPanel, panelTaskManager);
        registerService(bc, controlPanel, CytoPanelComponent.class, new Properties());
        registerService(bc, controlPanel, SetCurrentNetworkListener.class, new Properties());
        
        FCResultsPanel fcresultsPanel =
                new FCResultsPanel(cySwingApplication);
            registerService(bc, fcresultsPanel, CytoPanelComponent.class, new Properties());
        
        FCmenu fcmenu = new FCmenu(cyApplicationManager,cySwingApplication,fcresultsPanel,panelTaskManager);
        registerService(bc,fcmenu,CyAction.class, new Properties());
        
        
        FVSmenu fvsmenu = new FVSmenu(cyApplicationManager,cySwingApplication,fcresultsPanel,panelTaskManager);
        registerService(bc,fvsmenu,CyAction.class, new Properties());
       
       SFAResultsPanel sfaresultsPanel =
                new SFAResultsPanel(cySwingApplication);
            registerService(bc, sfaresultsPanel, CytoPanelComponent.class, new Properties());
        
        SFAmenu sfamenu = new SFAmenu(cyApplicationManager,cySwingApplication,sfaresultsPanel,panelTaskManager);
        registerService(bc,sfamenu,CyAction.class, new Properties());
        
        
    Properties FCRunnerTaskFactoryProps = new Properties();
        FCRunnerTaskFactoryProps.setProperty(COMMAND_NAMESPACE, "ocsanaplus");
        FCRunnerTaskFactoryProps.setProperty(COMMAND, "fc");
        FCRunnerTaskFactoryProps.setProperty(COMMAND_DESCRIPTION, "Execute FC on network");
        FCRunnerTaskFactoryProps.setProperty(PREFERRED_MENU, "ocsanaplus");
        FCRunnerTaskFactoryProps.setProperty(IN_CONTEXT_MENU, "true");
        FCRunnerTaskFactoryProps.setProperty("title", "Selected Nodes");
        FCRunnerTaskFactoryProps.setProperty(ENABLE_FOR,ENABLE_FOR_NETWORK);
        registerAllServices(bc, fcmenu, FCRunnerTaskFactoryProps);


-Lauren

Scooter Morris

unread,
Jul 1, 2021, 8:39:00 AMJul 1
to cytoscape-app-dev
Hi Lauren,
   I don't think you can use properties the way you are with registerAllServices.  They only apply to the TaskFactory, and fcmenu isn't a TaskFactory -- it's a CyAction (and it's already registered).  So, you need to refactor FCMenu from a CyAction to a TaskFactory/Task combination, then you can register it as a TaskFactory and pass the properties you have set up.

-- scooter

lauren...@gmail.com

unread,
Jul 22, 2021, 11:38:10 AMJul 22
to cytoscape-app-dev
Hi Scooter,

Thanks to your help, I was able to refactor my algorithms and now have my automated functions working. Thanks again!

- Lauren

Reply all
Reply to author
Forward
0 new messages