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


Java IDMapper.mapID方法代码示例

本文整理汇总了Java中org.bridgedb.IDMapper.mapID方法的典型用法代码示例。如果您正苦于以下问题:Java IDMapper.mapID方法的具体用法?Java IDMapper.mapID怎么用?Java IDMapper.mapID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bridgedb.IDMapper的用法示例。


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

示例1: getIdentifiers

import org.bridgedb.IDMapper; //导入方法依赖的package包/类
private String getIdentifiers(String identifier, String targetSyscodeIn,
		List<String> targetSyscodeOut, IDMapper mapper) throws IDMapperException {
	String identifiers = "";
	Set<String> ids = new HashSet<String>();
	ids.add(identifier);
	Xref in = new Xref(identifier, DataSource.getBySystemCode(targetSyscodeIn));
	for(String ds : targetSyscodeOut) {
		Set<Xref> result = mapper.mapID(in, DataSource.getBySystemCode(ds));
		for(Xref x : result) {
			ids.add(x.getId());
		}
	}
	for(String str : ids) {
		if(!str.equals(identifier)) {
			identifiers = identifiers + "," + str;
		}
	}
	return identifiers;
}
 
开发者ID:mkutmon,项目名称:regin-creator,代码行数:20,代码来源:GenericCreator.java

示例2: main

import org.bridgedb.IDMapper; //导入方法依赖的package包/类
public static void main (String[] args) throws ClassNotFoundException, IDMapperException
{
	// We'll use the BridgeRest webservice in this case, as it does compound mapping fairly well.
	// We'll use the human database, but it doesn't really matter which species we pick.
	Class.forName ("org.bridgedb.webservice.bridgerest.BridgeRest");
	IDMapper mapper = BridgeDb.connect("idmapper-bridgerest:http://webservice.bridgedb.org/Human");

	// Start with defining the Chebi identifier for
	// Methionine, id 16811
	Xref src = new Xref("16811", BioDataSource.CHEBI);		
	
	// the method returns a set, but in actual fact there is only one result
	for (Xref dest : mapper.mapID(src, BioDataSource.PUBCHEM_COMPOUND))
	{
		// this should print 6137, the pubchem identifier for Methionine.
		System.out.println ("" + dest.getId());
	}
}
 
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:19,代码来源:ChebiPubchemExample.java

示例3: main

import org.bridgedb.IDMapper; //导入方法依赖的package包/类
public static void main (String[] args) throws ClassNotFoundException, IDMapperException
{
	// We want to map primary or secondary Uniprot ID's to the primary ID.
	// The best resource to do this is Picr, so we set up a connection
	Class.forName ("org.bridgedb.webservice.picr.IDMapperPicr");
	IDMapper mapper = BridgeDb.connect("idmapper-picr:");

	
	// what's there?
	System.out.println("IDMapperBiomart\n keys" + mapper.getCapabilities().getKeys().toString());
	System.out.println("supported src: " + mapper.getCapabilities().getSupportedSrcDataSources().toString());
	System.out.println("supported dst: " + mapper.getCapabilities().getSupportedTgtDataSources().toString());
	
	
	// we look for ID "Q91Y97"
	Xref src = new Xref("Q91Y97", DataSource.getByFullName("SWISSPROT"));
	
	// we request swissprot id's back. By default, we only get primary identifiers from picr. 
	// the method returns a set, but in actual fact there is only one result
	for (Xref dest : mapper.mapID(src, DataSource.getByFullName("SWISSPROT")))
	{
		//This should print Q91Y97 again, as it already is the primary identifier.
		System.out.println ("" + dest.getId());
	}
	
}
 
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:27,代码来源:PicrUniprotExample.java

示例4: testBioMartMapping

import org.bridgedb.IDMapper; //导入方法依赖的package包/类
@Test
 public void testBioMartMapping() throws IOException, IDMapperException, ClassNotFoundException
 {
    Class.forName("org.bridgedb.webservice.biomart.IDMapperBiomart");
     
    IDMapper mapper = BridgeDb.connect ("idmapper-biomart:http://www.biomart.org/biomart/martservice?mart=ensembl&dataset=hsapiens_gene_ensembl");
    
    Set<Xref> result = mapper.mapID(
 		   new Xref("ENSG00000171105", DataSource.getByFullName("ensembl_gene_id")),
 		   DataSource.getByFullName("entrezgene"));
    for (Xref ref : result)
    {
 	   System.out.println (ref);
    }
    
    assertTrue ("Expected entrezgene:3643. Got " + setRep (result), 
 		   result.contains (new Xref ("3643", DataSource.getByFullName("entrezgene"))));
}
 
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:19,代码来源:TestBiomart.java

示例5: getDataForXref

