use of uk.ac.ebi.jdbfetch.exceptions.DbfException in project vcell by virtualcell.
the class AnnotationMapping method getNameRef.
public static ArrayList<String> getNameRef(ArrayList<Xref> xRef, String entryName) {
CachedDataBaseReferenceReader dbReader = CachedDataBaseReferenceReader.getCachedReader();
ArrayList<String> names = new ArrayList<String>();
for (Xref xref : xRef) {
try {
// System.out.println(xref.getDb() + "***" + xref.getId());
if (xref.getDb().toLowerCase().equals("uniprot")) {
// String name = dbReader.getMoleculeDataBaseReference(xref.getId());
// if(name != null)names.add(name);
// if(xref.getId() != null && xref.getDb().toLowerCase() != null) {
// names.add(xref.getDb().toLowerCase()+ ":" + xref.getId());
// }
// System.out.println(xref.getId() + ">>>>>>>"+ name);
} else if (xref.getDb().toLowerCase().equals("interpro")) {
// String name = dbReader.getMoleculeDataBaseReference("interpro", xref.getId());
// if(name != null)names.add(name);
// if(xref.getId() != null && xref.getDb().toLowerCase() != null) {
// names.add(xref.getDb().toLowerCase()+ ":" + xref.getId());
// }
// System.out.println(xref.getId() + ">>>>>>>"+ name);
} else if (xref.getDb().toLowerCase().equals("obo.chebi")) {
String id = xref.getId().substring(6);
String name = dbReader.getChEBIName(id);
if (name != null)
names.add(name);
// System.out.println(xref.getId() + ">>>>>>>"+ name);
} else if (xref.getDb().toLowerCase().equals("gene_ontology")) {
// String name = dbReader.getGOTerm(xref.getId());
// if(name != null) {
// names.add(name);
// } else
// if(xref.getId() != null && xref.getDb().toLowerCase() != null) {
// names.add(xref.getDb().toLowerCase()+ ":" + xref.getId());
// }
// System.out.println(xref.getId() + ">>>>>>>"+ name);
} else // else if(xref.getDb().toLowerCase().equals("ec-code")){
// WSDBFetchServerServiceLocator providerLocator = new WSDBFetchServerServiceLocator();
// WSDBFetchServer server = providerLocator.getWSDbfetch();
// String[] supported = server.getSupportedDBs();
// for (int i = 0; i < supported.length; i++) {
// System.out.println(supported[i]);
// }
// String fetchResultStr = server.fetchBatch("embl", xref.getId(),null,null);
// System.out.println(xref.getId() + ">>>>>>> lookup"+fetchResultStr);
// }
{
// System.out.println(xref.getDb());
}
} catch (DbfConnException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (DbfNoEntryFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (DbfParamsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (DbfException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InputException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (DataAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
if (names.size() == 0 && entryName != null)
names.add(entryName);
return names;
}
Aggregations