Changeset 402
- Timestamp:
- 06/10/10 13:16:51 (20 months ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
org.bridgedb.webservice.synergizer/src/org/bridgedb/webservice/synergizer/IDMapperSynergizer.java (modified) (1 diff)
-
org.bridgedb.webservice.synergizer/src/org/bridgedb/webservice/synergizer/SynergizerStub.java (modified) (1 diff)
-
org.bridgedb.webservice.synergizer/test/org/bridgedb/webservice/synergizer/Test.java (modified) (1 diff)
-
org.bridgedb/src/org/bridgedb/IDMapper.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/org.bridgedb.webservice.synergizer/src/org/bridgedb/webservice/synergizer/IDMapperSynergizer.java
r308 r402 311 311 * {@inheritDoc} 312 312 */ 313 public boolean xrefExists(Xref xref) throws IDMapperException { 314 if (xref==null) 315 return false; 316 317 DataSource ds = xref.getDataSource(); 318 if (!supportedSrcDs.contains(ds)) 319 return false; 320 321 String src = ds.getFullName(); 322 String id = xref.getId(); 323 return stub.idExist(authority, species, src, id); 313 public boolean xrefExists(Xref xref) throws IDMapperException 314 { 315 throw new UnsupportedOperationException ("xrefExists operation not supported for synergizer"); 324 316 } 325 317 } -
trunk/org.bridgedb.webservice.synergizer/src/org/bridgedb/webservice/synergizer/SynergizerStub.java
r400 r402 258 258 } 259 259 260 public boolean idExist(final String authority, final String species,261 final String domain, final String id) throws IDMapperException {262 String range = domain; // bug: client now complains that domain==range!263 Set<String> ids = new HashSet(1);264 ids.add(id);265 266 SynergizerClient.TranslateResult res;267 try {268 res = client.translate(authority, species, domain, range, ids);269 } catch (IOException e) {270 throw new IDMapperException(e);271 } catch (JSONException e) {272 throw new IDMapperException(e);273 }274 275 return res.foundSourceIDsWithFoundTargetIDs().contains(id)276 || res.foundSourceIDsWithUnfoundTargetIDs().contains(id);277 }278 260 } -
trunk/org.bridgedb.webservice.synergizer/test/org/bridgedb/webservice/synergizer/Test.java
r400 r402 72 72 IDMapper mapper = BridgeDb.connect("idmapper-synergizer:?authority=ensembl&species=Homo sapiens"); 73 73 DataSource srcDs = DataSource.getByFullName("hgnc_symbol"); 74 assertTrue(mapper.xrefExists(new Xref("snph", srcDs))); 74 75 try 76 { 77 mapper.xrefExists(new Xref("snph", srcDs)); 78 fail ("Expected UnsupportedOperationException after calling xrefExists"); 79 } 80 catch (UnsupportedOperationException ex) 81 { 82 // ok. 83 } 75 84 76 85 Set<Xref> srcXrefs = new HashSet(); -
trunk/org.bridgedb/src/org/bridgedb/IDMapper.java
r308 r402 54 54 55 55 /** 56 * Check whether an Xref exists.56 * Check whether an Xref is known by the given mapping source. This is an optionally supported operation. 57 57 * @param xref reference to check 58 58 * @return if the reference exists, false if not 59 * @throws IDMapperException if failed 59 * @throws IDMapperException if failed, UnsupportedOperationException if it's not supported by the Driver. 60 60 */ 61 61 public boolean xrefExists(Xref xref) throws IDMapperException;
