Skip to content

Instantly share code, notes, and snippets.

@codekaust
Last active February 22, 2020 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codekaust/c62e011936b155d5808b673d313c7622 to your computer and use it in GitHub Desktop.
Save codekaust/c62e011936b155d5808b673d313c7622 to your computer and use it in GitHub Desktop.
Do not delete.
private String getGeneProductBiGGIdFromUriList(List<String> list_Uri) {
String biggId = null;
for(String uri : list_Uri){
String dataSource, synonym_id, currentBiGGId; //currentBiGGId is id calculated in current iteration
synonym_id = uri.substring(uri.lastIndexOf('/')+1);
uri = uri.substring(0,uri.lastIndexOf('/'));
dataSource = uri.substring(uri.lastIndexOf('/')+1);
//updating the dataSource and synonym_id to match bigg database
switch (dataSource){
case "ncbigi":
synonym_id = synonym_id.substring(3);
break;
case "ncbigene" : break;
case "goa" : break;
case "interpro" : break;
case "asap" : break;
case "ecogene" : break;
case "uniprot" : break;
default:
return null; //the dataSource must belong one of above
}
currentBiGGId = bigg.getBiggIdFromSynonym(dataSource,synonym_id,BiGGDB.TYPE_GENE_PRODUCT);
if(biggId==null){
biggId = currentBiGGId;
}else {
//we must get same biggId from each synonym
if(!currentBiGGId.equals(biggId))
return null;
}
}
return biggId == null ? null : "G_"+biggId;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment