本文整理汇总了Java中org.cytoscape.model.CyRow.get方法的典型用法代码示例。如果您正苦于以下问题:Java CyRow.get方法的具体用法?Java CyRow.get怎么用?Java CyRow.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.cytoscape.model.CyRow
的用法示例。
在下文中一共展示了CyRow.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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);
};
}
示例6: 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();
}
}
示例7: 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;
}
示例8: makeLabel
import org.cytoscape.model.CyRow; //导入方法依赖的package包/类
@Override
public String makeLabel(CyNetwork network, Collection<CyNode> nodes, String labelColumn) {
CyNode node = nodes.stream().findFirst().get();
CyRow row = network.getRow(node);
String label = row.get(CyNetwork.NAME, String.class);
return label;
}
示例9: getSelectedElements
import org.cytoscape.model.CyRow; //导入方法依赖的package包/类
public List<String> getSelectedElements() {
List<CyNode> nodes = CyTableUtil.getNodesInState(network, CyNetwork.SELECTED, true);
List<CyEdge> edges = CyTableUtil.getEdgesInState(network, CyNetwork.SELECTED, true);
if(nodes.size() == 1 && edges.isEmpty()) {
CyNode node = nodes.get(0);
String nodeGOTerm = network.getRow(node).get(GOTermColumn, String.class);
if (Unknown.equals(nodeGOTerm) || Unnanotated.equals(nodeGOTerm)) {
return null;
}
return Arrays.asList(network.getRow(node).get(CyNetwork.NAME, String.class));
}
else if (nodes.isEmpty() && edges.size() == 1) {
CyEdge edge = edges.get(0);
CyRow sourceRow = network.getRow(edge.getSource());
CyRow targetRow = network.getRow(edge.getTarget());
String sourceGOTerm = sourceRow.get(GOTermColumn, String.class);
String targetGOTerm = targetRow.get(GOTermColumn, String.class);
if (Unknown.equals(sourceGOTerm) || Unnanotated.equals(sourceGOTerm)
|| Unknown.equals(targetGOTerm) || Unnanotated.equals(targetGOTerm)) {
return null;
}
return Arrays.asList(sourceRow.get(CyNetwork.NAME, String.class), targetRow.get(CyNetwork.NAME, String.class));
}
return null;
}
示例10: ensemblGeneIds
import org.cytoscape.model.CyRow; //导入方法依赖的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();
}
示例11: initGroupIndex
import org.cytoscape.model.CyRow; //导入方法依赖的package包/类
/**
* Initialize group index.
*/
private void initGroupIndex(CyNetwork network, CyTable nodeTable) {
groupIndex = new HashMap<String, CyGroup>();
Set<CyGroup> groups = groupManager.getGroupSet(network);
for (CyGroup group : groups) {
long SUID = group.getGroupNode().getSUID();
CyRow row = nodeTable.getRow(SUID);
String groupName = row.get(CyNetwork.NAME, String.class);
groupIndex.put(groupName, group);
}
}
示例12: addIHOPLinks
import org.cytoscape.model.CyRow; //导入方法依赖的package包/类
private void addIHOPLinks(CyNetwork network, CyNode node, StringBuffer buf) {
CyRow row = network.getRow(node,CyNetwork.HIDDEN_ATTRS);
String ihopLinks = row.get(BIOPAX_IHOP_LINKS, String.class);
if (ihopLinks != null) {
buf.append("<ul>");
buf.append(ihopLinks);
buf.append("</ul>");
}
}
示例13: run
import org.cytoscape.model.CyRow; //导入方法依赖的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.");
}
}
示例14: createMenuItem
import org.cytoscape.model.CyRow; //导入方法依赖的package包/类
@Override
public CyMenuItem createMenuItem(CyNetworkView netView,
View<CyNode> nodeView)
{
JMenu submenu = new JMenu ("SPARQL");
MarrsProject project = projectMgr.getProject();
if (project != null)
{
CyTable tab = netView.getModel().getDefaultNodeTable();
CyNode node = nodeView.getModel();
CyRow row = tab.getRow(node.getSUID());
for (int i = 0; i < project.getRowCount(); ++i)
{
MarrsQuery q = project.getRow(i);
if (q.isContextQuery())
{
Map<String, String> queryContext = q.getContext();
boolean nodeMatchesContext = true;
for (String key : queryContext.keySet())
{
String expectedValue = queryContext.get(key);
String actualValue = row.get(key, String.class);
if (!expectedValue.equals(actualValue))
{
nodeMatchesContext = false;
}
}
if (nodeMatchesContext)
{
submenu.add(new QueryAction(q, node, row.get("id", String.class)));
}
}
}
}
// JMenuItem menuItem = new JMenuItem("Node View Context Menu Item");
// menuItem.addActionListener(this);
CyMenuItem cyMenuItem = new CyMenuItem(submenu, 0);
return cyMenuItem;
}
开发者ID:generalbioinformatics,项目名称:general-sparql-cy3,代码行数:47,代码来源:MarrsNodeViewContextMenuFactory.java
示例15: updateNodeDetails
import org.cytoscape.model.CyRow; //导入方法依赖的package包/类
/**
* Shows details about BioPAX Entities
* that were mapped to the selected nodes.
*
* @param network
* @param nodes
*/
public void updateNodeDetails(CyNetwork network, Collection<CyNode> nodes) {
textPane.setText(""); //clear
StringBuffer buf = new StringBuffer("<html><body>");
buf.append("<dl>");
for (CyNode selected : nodes) {
CyRow row = network.getRow(selected);
// name
String s = row.get(CyNetwork.NAME, String.class);
buf.append("<dt><strong>").append(s).append("</strong>");
// type (to the text buffer)
String type = row.get(BioPaxUtil.BIOPAX_ENTITY_TYPE, String.class);
if (type != null) {
buf.append(" (BioPAX: <em>").append(type).append("</em>)");
}
buf.append("</dt>").append("<dd>").append("<dl>");
// organism
s = row.get("entityReference/organism/displayName", String.class);
if(s == null)
s = row.get("organism/displayName", String.class);
if (s != null) {
buf.append("<dt>").append("Organism").append("</dt>")
.append("<dd>").append(s).append("</dd>");
}
// cellular location
List<?> clTerms = row.getList("cellularLocation/term", String.class); //list
if (clTerms != null && !clTerms.isEmpty()) {
buf.append("<dt>").append("Cellular Location").append("</dt>")
.append("<dd>").append(clTerms.toString().replaceAll("\\[|\\]", "")).append("</dd>");
}
// chemical modification
addAttributeList(network, selected, null, BIOPAX_CHEMICAL_MODIFICATIONS_LIST, "Chemical Modifications:", buf);
// data source
addAttributeList(network, selected, null, "dataSource", "Data sources:", buf);
// links
addLinks(network, selected, buf);
buf.append("</dl>");
buf.append("</dd><hr/>");
}
buf.append("</dl>");
buf.append("</body></html>");
textPane.setText(buf.toString());
textPane.setCaretPosition(0);
}