本文整理汇总了Java中org.cytoscape.model.CyTableUtil类的典型用法代码示例。如果您正苦于以下问题:Java CyTableUtil类的具体用法?Java CyTableUtil怎么用?Java CyTableUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CyTableUtil类属于org.cytoscape.model包,在下文中一共展示了CyTableUtil类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createCluster
import org.cytoscape.model.CyTableUtil; //导入依赖的package包/类
private void createCluster(AnnotationSet annotationSet) {
LabelMaker labelMaker = labelManager.get().getLabelMaker(annotationSet);
if(!labelMaker.isReady()) {
return;
}
List<CyNode> nodes = CyTableUtil.getNodesInState(networkView.getModel(), CyNetwork.SELECTED, true);
CyNetwork network = networkView.getModel();
// Remove selected nodes from existing clusters. Bug #37
annotationSet.removeNodes(nodes);
String label = labelMaker.makeLabel(network, nodes, annotationSet.getLabelColumn());
Cluster cluster = annotationSet.createCluster(nodes, label, false);
// It was the intention to only allow ModelEvents to be fired from inside the model package.
// But the cluster is already selected and firing the event here is much simpler than
// re-selecting the nodes to get the event to fire.
EventBus eventBus = eventBusProvider.get();
eventBus.post(new ModelEvents.ClustersSelected(annotationSet, Collections.singleton(cluster)));
}
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:22,代码来源:CreateClusterTask.java
示例2: createAnnotationSetAndCluster
import org.cytoscape.model.CyTableUtil; //导入依赖的package包/类
private void createAnnotationSetAndCluster() {
// Automatically create an annotation set
ModelManager modelManager = modelManagerProvider.get();
NetworkViewSet nvs = modelManager.getNetworkViewSet(networkView);
List<CyNode> nodes = CyTableUtil.getNodesInState(networkView.getModel(), CyNetwork.SELECTED, true);
String labelColumn = getLabelColumn();
@SuppressWarnings("rawtypes")
LabelMakerFactory labelMakerFactory = labelManagerProvider.get().getDefaultFactory();
@SuppressWarnings("unchecked")
LabelMaker labelMaker = labelMakerFactory.createLabelMaker(labelMakerFactory.getDefaultContext());
String label = labelMaker.makeLabel(networkView.getModel(), nodes, labelColumn);
String suggestedName = nvs.suggestName();
AnnotationSetBuilder builder = nvs.getAnnotationSetBuilder(suggestedName, labelColumn);
builder.addCluster(nodes, label, false);
AnnotationSet as = builder.build();
nvs.select(as);
}
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:21,代码来源:CreateClusterTask.java
示例3: handleEvent
import org.cytoscape.model.CyTableUtil; //导入依赖的package包/类
@Override
public void handleEvent(RowsSetEvent e) {
if(safeRunner.shouldIgnore(EventType.SELECTION)) {
return;
}
if(!e.containsColumn(CyNetwork.SELECTED))
return;
Optional<AnnotationSet> active = getActiveNetworkViewSet().flatMap(NetworkViewSet::getActiveAnnotationSet);
if(active.isPresent()) {
AnnotationSet annotationSet = active.get();
CyNetwork network = annotationSet.getParent().getNetwork();
if(network.getDefaultNodeTable().equals(e.getSource())) {
List<Cluster> selectedClusters = new ArrayList<>();
List<CyNode> selectedNodes = CyTableUtil.getNodesInState(network, CyNetwork.SELECTED, true);
for(Cluster cluster : annotationSet.getClusters()) {
if(selectedNodes.containsAll(cluster.getNodes())) {
selectedClusters.add(cluster);
}
}
// Fire event even when selectedClusters is empty
postEventOffEDT(new ModelEvents.ClustersSelected(annotationSet, selectedClusters));
}
}
}
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:29,代码来源:ModelManager.java
示例4: getSelectedElements
import org.cytoscape.model.CyTableUtil; //导入依赖的package包/类
public List<String> getSelectedElements() {
List<CyNode> nodes = CyTableUtil.getNodesInState(network, CyNetwork.SELECTED, true);
List<CyEdge> edges = CyTableUtil.getEdgesInState(network, CyNetwork.SELECTED, true);
if(nodes.size() == 1 && edges.isEmpty()) {
CyNode node = nodes.get(0);
String nodeGOTerm = network.getRow(node).get(GOTermColumn, String.class);
if (Unknown.equals(nodeGOTerm) || Unnanotated.equals(nodeGOTerm)) {
return null;
}
return Arrays.asList(network.getRow(node).get(CyNetwork.NAME, String.class));
}
else if (nodes.isEmpty() && edges.size() == 1) {
CyEdge edge = edges.get(0);
CyRow sourceRow = network.getRow(edge.getSource());
CyRow targetRow = network.getRow(edge.getTarget());
String sourceGOTerm = sourceRow.get(GOTermColumn, String.class);
String targetGOTerm = targetRow.get(GOTermColumn, String.class);
if (Unknown.equals(sourceGOTerm) || Unnanotated.equals(sourceGOTerm)
|| Unknown.equals(targetGOTerm) || Unnanotated.equals(targetGOTerm)) {
return null;
}
return Arrays.asList(sourceRow.get(CyNetwork.NAME, String.class), targetRow.get(CyNetwork.NAME, String.class));
}
return null;
}
开发者ID:juanjoDiaz,项目名称:gfdnet,代码行数:30,代码来源:NetworkController.java
示例5: collectParameters
import org.cytoscape.model.CyTableUtil; //导入依赖的package包/类
@Override
public boolean collectParameters() {
CyNetwork currNet = getPlugin().getCyApplicationManager().getCurrentNetwork();
List<CyNode> selectedNodes = CyTableUtil.getNodesInState(currNet, "selected", true);
if(selectedNodes.size() == 2){
setFrom(selectedNodes.get(0));
setTo(selectedNodes.get(1));
setNet(currNet);
} else {
JOptionPane.showMessageDialog(plugin.getCySwingApplication().getJFrame(), "Please select only two nodes!");
}
return from != null && to != null && depth != null && net != null;
}
开发者ID:gsummer,项目名称:cyNeo4j,代码行数:16,代码来源:ShortestPathExtExec.java
示例6: isReady
import org.cytoscape.model.CyTableUtil; //导入依赖的package包/类
@Override
public boolean isReady(CyNetworkView networkView) {
List<CyNode> nodes = CyTableUtil.getNodesInState(networkView.getModel(), CyNetwork.SELECTED, true);
return !nodes.isEmpty();
}
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:6,代码来源:CreateClusterTaskFactory.java
示例7: actionPerformed
import org.cytoscape.model.CyTableUtil; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e)
{
MarrsProject project = projectMgr.getProject();
CyNetwork myNet = mapper.createOrGetNetwork();
String filter = project.getQueryParameterFilter(mq, "ID");
if ("uri-list".equals (filter))
{
// active nodes is the union of selected nodes and the right-clicked node.
List<CyNode> activeNodes = new ArrayList<CyNode>();
activeNodes.addAll (CyTableUtil.getNodesInState(myNet,"selected",true));
if (!activeNodes.contains (clickedNode))
{
activeNodes.add (clickedNode);
}
CyTable nodeTable = myNet.getDefaultNodeTable();
StringBuilder builder = new StringBuilder();
String sep = "<";
for (CyNode n : activeNodes)
{
String nid = nodeTable.getRow(n.getSUID()).get("id", String.class);
builder.append (sep);
builder.append (nid);
sep = ">, <";
}
builder.append (">");
project.setQueryParameter("ID", builder.toString());
}
else if ("uri".equals(filter))
{
project.setQueryParameter("ID", "<" + id + ">");
}
else if ("uri-bracketed".equals(filter))
{
project.setQueryParameter("ID", "<" + id + ">");
}
else
{
project.setQueryParameter("ID", id);
}
String qtext;
try {
QueryStatus result = ProjectDlg.run(mapper, project, frame, mq);
if (!result.userCancelled && (result.resultNum == 0))
JOptionPane.showMessageDialog(frame, "Zero results");
} catch (MarrsException e2) {
JOptionPane.showMessageDialog(frame, "<html>Error fetching results<br>" + StringUtils.escapeHtml(e2.getMessage()), "Error preparing query", JOptionPane.ERROR_MESSAGE);
}
catch (StreamException e1) {
JOptionPane.showMessageDialog(frame, "<html>Error fetching results<br>" + StringUtils.escapeHtml(e1.getMessage()), "Error executing query", JOptionPane.ERROR_MESSAGE);
}
System.out.println ("Query done");
}
开发者ID:generalbioinformatics,项目名称:general-sparql-cy3,代码行数:60,代码来源:MarrsNodeViewContextMenuFactory.java
注:本文中的org.cytoscape.model.CyTableUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论