diff --git a/normalizer/src/main/java/org/biopax/paxtools/normalizer/Normalizer.java b/normalizer/src/main/java/org/biopax/paxtools/normalizer/Normalizer.java index d3a449cd..1894efa3 100644 --- a/normalizer/src/main/java/org/biopax/paxtools/normalizer/Normalizer.java +++ b/normalizer/src/main/java/org/biopax/paxtools/normalizer/Normalizer.java @@ -301,7 +301,7 @@ public static String uri(final String xmlBase, String dbName, String idPart, { //for xrefs, always use the simple URI strategy (human-readable) //replace unsafe symbols with underscore - localPart = localPart.replaceAll("[^-\\w]", "_"); + localPart = localPart.replaceAll("[^-\\w]", "_");//todo: e.g. "foo bar" and "foo&bar" result in the same value - can mess things up... } else { //replace the local part with its md5 hash string (32-byte) localPart = ModelUtils.md5hex(localPart); diff --git a/normalizer/src/test/java/org/biopax/paxtools/normalizer/NormalizerTest.java b/normalizer/src/test/java/org/biopax/paxtools/normalizer/NormalizerTest.java index 7c428504..c0039ef0 100644 --- a/normalizer/src/test/java/org/biopax/paxtools/normalizer/NormalizerTest.java +++ b/normalizer/src/test/java/org/biopax/paxtools/normalizer/NormalizerTest.java @@ -66,7 +66,7 @@ private static Stream uri() { arguments("http://bioregistry.io/pubchem.substance:12345", "", "pubchem-substance", "12345", SmallMoleculeReference.class), //special symbols or spaces in the 'id' part get replaced with underscore in the URI arguments("UX_Foo_Bar", null, null, "Foo Bar", UnificationXref.class), - arguments("UX_Foo_Bar", null, null, "Foo&Bar", UnificationXref.class), //todo: no good - makes the same URI, can mess things up... + arguments("UX_Foo_Bar", null, null, "Foo&Bar", UnificationXref.class), //todo: the same expected URI as above can be wrong/bug... arguments("uniprot:W0C7J9", "", "UniProt", "W0C7J9", UnificationXref.class), arguments("http://bioregistry.io/ncbitaxon:9606", null, "taxonomy", "9606", BioSource.class), arguments("http://bioregistry.io/ncbitaxon:9606", null, "NCBI Taxonomy", "9606", BioSource.class), diff --git a/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java b/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java index 7323ff79..3ccffb0c 100644 --- a/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java +++ b/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java @@ -311,7 +311,7 @@ public static Pattern controlsPhosphorylation() * Pattern for a Protein controlling a reaction whose participant is a small molecule. * * @param blacklist a skip-list of ubiquitous molecules - * @param consumption true/false (TODO explain) + * @param consumption true/false * @return the pattern */ public static Pattern controlsMetabolicCatalysis(Blacklist blacklist, boolean consumption) diff --git a/paxtools-console/src/main/java/org/biopax/paxtools/Commands.java b/paxtools-console/src/main/java/org/biopax/paxtools/Commands.java index 0b164564..d17514be 100644 --- a/paxtools-console/src/main/java/org/biopax/paxtools/Commands.java +++ b/paxtools-console/src/main/java/org/biopax/paxtools/Commands.java @@ -399,17 +399,6 @@ static void sifnxToSif(String inputFile, String outputFile) throws IOException { writer.close(); } - static void integrate(String[] argv) throws IOException { - Model model1 = getModel(io, argv[1]); - Model model2 = getModel(io, argv[2]); - - Integrator integrator = new Integrator(SimpleEditorMap.get(model1.getLevel()), model1, model2); - integrator.integrate(); - - io.setFactory(model1.getLevel().getDefaultFactory()); - io.convertToOWL(model1, new FileOutputStream(argv[3])); - } - static void merge(String[] argv) throws IOException { Model model1 = getModel(io, argv[1]); Model model2 = getModel(io, argv[2]); diff --git a/paxtools-console/src/main/java/org/biopax/paxtools/Main.java b/paxtools-console/src/main/java/org/biopax/paxtools/Main.java index 1bb5087d..a351ad0b 100644 --- a/paxtools-console/src/main/java/org/biopax/paxtools/Main.java +++ b/paxtools-console/src/main/java/org/biopax/paxtools/Main.java @@ -57,9 +57,6 @@ enum Command { toSBGN(" [-nolayout]\n" + "\t- converts model to the SBGN format and applies COSE layout unless optional -nolayout flag is set.") {public void run(String[] argv) throws IOException { toSbgn(argv); } }, - integrate(" \n" + - "\t- integrates file2 into file1 and writes it into output (experimental)") - {public void run(String[] argv) throws IOException{integrate(argv);} }, toLevel3(" [-psimiToComplexes]\n" + "\t- converts BioPAX level 1 or 2, PSI-MI 2.5 and PSI-MITAB to the level 3 file;\n" + "\t-psimiToComplexes forces PSI-MI Interactions become BioPAX Complexes instead MolecularInteractions.") diff --git a/paxtools-core/src/main/java/org/biopax/paxtools/controller/Integrator.java b/paxtools-core/src/main/java/org/biopax/paxtools/controller/Integrator.java index 27cb1eac..4fbf7a64 100644 --- a/paxtools-core/src/main/java/org/biopax/paxtools/controller/Integrator.java +++ b/paxtools-core/src/main/java/org/biopax/paxtools/controller/Integrator.java @@ -24,7 +24,13 @@ * into the target. * * Please note that this class is in its beta state. + * + * @author Ozgun Babur + * @author Emek Demir + * + * @deprecated it's experimetal, only for Level2, and seems not tested/maintained */ +@Deprecated public class Integrator { private static final Logger log = LoggerFactory.getLogger(Integrator.class); @@ -48,10 +54,7 @@ public class Integrator { * C | | | | * ------------------------------ */ - private Map> pepScoreMatrix - = new HashMap>(); + private Map> pepScoreMatrix = new HashMap<>(); /** * This is the pool where the scores and relevant conversions @@ -114,8 +117,6 @@ public Integrator(EditorMap editorMap, Model target, Model... sources) { log.info("Merging finished."); if( isNormalizeModels() ) { - log.info("Normalizing models."); - log.info("Normaling XREFs."); normalizeXrefs(target); normalizeXrefs(mergedSources); @@ -123,8 +124,6 @@ public Integrator(EditorMap editorMap, Model target, Model... sources) { normalizeOpenControlledVocabulary(mergedSources); log.info("Normaling cellular locations."); normalizeCellularLocations(mergedSources); - - log.info("Normalization completed."); } } @@ -296,21 +295,18 @@ public List integrate(List alternativeScores) * Instead, we are going to copy them, and modify their copies. */ log.info("Creating a copy of the PEP scores."); - Map> copyMatrix - = new HashMap>(); + Map> copyMatrix = new HashMap<>(); // Copy the contents of the matrix for(physicalEntityParticipant pepKey: pepScoreMatrix.keySet()) { - copyMatrix.put(pepKey, - new HashMap(pepScoreMatrix.get(pepKey))); + copyMatrix.put(pepKey, new HashMap<>(pepScoreMatrix.get(pepKey))); } // We want to use the copy now pepScoreMatrix = copyMatrix; log.info("PEP scores copied."); similarConversions = (alternativeScores == null) - ? new ArrayList<>(this.similarConversions) - : alternativeScores; + ? new ArrayList<>(this.similarConversions) + : alternativeScores; log.info("Conversion scores copied."); /* End of copies */ @@ -347,7 +343,7 @@ private void equalizeEntities(List similarConversions) { for(ConversionScore convScore: similarConversions) { // Since we sorted the list, we are safe to break - // But a continue will also do the trick, mostly + // But a "continue;" would also do the trick, mostly // requiring little more time if( convScore.getScore() < getThreshold() ) break; @@ -420,25 +416,8 @@ private void equalizeEntities(List similarConversions) { } } - /** - * @deprecated setRDFId/setUri is not available anymore - */ - @Deprecated private void equalize(BioPAXElement e1, BioPAXElement e2) { - // Operation below is enough for the time being - // TODO re-factoring: setRDFId/setUri is not available anymore! (changing URIs directly is dangerous) - //e2.setUri(e1.getUri()); - - throw new UnsupportedOperationException("This needs re-factoring: bpe.setUri is not available anymore!"); - - //TODO ? use some alternative way to store that a1 equals e2, e.g., Set matched, - //matched.add(e1.getUri()+e2.getUri()); matched.add(e2.getUri()+e1.getUri()); - } - - private boolean equals(BioPAXElement a, BioPAXElement b) { - throw new UnsupportedOperationException("not implemented yet."); - // TODO ? implement equals(BioPAXElement a, BioPAXElement b): can be smth. like the following... and use below - //return (a == null) ? b == null : a.equals(b) || matched.contains(a.getUri()+b.getUri()); + ModelUtils.updateUri(null, e2, e1.getUri()); } private void equalizePEP(physicalEntityParticipant controller1, physicalEntityParticipant controller2) { diff --git a/paxtools-core/src/test/resources/L3/skip.owl b/paxtools-core/src/test/resources/L3/skip.owl index 71492e30..f6161a1c 100644 --- a/paxtools-core/src/test/resources/L3/skip.owl +++ b/paxtools-core/src/test/resources/L3/skip.owl @@ -27,7 +27,7 @@ test data inspired by several humancyc v24 data issues --> comment1