From b19e2bbfd00d5b92e3f27b9ead5b9aa76064dfaa Mon Sep 17 00:00:00 2001 From: julianu Date: Fri, 5 Jul 2024 09:59:43 +0200 Subject: [PATCH 1/2] enabling mzid1.2 import --- .../intermediate/compiler/PIACompiler.java | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/mpc/pia/intermediate/compiler/PIACompiler.java b/src/main/java/de/mpc/pia/intermediate/compiler/PIACompiler.java index 0aa3d41..86ecf7a 100755 --- a/src/main/java/de/mpc/pia/intermediate/compiler/PIACompiler.java +++ b/src/main/java/de/mpc/pia/intermediate/compiler/PIACompiler.java @@ -12,6 +12,7 @@ import java.util.Date; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.Map; @@ -21,6 +22,7 @@ import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; +import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.stream.FactoryConfigurationError; import javax.xml.stream.XMLOutputFactory; @@ -135,13 +137,13 @@ public abstract class PIACompiler { private static String nsjPiaXML = "http://www.medizinisches-proteom-center.de/PIA/piaintermediate"; /** prefixdeclaration for jPiaXML */ - private static String prefixjPiaXML = "ns3"; + private static String prefixjPiaXML = "pia"; /** namespace declaration for mzIdentML */ private static String nsMzIdentML = "http://psidev.info/psi/pi/mzIdentML/1.1"; /** prefix declaration for mzIdentML */ - private static String prefixMzIdentML = "ns2"; + private static String prefixMzIdentML = "mzid"; /** encoding specification */ private static String encoding = "UTF-8"; @@ -933,6 +935,26 @@ public final void writeOutXML(OutputStream outputStream) { XMLOutputFactory xmlof = XMLOutputFactory.newInstance(); XMLStreamWriter xmlOut = new IndentingXMLStreamWriter(xmlof.createXMLStreamWriter(out)); + // take care of the namespace in the PIA XML files -> basically set them fixed to PIA and mzid 1.1 + xmlOut.setNamespaceContext(new NamespaceContext() { + public Iterator getPrefixes(String namespaceURI) { + return null; + } + + public String getPrefix(String namespaceURI) { + if (namespaceURI.equals(nsjPiaXML)) { + return prefixjPiaXML; + } else if (namespaceURI.contains("mzIdentML")) { + return prefixMzIdentML; + } + return ""; + } + + public String getNamespaceURI(String prefix) { + return ""; + } + }); + // xml header xmlOut.writeStartDocument(encoding, "1.0"); From ca3cae56c9fa9e64e4eac782f34966b4433bd318 Mon Sep 17 00:00:00 2001 From: julianu Date: Fri, 5 Jul 2024 10:16:25 +0200 Subject: [PATCH 2/2] bumping version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 63ef864..6aa694d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ de.mpc.pia pia - 1.5.1 + 1.5.2 PIA - Protein Inference Algorithms https://github.com/mpc-bioinformatics/pia