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


Java CyTable.createColumn方法代码示例

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


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

示例1: checkSafeColumns

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
public static void checkSafeColumns(CyTable table) {
    CyColumn column = table.getColumn(StyleFactory.HIGHLIGHT_COLUMN);
    if (column == null) {
        table.createColumn(StyleFactory.HIGHLIGHT_COLUMN, Double.class, false, 0D);
    }

    column = table.getColumn(StyleFactory.COLOR_COLUMN);
    if (column == null) {
        table.createColumn(StyleFactory.COLOR_COLUMN, String.class, false, null);
    }

    column = table.getColumn(StyleFactory.BRIGHTNESSS_COLUMN);
    if (column == null) {
        table.createColumn(StyleFactory.BRIGHTNESSS_COLUMN, Double.class, false, 0D);
    }
}
 
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:17,代码来源:SafeUtil.java

示例2: set

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
public static void set(CyNetwork network, CyIdentifiable entry, String tableName, String name, Object value, Class<?> type) {
	CyRow row = network.getRow(entry, tableName);
	CyTable table = row.getTable();
	CyColumn column = table.getColumn(name);
	if (value != null) {
		if (column == null) {
			if (value instanceof List) {
				table.createListColumn(name, type, false);
			}
			else if (value instanceof Collection) {
				throw new IllegalArgumentException("Arrt. values collection is not a List: "
						+ value.getClass().getSimpleName());
			}
			else {
				table.createColumn(name, type, false);
			}
		}
		row.set(name, value);
	}
}
 
开发者ID:cytoscape,项目名称:biopax,代码行数:21,代码来源:AttributeUtil.java

示例3: setEdgeAttribute

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
@Override
protected void setEdgeAttribute(CyEdge edge, String colName, Object value) 
{
	if (value == null) return; //ignore
	if (value instanceof RdfNode) { value = value.toString(); }
	
	CyTable table = myNet.getDefaultEdgeTable();
	if (table.getColumn(colName) == null)
	{
		table.createColumn(colName, value.getClass(), true);
	}
	
	try
	{
		table.getRow(edge.getSUID()).set(colName, value);
	}
	catch (IllegalStateException e)
	{
		// class cast problem when sparql result does not match column class.
		// TODO...
		e.printStackTrace();
	}

}
 
开发者ID:generalbioinformatics,项目名称:general-sparql-cy3,代码行数:25,代码来源:CytoscapeV3Mapper.java

示例4: addProperties

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
public static void addProperties(Long suid, CyTable table,Map<String,Object> props){
	
	for(Entry<String,Object> obj : props.entrySet()){
		if(table.getColumn(obj.getKey()) == null){
			if(obj.getValue().getClass() == ArrayList.class){
				table.createListColumn(obj.getKey(), CyUtils.getArrayListType((ArrayList)obj.getValue()), false);
			} else {
				table.createColumn(obj.getKey(), obj.getValue().getClass(), false);
			}
		}

		CyUtils.addValueToTable(suid,obj.getKey(),obj.getValue(),table);

	}
	
}
 
开发者ID:gsummer,项目名称:cyNeo4j,代码行数:17,代码来源:CyUtils.java

示例5: set

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
public static void set(CyNetwork network, CyIdentifiable entry, String tableName, String name, Object value, Class<?> type) {
	CyRow row = network.getRow(entry, tableName);
	CyTable table = row.getTable();
	CyColumn column = table.getColumn(name);
	if (value != null) {
		if (column == null) {
			if (value instanceof List) {
				table.createListColumn(name, type, false);
			}
			else if (value instanceof Collection) {
				throw new IllegalArgumentException("Attribute value is a Collection and not List: "
						+ value.getClass().getSimpleName());
			}
			else {
				table.createColumn(name, type, false);
			}
		}
		row.set(name, value);
	}
}
 
开发者ID:PathwayCommons,项目名称:CyPath2,代码行数:21,代码来源:Attributes.java

示例6: checkColumn

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
private void checkColumn(CyTable table,
                         String name,
                         Class<?> type) {
    CyColumn column = table.getColumn(name);
    if (column == null) {
        table.createColumn(name, type, false);
    }
}
 
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:9,代码来源:SafeSessionSerializer.java