import org.bridgedb.IDMapper; //导入方法依赖的package包/类
private Collection<? extends IRow> getDataForXref(Xref srcRef, IDMapper gdb, Set<DataSource> destFilter) throws IDMapperException, DataException
{
	// get all cross-refs for this id
	Set<Xref> destRefs = new HashSet<Xref>();
	if (gdb.isConnected() && srcRef.getId() != null && srcRef.getDataSource() != null)
	{
		for (Xref destRef : gdb.mapID(srcRef))
		{
			// add only the ones that are in the dest filter.
			if (destFilter.contains(destRef.getDataSource()))
			{
				destRefs.add(destRef);
			}

		}
	}
	// also the srcRef, in case we can't look up cross references
	if (destFilter.contains(srcRef.getDataSource()))
	{
		destRefs.add(srcRef);
	}

	if(destRefs.size() > 0)
	{
		return parent.getData(destRefs);
	}
	else
		return Collections.emptyList();
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:30,代码来源:CachedData.java

示例6: ByXrefMatcher

import org.bridgedb.IDMapper; //导入方法依赖的package包/类
public ByXrefMatcher(IDMapper gdb, Xref ref) throws SearchException
{
	try
	{
		refs = gdb.mapID(ref);
	}
	catch (IDMapperException ex)
	{
		throw new SearchException (MSG_GDB_ERROR);
	}
	if(refs == null || refs.size() == 0) throw new SearchException(MSG_NOT_IN_GDB);
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:13,代码来源:SearchMethods.java

示例7: domapping

import org.bridgedb.IDMapper; //导入方法依赖的package包/类
private void domapping(String connectString, String id, DataSource src, DataSource dest) throws IDMapperException
{
	// connect to the mapper.
	IDMapper mapper = BridgeDb.connect(connectString);
	Xref srcRef = new Xref (id, src);
	
	// map the source Xref and print the results, one per line
	for (Xref destRef : mapper.mapID(srcRef, dest))
	{
		System.out.println ("  " + destRef);
	}
}
 
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:13,代码来源:ExampleWithBridgeDb.java

示例8: main

import org.bridgedb.IDMapper; //导入方法依赖的package包/类
public static void main(String args[]) throws ClassNotFoundException, IDMapperException
{
	// This example shows how to map an identifier
	// using BridgeWebservice
	
	// first we have to load the driver
	// and initialize information about DataSources
	Class.forName("org.bridgedb.webservice.bridgerest.BridgeRest");
	DataSourceTxt.init();
	
	// now we connect to the driver and create a IDMapper instance.
	IDMapper mapper = BridgeDb.connect ("idmapper-bridgerest:http://webservice.bridgedb.org/Human");
	
	// We create an Xref instance for the identifier that we want to look up.
	// In this case we want to look up Entrez gene 3643.
	Xref src = new Xref ("3643", BioDataSource.ENTREZ_GENE);
	
	// let's see if there are cross-references to Ensembl Human
	Set<Xref> dests = mapper.mapID(src, DataSource.getBySystemCode("EnHs"));
	
	// and print the results.
	// with getURN we obtain valid MIRIAM urn's if possible.
	System.out.println (src.getURN() + " maps to:");
	for (Xref dest : dests)
		System.out.println("  " + dest.getURN());
	
}
 
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:28,代码来源:ExHello.java

示例9: testFile

import org.bridgedb.IDMapper; //导入方法依赖的package包/类
public void testFile() throws IDMapperException, MalformedURLException
{
	IDMapper mapper = BridgeDb.connect ("idmapper-text:" + YEAST_ID_MAPPING.toURL());
	src.add (RAD51);
	Map<Xref, Set<Xref>> refmap = mapper.mapID(src, BioDataSource.ENTREZ_GENE);
	Set<Xref> expected = new HashSet<Xref>();
	expected.add (new Xref ("856831", BioDataSource.ENTREZ_GENE));
	Assert.assertEquals (expected, refmap.get(RAD51));
	
	System.out.println (mapper.getCapabilities().getSupportedTgtDataSources());
}
 
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:12,代码来源:TestStack.java

示例10: testPgdb

import org.bridgedb.IDMapper; //导入方法依赖的package包/类
public void testPgdb() throws IDMapperException
{
	IDMapper mapper = BridgeDb.connect("idmapper-pgdb:" + GDB_HUMAN);
	src.add (INSR);
	Map<Xref, Set<Xref>> refmap = mapper.mapID(src, BioDataSource.ENTREZ_GENE);
	Set<Xref> expected = new HashSet<Xref>();
	expected.add (new Xref ("3643", BioDataSource.ENTREZ_GENE));
	Assert.assertEquals (expected, refmap.get(INSR));
}
 
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:10,代码来源:TestStack.java

示例11: test

import org.bridgedb.IDMapper; //导入方法依赖的package包/类
@Ignore("HTTP 301 redirect issues with wsdl service at http://www.ebi.ac.uk/Tools/picr/service")
@org.junit.Test
public void test() throws IDMapperException
{
	IDMapper idmap = BridgeDb.connect ("idmapper-picr:");
	AttributeMapper amap = (AttributeMapper)idmap;
	
	Set<DataSource> dslist = idmap.getCapabilities().getSupportedTgtDataSources();
	
	final DataSource SGD = DataSource.getByFullName("SGD");
	final DataSource PDB  = DataSource.getByFullName("PDB");
	final DataSource ENSEMBL_YEAST = DataSource.getByFullName("ENSEMBL_S_CEREVISIAE");
	Assert.assertTrue (dslist.contains(SGD));
	Assert.assertTrue (dslist.contains(PDB));
	Assert.assertTrue (dslist.contains(ENSEMBL_YEAST));
	
	Xref src1 = new Xref ("YER095W", ENSEMBL_YEAST);
	for (DataSource ds : dslist) System.out.println (ds.getFullName());
	
	Set<Xref> srcRefs = new HashSet<Xref>();
	srcRefs.add (src1);
	DataSource[] targets = new DataSource[] { SGD, PDB, ENSEMBL_YEAST }; 
	Map<Xref, Set<Xref>> result = idmap.mapID(srcRefs, targets);
	
	/*
	This list is expected:
	RAD51 SGD
	YER095W SGD
	YER095W ENSEMBL_S_CEREVISIAE
	1SZP PDB
	S000000897 SGD
	*/
	for (Xref ref : result.get(src1)) System.out.println (ref.getId() + " "  + ref.getDataSource().getFullName());

	System.out.println (amap.getAttributes(src1, "Sequence").iterator().next());
}
 
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:37,代码来源:Test.java

示例12: testSimple

import org.bridgedb.IDMapper; //导入方法依赖的package包/类
@org.junit.Test
public void testSimple() throws IDMapperException
{
       try {
           IDMapper mapper = BridgeDb.connect ("idmapper-cronos:hsa");
           BioDataSource.init();
           Xref insr = new Xref ("3643", BioDataSource.ENTREZ_GENE);
           Set<Xref> result = mapper.mapID(insr, BioDataSource.ENSEMBL);
           for (Xref ref : result) System.out.println (ref);
       } catch (Exception ex){
           System.err.println("**** Warning Cronos Test FAILED due to Cronos server not responding");
           System.err.println(ex);
       }
}
 
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:15,代码来源:Test.java

示例13: getXrefs

import org.bridgedb.IDMapper; //导入方法依赖的package包/类
@Get
public String getXrefs() {
   System.out.println( "Xrefs.getXrefs() start" );
	try {
		//The result set

		IDMapper mapper = getIDMappers();
		Set<Xref> xrefs;
		if (targetDs == null)
			xrefs = mapper.mapID(xref);
		else
			xrefs = mapper.mapID(xref, targetDs);
		
		StringBuilder result = new StringBuilder();
		for(Xref x : xrefs) {
			result.append(x.getId());
			result.append("\t");
			result.append(x.getDataSource().getFullName());
			result.append("\n");
		}
		
		return result.toString();
	} catch(Exception e) {
		e.printStackTrace();
		setStatus(Status.SERVER_ERROR_INTERNAL);
		return e.getMessage();
	}
}
 
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:29,代码来源:Xrefs.java

示例14: testLocalMapID

import org.bridgedb.IDMapper; //导入方法依赖的package包/类
@org.junit.Test
public void testLocalMapID() throws IDMapperException, ClassNotFoundException {
	
    if (configExists)
    {
   	    IDMapper mapper = getLocalService();
   		
   		Xref insr = new Xref ("3643", BioDataSource.ENTREZ_GENE);
   		Xref affy = new Xref ("33162_at", BioDataSource.AFFY);
   		Set<Xref> result = mapper.mapID(insr);
   		Assert.assertTrue (result.contains(affy));
   		
   		Assert.assertTrue(mapper.xrefExists(insr));
    }
}
 
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:16,代码来源:Test.java

示例15: mapMultiFromSingle

import org.bridgedb.IDMapper; //导入方法依赖的package包/类
/**
 * call the "single" mapID (Xref, ...) multiple times
 * to perform mapping of a Set.
 * <p> 
 * This is intended for IDMappers that don't gain any advantage of mapping
 * multiple ID's at a time. They can implement mapID(Xref, ...), and
 * use mapMultiFromSingle to simulate mapID(Set, ...)
 * @param mapper used for performing a single mapping
 * @param srcXrefs xrefs to translate
 * @param tgt DataSource(s) to map to, optional.
 * @return mappings with the translated result for each input Xref. Never returns null, but
 *    not each input is a key in the output map.
 * @throws IDMapperException when mapper.mapID throws IDMapperException
 */
public static Map<Xref, Set<Xref>> mapMultiFromSingle(IDMapper mapper, Collection<Xref> srcXrefs, DataSource... tgt)
	throws IDMapperException
{
	final Map<Xref, Set<Xref>> result = new HashMap<Xref, Set<Xref>>();
	for (Xref src : srcXrefs)
	{
		final Set<Xref> refs = mapper.mapID(src, tgt);
		if (refs.size() > 0)
			result.put (src, refs);
	}
	return result;
}
 
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:27,代码来源:InternalUtils.java


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