Skip to content

Commit

Permalink
Can now perform compression and decompression on same imzML file
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanRace committed Jan 14, 2019
1 parent 1eeb17b commit cfdd075
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ jimzMLConverter/src/main/assembly/
jimzMLConverter/\.idea/

jimzMLConverter/jimzMLConverter\.iml

\.idea/

jimzMLConverter/Ontologies/
12 changes: 9 additions & 3 deletions jimzMLConverter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.alanmrace</groupId>
<artifactId>jimzMLConverter</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0.1</version>
<packaging>jar</packaging>


Expand Down Expand Up @@ -168,8 +168,8 @@
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jimzMLParser</artifactId>
<version>${project.version}</version>
<artifactId>jimzmlparser</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down Expand Up @@ -211,6 +211,12 @@
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.13</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>13.0</version>
<scope>compile</scope>
</dependency>

<!-- END FOR HDF5 -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ public void convert() throws ConversionException {
for (int fileIndex = 0; fileIndex < inputFilenames.length; fileIndex++) {
String imzMLFilename = inputFilenames[fileIndex];

Logger.getLogger(MzMLToImzMLConverter.class.getName()).log(Level.INFO, "Processing " + imzMLFilename);

try {
ImzML currentimzML = ImzMLHandler.parseimzML(imzMLFilename);

Expand Down Expand Up @@ -213,6 +215,10 @@ public void convert() throws ConversionException {
binaryDataArray.removeChildrenOfCVParam(BinaryDataArray.COMPRESSION_TYPE_ID, false);
binaryDataArray.removeChildrenOfCVParam(BinaryDataArray.BINARY_DATA_TYPE_ID, false);

// TODO: ONLY HERE BECAUSE OF 3D DATA FROM SCILS LAB - need a better way to do this otherwise this will
// cause all RPGs to be removed which may not be desirable
binaryDataArray.removeAllReferenceableParamGroupRefs();

if (binaryDataArray.ismzArray()) {
binaryDataArray.addReferenceableParamGroupRef(new ReferenceableParamGroupRef(rpgmzArray));
binaryDataArray.removeCVParam(BinaryDataArray.MZ_ARRAY_ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public void convert(String parsedCommand) {

String[] inputFilenames;

if (extension.equals("grd") || extension.equals("mzML"))
if (extension.equals("grd") || extension.equals("mzML") || extension.equals("imzML"))
inputFilenames = new String[] {fileName};
else if(currentFile.isDirectory() && !fileName.endsWith(".raw")) {
inputFilenames = currentFile.list();
Expand Down Expand Up @@ -346,6 +346,8 @@ else if(currentFile.isDirectory() && !fileName.endsWith(".raw")) {

converter = null;
}
} else {
converter = new ImzMLToImzMLConverter(outputPath, inputFilenames);
}
}

Expand Down Expand Up @@ -439,6 +441,8 @@ else if(currentFile.isDirectory() && !fileName.endsWith(".raw")) {
((ImzMLConverter) converter).setPixelLocations(locations);
((ImzMLConverter) converter).setOutputFilename(outputPath + "_" + splitIndex);
}

logger.log(Level.INFO, MessageFormat.format("Converting using {0} compression for m/z array", ((ImzMLConverter)converter).mzArrayCompressionType));
}
}

Expand Down

0 comments on commit cfdd075

Please sign in to comment.