本文整理汇总了Java中org.cytoscape.model.CyRow类的典型用法代码示例。如果您正苦于以下问题:Java CyRow类的具体用法?Java CyRow怎么用?Java CyRow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CyRow类属于org.cytoscape.model包,在下文中一共展示了CyRow类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: serializeSession
import org.cytoscape.model.CyRow; //导入依赖的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: loadFromSession
import org.cytoscape.model.CyRow; //导入依赖的package包/类
public LongObjectMap<SafeSession> loadFromSession(CySession cySession) throws IOException {
CyTable dataTable = cySession.getTables()
.stream()
.map(metadata -> metadata.getTable())
.filter(table -> DATA_TABLE_TITLE.equals(table.getTitle()))
.findFirst()
.orElse(null);
LongObjectMap<SafeSession> sessions = new LongObjectHashMap<>();
if (dataTable == null) {
return sessions;
}
for (CyRow row : dataTable.getAllRows()) {
String json = row.get(SAFE_DATA_COLUMN, String.class);
SafeSession session = parseSession(json);
Long oldSuid = row.get(CyIdentifiable.SUID, Long.class);
CyNetworkView view = cySession.getObject(oldSuid, CyNetworkView.class);
session.setNetworkView(view);
sessions.put(view.getSUID(), session);
}
return sessions;
}
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:26,代码来源:SafeSessionSerializer.java
示例3: collapse
import org.cytoscape.model.CyRow; //导入依赖的package包/类
private void collapse() {
if(!cluster.isCollapsed()) {
modelManager.ignore(VIEW_CHANGE, SELECTION).whileRunning(() -> {
CyNetwork network = cluster.getNetwork();
List<CyNode> nodes = new ArrayList<>(cluster.getNodes());
CyGroup group = groupFactory.createGroup(network, nodes, null, true);
CyRow groupRow = ((CySubNetwork)network).getRootNetwork().getRow(group.getGroupNode(), CyRootNetwork.SHARED_ATTRS);
groupRow.set(CyRootNetwork.SHARED_NAME, cluster.getLabel());
group.collapse(network);
if(overrideAttribute) {
maybeCreateAnotherAttributeForName(network, groupRow);
}
});
}
}
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:20,代码来源:CollapseTask.java
示例4: set
import org.cytoscape.model.CyRow; //导入依赖的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
示例5: selectEdges
import org.cytoscape.model.CyRow; //导入依赖的package包/类
public void selectEdges(String n1, String n2) {
CyTable nodeTable = network.getDefaultNodeTable();
List<CyEdge> edges = network.getEdgeList();
for(CyRow row : nodeTable.getAllRows()) {
row.set(CyNetwork.SELECTED, false);
}
for(CyEdge edge : edges) {
if((network.getRow(edge.getSource()).get(CyNetwork.NAME, String.class).equalsIgnoreCase(n1) && network.getRow(edge.getTarget()).get(CyNetwork.NAME, String.class).equalsIgnoreCase(n2)) ||
(network.getRow(edge.getSource()).get(CyNetwork.NAME, String.class).equalsIgnoreCase(n2) && network.getRow(edge.getTarget()).get(CyNetwork.NAME, String.class).equalsIgnoreCase(n1))) {
network.getRow(edge).set(CyNetwork.SELECTED, true);
}
else{
network.getRow(edge).set(CyNetwork.SELECTED, false);
}
}
if (networkView != null) {
networkView.updateView();
applicationManager.setCurrentNetworkView(networkView);
}
}
开发者ID:juanjoDiaz,项目名称:gfdnet,代码行数:24,代码来源:NetworkController.java
示例6: getNodesWithValue
import org.cytoscape.model.CyRow; //导入依赖的package包/类
public static Set<CyNode> getNodesWithValue(
final CyNetwork net, final CyTable table,
final String colname, final Object value)
{
final Collection<CyRow> matchingRows = table.getMatchingRows(colname, value);
final Set<CyNode> nodes = new HashSet<CyNode>();
final String primaryKeyColname = table.getPrimaryKey().getName();
for (final CyRow row : matchingRows)
{
final Long nodeId = row.get(primaryKeyColname, Long.class);
if (nodeId == null)
continue;
final CyNode node = net.getNode(nodeId);
if (node == null)
continue;
nodes.add(node);
}
return nodes;
}
开发者ID:gsummer,项目名称:cyNeo4j,代码行数:20,代码来源:CyUtils.java
示例7: getEdgeWithValue
import org.cytoscape.model.CyRow; //导入依赖的package包/类
public static Set<CyEdge> getEdgeWithValue(
final CyNetwork net, final CyTable table,
final String colname, final Object value)
{
final Collection<CyRow> matchingRows = table.getMatchingRows(colname, value);
final Set<CyEdge> edges = new HashSet<CyEdge>();
final String primaryKeyColname = table.getPrimaryKey().getName();
for (final CyRow row : matchingRows)
{
final Long edgeId = row.get(primaryKeyColname, Long.class);
if (edgeId == null)
continue;
final CyEdge edge = net.getEdge(edgeId);
if (edge == null)
continue;
edges.add(edge);
}
return edges;
}
开发者ID:gsummer,项目名称:cyNeo4j,代码行数:20,代码来源:CyUtils.java
示例8: serialize
import org.cytoscape.model.CyRow; //导入依赖的package包/类
@Override
public void serialize(final CyRow row, JsonGenerator jgen, SerializerProvider provider) throws IOException,
JsonProcessingException {
final CyTable table = row.getTable();
final Map<String, Object> values = row.getAllValues();
for (final String columnName : values.keySet()) {
final Object value = values.get(columnName);
if (value == null)
continue;
Class<?> type = table.getColumn(columnName).getType();
if (type == List.class) {
type = table.getColumn(columnName).getListElementType();
writeList(type, columnName, (List<?>) value, jgen);
} else {
jgen.writeFieldName(replaceColumnName(columnName));
writeValue(type, value, jgen);
}
}
}
开发者ID:keiono,项目名称:cytoscape-d3,代码行数:23,代码来源:D3RowSerializer.java
示例9: serialize
import org.cytoscape.model.CyRow; //导入依赖的package包/类
@Override
public void serialize(final CyNetworkView networkView, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonProcessingException {
final CyNetwork network = networkView.getModel();
Collection<CyRow> root = network.getDefaultNodeTable().getMatchingRows(CyNetwork.SELECTED, true);
if (root.size() != 1) {
throw new IllegalStateException("You need to select one node as the root for this tree.");
}
CyRow rootNodeRow = root.iterator().next();
final CyNode rootNode = network.getNode(rootNodeRow.get(CyIdentifiable.SUID, Long.class));
if (rootNode == null) {
throw new IllegalStateException("Could not find the root for this tree.");
}
jgen.useDefaultPrettyPrinter();
expanded = new HashSet<CyNode>();
getChildren(network, rootNode, jgen);
}
开发者ID:keiono,项目名称:cytoscape-d3,代码行数:23,代码来源:D3CyNetworkViewTreeSerializer.java
示例10: set
import org.cytoscape.model.CyRow; //导入依赖的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
示例11: ChartSource
import org.cytoscape.model.CyRow; //导入依赖的package包/类
public ChartSource(CyNetwork network, Class<? extends CyIdentifiable> targetClass, CyRow row) {
super();
this.network = network;
this.targetClass = targetClass;
this.row = row;
}
开发者ID:cas-bioinf,项目名称:cy-dataseries,代码行数:7,代码来源:DataSeriesVisualPanel.java
示例12: getDataSeriesRow
import org.cytoscape.model.CyRow; //导入依赖的package包/类
/**
* Gets the index of the data series row corresponding to a given CyRow under this mapping
* @param row
* @return -1 if there is no row for this CyRow, or the index of the associated row.
* @throws DataSeriesException if the CyRow contains an invalid ID.
*/
public int getDataSeriesRow(CyRow row)
{
Integer rowID = row.get(columnName, DataSeriesMappingManager.MAPPING_COLUMN_CLASS);
if(rowID == null)
{
return -1;
}
int tsRow = dataSeries.idToRow(rowID);
if(tsRow < 0)
{
throw new DataSeriesException("Requesting non existent row id (" + tsRow + ") from Data Series " + dataSeries.getName());
}
return tsRow;
}
开发者ID:cas-bioinf,项目名称:cy-dataseries,代码行数:21,代码来源:MappingDescriptor.java
示例13: setEnrichmentLandscape
import org.cytoscape.model.CyRow; //导入依赖的package包/类
void setEnrichmentLandscape(EnrichmentLandscape landscape) {
if (session == null) {
notifyListeners();
return;
}
isEnabled = true;
Long[] nodeMappings = session.getNodeMappings();
if (nodeMappings == null) {
notifyListeners();
return;
}
CyNetworkView view = session.getNetworkView();
CyNetwork network = view.getModel();
CyTable nodeTable = network.getDefaultNodeTable();
nodeTableId = nodeTable.getSUID();
Arrays.stream(nodeMappings)
.forEach(suid -> {
CyRow row = nodeTable.getRow(suid);
boolean selected = row.get(CyNetwork.SELECTED, Boolean.class);
if (selected) {
nodeSuids.add(suid);
}
});
notifyListeners();
}
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:31,代码来源:SelectionTracker.java
示例14: handleEvent
import org.cytoscape.model.CyRow; //导入依赖的package包/类
@Override
public void handleEvent(RowsSetEvent event) {
if (nodeTableId == null || !isEnabled) {
return;
}
if (event.getSource()
.getSUID() != nodeTableId) {
return;
}
int initialSize = nodeSuids.size();
Collection<RowSetRecord> records = event.getColumnRecords(CyNetwork.SELECTED);
records.stream()
.forEach(record -> {
CyRow row = record.getRow();
Long suid = row.get(CyNetwork.SUID, Long.class);
if (Boolean.TRUE.equals(record.getValue())) {
nodeSuids.add(suid);
} else {
nodeSuids.removeAll(suid);
}
});
if (nodeSuids.size() != initialSize) {
notifyListeners();
}
}
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:29,代码来源:SelectionTracker.java
示例15: selectSignificantNodes
import org.cytoscape.model.CyRow; //导入依赖的package包/类
private void selectSignificantNodes() {
SignificancePredicate predicate = getSignificancePredicate();
int[] rows = filteredTable.getTable()
.getSelectedRows();
TableRowSorter<TableModel> sorter = filteredTable.getSorter();
Long[] nodeMappings = session.getNodeMappings();
CyNetworkView view = session.getNetworkView();
CyNetwork network = view.getModel();
CyTable nodeTable = network.getDefaultNodeTable();
CyTable edgeTable = network.getDefaultEdgeTable();
SafeUtil.clearSelection(nodeTable);
SafeUtil.clearSelection(edgeTable);
EnrichmentLandscape landscape = session.getEnrichmentLandscape();
List<? extends Neighborhood> neighborhoods = landscape.getNeighborhoods();
neighborhoods.stream()
.forEach(n -> {
boolean include = Arrays.stream(rows)
.map(i -> sorter.convertRowIndexToModel(i))
.filter(i -> predicate.test(n, i))
.findAny()
.isPresent();
Long suid = nodeMappings[n.getNodeIndex()];
CyRow row = nodeTable.getRow(suid);
row.set(CyNetwork.SELECTED, include);
});
}
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:31,代码来源:AttributeBrowserController.java
示例16: getLabelFunction
import org.cytoscape.model.CyRow; //导入依赖的package包/类
LabelFunction getLabelFunction(Long[] nodeMappings,
String nameColumn) {
return i -> {
Long suid = nodeMappings[i];
CyRow row = nodeTable.getRow(suid);
return row.get(nameColumn, String.class);
};
}
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:9,代码来源:BaseExportReportsTask.java
示例17: safeGet
import org.cytoscape.model.CyRow; //导入依赖的package包/类
private static <T> void safeGet(CyRow row, String column, Class<T> type, Consumer<T> consumer) {
try {
T value = row.get(column, type);
if(value == null) {
System.err.println("AutoAnnotate.importModel - Can't find display option for " + column);
}
else {
consumer.accept(value);
}
} catch(ClassCastException e) {
System.err.println("AutoAnnotate.importModel - Error loading display options for " + column);
e.printStackTrace();
}
}
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:15,代码来源:ModelTablePersistor.java
示例18: valueChanged
import org.cytoscape.model.CyRow; //导入依赖的package包/类
@Override
public void valueChanged(ListSelectionEvent e) {
if(e.getValueIsAdjusting())
return;
ClusterTableModel model = (ClusterTableModel)table.getModel();
AnnotationSet annotationSet = model.getAnnotationSet();
if(annotationSet == null)
return;
Set<CyNode> nodesToSelect =
Arrays.stream(table.getSelectedRows())
.map(table::convertRowIndexToModel)
.mapToObj(model::getCluster)
.flatMap(c -> c.getNodes().stream())
.collect(Collectors.toSet());
CyNetwork network = annotationSet.getParent().getNetwork();
for(CyNode node : network.getNodeList()) {
CyRow row = network.getRow(node);
// Test if the node is already in the correct state, don't fire unnecessary events
boolean select = nodesToSelect.contains(node);
if(!Boolean.valueOf(select).equals(row.get(CyNetwork.SELECTED, Boolean.class))) {
row.set(CyNetwork.SELECTED, select);
}
}
}
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:30,代码来源:ClusterTableSelectionListener.java
示例19: aggregateAttributes
import org.cytoscape.model.CyRow; //导入依赖的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
示例20: run
import org.cytoscape.model.CyRow; //导入依赖的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;
}
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:30,代码来源:CutoffTask.java
注:本文中的org.cytoscape.model.CyRow类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论