Skip to content

Commit 52098a5

Browse files
Import full project
1 parent d32d3ba commit 52098a5

142 files changed

Lines changed: 642542 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pom.xml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>fr.lsmbo.msdecoder</groupId>
6+
<artifactId>MS-DECODER</artifactId>
7+
<version>1.4.2</version>
8+
<description>Decoding Polymer Sequences</description>
9+
<properties>
10+
<project.build.date>2017-07-28</project.build.date>
11+
</properties>
12+
13+
<dependencies>
14+
<dependency>
15+
<groupId>org.hamcrest</groupId>
16+
<artifactId>hamcrest-core</artifactId>
17+
<version>1.3</version>
18+
<scope>test</scope>
19+
</dependency>
20+
<dependency>
21+
<groupId>com.beust</groupId>
22+
<artifactId>jcommander</artifactId>
23+
<version>1.48</version>
24+
</dependency>
25+
<dependency>
26+
<groupId>junit</groupId>
27+
<artifactId>junit</artifactId>
28+
<version>4.12</version>
29+
<scope>test</scope>
30+
</dependency>
31+
</dependencies>
32+
33+
<build>
34+
<resources>
35+
<resource>
36+
<directory>src/main/java</directory>
37+
<includes>
38+
<include>**/*.fxml</include>
39+
</includes>
40+
</resource>
41+
<resource>
42+
<directory>src/main/resources</directory>
43+
<filtering>true</filtering>
44+
<includes>
45+
<include>**/*</include>
46+
</includes>
47+
</resource>
48+
</resources>
49+
<plugins>
50+
<plugin>
51+
<groupId>org.apache.maven.plugins</groupId>
52+
<artifactId>maven-eclipse-plugin</artifactId>
53+
<version>2.9</version>
54+
<configuration>
55+
<downloadSources>true</downloadSources>
56+
<downloadJavadocs>false</downloadJavadocs>
57+
</configuration>
58+
</plugin>
59+
<plugin>
60+
<groupId>org.apache.maven.plugins</groupId>
61+
<artifactId>maven-compiler-plugin</artifactId>
62+
<version>3.6.1</version>
63+
<configuration>
64+
<source>1.8</source>
65+
<target>1.8</target>
66+
</configuration>
67+
</plugin>
68+
<plugin>
69+
<artifactId>maven-assembly-plugin</artifactId>
70+
<configuration>
71+
<archive>
72+
<manifest>
73+
<mainClass>fr.lsmbo.msdecoder.Main</mainClass>
74+
</manifest>
75+
</archive>
76+
<descriptorRefs>
77+
<descriptorRef>jar-with-dependencies</descriptorRef>
78+
</descriptorRefs>
79+
</configuration>
80+
<executions>
81+
<execution>
82+
<id>make-assembly</id> <!-- this is used for inheritance merges -->
83+
<phase>package</phase> <!-- bind to the packaging phase -->
84+
<goals>
85+
<goal>single</goal>
86+
</goals>
87+
</execution>
88+
</executions>
89+
</plugin>
90+
</plugins>
91+
</build>
92+
</project>
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
/*
2+
* Copyright 2017 CNRS
3+
* Author: Alexandre BUREL
4+
* Email: alexandre.burel@unistra.Fr
5+
*
6+
* This software is a computer program whose purpose is to extract polymer
7+
* codes encoded into MS/MS spectra. The goal of this software is to
8+
* automate the decoding for several spectra, in a short amount of time
9+
* using a user-friendly user-interface.
10+
*
11+
* This software is governed by the CeCILL license under French law and
12+
* abiding by the rules of distribution of free software. You can use,
13+
* modify and/ or redistribute the software under the terms of the CeCILL
14+
* license as circulated by CEA, CNRS and INRIA at the following URL
15+
* "http://www.cecill.info".
16+
*
17+
* As a counterpart to the access to the source code and rights to copy,
18+
* modify and redistribute granted by the license, users are provided only
19+
* with a limited warranty and the software's author, the holder of the
20+
* economic rights, and the successive licensors have only limited
21+
* liability.
22+
*
23+
* In this respect, the user's attention is drawn to the risks associated
24+
* with loading, using, modifying and/or developing or reproducing the
25+
* software by the user in light of its specific status of free software,
26+
* that may mean that it is complicated to manipulate, and that also
27+
* therefore means that it is reserved for developers and experienced
28+
* professionals having in-depth computer knowledge. Users are therefore
29+
* encouraged to load and test the software's suitability as regards their
30+
* requirements in conditions enabling the security of their systems and/or
31+
* data to be ensured and, more generally, to use and operate it in the
32+
* same conditions as regards security.
33+
*
34+
* The fact that you are presently reading this means that you have had
35+
* knowledge of the CeCILL license and that you accept its terms.
36+
*
37+
*/
38+
39+
package fr.lsmbo.msdecoder;
40+
41+
import java.util.Properties;
42+
43+
public class AppInfo {
44+
45+
private static Boolean isInitialized = false;
46+
private static String appName = "MS-DECODER";
47+
private static String appSubName = "Decoding Polymer Sequences";
48+
private static String appVersion = "";
49+
private static String appDate = "";
50+
51+
private static void initialize() {
52+
if(!isInitialized) {
53+
try {
54+
final Properties properties = new Properties();
55+
properties.load(AppInfo.class.getClassLoader().getResourceAsStream("ms-decoder.properties"));
56+
appName = properties.getProperty("name");
57+
appSubName = properties.getProperty("description");
58+
appVersion = properties.getProperty("version");
59+
appDate = properties.getProperty("build-date");
60+
} catch(Exception e) {
61+
e.printStackTrace();
62+
}
63+
}
64+
isInitialized = true;
65+
}
66+
67+
public static String getAppName() {
68+
initialize();
69+
return appName;
70+
}
71+
public static String getAppSubName() {
72+
initialize();
73+
return appSubName;
74+
}
75+
public static String getAppVersion() {
76+
initialize();
77+
return appVersion;
78+
}
79+
public static String getAppDate() {
80+
initialize();
81+
return appDate;
82+
}
83+
84+
public static String getAppTitle() {
85+
initialize();
86+
return appName + " " + appVersion + " (" + appDate + ")";
87+
}
88+
89+
public static String getLicence() {
90+
initialize();
91+
return "Copyright 2017 CNRS\n" +
92+
"Corresponding author: Alexandre BUREL\n" +
93+
"Email: alexandre.burel@unistra.fr\n" +
94+
"Affiliation: Laboratoire de Spectrométrie de Masse BioOrganique, Université de Strasbourg, CNRS, IPHC, UMR7178, F-67000 Strasbourg, France\n" +
95+
"Laboratory contact: Christine CARAPITO\n" +
96+
"Email: ccarapito@unistra.fr\n\n" +
97+
98+
"This software is a computer program whose purpose is to extract polymer " +
99+
"codes encoded in MS/MS spectra. The goal of this software is to " +
100+
"automate spectra decoding, in a short time using a user-friendly interface.\n\n " +
101+
102+
"This software is governed by the CeCILL license under French law and " +
103+
"abiding by the rules of distribution of free software. You can use, " +
104+
"modify and/ or redistribute the software under the terms of the CeCILL " +
105+
"license as circulated by CEA, CNRS and INRIA at the following URL " +
106+
"http://www.cecill.info\n\n " +
107+
108+
"As a counterpart to the access to the source code and rights to copy, " +
109+
"modify and redistribute granted by the license, users are provided only " +
110+
"with a limited warranty and the software's author, the holder of the " +
111+
"economic rights, and the successive licensors have only limited " +
112+
"liability. \n\n" +
113+
114+
"In this respect, the user's attention is drawn to the risks associated " +
115+
"with loading, using, modifying and/or developing or reproducing the " +
116+
"software by the user in light of its specific status of free software, " +
117+
"that may mean that it is complicated to manipulate, and that also " +
118+
"therefore means that it is reserved for developers and experienced " +
119+
"professionals having in-depth computer knowledge. Users are therefore " +
120+
"encouraged to load and test the software's suitability as regards their " +
121+
"requirements in conditions enabling the security of their systems and/or " +
122+
"data to be ensured and, more generally, to use and operate it in the " +
123+
"same conditions as regards security.\n\n" +
124+
125+
"The fact that you are presently reading this means that you have had " +
126+
"knowledge of the CeCILL license and that you accept its terms.";
127+
}
128+
}
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
/*
2+
* Copyright 2017 CNRS
3+
* Author: Alexandre BUREL
4+
* Email: alexandre.burel@unistra.Fr
5+
*
6+
* This software is a computer program whose purpose is to extract polymer
7+
* codes encoded into MS/MS spectra. The goal of this software is to
8+
* automate the decoding for several spectra, in a short amount of time
9+
* using a user-friendly user-interface.
10+
*
11+
* This software is governed by the CeCILL license under French law and
12+
* abiding by the rules of distribution of free software. You can use,
13+
* modify and/ or redistribute the software under the terms of the CeCILL
14+
* license as circulated by CEA, CNRS and INRIA at the following URL
15+
* "http://www.cecill.info".
16+
*
17+
* As a counterpart to the access to the source code and rights to copy,
18+
* modify and redistribute granted by the license, users are provided only
19+
* with a limited warranty and the software's author, the holder of the
20+
* economic rights, and the successive licensors have only limited
21+
* liability.
22+
*
23+
* In this respect, the user's attention is drawn to the risks associated
24+
* with loading, using, modifying and/or developing or reproducing the
25+
* software by the user in light of its specific status of free software,
26+
* that may mean that it is complicated to manipulate, and that also
27+
* therefore means that it is reserved for developers and experienced
28+
* professionals having in-depth computer knowledge. Users are therefore
29+
* encouraged to load and test the software's suitability as regards their
30+
* requirements in conditions enabling the security of their systems and/or
31+
* data to be ensured and, more generally, to use and operate it in the
32+
* same conditions as regards security.
33+
*
34+
* The fact that you are presently reading this means that you have had
35+
* knowledge of the CeCILL license and that you accept its terms.
36+
*
37+
*/
38+
39+
package fr.lsmbo.msdecoder;
40+
41+
import java.io.File;
42+
import java.util.ArrayList;
43+
import java.util.List;
44+
45+
import com.beust.jcommander.JCommander;
46+
import com.beust.jcommander.Parameter;
47+
48+
import fr.lsmbo.msdecoder.decoder.*;
49+
import fr.lsmbo.msdecoder.gui.DecoderGUI;
50+
51+
public class Main {
52+
53+
// TODO add algorithm-specific parameters
54+
public static class ArgumentList {
55+
@Parameter
56+
private List<String> parameters = new ArrayList<String>();
57+
58+
@Parameter(names = { "-input", "--input_spectrum_path" }, description = "Spectrum text file")
59+
private String spectrum = "";
60+
61+
@Parameter(names = { "-tol", "--mz_tolerance" }, description = "M/z tolerance")
62+
private Double mzTolerance = 0.05;
63+
64+
@Parameter(names = { "-it", "--intensity_threshold" }, description = "Intensity minimal value")
65+
private Double intensityThreshold = 4.0; // default should be 4
66+
67+
@Parameter(names = { "-iti", "--intensity_threshold_for_isotope_search" }, description = "Intensity minimal value to search for the first isotope")
68+
private Double intensityThresholdForIsotopeSearch = 25.0; // default should be 25
69+
70+
@Parameter(names = { "-p", "--polymer_type" }, description = "Indicate which polymer should be searched")
71+
private String polymer = "";
72+
73+
@Parameter(names = { "-g", "--graphical_interface" }, description = "Use user-friendly GUI (default if CLI arguments are not provided)")
74+
private boolean gui = false;
75+
76+
@Parameter(names = { "-h", "--help" }, description = "Display this help")
77+
private boolean help = false;
78+
79+
@Parameter(names = { "-v", "--version" }, description = "Print version number")
80+
private boolean version = false;
81+
82+
// @Parameter(names = { "-t", "--test" }, description = "Run some internal test [to be removed]")
83+
// private boolean test = false;
84+
}
85+
86+
private static boolean checkSpectrumFile(String file) {
87+
try {
88+
File f = new File(file);
89+
if(f.exists() && f.isFile() && f.canRead()) {
90+
return true;
91+
}
92+
} catch(Exception e) {
93+
System.out.println("File '"+file+"' is not readable");
94+
e.printStackTrace();
95+
}
96+
return false;
97+
}
98+
99+
private static boolean checkPolymerType(String polymer) {
100+
for(PolymerTypes p: PolymerTypes.values()) {
101+
if(p.name().equals(polymer)) {
102+
return true;
103+
}
104+
}
105+
return false;
106+
}
107+
108+
public static void main(String[] args) {
109+
110+
ArgumentList jc = new ArgumentList();
111+
JCommander cmds = new JCommander(jc, args);
112+
cmds.setProgramName(AppInfo.getAppName());
113+
114+
if(jc.help) {
115+
// just print usage and quit
116+
cmds.usage();
117+
} else if(jc.version) {
118+
// just print version number and quit
119+
System.out.println(AppInfo.getAppTitle());
120+
} else if(jc.parameters.size() == 0 || jc.gui) {
121+
// open gui
122+
DecoderGUI.run();
123+
} else {
124+
// if CLI, then spectrum and mode must be provided !
125+
if(checkSpectrumFile(jc.spectrum) && checkPolymerType(jc.polymer)) {
126+
// prepare a string for the expected response
127+
String code = "";
128+
129+
// call the requested algorithm
130+
try {
131+
AbstractDecoder d = Decoders.get(PolymerTypes.valueOf(jc.polymer));
132+
code = d.decode(jc.spectrum, jc.mzTolerance, jc.intensityThreshold, jc.intensityThresholdForIsotopeSearch).getCode();
133+
} catch(Exception e) {
134+
e.printStackTrace();
135+
}
136+
// print the response
137+
System.out.println(code);
138+
} else {
139+
System.err.println("Error: input spectrum file and polymer type must be provided !");
140+
}
141+
}
142+
}
143+
144+
}

0 commit comments

Comments
 (0)