示例7: 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

示例8: createNodeAttributeIfNotExists

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
private void createNodeAttributeIfNotExists(String colName)
{
	CyTable table = myNet.getDefaultNodeTable();
	if (table.getColumn(colName) == null)
	{
		table.createColumn(colName, String.class, true);
	}
}
 
开发者ID:generalbioinformatics,项目名称:general-sparql-cy3,代码行数:9,代码来源:CytoscapeV3Mapper.java

示例9: addEdgeInfo

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
private void addEdgeInfo(Graph<GeneInput> gfdNetNetwork) {
    CyTable edgeTable = network.getDefaultEdgeTable();
    try {
        edgeTable.createColumn(DissimilairtyColumn, Double.class, false);
    } catch (IllegalArgumentException ex) {
        // Do nothing and just override the values in the collumn
    }
    
    List<CyEdge> edges = network.getEdgeList();
    int noNodes = gfdNetNetwork.getNodes().size();
    List<Object[]> relationshipList = new ArrayList<Object[]>();
    for (int i = 0; i < noNodes; i++) {
        String n1 = gfdNetNetwork.getNode(i).getName();
        for (int j = i + 1; j < noNodes; j++) {
            String n2 = gfdNetNetwork.getNode(j).getName();
            Double weight = gfdNetNetwork.getEdgeWeight(i, j);
            if (weight != -1) {
                for(CyEdge edge : edges) {
                    String sourceName = network.getRow(edge.getSource()).get(CyNetwork.NAME, String.class);
                    String targetName = network.getRow(edge.getTarget()).get(CyNetwork.NAME, String.class);
                    
                    if((sourceName.equalsIgnoreCase(n1) && targetName.equalsIgnoreCase(n2)) ||
                            (sourceName.equalsIgnoreCase(n2) && targetName.equalsIgnoreCase(n1))) {
                        edgeTable.getRow(edge.getSUID()).set(DissimilairtyColumn, weight);
                        Object[] row = new Object[3];
                        row[0] = sourceName;
                        row[1] = targetName;
                        row[2] = weight;
                        relationshipList.add(row);
                        break;
                    }
                }
            }
        }
        edgeRows = relationshipList.toArray(new Object[relationshipList.size()][3]);
    }
}
 
开发者ID:juanjoDiaz,项目名称:gfdnet,代码行数:38,代码来源:NetworkController.java

示例10: 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

示例11: detectImmutableProblem

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
private static String detectImmutableProblem(String key, CyTable table, Class<?> valueClass, Class<?> colClass){
	
	CyColumn col = table.getColumn(key);
	
	String newKey = key; // trying to make this less confusing with the extra variables

	if(col.isImmutable() && !matchingValues(valueClass,colClass)){
		newKey = key + "_cannot_change_original";
		
		// we had this problem before and fixed it, now use the fixed column instead of the previous one!
		if(table.getColumn(newKey) == null){
			if(table.getColumn(key).getListElementType() != null){
				table.createListColumn(newKey,table.getColumn(key).getListElementType() , false);
				
			} else {
				table.createColumn(newKey, table.getColumn(key).getType(), false);
			}
			
			// populate the new column!
			List<CyRow> rows = table.getAllRows();
			for(CyRow row : rows){
				if(row.isSet(key)){
					table.getRow(row.get("SUID", Long.class)).set(newKey, row.getRaw(key));
				}
			}
			
		}
	}
	
	return newKey;
	
}
 
开发者ID:gsummer,项目名称:cyNeo4j,代码行数:33,代码来源:CyUtils.java

示例12: addValue

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
private void addValue(CyNode n, CyTable defNodeTab, String key, Object value) {
	if(defNodeTab.getColumn(key) == null){
		defNodeTab.createColumn(key, value.getClass(), false);
	}
	Object val2 = value;
	
	CyColumn col = defNodeTab.getColumn(key);
	if(!value.getClass().equals(col.getType())){
		val2 = col.getType().cast(value);
	}

	defNodeTab.getRow(n.getSUID()).set(key, val2);
}
 
