Skip to content

Commit

Permalink
Added check whether wine is being called
Browse files Browse the repository at this point in the history
Removed " from command line if wine being called
  • Loading branch information
AlanRace committed Mar 4, 2019
1 parent d1a7500 commit 1343b6e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion 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>2.0.4</version>
<version>2.0.5</version>
<packaging>jar</packaging>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
package com.alanmrace.jimzmlconverter;

import com.alanmrace.jimzmlconverter.exceptions.ConversionException;
import java.io.File;
import java.io.FileFilter;
import java.io.FilenameFilter;
import java.io.IOException;

import java.io.*;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Comparator;
Expand All @@ -33,6 +31,8 @@ public class WatersRAWTomzMLConverter {

public static final String COMMAND_LINE = " --zlib --simAsSpectra ";
// public static final String INDEX_COMMAND = " /index";



public static File[] convert(String filepath) throws IOException {
return convert(filepath, false, "");
Expand All @@ -57,21 +57,42 @@ public static File[] convert(String filepath, String outputFilepath, boolean cen

if(extention.equalsIgnoreCase("raw")) { // && fileToConvert.isDirectory()) {
try {
String tempCommand = getCommand() + " \"" + filepath + "\"" + COMMAND_LINE;
String tempCommand = getCommand();
boolean isLinux = tempCommand.contains("wine");

if(isLinux)
tempCommand += " " + filepath;
else
tempCommand += " \"" + filepath + "\"";

tempCommand += COMMAND_LINE;

if(centroid)
tempCommand += " --filter \"peakPicking true 1-\"";

if(!msconvertFilter.isEmpty())
tempCommand += " --filter \"" + msconvertFilter + "\"";

tempCommand += " -o \"" + outputFilepath + "\"";
tempCommand += " -o ";

if(isLinux)
tempCommand += outputFilepath;
else
tempCommand += "\"" + outputFilepath + "\"";

System.out.println(tempCommand);
Process process = Runtime.getRuntime().exec(tempCommand);

// Wait for the conversion to complete
process.waitFor();

BufferedReader br=new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;

while((line = br.readLine()) != null) {
System.out.println(line);
}


// Locate the mzML files that were created
File directory = new File(outputFilepath);
Expand Down

0 comments on commit 1343b6e

Please sign in to comment.