• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java WikiPathwaysClient类的典型用法和代码示例

java 1次浏览

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

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

示例1: testUpdatePathway

点赞 3

import org.wikipathways.client.WikiPathwaysClient; //导入依赖的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

示例2: PathwayGeneParser

点赞 2

import org.wikipathways.client.WikiPathwaysClient; //导入依赖的package包/类
public PathwayGeneParser(String url, File bridgeDbFile, File outputNodes, File outputEdges) throws MalformedURLException, ClassNotFoundException, IDMapperException {
	client = new WikiPathwaysClient(new URL(url));
	
	// setting up bridgedb
	DataSourceTxt.init();
	Class.forName("org.bridgedb.rdb.IDMapperRdb");
	mapper = BridgeDb.connect("idmapper-pgdb:" + bridgeDbFile.getAbsolutePath());
	
	this.outputEdges = outputEdges;
	this.outputNodes = outputNodes;
}
 

开发者ID:BiGCAT-UM,
项目名称:Drug-Gene-Pathway-Network,
代码行数:12,
代码来源:PathwayGeneParser.java

示例3: BotsTest

点赞 2

import org.wikipathways.client.WikiPathwaysClient; //导入依赖的package包/类
public BotsTest() {
	new File(cachePath).mkdirs();
	try {
		client = new WikiPathwaysClient(new URL(
				wsUrl
		));
		client.login(user, pass);
	} catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 

开发者ID:wikipathways,
项目名称:org.wikipathways.client,
代码行数:13,
代码来源:BotsTest.java

示例4: WikiPathwaysClientTest

点赞 2

import org.wikipathways.client.WikiPathwaysClient; //导入依赖的package包/类
public WikiPathwaysClientTest() {
	super();
	try {
		client = new WikiPathwaysClient(new URL(
				"http://localhost/wikipathways/wpi/webservice/webservice.php"
		));
	} catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 

开发者ID:wikipathways,
项目名称:org.wikipathways.client,
代码行数:12,
代码来源:WikiPathwaysClientTest.java

示例5: createClient

点赞 2

import org.wikipathways.client.WikiPathwaysClient; //导入依赖的package包/类
public static WikiPathwaysClient createClient() throws Exception {
		URL url = new URL("https://webservice.wikipathways.org");
//		URL url = new URL("https://rcbranch.wikipathways.org/wpi/webservicetest");
		return new WikiPathwaysClient(url);
	}
 

开发者ID:wikipathways,
项目名称:wikipathways-api-client-java
代码行数:6,
代码来源:ConnectionSettings.java

示例6: main

点赞 2

import org.wikipathways.client.WikiPathwaysClient; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	//Create a client to the WikiPathways web service
	URL wsURL = new URL("http://webservice.wikipathways.org");
	WikiPathwaysClient client = new WikiPathwaysClient(wsURL);
		
	//////////////////////////
	// EXAMPLE (FIND BY XREF)
	// Find a pathway by affymetrix probeset
	Xref affy = new Xref("201746_at", DataSource.getBySystemCode("X"));
		
	System.out.println("Searching for pathways with Affymetrix probeset " + affy);

	WSSearchResult[] result = client.findPathwaysByXref(affy);
	for(WSSearchResult r : result) {
		System.out.println("Found pathway: " + r.getName() + " (" + r.getSpecies() + ")");
	}
		
	////////////////////////////////////
	// EXAMPLE (GET PATHWAY - SAVE GPML)
	//Download a pathway from WikiPathways
	WSPathway wsPathway = client.getPathway("WP274");
		
	System.out.println("Downloaded pathway " + wsPathway.getName() + ", revision " + wsPathway.getRevision());
		
	//Create a pathway object
	Pathway pathway = WikiPathwaysClient.toPathway(wsPathway);
		
	//Get all genes, proteins and metabolites for a pathway
	for(PathwayElement pwElm : pathway.getDataObjects()) {
		//Only take elements with type DATANODE (genes, proteins, metabolites)
		if(pwElm.getObjectType() == ObjectType.DATANODE) {
			//Print information to the screen
			System.out.println(pwElm.getTextLabel());
			System.out.println("\t" + pwElm.getXref());
			System.out.println("\t" + pwElm.getDataNodeType());
		}
	}
		
	//Save the pathway locally
	pathway.writeToXml(new File(wsPathway.getName() + ".gpml"), true);
		
	///////////////////////////////
	// EXAMPLE (LIST ALL PATHWAYS)
	//Print info for all WikiPathways pathways
	WSPathwayInfo[] pathwayList = client.listPathways();
		
	for(WSPathwayInfo pathwayInfo : pathwayList) {
		System.out.println("Pathway:");
		System.out.println("\tIdentifier:\t" + pathwayInfo.getId());
		System.out.println("\tName:\t" + pathwayInfo.getName());
		System.out.println("\tOrganism:\t" + pathwayInfo.getSpecies());
	}
}
 

开发者ID:wikipathways,
项目名称:wikipathways-api-client-java
代码行数:54,
代码来源:Example1.java

示例7: getClient

点赞 2

import org.wikipathways.client.WikiPathwaysClient; //导入依赖的package包/类
protected WikiPathwaysClient getClient() {
	return client;
}
 

开发者ID:wikipathways,
项目名称:org.wikipathways.client,
代码行数:4,
代码来源:Bot.java

示例8: removeConnectorTag

点赞 2

import org.wikipathways.client.WikiPathwaysClient; //导入依赖的package包/类
/**
 * Test if tag is removed when needed.
 */
private void removeConnectorTag(String pwId) {
	try {
		WSPathway wsp = client.getPathway(pwId);
		//Connect the line and update the pathway
		Pathway pathway = WikiPathwaysClient.toPathway(wsp);
		PathwayElement line = null;
		for(PathwayElement pwe : pathway.getDataObjects()) {
			if(pwe.getObjectType() == ObjectType.LINE) {
				line = pwe;
				break;
			}
		}
		assertNotNull(line);

		PathwayElement e1 = PathwayElement.createPathwayElement(ObjectType.DATANODE);
		PathwayElement e2 = PathwayElement.createPathwayElement(ObjectType.DATANODE);
		pathway.add(e1);
		pathway.add(e2);
		e1.setGeneratedGraphId(); e2.setGeneratedGraphId();
		line.getMStart().setGraphRef(e1.getGraphId());
		line.getMEnd().setGraphRef(e2.getGraphId());
		client.updatePathway(pwId, pathway, "junit test - connecting line",
				Integer.parseInt(wsp.getRevision()));

		//Run the bot, it should remove the tag
		Bot bot = createConnectorBot();
		Collection<Result> results = bot.scan();
		BotReport report = bot.createReport(results);
		bot.applyCurationTags(results, report);

		//Check if the pathway is tagged
		WSCurationTag[] tags = client.getCurationTags(wsp.getId());
		boolean found = false;
		for(WSCurationTag t : tags) {
			if(t.getName().equals(ConnectorBot.CURATIONTAG)) {
				found = true;
				break;
			}
		}
		assertFalse("Should have removed connector tag", found);
	} catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 

开发者ID:wikipathways,
项目名称:org.wikipathways.client,
代码行数:49,
代码来源:BotsTest.java

示例9: overrideConnectorTag

点赞 2

import org.wikipathways.client.WikiPathwaysClient; //导入依赖的package包/类
/**
 * Test if override mechanism works properly.
 */
public void overrideConnectorTag(String pwId) {
	try {
		WSPathway wsp = client.getPathway(pwId);
		Pathway pathway = WikiPathwaysClient.toPathway(wsp);

		//Reset the line
		for(PathwayElement pwe : new ArrayList<PathwayElement>(pathway.getDataObjects())) {
			switch(pwe.getObjectType()) {
			case DATANODE:
			case LINE:
				pathway.remove(pwe);
				break;
			}
		}
		PathwayElement line = PathwayElement.createPathwayElement(ObjectType.LINE);
		pathway.add(line);
		client.updatePathway(pwId, pathway, "junit test", Integer.parseInt(wsp.getRevision()));

		//Re-add the tag
		addConnectorTag(pwId);

		//Manually remove the tag, it shouldn't be re-added
		client.removeCurationTag(pwId, ConnectorBot.CURATIONTAG);

		//Try to re-add the tag, it should fail
		//Run the bot, it should tag the created pathway
		Bot bot = createConnectorBot();
		Collection<Result> results = bot.scan();
		BotReport report = bot.createReport(results);
		bot.applyCurationTags(results, report);

		WSCurationTag[] tags = client.getCurationTags(pwId);
		boolean found = false;
		for(WSCurationTag t : tags) {
			if(t.getName().equals(ConnectorBot.CURATIONTAG)) {
				found = true;
				break;
			}
		}
		assertFalse("Should not have added connector tag", found);

		//Change the number of unconnected lines, the tag should be added again
		PathwayElement line2 = PathwayElement.createPathwayElement(ObjectType.LINE);
		pathway.add(line2);

		wsp = client.getPathway(pwId);
		client.updatePathway(pwId, pathway, "junit test", Integer.parseInt(wsp.getRevision()));

		addConnectorTag(pwId);
	} catch(Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 

开发者ID:wikipathways,
项目名称:org.wikipathways.client,
代码行数:58,
代码来源:BotsTest.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)