Changeset 146
- Timestamp:
- 08/07/09 10:57:34 (2 years ago)
- Location:
- trunk/corelib
- Files:
-
- 2 modified
-
src/org/bridgedb/webservice/IDMapperBiomart.java (modified) (2 diffs)
-
test/org/bridgedb/TestBiomart.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/corelib/src/org/bridgedb/webservice/IDMapperBiomart.java
r136 r146 250 250 */ 251 251 public Map<Xref, Set<Xref>> mapID(Set<Xref> srcXrefs, Set<DataSource> tgtDataSources) throws IDMapperException { 252 if (srcXrefs==null || tgtDataSources==null) {253 throw new java.lang.IllegalArgumentException("srcXrefs or tgtDataSourcescannot be null");252 if (srcXrefs==null) { 253 throw new java.lang.IllegalArgumentException("srcXrefs cannot be null"); 254 254 } 255 255 … … 272 272 // remove unsupported target datasources 273 273 Set<DataSource> supportedTgtDatasources = cap.getSupportedTgtDataSources(); 274 Vector<DataSource> tgtDss = new Vector(tgtDataSources); 275 tgtDss.retainAll(supportedTgtDatasources); 274 Vector<DataSource> tgtDss; 275 if (tgtDataSources == null) 276 tgtDss = new Vector(supportedSrcDatasources); 277 else 278 { 279 tgtDss = new Vector(tgtDataSources); 280 tgtDss.retainAll(supportedTgtDatasources); 281 } 276 282 if (tgtDss.isEmpty()) { 277 283 return result; -
trunk/corelib/test/org/bridgedb/TestBiomart.java
r134 r146 56 56 57 57 for (Database db : dbs) { 58 System.out.println (db.getName()); 58 59 Set<Dataset> datasets = new HashSet(biomartStub.getAvailableDatasets(db.getName())); 59 60 int nds = datasets.size(); 60 61 for (Dataset ds : datasets) { 62 System.out.println ("\t" + ds.getName()); 61 63 IDMapperBiomart idMapper = new IDMapperBiomart(ds.getName()); 62 64 IDMapperCapabilities cap = idMapper.getCapabilities(); 63 65 if (cap.getSupportedSrcDataSources().isEmpty() 64 66 || cap.getSupportedTgtDataSources().isEmpty()) { 65 System.out.println("ds\t"+ds.getName());67 // System.out.println("\tds\t"+ds.getName()); 66 68 nds--; 67 69 } 70 for (DataSource dsx : cap.getSupportedSrcDataSources()) 71 { 72 System.out.println ("\t\t" + dsx); 73 } 74 for (DataSource dsx : cap.getSupportedTgtDataSources()) 75 { 76 System.out.println ("\t\t" + dsx); 77 } 68 78 } 69 if (nds==0) {70 System.out.println("db\t"+db.getName());71 }79 // if (nds==0) { 80 // System.out.println("\tdb\t"+db.getName()); 81 // } 72 82 } 73 83 } 74 84 85 public void testBioMartConnector() throws IOException, IDMapperException 86 { 87 // BiomartStub biomartStub = BiomartStub.getInstance(); 88 // Map<String, Database> reg = null; 89 // try { 90 // reg = biomartStub.getRegistry(); 91 // } catch (Exception e) { 92 // e.printStackTrace(); 93 // } 94 // Set<Database> dbs = new HashSet(reg.size()); 95 // for (Database db : reg.values()) { 96 // //if (db.visible()) { 97 // dbs.add(db); 98 // //} 99 // System.out.println (db.getName()); 100 // } 101 BiomartStub biomartStub = BiomartStub.getInstance(); 102 103 Set<Dataset> datasets = new HashSet(biomartStub.getAvailableDatasets("ensembl")); 104 105 IDMapperBiomart mapper = new IDMapperBiomart("hsapiens_gene_ensembl"); 106 for (DataSource ds : mapper.getCapabilities().getSupportedSrcDataSources()) 107 { 108 System.out.println (ds); 109 } 110 for (DataSource ds : mapper.getCapabilities().getSupportedTgtDataSources()) 111 { 112 System.out.println (ds); 113 } 114 } 115 116 public void testBioMartConnector2() throws IOException, IDMapperException, ClassNotFoundException 117 { 118 BiomartStub biomartStub = BiomartStub.getInstance(); 119 120 Class.forName("org.bridgedb.webservice.IDMapperBiomart"); 121 122 biomartStub.getAvailableDatasets("ensembl"); 123 124 //IDMapperBiomart mapper = new IDMapperBiomart("hsapiens_gene_ensembl"); 125 IDMapper mapper = BridgeDb.connect ("idmapper-biomart:dataset=hsapiens_gene_ensembl"); 126 for (DataSource ds : mapper.getCapabilities().getSupportedSrcDataSources()) 127 { 128 System.out.println (ds); 129 } 130 for (DataSource ds : mapper.getCapabilities().getSupportedTgtDataSources()) 131 { 132 System.out.println (ds); 133 } 134 } 135 75 136 }
