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


Java WSSearchResult类代码示例

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


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

示例1: findPathwaysByXref

import org.pathvisio.wikipathways.webservice.WSSearchResult; //导入依赖的package包/类
/**
 * Search for pathways containing one of the given xrefs by taking
 * into account cross-references to other database systems.
 * @param xrefs
 * @return
 * @throws RemoteException
 */
public WSSearchResult[] findPathwaysByXref(Xref... xrefs) throws RemoteException {
	String[] ids = new String[xrefs.length];
	String[] codes = new String[xrefs.length];
	for(int i = 0; i < xrefs.length; i++) {
		ids[i] = xrefs[i].getId();
		DataSource ds = xrefs[i].getDataSource();
		if(ds == null) {
			codes[i] = null;
		} else {
			codes[i] = ds.getSystemCode();
		}
	}
	WSSearchResult[] r =  port.findPathwaysByXref(ids, codes);
	if(r == null) r = new WSSearchResult[0];
	return r;
}
 
开发者ID:wikipathways,项目名称:wikipathways-api-client-java,代码行数:24,代码来源:WikiPathwaysClient.java

示例2: testSearchXref

import org.pathvisio.wikipathways.webservice.WSSearchResult; //导入依赖的package包/类
public void testSearchXref() {
	try {
		WSSearchResult[] results = client.findPathwaysByXref(
				new Xref("8743", BioDataSource.ENTREZ_GENE)
		);
		assertNotNull(results);
		assertTrue(results.length > 0);

		results = client.findPathwaysByXref(
				new Xref("GO:0016021", BioDataSource.GENE_ONTOLOGY)
		);
		assertNotNull(results);
		assertTrue(results.length > 0);

		results = client.findPathwaysByXref(
				new Xref("8743", BioDataSource.ENTREZ_GENE),
				new Xref("GO:0016021", BioDataSource.GENE_ONTOLOGY),
				new Xref("1234", null)
		);
		assertNotNull(results);
		assertTrue(results.length > 0);
	} catch (RemoteException e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
开发者ID:wikipathways,项目名称:org.wikipathways.client,代码行数:27,代码来源:WikiPathwaysClientTest.java

示例3: parseWSSearchResult

import org.pathvisio.wikipathways.webservice.WSSearchResult; //导入依赖的package包/类
public static WSSearchResult parseWSSearchResult(Element searchResult) {
	WSSearchResult res = new WSSearchResult();
	String score = searchResult.getChildText("score", WSNamespaces.NS2);
	res.setScore(Double.parseDouble(score));
	
	List<Element> fieldList = searchResult.getChildren("fields", WSNamespaces.NS2);
	WSIndexField[] fields = new WSIndexField[fieldList.size()];
	for(int i = 0; i < fieldList.size(); i++) {
		WSIndexField f  = parseWSIndexField(fieldList.get(i));
		fields[i] = f;
	}
	res.setFields(fields);
	
	String id = searchResult.getChildText("id", WSNamespaces.NS2);
	String url = searchResult.getChildText("url", WSNamespaces.NS2);
	String name = searchResult.getChildText("name", WSNamespaces.NS2);
	String species = searchResult.getChildText("species", WSNamespaces.NS2);
	String revision = searchResult.getChildText("revision", WSNamespaces.NS2);

	res.setId(id);
	res.setName(name);
	res.setUrl(url);
	res.setSpecies(species);
	res.setRevision(revision);
	
	return res;
}
 
开发者ID:wikipathways,项目名称:wikipathways-api-client-java,代码行数:28,代码来源:Utils.java

示例4: findPathwaysByText

import org.pathvisio.wikipathways.webservice.WSSearchResult; //导入依赖的package包/类
public WSSearchResult[] findPathwaysByText(String query, Organism organism) throws RemoteException {
	String species = null;
	if(organism != null) {
		species = organism.latinName();
	}
	WSSearchResult[] r =  port.findPathwaysByText(query, species);
	if(r == null) r = new WSSearchResult[0];
	return r;
}
 
开发者ID:wikipathways,项目名称:wikipathways-api-client-java,代码行数:10,代码来源:WikiPathwaysClient.java

示例5: test

import org.pathvisio.wikipathways.webservice.WSSearchResult; //导入依赖的package包/类
@Test
public void test() throws RemoteException {
	String query = "apoptosis";
	WSSearchResult [] results = client.findPathwaysByText(query);
	boolean found = false;
	for(WSSearchResult res : results) {
		// original human apoptosis pathway
		if(res.getId().equals("WP254")) {
			found = true;
		}
	}
	assertTrue(found);
}
 
开发者ID:wikipathways,项目名称:wikipathways-api-client-java,代码行数:14,代码来源:TestFindPathwayByText.java

示例6: test

import org.pathvisio.wikipathways.webservice.WSSearchResult; //导入依赖的package包/类
@Test
public void test() throws RemoteException {
	String query = "18651794";
	WSSearchResult [] res = client.findPathwaysByLiterature(query);
	boolean found = false;
	for(WSSearchResult r : res) {
		if(r.getId().equals("WP4")) {
			found = true;
		}
	}
	assertTrue(found);
}
 
开发者ID:wikipathways,项目名称:wikipathways-api-client-java,代码行数:13,代码来源:TestFindPathwaysByLiterature.java

示例7: testSingleXref

import org.pathvisio.wikipathways.webservice.WSSearchResult; //导入依赖的package包/类
@Test
public void testSingleXref() throws RemoteException {
	Xref x = new Xref("1234", DataSource.getExistingBySystemCode("L"));
	WSSearchResult [] result = client.findPathwaysByXref(x);
	assertTrue(result.length > 0);
	
	Xref x2 = new Xref("ABC", DataSource.getExistingBySystemCode("L"));
	WSSearchResult [] result2 = client.findPathwaysByXref(x2);
	assertTrue(result2.length == 0);
}
 
开发者ID:wikipathways,项目名称:wikipathways-api-client-java,代码行数:11,代码来源:TestFindByXref.java

示例8: testMultiXref

import org.pathvisio.wikipathways.webservice.WSSearchResult; //导入依赖的package包/类
@Test
public void testMultiXref() throws RemoteException {
	Xref x = new Xref("1234", DataSource.getExistingBySystemCode("L"));
	Xref x2 = new Xref("ENSG00000130164", DataSource.getExistingBySystemCode("En"));
	WSSearchResult [] result = client.findPathwaysByXref(x, x2);
	assertTrue(result.length > 0);
}
 
开发者ID:wikipathways,项目名称:wikipathways-api-client-java,代码行数:8,代码来源:TestFindByXref.java

示例9: test

import org.pathvisio.wikipathways.webservice.WSSearchResult; //导入依赖的package包/类
@Test
public void test() throws RemoteException {
	// find interaction of DFFA and DFFB in pathway WP254
	String query = "DFFA";
	WSSearchResult [] res = client.findInteractions(query);
	String partner = "DFFB";
	
	System.out.println(res.length + " interactions found for " + query);
	
	boolean found = false;
	for(WSSearchResult r : res) {
		if(r.getId().equals("WP254")) {
			for(WSIndexField f : r.getFields()) {
				if(f.getName().equals("right")) {
					String [] values = f.getValues();
					for(String s : values) {
						if(s.equals(partner)) {
							found = true;
						}
					}
				}
			}
		}
	}
	
	assertTrue(found);
}
 
开发者ID:wikipathways,项目名称:wikipathways-api-client-java,代码行数:28,代码来源:TestFindInteractions.java

示例10: test2

import org.pathvisio.wikipathways.webservice.WSSearchResult; //导入依赖的package包/类
@Test
public void test2() throws RemoteException {
	// find interaction of DFFA and DFFB in pathway WP254
	String query = "p53";
	WSSearchResult [] res = client.findInteractions(query);
	String partner = "p73";
	
	System.out.println(res.length + " interactions found for " + query);
	
	boolean found = false;
	for(WSSearchResult r : res) {
		if(r.getId().equals("WP655")) {
			for(WSIndexField f : r.getFields()) {
				if(f.getName().equals("left")) {
					String [] values = f.getValues();
					for(String s : values) {
						if(s.equals(partner)) {
							found = true;
						}
					}
				}
			}
		}
	}
	
	assertTrue(found);
}
 
开发者ID:wikipathways,项目名称:wikipathways-api-client-java,代码行数:28,代码来源:TestFindInteractions.java

示例11: findInteractions

import org.pathvisio.wikipathways.webservice.WSSearchResult; //导入依赖的package包/类
public WSSearchResult[] findInteractions(String query) throws RemoteException {
	WSSearchResult[] r = port.findInteractions(query);
	if(r == null) r = new WSSearchResult[0];
	return r;
}
 
开发者ID:wikipathways,项目名称:wikipathways-api-client-java,代码行数:6,代码来源:WikiPathwaysClient.java

示例12: findPathwaysByLiterature

import org.pathvisio.wikipathways.webservice.WSSearchResult; //导入依赖的package包/类
/**
 * search by literature reference
 */
public WSSearchResult[] findPathwaysByLiterature(String query) throws RemoteException {
	WSSearchResult[] r = port.findPathwaysByLiterature(query);
	if(r == null) r = new WSSearchResult[0];
	return r;        
}
 
开发者ID:wikipathways,项目名称:wikipathways-api-client-java,代码行数:9,代码来源:WikiPathwaysClient.java

示例13: main

import org.pathvisio.wikipathways.webservice.WSSearchResult; //导入依赖的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


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