• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Pathway类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: loadGexCache

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
/**
 * Load the Gex cache for the current pathway. Only starts loading
 * when an expression dataset is available and a pathway is open.
 */
public void loadGexCache() {
	final CachedData gex = gexManager.getCachedData();
	final Pathway p = swingEngine.getEngine().getActivePathway();
	if(p != null && gex != null) {
		try
		{
			gex.clearCache();
			gex.setMapper (swingEngine.getGdbManager().getCurrentGdb());
			gex.preSeed(p.getDataNodeXrefs());
			gex.preSeed(p.getLineXrefs());
			swingEngine.getEngine().getActiveVPathway().redraw();
		}
		catch (DataException e)
		{
			Logger.log.error ("Exception while caching expression data ", e);
		}
	}
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:23,代码来源:PvDesktop.java


示例2: fromModel

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
/**
 * Maps the contents of a pathway to this VPathway
 */
public void fromModel(Pathway aData)
{
	Logger.log.trace("Create view structure");

	data = aData;
	for (PathwayElement o : data.getDataObjects())
	{
		fromModelElement(o);
	}

	// data.fireObjectModifiedEvent(new PathwayEvent(null,
	// PathwayEvent.MODIFIED_GENERAL));
	fireVPathwayEvent(new VPathwayEvent(this, VPathwayEventType.MODEL_LOADED));
	data.addListener(this);
	undoManager.setPathway(data);
	addScheduled();
	Logger.log.trace("Done creating view structure");
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:22,代码来源:VPathway.java


示例3: addElements

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
public PathwayElement[] addElements(Pathway p, double mx, double my) {
			PathwayElement e = PathwayElement.createPathwayElement(ObjectType.SHAPE);
			e.setShapeType(type);
			e.setMCenterX(mx);
			e.setMCenterY(my);
			e.setMWidth(1);
			e.setMHeight(1);
			e.setRotation(0);
			e.setGraphId(p.getUniqueGraphId());
			addElement(e, p);

			//brace
//			gdata.setOrientation(OrientationType.RIGHT);

			return new PathwayElement[] { e };
		}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:17,代码来源:DefaultTemplates.java


示例4: exportPathway

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
/**
	 * Exports given pathway to file. This function doesn't act on the active pathway.
	 * @param pathway pathway to export
	 * @param file file to write to.
	 * @returns a list of warnings that occurred during export, or an empty list if there were none.
	 */
	public List<String> exportPathway(File file, Pathway pathway, String exporterName) throws ConverterException 
	{
		Logger.log.trace("Exporting pathway to " + file);
		
		Set<PathwayExporter> set = getPathwayExporters(file);
		try {
			for ( PathwayExporter pExporter : set){
				if (pExporter.getName().equals(exporterName))
				{
//					System.out.println(pExporter.getName());
					pExporter.doExport(file, pathway);
					return pExporter.getWarnings();
				}
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:27,代码来源:Engine.java


示例5: usesOldEnsembl

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
private boolean usesOldEnsembl(Pathway pwy)
{
	Organism org = Organism.fromLatinName(pwy.getMappInfo().getOrganism());
	if (!ensSpecies.containsKey(org))
		return false; // this pwy is not one of the species to be converted

	for (PathwayElement elt : pwy.getDataObjects())
	{
		if (elt.getObjectType() == ObjectType.DATANODE &&
				elt.getDataSource() == BioDataSource.ENSEMBL)
		{
			return true;
		}
	}
	return false;
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:17,代码来源:Compat.java


示例6: convertEnsembl

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
/**
 * Ensembl considers each species database as separate,
 * and thus they should have separate system codes as well.
 * This method will convert generic Ensembl datanodes
 * to species specific datanodes if possible.
 */
private void convertEnsembl(Pathway pwy)
{
	Organism org = Organism.fromLatinName(pwy.getMappInfo().getOrganism());
	if (!ensSpecies.containsKey(org))
		return; // this pwy is not one of the species to be converted

	for (PathwayElement elt : pwy.getDataObjects())
	{
		if (elt.getObjectType() == ObjectType.DATANODE &&
				elt.getDataSource() == BioDataSource.ENSEMBL)
		{
			elt.setDataSource (ensSpecies.get (org));
		}
	}

}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:23,代码来源:Compat.java


示例7: applicationEvent

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
public void applicationEvent(ApplicationEvent e)
{
	switch (e.getType())
	{
	case PATHWAY_OPENED:
		{
			Pathway pwy = swingEngine.getEngine().getActivePathway();
			if (usesOldEnsembl(pwy))
			{
				int result = JOptionPane.showConfirmDialog(
						swingEngine.getFrame(),
						"This Pathway uses the old style references to Ensembl.\nDo you want" +
						"to update this pathway?\n\n" +
						"This update is required if you want to use the latest gene databases.",
						"Update pathway?", JOptionPane.YES_NO_OPTION);
				if (result == JOptionPane.YES_OPTION)
				{
					convertEnsembl(pwy);
				}
			}
		}
	}

}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:25,代码来源:Compat.java


示例8: savePathway

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
public boolean savePathway()
{
	Pathway pathway = engine.getActivePathway();

	boolean result = true;

       // Overwrite the existing xml file.
	// If the target file is read-only, let the user select a new pathway
	if (pathway.getSourceFile() != null && pathway.getSourceFile().canWrite())
	{
		try {
			engine.savePathway(pathway.getSourceFile());
		} catch (ConverterException e) {
			handleConverterException(e.getMessage(), null, e);
		}
	}
	else {
		result = savePathwayAs();
	}

	return result;
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:23,代码来源:SwingEngine.java


示例9: canDiscardPathway

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
/**
 * Call this when the user is about to perform an
 * action that could lead to discarding the current pathway.
 * (For example when creating a new pathway)
 *
 * Checks if there are any unsaved changes, and
 * asks the user if they want to save those changes.
 *
 * @return true if the user allows discarding the pathway, possibly after saving.
 */
public boolean canDiscardPathway()
{
	Pathway pathway = engine.getActivePathway();
       // checking not necessary if there is no pathway or if pathway is not changed.

	if (pathway == null || !pathway.hasChanged()) return true;
	int result = JOptionPane.showConfirmDialog
		(frame, "Save changes?",
				"Your pathway has changed. Do you want to save?",
				JOptionPane.YES_NO_CANCEL_OPTION,
				JOptionPane.QUESTION_MESSAGE);
	if (result == JOptionPane.CANCEL_OPTION) // cancel
	{
		return false;
	}
	else if (result == JOptionPane.YES_OPTION) // yes
	{
		// return false if save is cancelled.
		return (savePathway());
	}
	// yes or no
	return true;
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:34,代码来源:SwingEngine.java


示例10: parsePathwayInfoGpml

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
/**
 * conversion only GPML vocabulary
 */
public static Resource parsePathwayInfoGpml(Pathway p, String wpId, String revision, Model model) {

	Resource pwyRes = model.createResource(Utils.WP_RDF_URL + "/Pathway/" + wpId + "_r" + revision.trim().replaceAll(" ", "_"));
	
	// Required Attributes
	pwyRes.addLiteral(Gpml.ORGANISM, p.getMappInfo().getOrganism());
	pwyRes.addLiteral(Gpml.BOARD_HEIGHT, p.getMappInfo().getMBoardHeight());
	pwyRes.addLiteral(Gpml.BOARD_WIDTH, p.getMappInfo().getMBoardWidth());
	pwyRes.addLiteral(Gpml.NAME, p.getMappInfo().getMapInfoName());
	
	// Optional Attributes
	if(p.getMappInfo().getVersion() != null) pwyRes.addLiteral(Gpml.VERSION, p.getMappInfo().getVersion());
	if(p.getMappInfo().getCopyright() != null) pwyRes.addLiteral(Gpml.LICENSE, p.getMappInfo().getCopyright());
	if(p.getMappInfo().getAuthor() != null) pwyRes.addLiteral(Gpml.AUTHOR, p.getMappInfo().getAuthor());
	if(p.getMappInfo().getEmail() != null) pwyRes.addLiteral(Gpml.EMAIL, p.getMappInfo().getEmail());
	if(p.getMappInfo().getMaintainer() != null) pwyRes.addLiteral(Gpml.MAINTAINER, p.getMappInfo().getMaintainer());
	if(p.getMappInfo().getLastModified() != null) pwyRes.addLiteral(Gpml.LAST_MODIFIED, p.getMappInfo().getLastModified());
	if(p.getMappInfo().getMapInfoDataSource() != null) pwyRes.addLiteral(Gpml.DATA_SOURCE, p.getMappInfo().getMapInfoDataSource());
	
	for(String s : p.getMappInfo().getBiopaxRefs()) {
		pwyRes.addLiteral(Gpml.BIOPAX_REF, s);
	}
	return pwyRes;
}
 
开发者ID:wikipathways,项目名称:GPML2RDF,代码行数:28,代码来源:PathwayConverter.java


示例11: convertGpml

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
public static void convertGpml(Pathway p, String wpId, String revision, Model pathwayModel) {
	Resource pathwayRes = PathwayConverter.parsePathwayInfoGpml(p, wpId, revision, pathwayModel);
	DataHandlerGpml data = new DataHandlerGpml(p, pathwayRes);
	
	for(PathwayElement e : p.getDataObjects()) {
		if(e.getObjectType().equals(ObjectType.DATANODE)) {
			DataNodeConverter.parseDataNodesGpml(e, pathwayModel, data);
		} else if(e.getObjectType().equals(ObjectType.STATE)) {
			StateConverter.parseStateGpml(e, pathwayModel, data);
		} else if(e.getObjectType().equals(ObjectType.LINE)) {
			InteractionConverter.parseInteractionGpml((MLine) e, pathwayModel, data);
		} else if(e.getObjectType().equals(ObjectType.GRAPHLINE)) {
			GraphicalLineConverter.parseInteractionGpml((MLine) e, pathwayModel, data);
		} else if(e.getObjectType().equals(ObjectType.LABEL)) {
			LabelConverter.parseLabelGpml(e, pathwayModel, data);
		} else if(e.getObjectType().equals(ObjectType.SHAPE)) {
			ShapeConverter.parseShapeGpml(e, pathwayModel, data);
		} else if(e.getObjectType().equals(ObjectType.GROUP)) {
			GroupConverter.parseGroupGpml((MGroup) e, pathwayModel, data);
		} else if(e.getObjectType().equals(ObjectType.INFOBOX)) {
			InfoBoxConverter.parseInfoBoxGpml(e, pathwayModel, data);
		}
	}
}
 
开发者ID:wikipathways,项目名称:GPML2RDF,代码行数:25,代码来源:GpmlConverter.java


示例12: test

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
@Test
public void test() throws ConverterException, IOException {
	client.login(props.getProperty("username"), props.getProperty("password"));
	
	String id = "WP4";
	WSPathway p = client.getPathway(id);
	Pathway pathway = new Pathway();
	pathway.readFromXml(IOUtils.toInputStream(p.getGpml(), "UTF-8"), true);
	
	PathwayElement pel = PathwayElement.createPathwayElement(ObjectType.DATANODE);
	pel.setGraphId(pathway.getUniqueGraphId());
	pel.setDataNodeType(DataNodeType.GENEPRODUCT);
	pel.setMCenterX(65);
	pel.setMCenterY(65);
	pel.setMHeight(20);
	pel.setMWidth(80);
	pel.setTextLabel("Test");
	pel.setElementID("12334");
	
	pathway.add(pel);
	
	String newRevision = client.updatePathway(p.getId(), pathway, "add data node test", Integer.parseInt(p.getRevision()));
	assertTrue(Integer.parseInt(newRevision) > Integer.parseInt(p.getRevision()));
}
 
开发者ID:wikipathways,项目名称:wikipathways-api-client-java,代码行数:25,代码来源:TestUpdatePathway.java


示例13: scanPathway

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
protected Result scanPathway(File pathwayFile) throws BotException {
	try {
		Pathway p = new Pathway();
		p.readFromXml(pathwayFile, true);

		String comment = null;
		for(Comment c : p.getMappInfo().getComments()) {
			if(COMMENT_DESCRIPTION.equals(c.getSource())) {
				comment = c.getComment();
				break;
			}
		}
		boolean hasDescr = comment != null && !"".equals(comment);
		WSPathwayInfo wsp = getCache().getPathwayInfo(pathwayFile);
		return new DescriptionResult(wsp, hasDescr);
	} catch(Exception e) {
		throw new BotException(e);
	}
}
 
开发者ID:wikipathways,项目名称:org.wikipathways.client,代码行数:20,代码来源:DescriptionBot.java


示例14: scanPathway

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
protected Result scanPathway(File pathwayFile) throws BotException {
	try {
		ConnectorBotResult report = new ConnectorBotResult(
				getCache().getPathwayInfo(pathwayFile));
		Pathway pathway = new Pathway();
		pathway.readFromXml(pathwayFile, true);

		String orgName = pathway.getMappInfo().getOrganism();
		Organism org = Organism.fromLatinName(orgName);
		if(org == null) org = Organism.fromShortName(orgName);

		for(PathwayElement pwe : pathway.getDataObjects()) {
			if(pwe.getObjectType() == ObjectType.LINE) {
				boolean valid =
					pwe.getMStart().isLinked() &&
					pwe.getMEnd().isLinked();

				report.addLine(pwe, valid);
			}
		}

		return report;
	} catch(Exception e) {
		throw new BotException(e);
	}
}
 
开发者ID:wikipathways,项目名称:org.wikipathways.client,代码行数:27,代码来源:ConnectorBot.java


示例15: scanPathway

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
@Override
protected Result scanPathway(File pathwayFile) throws BotException {
	try {
		Pathway p = new Pathway();
		p.readFromXml(pathwayFile, true);

		boolean hasRef = false;
		for(BiopaxNode bpe : p.getBiopaxElementManager().getElements()) {
			if(bpe instanceof PublicationXref) {
				hasRef = true;
				break;
			}
		}
		
		WSPathwayInfo wsp = getCache().getPathwayInfo(pathwayFile);
		return new LiteratureResult(wsp, hasRef);
	} catch(Exception e) {
		throw new BotException(e);
	}
}
 
开发者ID:wikipathways,项目名称:org.wikipathways.client,代码行数:21,代码来源:LiteratureBot.java


示例16: downloadFiles

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
/**
 * Download the latest version of all given pathways to the cache directory
 * @return The list of downloaded files (partial list if interrupted)
 * @throws ConverterException
 * @throws IOException
 */
private List<File> downloadFiles (Collection<WSPathwayInfo> pathways, ProgressKeeper keeper) throws ConverterException, IOException {
	List<File> files = new ArrayList<File>();

	int i = 1;
	for(WSPathwayInfo pwi : pathways) {
		if (keeper != null) keeper.report("Downloading " + pwi.getName());

		File file = pathwayToFile(pwi);
		WSPathway wsp = wpClient.getPathway(pwi.getId());
		Pathway p = WikiPathwaysClient.toPathway(wsp);
		p.writeToXml(file, true);
		// also write a file that stores some pathway info
		writeInfoFile(pwi);
		files.add(file);
		Logger.log.info("Downloaded file "+(i++)+" of "+pathways.size()+ ": " +
				pwi.getName() + "(" + pwi.getSpecies() + ")");
		if (keeper != null)
		{
			keeper.worked (50 / pathways.size());
			if (keeper.isCancelled()) return files;
		}
	}
	return files;
}
 
开发者ID:wikipathways,项目名称:org.wikipathways.client,代码行数:31,代码来源:WikiPathwaysCache.java


示例17: testUpdatePathway

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
public void testUpdatePathway() {
	try {
		login();
		WSPathway wsp = client.getPathway("WP1");
		Pathway p = WikiPathwaysClient.toPathway(wsp);
		p.getMappInfo().addComment("Soap test - " + System.currentTimeMillis(), "Soap test");

		client.updatePathway(
				"WP1", p,
				"Soap test - " + System.currentTimeMillis(),
				Integer.parseInt(wsp.getRevision()));
	} catch(Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
开发者ID:wikipathways,项目名称:org.wikipathways.client,代码行数:17,代码来源:WikiPathwaysClientTest.java


示例18: autoSaveFile

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
private void autoSaveFile() throws ConverterException 
{
	Pathway p = engine.getActivePathway();
	if (p != null) 
	{
		GpmlFormat.writeToXml (p, autoSaveFile, true);
		Logger.log.info("Autosaved");
	}
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:10,代码来源:AutoSave.java


示例19: PwyDoc

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
public PwyDoc (Pathway aPwy)
{
	assert (aPwy != null);
	pwy = aPwy;

	for (PathwayElement e : pwy.getDataObjects())
	{
		add (e);
	}
	modified = false;
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:12,代码来源:PwyDoc.java


示例20: replacePathway

import org.pathvisio.core.model.Pathway; //导入依赖的package包/类
/**
 * used by undo manager.
 */
public void replacePathway(Pathway originalState)
{
	boolean changed = data.hasChanged();

	clearSelection();
	drawingObjects = new ArrayList<VPathwayElement>();
	// transfer selectionBox with corresponding listeners
	SelectionBox newSelection = new SelectionBox(this);
	for(Iterator<SelectionListener> i = selection.getListeners().iterator(); i.hasNext(); )
	{
		SelectionListener l = i.next();
		newSelection.addListener(l);
		i.remove();
	}
	selection = newSelection;
	data.removeListener(this);
	pressedObject = null;
	data.transferStatusFlagListeners(originalState);
	data = null;
	pointsMtoV = new HashMap<MPoint, VPoint>();
	fromModel(originalState);

	if(changed != originalState.hasChanged()) {
		data.fireStatusFlagEvent(new StatusFlagEvent(originalState.hasChanged()));
	}
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:30,代码来源:VPathway.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HttpException类代码示例发布时间:2022-05-23
下一篇:
Java Tuple2类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap