本文整理汇总了Java中org.cytoscape.model.CyColumn类的典型用法代码示例。如果您正苦于以下问题:Java CyColumn类的具体用法?Java CyColumn怎么用?Java CyColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CyColumn类属于org.cytoscape.model包,在下文中一共展示了CyColumn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkSafeColumns
import org.cytoscape.model.CyColumn; //导入依赖的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);
}
}
示例2: set
import org.cytoscape.model.CyColumn; //导入依赖的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);
}
}
示例3: addColumnName
import org.cytoscape.model.CyColumn; //导入依赖的package包/类
/**
* Adds a column to the current network settings.
*
* @param network
* @param addedColumnName
*/
public void addColumnName(CyNetwork network, String addedColumnName) {
CyColumn c = network.getDefaultNodeTable().getColumn(addedColumnName);
if (c == null)
return;
if (existsColumn(addedColumnName) && c != null)
return;
columnNamesSet.add(addedColumnName);
columnNames.add(addedColumnName);
int i = columnNames.size() - 1;
if (c.getListElementType() == String.class) {
allGroupColumns.add(i);
allGroupColumnSizes.add(Constants.CATEGORY_MAX_SIZE);
} else if (c.getType() == String.class) {
allStringColumns.add(i);
} else if (c.getType() == Double.class) {
allDoubleColumns.add(i);
}
}
示例4: set
import org.cytoscape.model.CyColumn; //导入依赖的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);
}
}
示例5: getTargetColumns
import org.cytoscape.model.CyColumn; //导入依赖的package包/类
private ListSingleSelection<String> getTargetColumns()
{
final CyTable table = network.getTable(CyNode.class, CyNetwork.DEFAULT_ATTRS);
final List<String> colNames = new ArrayList<String>();
for (final CyColumn col : table.getColumns()) {
// Exclude list, numerical, boolean type columns
if (String.class.isAssignableFrom(col.getType())) {
colNames.add(col.getName());
}
}
ListSingleSelection<String> toReturn =
new ListSingleSelection<String>(colNames);
if(colNames.contains("UNIPROT"))
toReturn.setSelectedValue("UNIPROT");
else if(colNames.contains("GENE SYMBOL"))
toReturn.setSelectedValue("GENE SYMBOL");
else if(colNames.contains("URI"))
toReturn.setSelectedValue("URI");
else if(colNames.contains(CyRootNetwork.SHARED_NAME))
toReturn.setSelectedValue(CyRootNetwork.SHARED_NAME); //less desired
return toReturn;
}
示例6: showColumnsForClass
import org.cytoscape.model.CyColumn; //导入依赖的package包/类
private void showColumnsForClass(Class<?> columnType, ListSingleSelection<String> selection, Class<? extends CyIdentifiable> targetClass)
{
CyNetwork network = targetNetwork.getSelectedValue();
List<CyColumn> candidateColumns = new ArrayList<>(mappingManager.getMappingTable(network, targetClass).getColumns());
List<String> filteredCandidateColumnsNames = candidateColumns.stream()
.filter(col -> col.getType() == columnType && !col.isPrimaryKey())
.map(col -> col.getName())
.collect(Collectors.toList());
filteredCandidateColumnsNames.sort(new AlphanumComparator<>());
selection.setPossibleValues(filteredCandidateColumnsNames);
}
示例7: isStringColumn
import org.cytoscape.model.CyColumn; //导入依赖的package包/类
static boolean isStringColumn(CyColumn column) {
Class<?> type = column.getType();
if (type.equals(String.class)) {
return true;
}
if (type.equals(List.class) && column.getListElementType()
.equals(String.class)) {
return true;
}
return false;
}
示例8: checkColumn
import org.cytoscape.model.CyColumn; //导入依赖的package包/类
private void checkColumn(CyTable table,
String name,
Class<?> type) {
CyColumn column = table.getColumn(name);
if (column == null) {
table.createColumn(name, type, false);
}
}
示例9: getColumnsOfType
import org.cytoscape.model.CyColumn; //导入依赖的package包/类
public static List<String> getColumnsOfType(CyNetwork network, Class<?> type, boolean node, boolean addNone, boolean allowList) {
List<String> columns = new LinkedList<>();
CyTable table;
if(node)
table = network.getDefaultNodeTable();
else
table = network.getDefaultEdgeTable();
for(CyColumn column : table.getColumns()) {
if(column.getName().equalsIgnoreCase("suid")) {
continue;
}
if(type.isAssignableFrom(column.getType())) {
columns.add(column.getName());
}
else if(allowList && List.class.equals(column.getType()) && type.isAssignableFrom(column.getListElementType())) {
columns.add(column.getName());
}
}
columns.sort(Comparator.naturalOrder());
if(addNone) {
columns.add(0, NONE);
}
return columns;
}
示例10: getLabelColumn
import org.cytoscape.model.CyColumn; //导入依赖的package包/类
private String getLabelColumn() {
Collection<CyColumn> columns = networkView.getModel().getDefaultNodeTable().getColumns();
for(CyColumn column : columns) {
String name = column.getName();
if(name.endsWith("GS_DESCR")) {
return name;
}
}
return CyNetwork.NAME;
}
示例11: aggregateAttributes
import org.cytoscape.model.CyColumn; //导入依赖的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);
}
}
}
示例12: run
import org.cytoscape.model.CyColumn; //导入依赖的package包/类
@Override
public void run(TaskMonitor taskMonitor) {
taskMonitor.setTitle(BuildProperties.APP_NAME);
taskMonitor.setStatusMessage("Calculating clusterMaker edgeCutOff attribute.");
CyTable table = network.getDefaultEdgeTable();
CyColumn column = table.getColumn(edgeAttribute);
double min = Double.MAX_VALUE;
boolean updated = false;
if(column != null) {
Class<?> type = column.getType();
if(Number.class.isAssignableFrom(type)) {
for(CyRow row : table.getAllRows()) {
Number value = (Number) row.get(edgeAttribute, type);
if(value != null) {
double doubleValue = value.doubleValue();
if(Double.isFinite(doubleValue)) {
min = Math.min(doubleValue, min);
updated = true;
}
}
}
}
}
result = updated ? min : null;
}
示例13: addVirtualColumn
import org.cytoscape.model.CyColumn; //导入依赖的package包/类
private void addVirtualColumn (CyColumn col, CyTable subTable){
VirtualColumnInfo colInfo = col.getVirtualColumnInfo();
CyColumn checkCol= subTable.getColumn(col.getName());
if (checkCol == null)
subTable.addVirtualColumn(col.getName(), colInfo.getSourceColumn(), colInfo.getSourceTable(),
colInfo.getTargetJoinKey(), col.isImmutable());
else
if (!checkCol.getVirtualColumnInfo().isVirtual() ||
!checkCol.getVirtualColumnInfo().getSourceTable().equals(colInfo.getSourceTable()) ||
!checkCol.getVirtualColumnInfo().getSourceColumn().equals(colInfo.getSourceColumn()))
subTable.addVirtualColumn(col.getName(), colInfo.getSourceColumn(), colInfo.getSourceTable(),
colInfo.getTargetJoinKey(), col.isImmutable());
}
示例14: getOrCreateColumnByPrototype
import org.cytoscape.model.CyColumn; //导入依赖的package包/类
public static CyColumn getOrCreateColumnByPrototype(String name, Object prototype,
boolean immutable, CyTable table) {
if (name == null) throw new NullPointerException("name cannot be null");
if (table == null) throw new NullPointerException("table cannot be null");
Class<?> type = (prototype == null) ? String.class : prototype.getClass();
if (!SUPPORTED_TYPES.contains(type)) {
type = String.class;
}
return getOrCreateColumn(name, type, immutable, table);
}
示例15: getOrCreateListColumn
import org.cytoscape.model.CyColumn; //导入依赖的package包/类
public static CyColumn getOrCreateListColumn(String name, Class<?> type, boolean immutable, CyTable table) {
if (name == null) throw new NullPointerException("name cannot be null");
if (type == null) throw new NullPointerException("type cannot be null");
if (table == null) throw new NullPointerException("table cannot be null");
CyColumn column = table.getColumn(name);
if (column == null) {
table.createListColumn(name, type, immutable);
column = table.getColumn(name);
}
return column;
}