Skip to content

Instantly share code, notes, and snippets.

@codekaust
Last active February 22, 2020 19:37
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/02f476aeb7cde616f906ae279b02a184 to your computer and use it in GitHub Desktop.
Save codekaust/02f476aeb7cde616f906ae279b02a184 to your computer and use it in GitHub Desktop.
Do not delete.
private String getReactionBiGGIdFromUriList(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){
//bigg.metabolite data_source identifier will directly give biggId
case "bigg.reaction":
return "R_"+synonym_id;
case "metanetx.reaction":
dataSource = "mnx.equation";
break;
case "kegg.reaction" : break;
case "ec-code" :
dataSource = "ec";
break;
case "rhea" : break;
default:
return null; //the dataSource must belong one of above
}
currentBiGGId = bigg.getBiggIdFromSynonym(dataSource,synonym_id,BiGGDB.TYPE_REACTION);
if(biggId==null){
biggId = currentBiGGId;
}else {
//we must get same biggId from each synonym
if(!currentBiGGId.equals(biggId))
return null;
}
}
return biggId == null ? null : "R_"+biggId;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment