当前位置: 首页>>代码示例>>Java>>正文


Java BasicVisualLexicon类代码示例

本文整理汇总了Java中org.cytoscape.view.presentation.property.BasicVisualLexicon的典型用法代码示例。如果您正苦于以下问题:Java BasicVisualLexicon类的具体用法?Java BasicVisualLexicon怎么用?Java BasicVisualLexicon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BasicVisualLexicon类属于org.cytoscape.view.presentation.property包,在下文中一共展示了BasicVisualLexicon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDomainBrowserStyle

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
public VisualStyle createDomainBrowserStyle() {

        Color noDomain = new Color(51, 51, 51);

        VisualStyle style = visualStyleFactory.createVisualStyle(DOMAIN_BROWSER_STYLE);

        style.setDefaultValue(BasicVisualLexicon.NETWORK_BACKGROUND_PAINT, Color.BLACK);

        style.setDefaultValue(BasicVisualLexicon.NODE_SIZE, 80D);
        style.setDefaultValue(BasicVisualLexicon.NODE_SHAPE, NodeShapeVisualProperty.ELLIPSE);
        style.setDefaultValue(BasicVisualLexicon.NODE_FILL_COLOR, noDomain);

        style.setDefaultValue(BasicVisualLexicon.EDGE_VISIBLE, false);

        VisualMappingFunction<String, Paint> fillFunction = passthroughMappingFactory.createVisualMappingFunction(COLOR_COLUMN,
                                                                                                                  String.class,
                                                                                                                  BasicVisualLexicon.NODE_FILL_COLOR);
        style.addVisualMappingFunction(fillFunction);

        VisualMappingFunction<Double, Double> zLocationFunction = passthroughMappingFactory.createVisualMappingFunction(StyleFactory.BRIGHTNESSS_COLUMN,
                                                                                                                        Double.class,
                                                                                                                        BasicVisualLexicon.NODE_Z_LOCATION);
        style.addVisualMappingFunction(zLocationFunction);

        return style;
    }
 
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:27,代码来源:StyleFactory.java

示例2: forNodes

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
public static CoordinateData forNodes(CyNetworkView networkView, Collection<CyNode> nodes) {
	double xmin = 100000000;
	double xmax = -100000000;
	double ymin = 100000000;
	double ymax = -100000000;
	
	Map<CyNode,double[]> coordinates = new HashMap<>();
	Map<CyNode,Double> radii = new HashMap<>();
	
	for(CyNode node : nodes) {
		View<CyNode> nodeView = networkView.getNodeView(node);
		if(nodeView != null) {
			double x = nodeView.getVisualProperty(BasicVisualLexicon.NODE_X_LOCATION);
			double y = nodeView.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION);
			double radius = nodeView.getVisualProperty(BasicVisualLexicon.NODE_WIDTH);
			
			coordinates.put(node, new double[]{x,y});
			radii.put(node, radius);
			
			xmin = Double.min(xmin, x);
			xmax = Double.max(xmax, x);
			ymin = Double.min(ymin, y);
			ymax = Double.max(ymax, y);
		}
	}
	
	return new CoordinateData(xmin, xmax, ymin, ymax, coordinates, radii);
}
 
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:29,代码来源:CoordinateData.java

示例3: applyVisualStyle

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
private void applyVisualStyle(CyNetworkView originNetworkView, CyNetworkView summaryNetworkView, SummaryNetwork summaryNetwork) {
	VisualStyle vs = visualMappingManager.getVisualStyle(originNetworkView);
	
	for(View<CyNode> nodeView : summaryNetworkView.getNodeViews()) {
		// Label
		String name = summaryNetworkView.getModel().getRow(nodeView.getModel()).get("name", String.class);
		nodeView.setLockedValue(BasicVisualLexicon.NODE_LABEL, name);
		
		// Node size
		CyNode node = nodeView.getModel();
		SummaryCluster cluster = summaryNetwork.getClusterFor(node);
		int numNodes = cluster.getNodes().size();
		nodeView.setLockedValue(BasicVisualLexicon.NODE_SIZE, (double)numNodes);
	}
	
	visualMappingManager.setVisualStyle(vs, summaryNetworkView);
}
 
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:18,代码来源:SummaryNetworkTask.java

