-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First PoC for lipid ms lib parsing and validation.
- Loading branch information
1 parent
4d30d73
commit 1172474
Showing
11 changed files
with
542 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
# | ||
# Linux start script should use lf | ||
/gradlew text eol=lf | ||
|
||
# These are Windows script files and should use crlf | ||
*.bat text eol=crlf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Ignore Gradle project-specific cache directory | ||
.gradle | ||
|
||
# Ignore Gradle build output directory | ||
build |
83 changes: 83 additions & 0 deletions
83
lipid_validation/mslibrary-lipid-validator/app/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
* | ||
* This generated file contains a sample Java application project to get you started. | ||
* For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.4/userguide/building_java_projects.html in the Gradle documentation. | ||
*/ | ||
|
||
plugins { | ||
// Apply the application plugin to add support for building a CLI application in Java. | ||
id 'application' | ||
} | ||
|
||
repositories { | ||
// Use Maven Central for resolving dependencies. | ||
mavenCentral() | ||
maven { | ||
url "https://m.lifs-tools.org/artifactory/libs-release" | ||
} | ||
maven { url = "file://" + projectDir + "/src/main/lib" } | ||
// For jmzml, etc. | ||
maven { url = "https://www.ebi.ac.uk/Tools/maven/repos/content/groups/ebi-repo/" } | ||
// For SIRIUS ID modules | ||
maven { url = "https://bio.informatik.uni-jena.de/repository/libs-oss/" } | ||
maven { url = "https://jitpack.io" } | ||
maven { url = "https://www.xypron.de/repository/" } | ||
// For cpdetector | ||
maven { url = "https://nexus.nuiton.org/nexus/content/groups/releases/" } | ||
// For jimzml | ||
// maven { url = "https://mvnrepository.com/artifact/com.alanmrace/jimzmlparser" } | ||
} | ||
|
||
ext { | ||
jgoslinVersion = '2.1.0' | ||
} | ||
|
||
dependencies { | ||
// Use JUnit Jupiter for testing. | ||
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.3' | ||
|
||
testRuntimeOnly 'org.junit.platform:junit-platform-launchchemspider-apier' | ||
|
||
// This dependency is used by the application. | ||
implementation 'com.google.guava:guava:32.1.1-jre' | ||
|
||
implementation('io.github.mzmine:mzmine3:3.9.3') { | ||
exclude group: 'org.rsc.chemspider', module: 'chemspider-api' | ||
exclude group: 'mzmine', module: 'jmprojection' | ||
exclude group: 'mzmine', module: 'gslibml' | ||
exclude group: 'org.du-lab.adap', module: 'adap' | ||
exclude group: 'gnf', module: 'clustering' | ||
} | ||
implementation "org.lifs-tools:jgoslin-parsers:$jgoslinVersion" | ||
} | ||
|
||
// Apply a specific Java toolchain to ease working on different environments. | ||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(20) | ||
} | ||
} | ||
|
||
application { | ||
// Define the main class for the application. | ||
mainClass = 'org.mzmine.mslibrary.lipid.validator.App' | ||
} | ||
|
||
tasks.named('test') { | ||
// Use JUnit Platform for unit tests. | ||
useJUnitPlatform() | ||
} | ||
|
||
tasks.withType(JavaCompile) { | ||
options.encoding = "UTF-8" | ||
options.compilerArgs += ['--enable-preview'] | ||
} | ||
|
||
tasks.withType(Test) { | ||
jvmArgs += "--enable-preview" | ||
} | ||
|
||
tasks.withType(JavaExec) { | ||
jvmArgs += '--enable-preview' | ||
} |
27 changes: 27 additions & 0 deletions
27
...mslibrary-lipid-validator/app/src/main/java/org/mzmine/mslibrary/lipid/validator/App.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* This Java source file was generated by the Gradle 'init' task. | ||
*/ | ||
package org.mzmine.mslibrary.lipid.validator; | ||
|
||
import io.github.mzmine.util.spectraldb.parser.UnsupportedFormatException; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
|
||
public class App { | ||
|
||
public String getGreeting() { | ||
return "Hello World!"; | ||
} | ||
|
||
public static void main(String[] args) { | ||
try { | ||
new MsLibraryReader().read(new File("/home/nilshoffmann/Projects/github.com/nilshoffmann/biohack23_p15/library_spectra_validation/tests/examples/test_case_correct.mgf")); | ||
} catch (IOException ex) { | ||
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex); | ||
} catch (UnsupportedFormatException ex) { | ||
Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex); | ||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...pid-validator/app/src/main/java/org/mzmine/mslibrary/lipid/validator/MsLibraryReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license | ||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template | ||
*/ | ||
package org.mzmine.mslibrary.lipid.validator; | ||
|
||
import io.github.mzmine.util.MemoryMapStorage; | ||
import io.github.mzmine.util.spectraldb.entry.DBEntryField; | ||
import io.github.mzmine.util.spectraldb.entry.SpectralLibrary; | ||
import io.github.mzmine.util.spectraldb.parser.AutoLibraryParser; | ||
import io.github.mzmine.util.spectraldb.parser.UnsupportedFormatException; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.UUID; | ||
import org.lifstools.jgoslin.domain.LipidParsingException; | ||
import org.lifstools.jgoslin.parser.LipidParser; | ||
|
||
/** | ||
* | ||
* @author nilshoffmann | ||
*/ | ||
public class MsLibraryReader { | ||
|
||
private final LipidParser lipidParser = new LipidParser(); | ||
|
||
public void read(File mgfFile) throws IOException, UnsupportedFormatException { | ||
AutoLibraryParser alp = new AutoLibraryParser(10, (spectralLibraryEntryList, alreadyProcessed) -> { | ||
spectralLibraryEntryList.forEach((t) -> { | ||
String name = t.getField(DBEntryField.NAME).orElse("NA"); | ||
System.out.println("Processing entry: " + name); | ||
try { | ||
lipidParser.parse(name); | ||
} catch (LipidParsingException e) { | ||
System.out.println(""); | ||
} | ||
}); | ||
}); | ||
String prefix = "lipid-spec-lib-" + UUID.randomUUID(); | ||
boolean parseSuccess = alp.parse(null, mgfFile, new SpectralLibrary(MemoryMapStorage.create(), prefix, File.createTempFile(prefix, ".slib"))); | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...brary-lipid-validator/app/src/test/java/org/mzmine/mslibrary/lipid/validator/AppTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* This Java source file was generated by the Gradle 'init' task. | ||
*/ | ||
package org.mzmine.mslibrary.lipid.validator; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class AppTest { | ||
@Test void appHasAGreeting() { | ||
App classUnderTest = new App(); | ||
assertNotNull(classUnderTest.getGreeting(), "app should have a greeting"); | ||
} | ||
} |
Binary file added
BIN
+62.2 KB
lipid_validation/mslibrary-lipid-validator/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions
7
lipid_validation/mslibrary-lipid-validator/gradle/wrapper/gradle-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.