开发者ID:gsummer,项目名称:cyNeo4j,代码行数:14,代码来源:NeoNetworkAnalyzerExec.java

示例13: run

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
@Override
public void run(TaskMonitor tm) throws Exception {
	CyNetwork network = targetNetwork.getSelectedValue();
	CyTable targetTable = mappingManager.getMappingTable(network, targetClass.getSelectedValue().getTargetClass());
	
	//Create the actual mapping
	CyColumn mappingColumn = null;
	if(createNewColumn)
	{
		targetTable.createColumn(newColumnName, DataSeriesMappingManager.MAPPING_COLUMN_CLASS, false);
		mappingColumn = targetTable.getColumn(newColumnName);
	}
	else
	{
		mappingColumn = targetTable.getColumn(existingColumnForMapping.getSelectedValue());
	}
	
	if(mappingColumn == null)
	{
		throw new DataSeriesException("Could not get/create the column for mapping");
	}
	
	if(!mappingColumn.getType().equals(DataSeriesMappingManager.MAPPING_COLUMN_CLASS))
	{
		throw new DataSeriesException("The mapping column is of wrong type (should be " + DataSeriesMappingManager.MAPPING_COLUMN_CLASS.getSimpleName() + ", is" + mappingColumn.getType().getSimpleName() + ")");
	}
	
	mappingManager.mapDataSeriesRowsToTableColumn(targetNetwork.getSelectedValue(), targetClass.getSelectedValue().targetClass, mappingColumn.getName(), dataSeries.getSelectedValue());
	
	//Fill the mapping column 
	if(mapByRowNames)
	{
		CyColumn rowNamesColumn = targetTable.getColumn(mapRowNamesWithColumn.getSelectedValue());
		if(rowNamesColumn == null || !rowNamesColumn.getType().equals(String.class))
		{
			throw new DataSeriesException("The column for row names matches (" + mapRowNamesWithColumn.getSelectedValue() + ") has to exist and be of type string.");
		}
		
		int mapped = 0;
		int notMapped = 0;
		int empty = 0;
		for(CyRow row : targetTable.getAllRows())
		{
			String rowNameInData = row.get(mapRowNamesWithColumn.getSelectedValue(), String.class);
			if(rowNameInData == null || rowNameInData.isEmpty())
			{
				row.set(mappingColumn.getName(), null);					
				empty++;
			}
			else
			{
				List<String> rowNames = dataSeries.getSelectedValue().getRowNames();
				int rowIndex = rowNames.indexOf(rowNameInData);
				if(rowIndex < 0)
				{
					row.set(mappingColumn.getName(), null);					
					notMapped++;
				}
				else
				{
					int rowID = dataSeries.getSelectedValue().getRowID(rowIndex);
					if (rowNames.lastIndexOf(rowNameInData) != rowIndex)
					{
						userLogger.warn("The data series '" + dataSeries.getSelectedValue().getName() + "' contains multiple rows with name '" +  rowNameInData + "'. Mapping the node '" + rowNameInData + "' to row ID " + rowID); 
					}
					row.set(mappingColumn.getName(), rowID);						
					mapped++;
				}
			}				
		}
		
		userLogger.info("Mapped " + mapped + " rows to data series " + dataSeries.getSelectedValue().getName() + ", " + notMapped + " rows could not be mapped, " + empty + " rows were empty.");			
	}
}
 
开发者ID:cas-bioinf,项目名称:cy-dataseries,代码行数:75,代码来源:MapColumnTask.java

示例14: createColumn

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
private static void createColumn(CyTable table, String name, Class<?> type) {
	if(table.getColumn(name) == null)
		table.createColumn(name, type, true);
}
 
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:5,代码来源:ModelTablePersistor.java

示例15: copyColumn

import org.cytoscape.model.CyTable; //导入方法依赖的package包/类
private void copyColumn(CyColumn col, CyTable subTable) {
	if (List.class.isAssignableFrom(col.getType()))
		subTable.createListColumn(col.getName(), col.getListElementType(), false);
	else
		subTable.createColumn(col.getName(), col.getType(), false);	
}
 
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:7,代码来源:CreateSubnetworkTask.java


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