@@ -0,0 +1,2260 @@
+package org.wp.homology;%0A%0Aimport java.io.File;%0Aimport java.net.URL;%0Aimport java.util.Map;%0A%0Aimport org.bridgedb.DataSource;%0Aimport org.bridgedb.IDMapper;%0Aimport org.bridgedb.Xref;%0Aimport org.bridgedb.bio.Organism;%0Aimport org.pathvisio.core.model.Pathway;%0Aimport org.pathvisio.wikipathways.webservice.WSPathway;%0Aimport org.pathvisio.wikipathways.webservice.WSPathwayInfo;%0Aimport org.wikipathways.client.WikiPathwaysClient;%0A%0Apublic class HomologyMappedPathwayUpdater %7B%0A%0A%09public static void main(String%5B%5D args) throws Exception %7B%0A%09%09// original pathway%0A%09%09String pathwayIdSource = %22WP176%22;%0A%09%09// pathway to overwrite%0A%09%09String pathwayIdTarget = %22WP1075%22;%0A%09%09%0A%09%09Organism orgTarget = Organism.BosTaurus;%0A%09%09%0A%09%09File mappingFile = new File(%22C:/Users/MSK/Downloads/homology-mapper/mart_export_hsa2bta.txt%22);%0A%09%09File geneNameFile = new File(%22C:/Users/MSK/Downloads/homology-mapper/mart_export_bta_gene_names.txt%22);%0A%09%09%0A%09%09File bridgedb = new File(%22C:/Users/MSK/Data/BridgeDb/Hs_Derby_Ensembl_89.bridge%22);%0A%09%09IDMapper sourceGeneMapper = Utils.setUpIDMapper(bridgedb);%0A%09%09%0A%09%09DataSource dsSource = DataSource.getExistingBySystemCode(%22En%22);%0A%09%09DataSource dsTarget = DataSource.getExistingBySystemCode(%22En%22);%0A%09%09%0A%09%09Map%3CXref,Xref%3E map = MappingFileReader.readMappingFile(mappingFile, dsSource, dsTarget);%0A%09%09Map%3CString, String%3E geneNames = MappingFileReader.readGeneNameFile(geneNameFile);%0A%0A%09%09WikiPathwaysClient client = new WikiPathwaysClient(new URL(%22https://webservice.wikipathways.org%22));%0A%09%09WSPathway wsPathway = client.getPathway(pathwayIdSource);%0A%09%09Pathway pathway = WikiPathwaysClient.toPathway(wsPathway);%0A%09%09Report r = PathwayConverter.convertPathway(pathway, wsPathway.getId(), wsPathway.getRevision(), map, orgTarget, sourceGeneMapper, dsSource, geneNames);%0A%09%09%0A%09%09// Initial check --%3E check local file before updating pathway on WP%0A%09%09System.out.println(r.getHomologyScore());%0A%09%09System.out.println(r.getNoMappingGenes().size());%0A%09%09r.getNewPathway().writeToXml(new File(%22output.gpml%22), false);%0A%09%09%0A%09%09// After initial check --%3E run again and update pathway on WP%0A//%09%09client.login(%22%22, %22%22);%0A//%09%09WSPathwayInfo i = client.getPathwayInfo(pathwayIdTarget);%0A//%09%09client.updatePathway(pathwayIdTarget, r.getNewPathway(), %22Updated homology conversion%22, Integer.parseInt(i.getRevision()));%0A%09%7D%0A%0A%7D%0A

add single pathway homology updater