Last active
February 22, 2020 19:37
-
-
Save codekaust/02f476aeb7cde616f906ae279b02a184 to your computer and use it in GitHub Desktop.
Do not delete.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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