示例4: makeMap

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
public void makeMap (CyApplicationManager manager){

		netMap=new HashMap<String,List<Double>>();
		networkView = manager.getCurrentNetworkView();
		network = manager.getCurrentNetwork();
		nameNetwork = network.getRow(network).get("name", String.class);
		//System.out.println("curr net 2 one" + network);
		List<CyNode> nodes = network.getNodeList();
		//networkView.setVisualProperty(BasicVisualLexicon.NETWORK_CENTER_X_LOCATION, 0.0);
		//networkView.setVisualProperty(BasicVisualLexicon.NETWORK_CENTER_Y_LOCATION, 0.0);


		for (CyNode node: nodes ){
			String name = network.getRow(node).get("name", String.class);
			nodeView= networkView.getNodeView(node) ;
			List<Double> XY = new ArrayList<Double>();
			Double xref = nodeView.getVisualProperty(BasicVisualLexicon.NODE_X_LOCATION);
			Double yref = nodeView.getVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION);

			XY.add(xref);
			XY.add(yref);
			netMap.put(name, XY);
		}
	}
 
开发者ID:sysbio-curie,项目名称:DeDaL,代码行数:25,代码来源:DedalMethods.java

示例5: UpdateNodeNames

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
public static void UpdateNodeNames(CyNetworkView myNetView) {
if (done == 1) {
    return;
}

CyNetwork myNetwork = myNetView.getModel();
DataConnectionRest dataConnection = new DataConnectionRest();

for (View<CyNode> myNode : myNetView.getNodeViews()) {
    int nodeID = Integer.parseInt(myNetwork.getRow(myNode.getModel()).get(CyNetwork.NAME, String.class).replaceAll("\"", ""));
    String userName = dataConnection.getUserNameFromID(nodeID);
    myNode.setVisualProperty(BasicVisualLexicon.NODE_LABEL, userName);
    myNode.setVisualProperty(BasicVisualLexicon.NODE_WIDTH, userName.length() * 7.5);
}
myNetView.updateView();
done = 1;
   }
 
开发者ID:AutonlabCMU,项目名称:ActiveSearch,代码行数:18,代码来源:UpdateNodeNameViewTask.java

示例6: mapVariationCountToNodeSize

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
/**
 * Map variation_count to node size continuously.
 */
private void mapVariationCountToNodeSize()
{
    VisualStyle visualStyle = visualMappingManager.getCurrentVisualStyle();

    // remove existing node size mapping
    visualStyle.removeVisualMappingFunction(BasicVisualLexicon.NODE_SIZE);

    // create new continuous node size mapping
    ContinuousMapping<Integer, Double> nodeSizeMapping = (ContinuousMapping<Integer, Double>) continuousMappingFactory.createVisualMappingFunction("variation_count", Integer.class, BasicVisualLexicon.NODE_SIZE);

    Double smallest = Double.valueOf(30.0d);
    Double largest = Double.valueOf(90.0d);
    int maxVariationCount = maxCount(model.getNetwork(), "variation_count");
    nodeSizeMapping.addPoint(0, new BoundaryRangeValues(smallest, smallest, smallest));
    nodeSizeMapping.addPoint(maxVariationCount, new BoundaryRangeValues(largest, largest, largest));

    // install new mapping
    visualStyle.addVisualMappingFunction(nodeSizeMapping);
}
 
开发者ID:heuermh,项目名称:variation-cytoscape3-app,代码行数:23,代码来源:VisualMappingView.java

示例7: mapVariationCountToNodeColor

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
/**
 * Map variation_count to node color continuously.
 */
