本文整理汇总了Java中org.cytoscape.model.CyColumn.getType方法的典型用法代码示例。如果您正苦于以下问题:Java CyColumn.getType方法的具体用法?Java CyColumn.getType怎么用?Java CyColumn.getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.cytoscape.model.CyColumn
的用法示例。
在下文中一共展示了CyColumn.getType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: 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;
}
示例3: 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;
}
示例4: getEdgeColumnNames
import org.cytoscape.model.CyColumn; //导入方法依赖的package包/类
private List<String> getEdgeColumnNames() {
List<String> names = new ArrayList<String>();
names.add("- Select Column -");
for (CyNetwork network: CyActivator.networkManager.getNetworkSet()) {
for (CyColumn col: network.getDefaultEdgeTable().getColumns()) {
if (!names.contains(col.getName()) && (!col.getName().equals("SUID")) &&
((col.getType() == Double.class) || (col.getType() == Integer.class) || (col.getType() == Long.class)))
names.add(col.getName());
}
}
return names;
}
示例5: ensemblGeneIds
import org.cytoscape.model.CyColumn; //导入方法依赖的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();
}
示例6: NetworkSettings
import org.cytoscape.model.CyColumn; //导入方法依赖的package包/类
public NetworkSettings(CyNetwork network) {
this.networkSUID = network.getSUID();
// columnNames
List<CyColumn> columns = new ArrayList<CyColumn>();
columns.addAll(network.getDefaultNodeTable().getColumns());
columnNames = new ArrayList<String>(columns.size());
int i = 0;
for (CyColumn c : columns) {
columnNames.add(c.getName());
columnNamesSet.add(c.getName());
if (c.getListElementType() == String.class) {
if (c.getName().equals("Pathway")) {
selectedGroupColumns.add(allGroupColumns.size());
}
allGroupColumns.add(i);
allGroupColumnSizes.add(Constants.CATEGORY_MAX_SIZE);
} else if (c.getType() == String.class) {
if (c.getName().equals("URL")) {
selectedURLColumn = allStringColumns.size();
} else if (c.getName().equals("Symbol")) {
selectedLabelColumn = allStringColumns.size();
}
allStringColumns.add(i);
} else if (c.getType() == Double.class) {
if (c.getName().equals("Score")) {
selectedScoreColumn = allDoubleColumns.size();
}
allDoubleColumns.add(i);
}
i++;
}
showScore = allDoubleColumns.size() > 0;
}
示例7: convertCyAttributesToJson
import org.cytoscape.model.CyColumn; //导入方法依赖的package包/类
public static String convertCyAttributesToJson(CyIdentifiable item, CyTable tab){
String params = "{";
// needs to be rebuild to ensure proper typing!
ObjectMapper mapper = new ObjectMapper();
for(CyColumn cyCol : tab.getColumns()){
String paramName = cyCol.getName();
if(paramName.equals("neoid"))
continue;
Object paramValue = tab.getRow(item.getSUID()).get(cyCol.getName(),cyCol.getType());
System.out.println(paramName + " = " + paramValue);
String paramValueStr = "";
if(paramValue == null){
continue;
}
else{
Class<?> colClass = cyCol.getType();
Class<?> colTypeClass = cyCol.getListElementType();
if(colClass.equals(List.class)){
paramValueStr = "[";
List<? extends Object> l= tab.getRow(item.getSUID()).getList(cyCol.getName(), cyCol.getListElementType());
Iterator<? extends Object> it = l.iterator();
while(it.hasNext()){
paramValueStr = paramValueStr + translateToJSON(it.next(),colTypeClass);
if(it.hasNext()){
paramValueStr = paramValueStr + ", ";
}
}
paramValueStr = paramValueStr + "]";
} else {
paramValueStr = paramValueStr + translateToJSON(paramValue,cyCol.getType());
}
// if(cyCol.getType() == String.class){
// paramValueStr = "\"" + paramValue.toString() + "\"";
// } else if(){
//
// } else
// {
// paramValueStr = paramValue.toString();
// }
}
String jsonParam = "\"" + paramName + "\" : " + paramValueStr + ",";
params = params + jsonParam;
}
params = params.substring(0,params.length()-1);
params = params + "}";
return params;
}