Skip to content

Commit

Permalink
DTASelect2mzIdentML version 1.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
smdb21 committed Feb 23, 2017
1 parent 2a1a9d1 commit 78c3692
Show file tree
Hide file tree
Showing 6 changed files with 714 additions and 14 deletions.
8 changes: 1 addition & 7 deletions .classpath
Expand Up @@ -22,17 +22,11 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/fastutil-7.0.12.jar"/>
<classpathentry kind="lib" path="lib/jmzidentml-1.1.9.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -17,3 +17,4 @@ hs_err_pid*
/build/
/src/test
/releases/
.classpath
98 changes: 91 additions & 7 deletions pom.xml
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>edu.scripps.yates</groupId>
<artifactId>dtaselect2mzid</artifactId>
<version>1.1-SNAPSHOT</version>
<version>1.1</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Expand Down Expand Up @@ -109,7 +109,7 @@
<dependency>
<groupId>edu.scripps.yates</groupId>
<artifactId>dtaselectparser</artifactId>
<version>1.0.1-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.compomics</groupId>
Expand Down Expand Up @@ -162,16 +162,28 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>uk.ac.ebi.jmzidml</groupId>
<artifactId>jmzidentml</artifactId>
<version>1.1.9</version>
</dependency>
</dependencies>
<build>

<profiles>
<profile>
<id>dtaselect2mzid</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -259,8 +271,80 @@
</execution>
</executions>
</plugin>
</plugins>
</build>
</plugins>
</build>
</profile>
<profile>
<id>mzxmlfixer</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/${lib.dir}</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<finalName>mzXMLFixer4Skyline</finalName>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>edu.scripps.yates.dtaselect2mzid.skyline.MzXMLFixerGUI</mainClass>
<classpathPrefix>lib</classpathPrefix>
</manifest>
</archive>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>assembly</id>
<phase>package</phase>
<goals>
<goal>assembly</goal>
</goals>
</execution>
</executions>
<configuration>
<finalName>${assembly.dir}</finalName>
<descriptors>
<descriptor>${basedir}/src/main/resources/assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>

</plugins>
</build>
</profile>
</profiles>
<repositories>
<repository>
<releases>
Expand Down
@@ -0,0 +1,97 @@
package edu.scripps.yates.dtaselect2mzid.skyline;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

import javax.swing.SwingWorker;

import org.apache.commons.io.FilenameUtils;

import edu.scripps.yates.utilities.util.Pair;

/**
* This class reads an input mzXML file and outputs the same file correcting
* mz-int tag by m/z-int
*
* @author Salva
*
*/
public class MzXMLFixer extends SwingWorker<Void, Void> {
private final File mzXMLFile;
private final File outputFolder;
public final static String STARTING = "MzXMLFixerSTARTING";
public final static String CANCELED = "MzXMLFixerCANCELED";
public final static String DONE = "MzXMLFixerDONE";
public static final String ERROR = "MzXMLFixerERROR";
public static final String NUM_LINES = "MzXMLFixerNUM_LINES";

public MzXMLFixer(File mzXMLFile, File outputFolder) {
if (mzXMLFile.getParentFile().getAbsolutePath().equals(outputFolder.getAbsolutePath())) {
throw new IllegalArgumentException(
"Output folder has to be different than the one containing the input mzXML file");
}
this.mzXMLFile = mzXMLFile;
this.outputFolder = outputFolder;
}

public void fixMZXML() throws IOException {
firePropertyChange(STARTING, null, this.mzXMLFile);
File mzXML = this.mzXMLFile;
File output = new File(
this.outputFolder + File.separator + FilenameUtils.getName(this.mzXMLFile.getAbsolutePath()));
FileWriter fw = null;
BufferedReader br = null;
try {
long numLinesFixed = 0;
fw = new FileWriter(output);
br = new BufferedReader(new FileReader(mzXML));
String line = br.readLine();
while (line != null) {

Thread.sleep(0);
if (line.contains("\"mz-int\"")) {
line = line.replace("\"mz-int\"", "\"m/z-int\"");
numLinesFixed++;
firePropertyChange(NUM_LINES, null, new Pair<File, Long>(this.mzXMLFile, numLinesFixed));
}
fw.write(line);
fw.write("\n");
line = br.readLine();
}
} catch (InterruptedException e) {

} finally {
try {
fw.close();
br.close();
} catch (IOException e) {
e.printStackTrace();
}

}
}

@Override
protected Void doInBackground() throws Exception {
try {
fixMZXML();
} catch (Exception e) {
e.printStackTrace();
firePropertyChange(ERROR, null, e);
}
return null;
}

@Override
protected void done() {
if (isCancelled()) {
firePropertyChange(CANCELED, null, this.mzXMLFile);
} else {
firePropertyChange(DONE, null, this.mzXMLFile);
}
super.done();
}
}

0 comments on commit 78c3692

Please sign in to comment.