Skip to content

Commit 883a951

Browse files
Removed experimental L2-specific command 'integrate', some todos, etc.
1 parent e7f5f28 commit 883a951

File tree

7 files changed

+17
-52
lines changed

7 files changed

+17
-52
lines changed

normalizer/src/main/java/org/biopax/paxtools/normalizer/Normalizer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public static String uri(final String xmlBase, String dbName, String idPart,
301301
{
302302
//for xrefs, always use the simple URI strategy (human-readable)
303303
//replace unsafe symbols with underscore
304-
localPart = localPart.replaceAll("[^-\\w]", "_");
304+
localPart = localPart.replaceAll("[^-\\w]", "_");//todo: e.g. "foo bar" and "foo&bar" result in the same value - can mess things up...
305305
} else {
306306
//replace the local part with its md5 hash string (32-byte)
307307
localPart = ModelUtils.md5hex(localPart);

normalizer/src/test/java/org/biopax/paxtools/normalizer/NormalizerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private static Stream<Arguments> uri() {
6666
arguments("http://bioregistry.io/pubchem.substance:12345", "", "pubchem-substance", "12345", SmallMoleculeReference.class),
6767
//special symbols or spaces in the 'id' part get replaced with underscore in the URI
6868
arguments("UX_Foo_Bar", null, null, "Foo Bar", UnificationXref.class),
69-
arguments("UX_Foo_Bar", null, null, "Foo&Bar", UnificationXref.class), //todo: no good - makes the same URI, can mess things up...
69+
arguments("UX_Foo_Bar", null, null, "Foo&Bar", UnificationXref.class), //todo: the same expected URI as above can be wrong/bug...
7070
arguments("uniprot:W0C7J9", "", "UniProt", "W0C7J9", UnificationXref.class),
7171
arguments("http://bioregistry.io/ncbitaxon:9606", null, "taxonomy", "9606", BioSource.class),
7272
arguments("http://bioregistry.io/ncbitaxon:9606", null, "NCBI Taxonomy", "9606", BioSource.class),

pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public static Pattern controlsPhosphorylation()
311311
* Pattern for a Protein controlling a reaction whose participant is a small molecule.
312312
*
313313
* @param blacklist a skip-list of ubiquitous molecules
314-
* @param consumption true/false (TODO explain)
314+
* @param consumption true/false
315315
* @return the pattern
316316
*/
317317
public static Pattern controlsMetabolicCatalysis(Blacklist blacklist, boolean consumption)

paxtools-console/src/main/java/org/biopax/paxtools/Commands.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -399,17 +399,6 @@ static void sifnxToSif(String inputFile, String outputFile) throws IOException {
399399
writer.close();
400400
}
401401

402-
static void integrate(String[] argv) throws IOException {
403-
Model model1 = getModel(io, argv[1]);
404-
Model model2 = getModel(io, argv[2]);
405-
406-
Integrator integrator = new Integrator(SimpleEditorMap.get(model1.getLevel()), model1, model2);
407-
integrator.integrate();
408-
409-
io.setFactory(model1.getLevel().getDefaultFactory());
410-
io.convertToOWL(model1, new FileOutputStream(argv[3]));
411-
}
412-
413402
static void merge(String[] argv) throws IOException {
414403
Model model1 = getModel(io, argv[1]);
415404
Model model2 = getModel(io, argv[2]);

paxtools-console/src/main/java/org/biopax/paxtools/Main.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ enum Command {
5757
toSBGN("<biopax.owl> <output.sbgn> [-nolayout]\n" +
5858
"\t- converts model to the SBGN format and applies COSE layout unless optional -nolayout flag is set.")
5959
{public void run(String[] argv) throws IOException { toSbgn(argv); } },
60-
integrate("<file1> <file2> <output>\n" +
61-
"\t- integrates file2 into file1 and writes it into output (experimental)")
62-
{public void run(String[] argv) throws IOException{integrate(argv);} },
6360
toLevel3("<input> <output> [-psimiToComplexes]\n" +
6461
"\t- converts BioPAX level 1 or 2, PSI-MI 2.5 and PSI-MITAB to the level 3 file;\n" +
6562
"\t-psimiToComplexes forces PSI-MI Interactions become BioPAX Complexes instead MolecularInteractions.")

paxtools-core/src/main/java/org/biopax/paxtools/controller/Integrator.java

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@
2424
* into the <em>target</em>.
2525
*
2626
* Please note that this class is in its beta state.
27+
*
28+
* @author Ozgun Babur
29+
* @author Emek Demir
30+
*
31+
* @deprecated it's experimetal, only for Level2, and seems not tested/maintained
2732
*/
33+
@Deprecated
2834
public class Integrator {
2935

3036
private static final Logger log = LoggerFactory.getLogger(Integrator.class);
@@ -48,10 +54,7 @@ public class Integrator {
4854
* C | | | |
4955
* ------------------------------
5056
*/
51-
private Map<physicalEntityParticipant,
52-
Map<physicalEntityParticipant, Double>> pepScoreMatrix
53-
= new HashMap<physicalEntityParticipant,
54-
Map<physicalEntityParticipant, Double>>();
57+
private Map<physicalEntityParticipant, Map<physicalEntityParticipant, Double>> pepScoreMatrix = new HashMap<>();
5558

5659
/**
5760
* This is the pool where the scores and relevant conversions
@@ -114,17 +117,13 @@ public Integrator(EditorMap editorMap, Model target, Model... sources) {
114117
log.info("Merging finished.");
115118

116119
if( isNormalizeModels() ) {
117-
log.info("Normalizing models.");
118-
119120
log.info("Normaling XREFs.");
120121
normalizeXrefs(target);
121122
normalizeXrefs(mergedSources);
122123
log.info("Normaling OCVs.");
123124
normalizeOpenControlledVocabulary(mergedSources);
124125
log.info("Normaling cellular locations.");
125126
normalizeCellularLocations(mergedSources);
126-
127-
log.info("Normalization completed.");
128127
}
129128
}
130129

@@ -296,21 +295,18 @@ public List<ConversionScore> integrate(List<ConversionScore> alternativeScores)
296295
* Instead, we are going to copy them, and modify their copies.
297296
*/
298297
log.info("Creating a copy of the PEP scores.");
299-
Map<physicalEntityParticipant,
300-
Map<physicalEntityParticipant, Double>> copyMatrix
301-
= new HashMap<physicalEntityParticipant, Map<physicalEntityParticipant, Double>>();
298+
Map<physicalEntityParticipant, Map<physicalEntityParticipant, Double>> copyMatrix = new HashMap<>();
302299
// Copy the contents of the matrix
303300
for(physicalEntityParticipant pepKey: pepScoreMatrix.keySet()) {
304-
copyMatrix.put(pepKey,
305-
new HashMap<physicalEntityParticipant, Double>(pepScoreMatrix.get(pepKey)));
301+
copyMatrix.put(pepKey, new HashMap<>(pepScoreMatrix.get(pepKey)));
306302
}
307303
// We want to use the copy now
308304
pepScoreMatrix = copyMatrix;
309305
log.info("PEP scores copied.");
310306

311307
similarConversions = (alternativeScores == null)
312-
? new ArrayList<>(this.similarConversions)
313-
: alternativeScores;
308+
? new ArrayList<>(this.similarConversions)
309+
: alternativeScores;
314310

315311
log.info("Conversion scores copied.");
316312
/* End of copies */
@@ -347,7 +343,7 @@ private void equalizeEntities(List<ConversionScore> similarConversions) {
347343

348344
for(ConversionScore convScore: similarConversions) {
349345
// Since we sorted the list, we are safe to break
350-
// But a continue will also do the trick, mostly
346+
// But a "continue;" would also do the trick, mostly
351347
// requiring little more time
352348
if( convScore.getScore() < getThreshold() )
353349
break;
@@ -420,25 +416,8 @@ private void equalizeEntities(List<ConversionScore> similarConversions) {
420416
}
421417
}
422418

423-
/**
424-
* @deprecated setRDFId/setUri is not available anymore
425-
*/
426-
@Deprecated
427419
private void equalize(BioPAXElement e1, BioPAXElement e2) {
428-
// Operation below is enough for the time being
429-
// TODO re-factoring: setRDFId/setUri is not available anymore! (changing URIs directly is dangerous)
430-
//e2.setUri(e1.getUri());
431-
432-
throw new UnsupportedOperationException("This needs re-factoring: bpe.setUri is not available anymore!");
433-
434-
//TODO ? use some alternative way to store that a1 equals e2, e.g., Set<String> matched,
435-
//matched.add(e1.getUri()+e2.getUri()); matched.add(e2.getUri()+e1.getUri());
436-
}
437-
438-
private boolean equals(BioPAXElement a, BioPAXElement b) {
439-
throw new UnsupportedOperationException("not implemented yet.");
440-
// TODO ? implement equals(BioPAXElement a, BioPAXElement b): can be smth. like the following... and use below
441-
//return (a == null) ? b == null : a.equals(b) || matched.contains(a.getUri()+b.getUri());
420+
ModelUtils.updateUri(null, e2, e1.getUri());
442421
}
443422

444423
private void equalizePEP(physicalEntityParticipant controller1, physicalEntityParticipant controller2) {

paxtools-core/src/test/resources/L3/skip.owl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test data inspired by several humancyc v24 data issues -->
2727
<!-- Entity is non-instantiable; also term property value must be a string value,
2828
preferably from MI ontology, e.g. "gene product" MI:0251 or "see-also", etc.
2929
Right now (after latest code fix to prevent exception here), Entity is not entirely ignored, -
30-
FIXME: its URI "http://biopax.org/tmp#Gene" becomes the value the term property value;
30+
FIXME: its URI "http://biopax.org/tmp#Gene" becomes the term property value;
3131
i.e. this is equivalent to <term>http://biopax.org/tmp#Gene</term> ... -->
3232
<Entity rdf:ID="Gene">
3333
<comment>comment1</comment>

0 commit comments

Comments
 (0)