Last active
February 22, 2020 19:36
-
-
Save codekaust/2c786c60e5a9f8a892cf49a418b9bed5 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 getSpeciesBiGGIdFromUriList(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); | |
//crop uri to remove synonym identifier from end | |
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.metabolite": | |
return "M_"+synonym_id; | |
case "metanetx.chemical" : | |
dataSource = "mnx.chemical"; | |
break; | |
case "chebi" : break; | |
case "kegg.compound" : break; | |
case "hmdb" : break; | |
case "lipidmaps" : break; | |
case "kegg.drug" : break; | |
case "seed.compound" : break; | |
case "biocyc" : break; | |
case "sgd" : | |
return null; //it maps to a gene not a component | |
case "uniprot" : | |
return null; //it maps to a gene not a component | |
default: | |
return null; //the dataSource must belong one of above | |
} | |
currentBiGGId = bigg.getBiggIdFromSynonym(dataSource,synonym_id,BiGGDB.TYPE_SPECIES); | |
if(currentBiGGId!=null){ | |
if(biggId==null){ | |
biggId = currentBiGGId; | |
}else { | |
//we must get same biggId from each synonym | |
if(!currentBiGGId.equals(biggId)) | |
return null; | |
} | |
} | |
} | |
return biggId == null ? null : "M_"+biggId; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment