Interface StringToModel


  • public interface StringToModel
    The service implementing StringToModel provides a common mechanism for converting command arguments into Cytoscape model elements. For example, the command:
     nodes select network=current nodelist="name:gene1,name:gene2"
     
    could be handled as follows:
     @Tunable(description="Network to select", context="nongui")
     String network;
     
     @Tunable(description="List of nodes to select", context="nongui")
     String nodelist;
     
     public run(TaskMonitor mon) {
       CyNetwork net = stringToModel.getNetwork(network);
       List<CyNode> nodeList = stringToModel.getNodeList(net, nodelist);
       // Actually select the nodes...
     }
     

    Module: command-executor-api

    To use this in your app, include the following dependency in your POM:

    <dependency>
        <groupId>org.cytoscape</groupId>
        <artifactId>command-executor-api</artifactId>
    </dependency>

    Cytoscape Backwards Compatibility (API Interface): We expect that this interface will be used but not implemented by developers using this interface. As such, we reserve the right to add methods to the interface as part of minor version upgrades. We will not remove methods for any changes other than major version upgrades.
    • Method Detail

      • getNetwork

        CyNetwork getNetwork​(String strNet)
        Convert a string request for a network into a CyNetwork. This method may be used to find a network with a given name or the current network. Future implementations might accept other columns to search on.
        Parameters:
        strNet - the name of the network to return or "current"
        Returns:
        the returned CyNetwork or null if the name doesn't exist
      • getNetworkView

        CyNetworkView getNetworkView​(String strNetView)
        Convert a string request for a network view into a CyNetworkView. This method may be used to find a network view with a given name or the current network view. Future implementations might accept other columns to search on.
        Parameters:
        strNetView - the name of the network view to return or "current"
        Returns:
        the returned CyNetworkView or null if the name doesn't exist
      • getTable

        CyTable getTable​(String strTable)
        Convert a string request for a table into a CyTable. This method may be used to find a table with a given name or the current table. Future implementations might accept other columns to search on.
        Parameters:
        strTable - the name of the table to return or "current"
        Returns:
        the returned CyTable or null if the name doesn't exist
      • getNodeList

        List<CyNode> getNodeList​(CyNetwork net,
                                 String nodelist)
        Convert a string request for a nodelist into a list of CyNodes. This method may be used to find selected nodes, or nodes matching a particular column by using the pattern "column:value". If no column is specified, it is assumed that the column is the NAME column. No wildcarding or regular expression matching is supported at this time. The following special keywords are also recognized: all return all nodes in this network selected return all selected nodes in this network unselected return all unselected nodes in this network
        Parameters:
        net - the CyNetwork to search through. If null, use the current network
        nodelist - the string representing the nodelist
        Returns:
        a list of CyNodes or null if nothing matched
      • getEdgeList

        List<CyEdge> getEdgeList​(CyNetwork net,
                                 String edgelist)
        Convert a string request for a edgelist into a list of CyEdges. This method may be used to find selected edges, or edges matching a particular column by using the pattern "column:value". If no column is specified, it is assumed that the column is the NAME column. No wildcarding or regular expression matching is supported at this time. The following special keywords are also recognized: all return all edges in this network selected return all selected edges in this network unselected return all unselected edges in this network
        Parameters:
        net - the CyNetwork to search through. If null, use the current network
        edgelist - the string representing the edgelist
        Returns:
        a list of CyEdges or null if nothing matched
      • getRowList

        List<CyRow> getRowList​(CyTable table,
                               String rowlist)
        Convert a string request for a rowlist into a list of CyRows. This method may be used to find all rows, or rows matching a particular column by using the pattern "column:value". If no column is specified, it is assumed that the column is the NAME column. No wildcarding or regular expression matching is supported at this time. The following special keywords are also recognized: all return all edges in this network
        Parameters:
        table - the CyTable to search through.
        rowlist - the string representing the rowlist
        Returns:
        a list of CyRows or null if nothing matched