private void mapVariationCountToNodeColor()
{
    VisualStyle visualStyle = visualMappingManager.getCurrentVisualStyle();

    // remove existing node color mapping
    visualStyle.removeVisualMappingFunction(BasicVisualLexicon.NODE_FILL_COLOR);

    // create new continuous node color mapping
    ContinuousMapping<Integer, Paint> nodeColorMapping = (ContinuousMapping<Integer, Paint>) continuousMappingFactory.createVisualMappingFunction("variation_count", Integer.class, BasicVisualLexicon.NODE_FILL_COLOR);

    // blues-4
    Paint p0 = new Color(239, 243, 255);
    Paint p1 = new Color(189, 215, 231);
    Paint p2 = new Color(107, 174, 214);
    Paint p3 = new Color(33, 113, 181);
    int maxVariationCount = maxCount(model.getNetwork(), "variation_count");
    nodeColorMapping.addPoint(0, new BoundaryRangeValues(p0, p0, p0));
    nodeColorMapping.addPoint(maxVariationCount / 3, new BoundaryRangeValues(p1, p1, p1));
    nodeColorMapping.addPoint(2 * maxVariationCount / 3, new BoundaryRangeValues(p2, p2, p2));
    nodeColorMapping.addPoint(maxVariationCount, new BoundaryRangeValues(p3, p3, p3));

    // install new mapping
    visualStyle.addVisualMappingFunction(nodeColorMapping);
}
 
开发者ID:heuermh,项目名称:variation-cytoscape3-app,代码行数:28,代码来源:VisualMappingView.java

示例8: processCallResponse

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
@Override
public void processCallResponse(ExtensionCall call, Object callRetValue) {

	List<Double> values = (List<Double>)callRetValue;

	CyTable defNodeTab = currNet.getDefaultNodeTable();
	CyNetworkView networkView = getPlugin().getCyNetViewMgr().getNetworkViews(currNet).iterator().next();

	for(int i = 0; i < (values.size() / 3); ++i){
		Long neoid = values.get(i*3).longValue();
		Double x = values.get(i*3+1);
		Double y = values.get(i*3+2);

		Set<CyNode> nodeSet = CyUtils.getNodesWithValue(currNet, defNodeTab, "neoid", neoid);
		CyNode n = nodeSet.iterator().next();

		View<CyNode> nodeView = networkView.getNodeView(n);
		nodeView.setVisualProperty(BasicVisualLexicon.NODE_X_LOCATION, x);
		nodeView.setVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION, y);

		CyUtils.updateVisualStyle(getPlugin().getVisualMappingManager(), networkView, currNet);
	}
}
 
开发者ID:gsummer,项目名称:cyNeo4j,代码行数:24,代码来源:ForceAtlas2LayoutExtExec.java

示例9: getArrowShape

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
private DiscreteMapping<String, ArrowShape> getArrowShape() {
	Class<String> dataType = String.class;
	DiscreteMapping<String, ArrowShape> arrowShapeMapper = (DiscreteMapping) plugin.getVisualMappingFunctionFactoryDiscrete().createVisualMappingFunction("datasource", dataType, BasicVisualLexicon.EDGE_TARGET_ARROW_SHAPE);
	
	ExtensionManager mgr = plugin.getExtensionManager(network);
	for(DataSource ds : mgr.getDatasources()) {
		arrowShapeMapper.putMapValue(ds.getName(), ArrowShapeVisualProperty.ARROW);
	}
	
       arrowShapeMapper.putMapValue("pp", ArrowShapeVisualProperty.CIRCLE);
       arrowShapeMapper.putMapValue("interaction", ArrowShapeVisualProperty.ARROW);
       arrowShapeMapper.putMapValue("Line, Arrow", ArrowShapeVisualProperty.ARROW);
       arrowShapeMapper.putMapValue("Line, TBar", ArrowShapeVisualProperty.T);
       arrowShapeMapper.putMapValue("group-connection", ArrowShapeVisualProperty.NONE);
       
       return arrowShapeMapper;
}
 
开发者ID:CyTargetLinker,项目名称:cytargetlinker,代码行数:19,代码来源:VisualStyleCreator.java

示例10: getNodeColor

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
private DiscreteMapping<String, Color> getNodeColor() {
	String ctrAttr = "biologicalType";
	Class<String> dataType = String.class; 
	
	DiscreteMapping<String, Color> dMapping = (DiscreteMapping) plugin.getVisualMappingFunctionFactoryDiscrete().createVisualMappingFunction(ctrAttr, dataType, BasicVisualLexicon.NODE_FILL_COLOR);
	
	String tf  = "transcriptionFactor";
	dMapping.putMapValue(tf, new Color(204, 255, 204));
	String gene  = "gene";
	dMapping.putMapValue(gene, new Color(255,204,204));
	String target  = "target";
	dMapping.putMapValue(target, new Color(255,204,204));
	String miRNA  = "microRNA";
	dMapping.putMapValue(miRNA, new Color(255, 255, 204));
	String drug  = "drug";
	dMapping.putMapValue(drug, new Color(204, 204, 255));
	
	return dMapping;
}
 
