本文整理汇总了Java中org.bridgedb.IDMapper类的典型用法代码示例。如果您正苦于以下问题:Java IDMapper类的具体用法?Java IDMapper怎么用?Java IDMapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDMapper类属于org.bridgedb包,在下文中一共展示了IDMapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testImportSimplyWrong
import org.bridgedb.IDMapper; //导入依赖的package包/类
public void testImportSimplyWrong() throws IOException, IDMapperException
{
ImportInformation info2 = new ImportInformation();
File f = new File ("example-data/sample_data_1.txt");
assertTrue (f.exists());
info2.setTxtFile(f);
String dbFileName = System.getProperty("java.io.tmpdir") + File.separator + "tempgex3";
info2.setGexName(dbFileName);
IDMapper gdb = BridgeDb.connect("idmapper-pgdb:" + GDB_HUMAN);
GexTxtImporter.importFromTxt(info2, null, gdb, gexManager);
// 91 errors expected if no genes can be looked up.
assertEquals (91, info2.getErrorList().size());
}
示例2: testImportAffy
import org.bridgedb.IDMapper; //导入依赖的package包/类
public void testImportAffy() throws IOException, IDMapperException
{
ImportInformation info = new ImportInformation();
File f = new File ("example-data/sample_affymetrix.txt");
assertTrue (f.exists());
info.setTxtFile(f);
info.guessSettings();
assertEquals (info.getDataSource(), BioDataSource.AFFY);
assertTrue (info.isSyscodeFixed());
assertTrue (info.digitIsDot());
assertEquals (info.getIdColumn(), 0);
String dbFileName = System.getProperty("java.io.tmpdir") + File.separator + "tempgex2";
info.setGexName(dbFileName);
info.setSyscodeFixed(true);
info.setDataSource(BioDataSource.AFFY);
IDMapper gdb = BridgeDb.connect("idmapper-pgdb:" + GDB_RAT);
GexTxtImporter.importFromTxt(info, null, gdb, gexManager);
// just 6 errors if all goes well
assertEquals (6, info.getErrorList().size());
}
示例3: testImportLongHeaders
import org.bridgedb.IDMapper; //导入依赖的package包/类
/**
* Column headers have lenghts of over 50.
* Make sure this doesn't lead to problems when setting sample names
*/
public void testImportLongHeaders() throws IOException, IDMapperException
{
ImportInformation info = new ImportInformation();
File f = new File ("example-data/sample_data_long_headers.txt");
assertTrue (f.exists());
info.setTxtFile(f);
info.guessSettings();
assertEquals (info.getDataSource(), BioDataSource.ENTREZ_GENE);
assertTrue (info.isSyscodeFixed());
assertTrue (info.digitIsDot());
assertEquals (0, info.getIdColumn());
String dbFileName = System.getProperty("java.io.tmpdir") + File.separator + "tempgex3";
info.setGexName(dbFileName);
IDMapper gdb = BridgeDb.connect("idmapper-pgdb:" + GDB_HUMAN);
GexTxtImporter.importFromTxt(info, null, gdb, gexManager);
// 0 errors if all goes well
assertEquals (0, info.getErrorList().size());
}
示例4: testImportNoHeader
import org.bridgedb.IDMapper; //导入依赖的package包/类
public void testImportNoHeader() throws IOException, IDMapperException
{
ImportInformation info = new ImportInformation();
File f = new File ("example-data/sample_data_no_header.txt");
assertTrue (f.exists());
info.setTxtFile(f);
info.setFirstDataRow(0);
info.guessSettings();
assertEquals (info.getDataSource(), BioDataSource.ENTREZ_GENE);
assertFalse (info.isSyscodeFixed());
assertTrue (info.digitIsDot());
assertEquals (0, info.getIdColumn());
assertTrue (info.getNoHeader());
assertEquals ("Column A", info.getColNames()[0]);
String dbFileName = System.getProperty("java.io.tmpdir") + File.separator + "tempgex5";
info.setGexName(dbFileName);
IDMapper gdb = BridgeDb.connect("idmapper-pgdb:" + GDB_HUMAN);
GexTxtImporter.importFromTxt(info, null, gdb, gexManager);
// 0 errors if all goes well
assertEquals (0, info.getErrorList().size());
}
示例5: testImportWithText
import org.bridgedb.IDMapper; //导入依赖的package包/类
/**
* Test dataset contains two columns with textual data
* make sure this doesn't give problems during import
*/
public void testImportWithText() throws IOException, IDMapperException
{
ImportInformation info = new ImportInformation();
File f = new File ("example-data/sample_data_with_text.txt");
assertTrue (f.exists());
info.setTxtFile(f);
info.guessSettings();
assertEquals (info.getDataSource(), BioDataSource.ENTREZ_GENE);
assertFalse (info.isSyscodeFixed());
assertEquals (info.getSyscodeColumn(), 1);
assertTrue (info.digitIsDot());
assertEquals (info.getIdColumn(), 0);
String dbFileName = System.getProperty("java.io.tmpdir") + File.separator + "tempgex4";
info.setGexName(dbFileName);
IDMapper gdb = BridgeDb.connect("idmapper-pgdb:" + GDB_HUMAN);
GexTxtImporter.importFromTxt(info, null, gdb, gexManager);
// 0 errors if all goes well
assertEquals (info.getErrorList().size(), 0);
}
示例6: ZScoreCalculator
import org.bridgedb.IDMapper; //导入依赖的package包/类
public ZScoreCalculator(Criterion crit, File pwDir, CachedData gex, IDMapper gdb, ProgressKeeper pk)
{
if (pk != null)
{
pk.setProgress (0);
pk.setTaskName("Analyzing data");
}
result = new StatisticsResult();
result.crit = crit;
result.stm = new StatisticsTableModel();
result.stm.setColumns(new Column[] {Column.PATHWAY_NAME, Column.R, Column.N, Column.TOTAL, Column.PCT, Column.ZSCORE, Column.PERMPVAL});
result.pwDir = pwDir;
result.gex = gex;
result.gdb = gdb;
this.pk = pk;
}
示例7: 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;
}
示例8: connect
import org.bridgedb.IDMapper; //导入依赖的package包/类
public IDMapper connect(String location) throws IDMapperException {
// e.g.: ?authority=ensembl&species=Homo sapiens
String baseURL = SynergizerStub.defaultBaseURL;
Map<String, String> info =
InternalUtils.parseLocation(location, "authority", "species");
if (info.containsKey("BASE"))
{
baseURL = info.get("BASE");
}
// could be null
String authority = info.get ("authority");
// could be null
String species = info.get ("species");
return new IDMapperSynergizer(authority, species, baseURL);
}
示例9: isLoopFreeExtension
import org.bridgedb.IDMapper; //导入依赖的package包/类
/**
* @param other Some other path
* @return true if this path is a non-cyclic extension of the other path.
* a path is considered "cyclic" when it uses the same IDMapper twice.
* (note that this is not the only possible definition of cyclic. But it is
* a convenient definition as it culls the number of paths, and thus
* reduces combinatorial problems)
*/
protected boolean isLoopFreeExtension( Path other )
{
/*
// see the commented code here for another possible definition of cyclic:
for (Edge e : other.delegate)
{
if (delegate.contains(e))
return false;
}
return true;
*
*/
for (IDMapper m : other.mappers)
if (mappers.contains(m)) return false;
return true;
}
示例10: getDirectPaths
import org.bridgedb.IDMapper; //导入依赖的package包/类
/**
* Create a list of all direct (i.e. one-step) paths.
*
* @return Hash that contains all relevant information on maps between
* DataSources of all IDMappers in this IDMapperStack. Reflexive
* maps (DataSourced X -> DataSource X) are ignored. The map will
* contain only DataSources that are connected.
*
* @throws IDMapperException
*/
private Set<Path> getDirectPaths(List<IDMapper> gdbs)
throws IDMapperException {
Set<Path> result = new HashSet<Path>();
// add each DataSource to a PathCollection
for (IDMapper idm : gdbs) {
if (idm != null && idm.isConnected()) {
IDMapperCapabilities capas = idm.getCapabilities();
for (DataSource src : capas.getSupportedSrcDataSources()) {
for (DataSource tgt : capas.getSupportedTgtDataSources()) {
if (capas.isMappingSupported(src, tgt) && src != tgt) {
Edge edge = new Edge(src, tgt, idm);
Path path = new Path(edge);
result.add(path);
}
}
}
}
}
return result;
}
示例11: 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());
}
}
示例12: main
import org.bridgedb.IDMapper; //导入依赖的package包/类
public static void main(String args[]) throws ClassNotFoundException, IDMapperException
{
// This example shows how to do a free text search for an identifier
// 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");
String query = "3643";
// let's do a free search without specifying the input type:
Set<Xref> hits = mapper.freeSearch(query, 100);
// Now print the results.
// with getURN we obtain valid MIRIAM urn's if possible.
System.out.println (query + " search results:");
for (Xref hit : hits)
System.out.println(" " + hit.getURN());
}
示例13: 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());
}
}
示例14: testGdbAttributes
import org.bridgedb.IDMapper; //导入依赖的package包/类
/**
* From schema v2 to v3 there was a change in how the backpage was stored.
* In schema v2 there was a backpage column in the datanode table
* In schema v3 the backpage is split in several attributes.
* For backwards compatibility, SimpleGdbImpl2 fakes these new attributes.
* This is tested here.
* @throws IDMapperException should be considered a failed test
*/
@Ignore public void testGdbAttributes() throws IDMapperException
{
// test special attributes that are grabbed from backpage
// since this is a Schema v2 database
IDMapper gdb = BridgeDb.connect ("idmapper-pgdb:" + GDB_HUMAN);
AttributeMapper am = (AttributeMapper)gdb;
Xref ref = new Xref ("26873", DataSource.getBySystemCode("L"));
Assert.assertTrue (am.getAttributes(ref, "Synonyms").contains ("5-Opase|DKFZP434H244|OPLA"));
Assert.assertTrue (am.getAttributes(ref, "Description").contains ("5-oxoprolinase (EC 3.5.2.9) (5-oxo-L-prolinase) (5-OPase) (Pyroglutamase) [Source:UniProtKB/Swiss-Prot.Acc:O14841]"));
Assert.assertTrue (am.getAttributes(ref, "Chromosome").contains ("8"));
Assert.assertTrue (am.getAttributes(ref, "Symbol").contains ("OPLAH"));
Set<String> allExpectedAttributes = new HashSet<String>();
allExpectedAttributes.add ("26873");
}
示例15: connect
import org.bridgedb.IDMapper; //导入依赖的package包/类
/** {@inheritDoc} */
public IDMapper connect(String location) throws IDMapperException {
// e.g.: dataset=oanatinus_gene_ensembl
// e.g.: http://www.biomart.org/biomart/martservice?mart=ensembl&dataset=hsapiens_gene_ensembl
String baseURL = BiomartClient.DEFAULT_BASE_URL;
Map<String, String> args =
InternalUtils.parseLocation(location, "mart", "dataset");
if (args.containsKey("BASE"))
{
baseURL = args.get("BASE");
}
// may be null if unspecified.
String mart = args.get("mart");
// may be null if unspecified.
String dataset = args.get("dataset");
return new IDMapperBiomart(mart, dataset, baseURL);
}