本文整理汇总了Java中org.cytoscape.model.CyTable类的典型用法代码示例。如果您正苦于以下问题:Java CyTable类的具体用法?Java CyTable怎么用?Java CyTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CyTable类属于org.cytoscape.model包,在下文中一共展示了CyTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setColumnIndicesForNewSeriesMapping
import org.cytoscape.model.CyTable; //导入依赖的package包/类
private void setColumnIndicesForNewSeriesMapping(CyTable table, DataSeries<?,?> sourceSeries, String sourceColumn, DataSeries<?,?> smoothedSeries, String targetColumn, Map<Integer, Integer> rowMapping)
{
if(rowMapping != null)
{
table.getAllRows().forEach(
row ->
row.set(targetColumn, rowMapping.get(row.get(sourceColumn, DataSeriesMappingManager.MAPPING_COLUMN_CLASS)))
);
}
else
{
table.getAllRows().forEach(
row ->
row.set(targetColumn, row.get(sourceColumn, DataSeriesMappingManager.MAPPING_COLUMN_CLASS))
);
}
}
示例2: replaceMapping
import org.cytoscape.model.CyTable; //导入依赖的package包/类
@Override
public void replaceMapping(DataSeries<?,?> sourceTimeSeries, DataSeries<?,?> targetTimeSeries, Map<String, List<Integer>> rowGrouping) {
final DataSeriesMappingManager mappingManager = registrar.getService(DataSeriesMappingManager.class);
List<MappingDescriptor<DataSeries<?,?>>> allDescriptors = mappingManager.getMappingDescriptorsForSeries(sourceTimeSeries);
Map<Integer, Integer> rowMapping = rowMappingFromRowGrouping(rowGrouping, targetTimeSeries);
allDescriptors.forEach(descriptor -> {
mappingManager.unmap(descriptor);
//No need to write anything if rows were not grouped
if(rowGrouping != null)
{
CyTable table = mappingManager.getMappingTable(descriptor.getNetwork(), descriptor.getTargetClass());
setColumnIndicesForNewSeriesMapping(table, sourceTimeSeries, descriptor.getColumnName(), targetTimeSeries, descriptor.getColumnName(), rowMapping);
}
mappingManager.mapDataSeriesRowsToTableColumn(descriptor.getNetwork(), descriptor.getTargetClass(), descriptor.getColumnName(), targetTimeSeries);
});
}
示例3: copyMapping
import org.cytoscape.model.CyTable; //导入依赖的package包/类
@Override
public void copyMapping(DataSeries<?,?> sourceTimeSeries, DataSeries<?,?> targetTimeSeries, Map<String, List<Integer>> rowGrouping, String mappingSuffix)
{
final DataSeriesMappingManager mappingManager = registrar.getService(DataSeriesMappingManager.class);
List<MappingDescriptor<DataSeries<?,?>>> allDescriptors = mappingManager.getMappingDescriptorsForSeries(sourceTimeSeries);
Map<Integer, Integer> rowMapping = rowMappingFromRowGrouping(rowGrouping, targetTimeSeries);
allDescriptors.forEach(descriptor -> {
String newColumnName = descriptor.getColumnName() + mappingSuffix;
CyTable table = mappingManager.getMappingTable(descriptor.getNetwork(), descriptor.getTargetClass());
if (table.getColumn(newColumnName) == null)
{
table.createColumn(newColumnName, DataSeriesMappingManager.MAPPING_COLUMN_CLASS, false);
}
setColumnIndicesForNewSeriesMapping(table, sourceTimeSeries, descriptor.getColumnName(), targetTimeSeries, newColumnName, rowMapping);
mappingManager.mapDataSeriesRowsToTableColumn(descriptor.getNetwork(), descriptor.getTargetClass(), newColumnName, targetTimeSeries);
});
}
示例4: updateEdgeWeightColumnList
import org.cytoscape.model.CyTable; //导入依赖的package包/类
private void updateEdgeWeightColumnList() {
weightColumnModel.removeAllElements();
if (session == null) {
return;
}
CyNetworkView view = session.getNetworkView();
CyNetwork model = view.getModel();
CyTable table = model.getDefaultEdgeTable();
table.getColumns()
.stream()
.filter(c -> !CyIdentifiable.SUID.equals(c.getName()) && Number.class.isAssignableFrom(c.getType()))
.map(c -> c.getName())
.sorted(String.CASE_INSENSITIVE_ORDER)
.forEach(name -> weightColumnModel.addElement(name));
weightColumn.setSelectedItem(session.getWeightColumn());
if (weightColumn.getSelectedIndex() == -1 && weightColumnModel.getSize() > 0) {
weightColumn.setSelectedIndex(0);
}
}
示例5: updateColumnList
import org.cytoscape.model.CyTable; //导入依赖的package包/类
void updateColumnList(SafeSession session) {
lastAnnotationPath = null;
this.session = session;
nodeIdsModel.removeAllElements();
if (session == null) {
return;
}
CyNetworkView view = session.getNetworkView();
CyNetwork model = view.getModel();
CyTable table = model.getDefaultNodeTable();
SafeUtil.getStringColumnNames(table)
.forEach(name -> {
nodeIdsModel.addElement(name);
});
nodeIds.setSelectedItem(session.getIdColumn());
}
示例6: setNetworkView
import org.cytoscape.model.CyTable; //导入依赖的package包/类
void setNetworkView(CyNetworkView view) {
if (view == null) {
setSession(null);
return;
}
long suid = view.getSUID();
synchronized (sessionMutex) {
SafeSession session = sessionsBySuid.get(suid);
if (session == null) {
session = createNewSession(view);
sessionsBySuid.put(suid, session);
CyNetwork network = view.getModel();
CyTable nodeTable = network.getDefaultNodeTable();
sessionsBySuid.put(nodeTable.getSUID(), session);
}
setSession(session);
}
}
示例7: 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);
}
}
示例8: saveToSession
import org.cytoscape.model.CyTable; //导入依赖的package包/类
public void saveToSession(SafeSession[] sessions) {
deleteExistingTables();
CyTable dataTable = getSafeDataTable();
checkColumn(dataTable, SAFE_DATA_COLUMN, String.class);
Arrays.stream(sessions)
.forEach(session -> {
try {
serializeSession(dataTable, session);
} catch (Throwable t) {
t.printStackTrace();
}
});
tableManager.addTable(dataTable);
}
示例9: 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();
}
}
示例10: loadFromSession
import org.cytoscape.model.CyTable; //导入依赖的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;
}
示例11: exportModel
import org.cytoscape.model.CyTable; //导入依赖的package包/类
public void exportModel() {
for(CyNetwork network: networkManager.getNetworkSet()) {
CyTable asTable = createAnnotationSetTable(network);
CyTable clusterTable = createClusterTable(network);
Ids ids = new Ids();
Collection<CyNetworkView> networkViews = networkViewManager.getNetworkViews(network);
for(CyNetworkView networkView : networkViews) {
Optional<NetworkViewSet> nvs = modelManagerProvider.get().getExistingNetworkViewSet(networkView);
if(nvs.isPresent()) {
try {
exportModel(nvs.get(), asTable, clusterTable, ids);
}catch(Exception ex) {
ex.printStackTrace();
}
continue;
}
}
}
}
示例12: createAnnotationSetTable
import org.cytoscape.model.CyTable; //导入依赖的package包/类
private CyTable createAnnotationSetTable(CyNetwork network) {
CyTable table = createTable(network, ANNOTATION_SET_TABLE, ANNOTATION_SET_ID);
createColumn(table, NAME, String.class);
createColumn(table, NETWORK_VIEW_SUID, Long.class);
createListColumn(table, LABEL_COLUMN, String.class);
createColumn(table, ACTIVE, Boolean.class);
createColumn(table, SHAPE_TYPE, String.class);
createColumn(table, SHOW_CLUSTERS, Boolean.class);
createColumn(table, SHOW_LABELS, Boolean.class);
createColumn(table, USE_CONSTANT_FONT_SIZE, Boolean.class);
createColumn(table, FONT_SCALE, Integer.class);
createColumn(table, FONT_SIZE, Integer.class);
createColumn(table, OPACITY, Integer.class);
createColumn(table, BORDER_WIDTH, Integer.class);
createColumn(table, FILL_COLOR, Integer.class); // store as RGB int value
createColumn(table, BORDER_COLOR, Integer.class);
createColumn(table, FONT_COLOR, Integer.class);
createColumn(table, LABEL_MAKER_ID, String.class);
createColumn(table, LABEL_MAKER_CONTEXT, String.class);
createColumn(table, CREATION_PARAMS, String.class);
return table;
}
示例13: 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);
}
}
示例14: 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();
}
}
示例15: selectEdges
import org.cytoscape.model.CyTable; //导入依赖的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);
}
}