开发者ID:CyTargetLinker,项目名称:cytargetlinker,代码行数:21,代码来源:VisualStyleCreator.java

示例11: getNodeShapeStyle

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
private DiscreteMapping<String, NodeShape> getNodeShapeStyle() {
	String ctrAttr = "ctl.nodeType";
	Class<String> dataType = String.class; 
	
	DiscreteMapping<String, NodeShape> dMapping = (DiscreteMapping) plugin.getVisualMappingFunctionFactoryDiscrete().createVisualMappingFunction(ctrAttr, dataType, BasicVisualLexicon.NODE_SHAPE);

	String reg  = NodeType.REGULATOR.toString();
	dMapping.putMapValue(reg, NodeShapeVisualProperty.ROUND_RECTANGLE);
	String tar  = NodeType.TARGET.toString();
	dMapping.putMapValue(tar, NodeShapeVisualProperty.HEXAGON);
	String both  = NodeType.BOTH.toString();
	dMapping.putMapValue(both, NodeShapeVisualProperty.DIAMOND);
	String init  = NodeType.INITIAL.toString();
	dMapping.putMapValue(init, NodeShapeVisualProperty.ELLIPSE);
	
	return dMapping;
}
 
开发者ID:CyTargetLinker,项目名称:cytargetlinker,代码行数:19,代码来源:VisualStyleCreator.java

示例12: createAttributeBrowserStyle

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
public VisualStyle createAttributeBrowserStyle() {

        VisualStyle style = visualStyleFactory.createVisualStyle(ATTRIBUTE_BROWSER_STYLE);

        style.setDefaultValue(BasicVisualLexicon.NETWORK_BACKGROUND_PAINT, Color.BLACK);

        style.setDefaultValue(BasicVisualLexicon.NODE_SIZE, 80D);
        style.setDefaultValue(BasicVisualLexicon.NODE_SHAPE, NodeShapeVisualProperty.ELLIPSE);
        style.setDefaultValue(BasicVisualLexicon.NODE_FILL_COLOR, ZERO);

        style.setDefaultValue(BasicVisualLexicon.EDGE_VISIBLE, false);

        ContinuousMapping<Double, Paint> fillFunction = (ContinuousMapping<Double, Paint>) continuousMappingFactory.createVisualMappingFunction(HIGHLIGHT_COLUMN,
                                                                                                                                                Double.class,
                                                                                                                                                BasicVisualLexicon.NODE_FILL_COLOR);

        fillFunction.addPoint(-1D, new BoundaryRangeValues<>(NEGATIVE, NEGATIVE, NEGATIVE));
        fillFunction.addPoint(0D, new BoundaryRangeValues<>(ZERO, ZERO, ZERO));
        fillFunction.addPoint(1D, new BoundaryRangeValues<>(POSITIVE, POSITIVE, POSITIVE));
        style.addVisualMappingFunction(fillFunction);

        VisualMappingFunction<Double, Double> zLocationFunction = passthroughMappingFactory.createVisualMappingFunction(StyleFactory.BRIGHTNESSS_COLUMN,
                                                                                                                        Double.class,
                                                                                                                        BasicVisualLexicon.NODE_Z_LOCATION);
        style.addVisualMappingFunction(zLocationFunction);

        return style;
    }
 
开发者ID:baryshnikova-lab,项目名称:safe-java,代码行数:29,代码来源:StyleFactory.java

