当前位置: 首页>>代码示例>>Java>>正文


Java CyTable.getRow方法代码示例

本文整理汇总了Java中org.cytoscape.model.CyTable.getRow方法的典型用法代码示例。如果您正苦于以下问题:Java CyTable.getRow方法的具体用法?Java CyTable.getRow怎么用?Java CyTable.getRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.cytoscape.model.CyTable的用法示例。


在下文中一共展示了CyTable.getRow方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serializeSession

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
void serializeSession(CyTable dataTable,
                      SafeSession session) {
    CyNetworkView networkView = session.getNetworkView();
    CyNetwork network = networkView.getModel();
    CyTable networkTable = network.getDefaultNetworkTable();
    CyRow row = networkTable.getRow(network.getSUID());

    checkColumn(networkTable, DATA_TABLE_COLUMN, Long.class);
    Long suid = dataTable.getSUID();
    row.set(DATA_TABLE_COLUMN, suid);

    CyRow viewRow = dataTable.getRow(networkView.getSUID());
    try (StringWriter writer = new StringWriter()) {
        toJson(session, writer);
        String json = writer.toString();
        viewRow.set(SAFE_DATA_COLUMN, json);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:21,代码来源:SafeSessionSerializer.java

示例2: aggregateAttributes

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
private void aggregateAttributes(CyNetwork originNetwork, SummaryNetwork summaryNetwork) {
	CyTable originNodeTable = originNetwork.getDefaultNodeTable();
	
	CyTable summaryNodeTable = summaryNetwork.network.getDefaultNodeTable();
	summaryNodeTable.createColumn("cluster node count", Integer.class, false);
	
	List<String> columnsToAggregate = new ArrayList<>();
	for(CyColumn column : originNodeTable.getColumns()) {
		String name = column.getName();
		if(summaryNodeTable.getColumn(name) == null) {
			columnsToAggregate.add(name);
			Class<?> listElementType = column.getListElementType();
			if(listElementType == null) {
				summaryNodeTable.createColumn(name, column.getType(), false);
			}
			else {
				summaryNodeTable.createListColumn(name, listElementType, false);
			}
		}
	}
	
	for(SummaryCluster cluster : summaryNetwork.getClusters()) {
		CyNode summaryNode = summaryNetwork.getNodeFor(cluster);
		CyRow row = summaryNodeTable.getRow(summaryNode.getSUID());
		
		row.set("name", cluster.getLabel());
		row.set("cluster node count", cluster.getNodes().size());
		
		for(String columnName : columnsToAggregate) {
			Object result = aggregate(originNetwork, cluster, columnName);
			row.set(columnName, result);
		}
	}
}
 
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:35,代码来源:SummaryNetworkTask.java

示例3: ensemblGeneIds

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
/**
 * Return zero or more Ensembl gene ids from the specified Ensembl gene id column for the specified node.
 *
 * @param node node
 * @param network network
 * @param ensemblGeneIdColumn Ensembl gene id column
 * @return zero or more Ensembl gene ids from the specified Ensembl gene id column for the specified node
 */
static Iterable<String> ensemblGeneIds(final CyNode node, final CyNetwork network, final String ensemblGeneIdColumn)
{
    CyTable table = network.getDefaultNodeTable();
    CyRow row = table.getRow(node.getSUID());
    CyColumn column = table.getColumn(ensemblGeneIdColumn);

    if (column != null)
    {
        Class<?> columnClass = column.getType();
        if (String.class.equals(columnClass))
        {
            String ensemblGeneId = row.get(ensemblGeneIdColumn, String.class);
            if (ensemblGeneId != null)
            {
                return ImmutableList.of(ensemblGeneId);
            }
        }
        else if (columnClass.equals(List.class))
        {
            Class<?> listClass = column.getListElementType();
            if (String.class.equals(listClass))
            {
                return row.getList(ensemblGeneIdColumn, String.class);
            }
        }
    }
    return Collections.<String>emptyList();
}
 
开发者ID:heuermh,项目名称:variation-cytoscape3-app,代码行数:37,代码来源:VariationUtils.java

示例4: addCount

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
/**
 * Add the specified count in the specified column name to the specified node.
 *
 * @param node node
 * @param network network
 * @param columnName column name
 * @param count count
 */
static void addCount(final CyNode node, final CyNetwork network, final String columnName, final int count)
{
    CyTable table = network.getDefaultNodeTable();
    CyRow row = table.getRow(node.getSUID());
    if (table.getColumn(columnName) == null)
    {
        table.createColumn(columnName, Integer.class, false);
    }
    // todo:  or add to current value
    row.set(columnName, count);
}
 
开发者ID:heuermh,项目名称:variation-cytoscape3-app,代码行数:20,代码来源:VariationUtils.java

示例5: initGroupIndex

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
/**
 * Initialize group index.
 */
private void initGroupIndex(CyNetwork network, CyTable nodeTable) {
    groupIndex = new HashMap<String, CyGroup>();
    Set<CyGroup> groups = groupManager.getGroupSet(network);
    
    for (CyGroup group : groups) {
    	long SUID = group.getGroupNode().getSUID();
    	CyRow row = nodeTable.getRow(SUID);
    	
    	String groupName = row.get(CyNetwork.NAME, String.class);
    	groupIndex.put(groupName, group);
    }
}
 
开发者ID:ls-cwi,项目名称:eXamine,代码行数:16,代码来源:GenerateGroups.java

示例6: exportModel

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
private void exportModel(NetworkViewSet nvs, CyTable asTable, CyTable clusterTable, Ids ids) {
	AnnotationPersistor annotationPersistor = annotationPersistorProvider.get();
	
	for(AnnotationSet as : nvs.getAnnotationSets()) {
		CyRow asRow = asTable.getRow(ids.asId);
		asRow.set(NAME, as.getName());
		asRow.set(NETWORK_VIEW_SUID, as.getParent().getNetworkView().getSUID());
		asRow.set(LABEL_COLUMN, Arrays.asList(as.getLabelColumn())); // may want to support multiple label columns in the future
		asRow.set(ACTIVE, as.isActive());
		
		DisplayOptions disp = as.getDisplayOptions();
		asRow.set(SHAPE_TYPE, disp.getShapeType().name());
		asRow.set(SHOW_CLUSTERS, disp.isShowClusters());
		asRow.set(SHOW_LABELS, disp.isShowLabels());
		asRow.set(USE_CONSTANT_FONT_SIZE, disp.isUseConstantFontSize());
		asRow.set(FONT_SCALE, disp.getFontScale());
		asRow.set(FONT_SIZE, disp.getFontSize());
		asRow.set(OPACITY, disp.getOpacity());
		asRow.set(BORDER_WIDTH, disp.getBorderWidth());
		asRow.set(FILL_COLOR, disp.getFillColor().getRGB());
		asRow.set(BORDER_COLOR, disp.getBorderColor().getRGB());
		asRow.set(FONT_COLOR, disp.getFontColor().getRGB());
		
		LabelMakerManager labelMakerManager = labelManagerProvider.get();
		
		LabelMakerFactory labelFactory = labelMakerManager.getFactory(as);
		Object context = labelMakerManager.getContext(as, labelFactory);
		
		if(labelFactory != null && context != null) {
			String serializedContext = labelFactory.serializeContext(context);
			asRow.set(LABEL_MAKER_ID, labelFactory.getID());
			asRow.set(LABEL_MAKER_CONTEXT, serializedContext);
		}
		
		Gson gson = new Gson();
		String cpJson = gson.toJson(as.getCreationParameters());
		asRow.set(CREATION_PARAMS, cpJson);
		
		for(Cluster cluster : as.getClusters()) {
			CyRow clusterRow = clusterTable.getRow(ids.clusterId);
			clusterRow.set(LABEL, cluster.getLabel());
			clusterRow.set(COLLAPSED, cluster.isCollapsed());
			clusterRow.set(NODES_SUID, cluster.getNodes().stream().map(CyNode::getSUID).collect(Collectors.toList()));
			clusterRow.set(ANNOTATION_SET_ID, ids.asId);
			
			Optional<UUID> shapeID = annotationPersistor.getShapeID(cluster);
			clusterRow.set(SHAPE_ID, shapeID.map(UUID::toString).orElse(null));
			Optional<UUID> textID = annotationPersistor.getTextID(cluster);
			clusterRow.set(TEXT_ID, textID.map(UUID::toString).orElse(null));
			
			ids.clusterId++;
		}
		ids.asId++;
	}
}
 
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:56,代码来源:ModelTablePersistor.java

示例7: createMenuItem

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
@Override
	public CyMenuItem createMenuItem(CyNetworkView netView,
			View<CyNode> nodeView) 
	{		
		JMenu submenu = new JMenu ("SPARQL");
		
		MarrsProject project = projectMgr.getProject();
		if (project != null) 
		{				
			CyTable tab = netView.getModel().getDefaultNodeTable();
			CyNode node = nodeView.getModel();
			CyRow row = tab.getRow(node.getSUID());
			
			for (int i = 0; i < project.getRowCount(); ++i)
			{
				MarrsQuery q = project.getRow(i);
				if (q.isContextQuery())
				{
					Map<String, String> queryContext = q.getContext();
					
					boolean nodeMatchesContext = true;
					
					for (String key : queryContext.keySet())
					{
						String expectedValue = queryContext.get(key);
						String actualValue = row.get(key, String.class);
						
						if (!expectedValue.equals(actualValue))
						{
							nodeMatchesContext = false;
						}
					}
					
					if (nodeMatchesContext)
					{
						submenu.add(new QueryAction(q, node, row.get("id", String.class)));
					}
				}
			}							
		}
		
//		JMenuItem menuItem = new JMenuItem("Node View Context Menu Item");
//		menuItem.addActionListener(this);
		CyMenuItem cyMenuItem = new CyMenuItem(submenu, 0);
		return cyMenuItem;
	}
 
开发者ID:generalbioinformatics,项目名称:general-sparql-cy3,代码行数:47,代码来源:MarrsNodeViewContextMenuFactory.java


注:本文中的org.cytoscape.model.CyTable.getRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。