Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements #15

Merged
merged 4 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified meta-data-action-1.1.2-jar-with-dependencies.jar
Binary file not shown.
Binary file modified meta-data-action-1.1.2.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private static void printPathwayInfo(String pId, String revision, List<Author> a
private static void printNodeList(String pId, PathwayModel p) throws IOException, ClassNotFoundException, IDMapperException {
File file = new File(folder, pId + "-datanodes.tsv");
BufferedWriter w = new BufferedWriter(new FileWriter(file));
w.write("Label\tType\tIdentifier\tComment\tEnsembl\tNCBI gene\tHGNC\tUniProt\tWikidata\tChEBI\tInChI\n");
w.write("Label\tType\tIdentifier\tComment\tEnsembl\tNCBI gene\tHGNC\tUniProt\tWikidata\tChEBI\tInChI\tPubChem\tChemSpider\tHMDB\tKEGG\tLipidMapd\n");
ArrayList<String> elementTypes = new ArrayList<String>(Arrays.asList("Metabolite", "GeneProduct", "Protein"));

// create idmapper stack using gdb.config file
Expand Down Expand Up @@ -213,12 +213,14 @@ private static void printNodeList(String pId, PathwayModel p) throws IOException
private static String getIDMappingsString(DataNode e, String pId, PathwayModel p, IDMapperStack idmpStack) throws ClassNotFoundException, IOException, IDMapperException {
// perform ID Mapping for Ensembl, NCBI gene, HGNC, UniProt, Wikidata, ChEBI, InChI
//DataSourceTxt.init();
ArrayList<String> dataSourceList = new ArrayList<String>(Arrays.asList("En", "L", "H", "S", "Wd", "Ce","Ik"));
ArrayList<String> dataSourceList = new ArrayList<String>(Arrays.asList("En", "L", "H", "S", "Wd", "Ce","Ik", "Cpc", "Cs", "Ch", "Ck", "Lm"));
String result = "";

// For each data source in the header, mapID and append the result to the string.
for (String sysCode : dataSourceList) {
Set<Xref> stackResult = idmpStack.mapID(e.getXref(), DataSource.getExistingBySystemCode(sysCode));
Set<Xref> stackResult = cleaner(
idmpStack.mapID(e.getXref(), DataSource.getExistingBySystemCode(sysCode))
);
// Check if more than one Xref was returned. If yes, then append them using semicolon.
String stackStr = "";
for (Xref ref : stackResult) {
Expand All @@ -242,6 +244,16 @@ private static String getIDMappingsString(DataNode e, String pId, PathwayModel p
return result;
}

private static Set<Xref> cleaner(Set<Xref> stackResult) {
Set<Xref> cleaner = new HashSet<>();
for (Xref ref : stackResult) {
String id = ref.getId();
if (id.startsWith("CHEBI:")) id = id.replace("CHEBI:", "");
cleaner.add(new Xref(id, ref.getDataSource()));
}
return cleaner;
}

private static void printRefList(String pId, PathwayModel p) throws IOException {
File file = new File(folder, pId + "-refs.tsv");
BufferedWriter w = new BufferedWriter(new FileWriter(file));
Expand Down