示例13: computeShapeArgs

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
private static ShapeArgs computeShapeArgs(AnnotationRenderer annotationRenderer, Cluster cluster) {
	AnnotationSet annotationSet = cluster.getParent();
	CyNetworkView view = annotationSet.getParent().getNetworkView();
	DisplayOptions displayOptions = annotationSet.getDisplayOptions();
	boolean isSelected = annotationRenderer.isSelected(cluster);
	
	ShapeType shapeType = displayOptions.getShapeType();
	int borderWidth = displayOptions.getBorderWidth() * (isSelected ? 3 : 1);
	int opacity = displayOptions.getOpacity();
	Color borderColor = isSelected ? SELECTED_COLOR : displayOptions.getBorderColor();
	Color fillColor = displayOptions.getFillColor();
	
	
	double zoom = view.getVisualProperty(BasicVisualLexicon.NETWORK_SCALE_FACTOR);

	CoordinateData coordinateData = cluster.getCoordinateData();
	double centreX = coordinateData.getCenterX();
	double centreY = coordinateData.getCenterY();
	double width  = Double.max(coordinateData.getWidth(),  minSize);
	double height = Double.max(coordinateData.getHeight(), minSize);
	
	if (shapeType == ShapeType.ELLIPSE) {
		while (nodesOutOfCluster(coordinateData, width, height, centreX, centreY, borderWidth)) {
			width *= 1.1;
			height *= 1.1;
		}
		width += 40;
		height += 40;
	} else {
		width += 50;
		height += 50;
	}
	
	// Set the position of the top-left corner of the ellipse
	Integer xPos = (int) Math.round(centreX - width/2);
	Integer yPos = (int) Math.round(centreY - height/2);
	
	return new ShapeArgs(xPos, yPos, width, height, zoom, shapeType, borderWidth, opacity, fillColor, borderColor);
}
 
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:40,代码来源:DrawClusterTask.java

示例14: createNetworkView

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
private CyNetworkView createNetworkView(SummaryNetwork summaryNetwork) {
	CyNetworkView networkView = networkViewFactory.createNetworkView(summaryNetwork.network);
	for(View<CyNode> nodeView : networkView.getNodeViews()) {
		SummaryCluster cluster = summaryNetwork.getClusterFor(nodeView.getModel());
		Point2D.Double center = cluster.getCoordinateData().getCenter();
		nodeView.setVisualProperty(BasicVisualLexicon.NODE_X_LOCATION, center.x);
		nodeView.setVisualProperty(BasicVisualLexicon.NODE_Y_LOCATION, center.y);
	}
	return networkView;
}
 
开发者ID:BaderLab,项目名称:AutoAnnotateApp,代码行数:11,代码来源:SummaryNetworkTask.java

示例15: addNodes

import org.cytoscape.view.presentation.property.BasicVisualLexicon; //导入依赖的package包/类
/**
 * @desc - Adds nodes to the protein network from the information returned by the Slim* run.
 * @param uniprotIDs - list of all Uniprot IDs input to the returned run.
 * @param nodeIds - map linking all selected Uniprot IDs to their CyNodes, for easy access to the network.
 * @param newNetwork - CyNetwork of the network being altered.
 * @param networkViewManager - NetworkViewManager for the network being altered. Initialised in CyActivator.
 * @param manager - CyApplicationManager for the network being altered. Initialised in CyActivator.
 */
public void addNodes (List<String> uniprotIDs, Map<String, CyNode> nodeIds, CyNetwork newNetwork,
                      CyNetworkViewManager networkViewManager, CyApplicationManager manager) {

    // Add network view
    final Collection<CyNetworkView> views = networkViewManager.getNetworkViews(newNetwork);
    CyNetworkView myView = null;
    if(views.size() != 0) {
        myView = views.iterator().next();
    }

    if (myView == null) {
        // create a new view for my network
        myView = networkViewFactory.createNetworkView(newNetwork);
        networkViewManager.addNetworkView(myView);
    } else {
        System.out.println("networkView already existed.");
    }

    CyNetworkView networkView =  manager.getCurrentNetworkView();
    for (Object o : nodeIds.entrySet()) {
        Map.Entry pairs = (Map.Entry) o;
        CyNode node = (CyNode) pairs.getValue();
        View<CyNode> nodeView = networkView.getNodeView(node);
        nodeView.setLockedValue(BasicVisualLexicon.NODE_SHAPE, NodeShapeVisualProperty.ELLIPSE);
        nodeView.setLockedValue(BasicVisualLexicon.NODE_BORDER_PAINT, Color.BLACK);
        nodeView.setLockedValue(BasicVisualLexicon.NODE_SIZE, 60.0);
    }
}
 
开发者ID:passeridae,项目名称:SLiMscape,代码行数:37,代码来源:AlterGraph.java


注:本文中的org.cytoscape.view.presentation.property.BasicVisualLexicon类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。