diff --git a/pom.xml b/pom.xml
index e59d7af..186ae60 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0rappsilberxiSEARCH
- 1.7.2
+ 1.7.3jar
diff --git a/src/main/java/rappsilber/applications/SimpleXiProcessLinearIncluded.java b/src/main/java/rappsilber/applications/SimpleXiProcessLinearIncluded.java
index c2f6d3c..94da071 100644
--- a/src/main/java/rappsilber/applications/SimpleXiProcessLinearIncluded.java
+++ b/src/main/java/rappsilber/applications/SimpleXiProcessLinearIncluded.java
@@ -735,9 +735,13 @@ protected MatchedXlinkedPeptide evaluateMatch(Spectra sin, Peptide alphaFirst, P
if (match!= null) {
m_mgcmgxDeltaScore.setScore(match, "mgcAlpha", mgcAlphaScore);
m_mgcmgxDeltaScore.setScore(match, "mgcBeta", mgcBetaScore);
- double pAlpha = Math.pow(-mgcAlphaScore, 10);
- double pBeta = Math.pow(-mgcBetaScore, 10);
- double pmgc = pAlpha+pBeta - pAlpha*pBeta;
+ double pAlpha = Math.pow(-mgcAlphaScore, Math.E);
+ double pBeta = pAlpha;
+ double pmgc = pAlpha;
+ if (beta != null) {
+ pBeta = Math.pow(-mgcBetaScore, Math.E);
+ pmgc = pAlpha+pBeta - pAlpha*pBeta;
+ }
double mgcAlphaBeta = -Math.log(pmgc);
m_mgcmgxDeltaScore.setScore(match, "mgcAlphaBeta", mgcAlphaBeta);
m_mgcmgxDeltaScore.setScore(match, "mgcScore", mgcScore);
diff --git a/src/main/java/rappsilber/applications/Xi.java b/src/main/java/rappsilber/applications/Xi.java
index b23d2a6..a93a484 100644
--- a/src/main/java/rappsilber/applications/Xi.java
+++ b/src/main/java/rappsilber/applications/Xi.java
@@ -37,6 +37,7 @@
import rappsilber.ms.dataAccess.output.CSVExportMatches;
import rappsilber.ms.dataAccess.output.PeakListWriter;
import rappsilber.ms.dataAccess.output.ResultMultiplexer;
+import rappsilber.ms.sequence.AminoModification;
import rappsilber.ms.sequence.SequenceList;
import rappsilber.ui.StatusInterface;
import rappsilber.utils.ObjectWrapper;
@@ -389,6 +390,9 @@ public static void main(String[] args) throws IOException, FileNotFoundException
DebugFrame df = null;
int argsCount = xi.parseArgs(args, unknownArgs);
+ // switch to automatically change modification symbols to lower case
+ rappsilber.utils.Util.AutoCaseSymbols=true;
+
if (xi.displayLog) {
df = new DebugFrame("Xi-Version : " + XiVersion.getVersionString(), xi.m_xi_process);
final DebugFrame mdf = df;
diff --git a/src/main/java/rappsilber/config/AbstractRunConfig.java b/src/main/java/rappsilber/config/AbstractRunConfig.java
index 854b007..a76b4e1 100644
--- a/src/main/java/rappsilber/config/AbstractRunConfig.java
+++ b/src/main/java/rappsilber/config/AbstractRunConfig.java
@@ -27,6 +27,7 @@
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
+import java.util.regex.Pattern;
import rappsilber.applications.SimpleXiProcessLinearIncluded;
import rappsilber.applications.XiProcess;
import rappsilber.ms.ToleranceUnit;
@@ -49,6 +50,7 @@
import rappsilber.ms.sequence.AminoLabel;
import rappsilber.ms.sequence.AminoModification;
import rappsilber.ms.sequence.NonAminoAcidModification;
+import rappsilber.ms.sequence.Sequence;
import rappsilber.ms.sequence.SequenceList;
import rappsilber.ms.sequence.digest.Digestion;
import rappsilber.ms.sequence.ions.BasicCrossLinkedFragmentProducer;
@@ -613,6 +615,20 @@ public Collection getAllAminoAcids() {
public void addAminoAcid(AminoAcid aa) {
m_AminoAcids.put(aa.SequenceID,aa);
+ if (aa.SequenceID.matches(".+[A-Z].*")) {
+ ArrayList badAA = new ArrayList<>();
+ for (AminoAcid baa : getAllAminoAcids()) {
+ if (baa.SequenceID.matches("[A-Z].*[A-Z].*")) {
+ badAA.add(baa.SequenceID);
+ }
+ }
+
+ if (!badAA.isEmpty()) {
+ badAA.add("[A-Z][^A-Z]*");
+ Sequence.m_sequenceSplit = Pattern.compile("("+MyArrayUtils.toString(badAA, "|") +")");
+ }
+
+ }
}
public void addKnownModification(AminoModification am) {
diff --git a/src/main/java/rappsilber/data/BasicConfig.conf b/src/main/java/rappsilber/data/BasicConfig.conf
index e1e5ff8..aee9f2c 100644
--- a/src/main/java/rappsilber/data/BasicConfig.conf
+++ b/src/main/java/rappsilber/data/BasicConfig.conf
@@ -1,20 +1,6 @@
#####################
# General settings not directly selectable in the GUI
-#####################
-## how many CPUs to use
-## Values smaller 0 mean that all available but the mentioned number will be used.
-## E.g. if the computer has 4 cores and UseCPUs is set to -1 then 3 threads are used for search.
-## Additionally, buffers also use threads to decouple the input and output of the buffer.
-## Each thread will also have a small buffer between itself and the input and the output queue - but the overall CPU-usage of these should be smallish
-UseCPUs:-1
-
-
-
-
-
-
-
####################
## include linear matches
diff --git a/src/main/java/rappsilber/gui/.LCKSimpleXiGui.form~ b/src/main/java/rappsilber/gui/.LCKSimpleXiGui.form~
new file mode 100644
index 0000000..5054a34
--- /dev/null
+++ b/src/main/java/rappsilber/gui/.LCKSimpleXiGui.form~
@@ -0,0 +1 @@
+/home/lfischer/Dropbox/XiSearch/src/main/java/rappsilber/gui/SimpleXiGui.form
\ No newline at end of file
diff --git a/src/main/java/rappsilber/gui/SimpleXiGui.form b/src/main/java/rappsilber/gui/SimpleXiGui.form
index 9e0050b..ecd9471 100644
--- a/src/main/java/rappsilber/gui/SimpleXiGui.form
+++ b/src/main/java/rappsilber/gui/SimpleXiGui.form
@@ -321,14 +321,19 @@
-
+
-
+
+
+
+
+
+
-
+
@@ -338,9 +343,12 @@
-
-
-
+
+
+
+
+
+
@@ -496,7 +504,7 @@
-
+
@@ -649,6 +657,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -826,6 +861,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/rappsilber/gui/SimpleXiGui.java b/src/main/java/rappsilber/gui/SimpleXiGui.java
index a8ab623..5db6027 100644
--- a/src/main/java/rappsilber/gui/SimpleXiGui.java
+++ b/src/main/java/rappsilber/gui/SimpleXiGui.java
@@ -328,6 +328,9 @@ public void run() {
public SimpleXiGui() {
initComponents();
this.setTitle("xiSEARCH v" + XiVersion.getVersionString());
+ this.txtVersion.setText(XiVersion.getVersionString());
+ this.txtChangeLog.setText(XiVersion.changes);
+ this.txtChangeLog.setCaretPosition(0);
loggingHandle = new JTextAreaHandle(txtLog);
loggingHandle.setFilter(new Filter() {
@@ -449,6 +452,20 @@ public void actionPerformed(ActionEvent e) {
configProvider = cfgTextConfig;
}
});
+ this.cfgTextConfig.setBasicConfig(cfgBasicConfig);
+
+ this.cfgTextConfig.addTransferListener(new ActionListener(){
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ rbBasicConfig.setSelected(true);
+ cfgBasicConfig.setConfig(e.getActionCommand());
+ spConfig.setViewportView(cfgBasicConfig);
+ configProvider = cfgBasicConfig;
+ }
+ });
+ this.cfgBasicConfig.setTextConfig(cfgTextConfig);
+
+
spConfig.setViewportView(cfgBasicConfig);
configProvider = cfgBasicConfig;
Runnable runnable = new Runnable() {
@@ -461,6 +478,17 @@ public void run() {
}
};
new Thread(runnable).start();
+
+ fbLoadConfig.setLocalPropertyKey("XLink_Config");
+ fbLoadConfig.setExtensions(new String[]{".cfg",".config",".conf",".txt"});
+ fbLoadConfig.setDescription("config-files");
+ fbLoadConfig.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ btnLoadConfig.setEnabled(!fbLoadConfig.getText().isBlank());
+ btnAddConfig.setEnabled(!fbLoadConfig.getText().isBlank());
+ }
+ });
}
@@ -863,6 +891,9 @@ private void initComponents() {
btnStopFDR = new javax.swing.JButton();
ckFDRGUI = new javax.swing.JCheckBox();
ckBoost = new javax.swing.JCheckBox();
+ fbLoadConfig = new rappsilber.gui.components.FileBrowser();
+ btnLoadConfig = new javax.swing.JButton();
+ btnAddConfig = new javax.swing.JButton();
ckPeakAnnotations = new javax.swing.JCheckBox();
pFeedback = new javax.swing.JPanel();
memory2 = new org.rappsilber.gui.components.memory.Memory();
@@ -876,6 +907,11 @@ private void initComponents() {
callBackSettings1 = new rappsilber.gui.components.CallBackSettings();
feedBack1 = new rappsilber.gui.components.FeedBack();
threadAdjust = new rappsilber.gui.components.ThreadAdjust();
+ jPanel9 = new javax.swing.JPanel();
+ jLabel3 = new javax.swing.JLabel();
+ txtVersion = new javax.swing.JTextField();
+ spChangeLog = new javax.swing.JScrollPane();
+ txtChangeLog = new javax.swing.JTextArea();
txtRunState = new javax.swing.JTextField();
spProteinFDR.setModel(new javax.swing.SpinnerNumberModel(100.0d, 0.0d, null, 1.0d));
@@ -1181,7 +1217,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(cbBoost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ckBoost))
- .addGap(18, 89, Short.MAX_VALUE)
+ .addGap(18, 83, Short.MAX_VALUE)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnStartFDR)
.addComponent(ckFDRGUI))
@@ -1201,6 +1237,24 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
+ fbLoadConfig.setExtensions(new String[] {"txt"});
+
+ btnLoadConfig.setText("Load Config");
+ btnLoadConfig.setEnabled(false);
+ btnLoadConfig.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnLoadConfigActionPerformed(evt);
+ }
+ });
+
+ btnAddConfig.setText("Add Config");
+ btnAddConfig.setEnabled(false);
+ btnAddConfig.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnAddConfigActionPerformed(evt);
+ }
+ });
+
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
@@ -1210,7 +1264,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(rbBasicConfig)
.addGap(35, 35, 35)
.addComponent(rbTextConfig)
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(fbLoadConfig, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnLoadConfig)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnAddConfig))
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(0, 0, 0)
@@ -1219,9 +1278,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
- .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
+ .addComponent(rbTextConfig)
.addComponent(rbBasicConfig)
- .addComponent(rbTextConfig))
+ .addComponent(fbLoadConfig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnLoadConfig)
+ .addComponent(btnAddConfig))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
@@ -1353,6 +1415,41 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
tpMain.addTab("Feedback", pFeedback);
+ jLabel3.setText("xiSEARCH Version:");
+
+ txtChangeLog.setColumns(20);
+ txtChangeLog.setRows(5);
+ spChangeLog.setViewportView(txtChangeLog);
+
+ javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
+ jPanel9.setLayout(jPanel9Layout);
+ jPanel9Layout.setHorizontalGroup(
+ jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel9Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(spChangeLog)
+ .addGroup(jPanel9Layout.createSequentialGroup()
+ .addComponent(jLabel3)
+ .addGap(1, 1, 1)
+ .addComponent(txtVersion, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 649, Short.MAX_VALUE)))
+ .addContainerGap())
+ );
+ jPanel9Layout.setVerticalGroup(
+ jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel9Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel3)
+ .addComponent(txtVersion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(spChangeLog, javax.swing.GroupLayout.DEFAULT_SIZE, 442, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+
+ tpMain.addTab("About", jPanel9);
+
txtRunState.setEditable(false);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
@@ -1455,6 +1552,18 @@ private void rbBasicConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN
}//GEN-LAST:event_rbBasicConfigActionPerformed
+ private void btnLoadConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoadConfigActionPerformed
+ File f = fbLoadConfig.getFile();
+ if (f != null)
+ (configProvider).loadConfig(fbLoadConfig.getFile(),false);
+ }//GEN-LAST:event_btnLoadConfigActionPerformed
+
+ private void btnAddConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddConfigActionPerformed
+ File f = fbLoadConfig.getFile();
+ if (f != null)
+ (configProvider).loadConfig(fbLoadConfig.getFile(),true);
+ }//GEN-LAST:event_btnAddConfigActionPerformed
+
protected void startXiFDR(final FDRInfo info) {
@@ -1590,6 +1699,8 @@ public static void main(String args[]) {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup bgConfig;
private javax.swing.ButtonGroup bgFDROptimized;
+ private javax.swing.JButton btnAddConfig;
+ private javax.swing.JButton btnLoadConfig;
private javax.swing.JButton btnStartFDR;
private javax.swing.JButton btnStartSearch;
private javax.swing.JButton btnStartSearch1;
@@ -1605,6 +1716,7 @@ public static void main(String args[]) {
private javax.swing.JCheckBox ckFDRGUI;
private javax.swing.JCheckBox ckPeakAnnotations;
private javax.swing.JComboBox cmbLogLevel;
+ private rappsilber.gui.components.FileBrowser fbLoadConfig;
private rappsilber.gui.components.FileBrowser fbXIFDR;
private rappsilber.gui.components.FeedBack feedBack1;
private rappsilber.gui.components.FileList flFASTAFiles;
@@ -1612,6 +1724,7 @@ public static void main(String args[]) {
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
@@ -1623,6 +1736,7 @@ public static void main(String args[]) {
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
+ private javax.swing.JPanel jPanel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSplitPane jSplitPane1;
private javax.swing.JLabel lblMaxFDR;
@@ -1636,6 +1750,7 @@ public static void main(String args[]) {
private javax.swing.JPanel pRun;
private javax.swing.JRadioButton rbBasicConfig;
private javax.swing.JRadioButton rbTextConfig;
+ private javax.swing.JScrollPane spChangeLog;
private javax.swing.JScrollPane spConfig;
private javax.swing.JSpinner spLinkFDR;
private javax.swing.JSpinner spPPIFdr;
@@ -1644,10 +1759,12 @@ public static void main(String args[]) {
private javax.swing.JSpinner spPsmFDR;
public rappsilber.gui.components.ThreadAdjust threadAdjust;
private javax.swing.JTabbedPane tpMain;
+ private javax.swing.JTextArea txtChangeLog;
private javax.swing.JTextArea txtLog;
private rappsilber.gui.components.FileBrowser txtPeakList;
private rappsilber.gui.components.FileBrowser txtResultFile;
private javax.swing.JTextField txtRunState;
+ private javax.swing.JTextField txtVersion;
// End of variables declaration//GEN-END:variables
}
diff --git a/src/main/java/rappsilber/gui/XiDBStarter.form b/src/main/java/rappsilber/gui/XiDBStarter.form
index c401c0f..5bf6d71 100644
--- a/src/main/java/rappsilber/gui/XiDBStarter.form
+++ b/src/main/java/rappsilber/gui/XiDBStarter.form
@@ -148,7 +148,7 @@
-
+
@@ -167,18 +167,18 @@
-
-
+
+
-
+
-
+
diff --git a/src/main/java/rappsilber/gui/XiDBStarter.java b/src/main/java/rappsilber/gui/XiDBStarter.java
index 4fd5b22..85aeb42 100644
--- a/src/main/java/rappsilber/gui/XiDBStarter.java
+++ b/src/main/java/rappsilber/gui/XiDBStarter.java
@@ -138,7 +138,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 656, Short.MAX_VALUE)
+ .addComponent(jScrollPane1)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -153,8 +153,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
- .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(localPicker1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
@@ -267,12 +267,14 @@ private void btnRunActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:
prevSetting = "";
else
prevSetting +="\n";
-
+
+ final String restoreExtra = prevSetting;
+
if (ckTopOnly.isSelected())
System.setProperty("XI_EXTRA_CONFIG", prevSetting + "TOPMATCHESONLY:true\n" +txtConfig.getText());
else
System.setProperty("XI_EXTRA_CONFIG", prevSetting + txtConfig.getText());
-
+
Runnable runnable = new Runnable() {
@@ -280,7 +282,7 @@ public void run() {
btnRun.setEnabled(false);
try {
XiDB.main(new String[]{Integer.toString(id), name});
-
+ System.setProperty("XI_EXTRA_CONFIG", restoreExtra);
} catch (Exception e) {
Logger.getLogger(this.getClass().getName()).log(Level.OFF, "Error during search", e);
e.printStackTrace();
diff --git a/src/main/java/rappsilber/gui/components/FileBrowser.java b/src/main/java/rappsilber/gui/components/FileBrowser.java
index 5175219..0c3ab38 100644
--- a/src/main/java/rappsilber/gui/components/FileBrowser.java
+++ b/src/main/java/rappsilber/gui/components/FileBrowser.java
@@ -95,6 +95,7 @@ public void setFile(File path) {
public void unsetFile() {
m_file = null;
+ doActionPerformed();
}
public void detectFrames() {
diff --git a/src/main/java/rappsilber/gui/components/config/BasicConfig.form b/src/main/java/rappsilber/gui/components/config/BasicConfig.form
index 89a2d7e..0f0ddc3 100644
--- a/src/main/java/rappsilber/gui/components/config/BasicConfig.form
+++ b/src/main/java/rappsilber/gui/components/config/BasicConfig.form
@@ -46,13 +46,26 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -63,27 +76,21 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -97,11 +104,9 @@
-
+
-
-
-
+
@@ -112,8 +117,11 @@
+
-
+
+
+
@@ -254,7 +262,7 @@
-
+
@@ -269,7 +277,7 @@
-
+
@@ -321,7 +329,7 @@
-
+
@@ -371,7 +379,7 @@
-
+
@@ -427,7 +435,7 @@
-
+
@@ -478,7 +486,7 @@
-
+
@@ -544,7 +552,7 @@
-
+
@@ -568,7 +576,9 @@
-
+
+
+
@@ -609,5 +619,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/rappsilber/gui/components/config/BasicConfig.java b/src/main/java/rappsilber/gui/components/config/BasicConfig.java
index b735705..30940d5 100644
--- a/src/main/java/rappsilber/gui/components/config/BasicConfig.java
+++ b/src/main/java/rappsilber/gui/components/config/BasicConfig.java
@@ -8,6 +8,8 @@
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener;
@@ -19,8 +21,11 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
+import java.util.HashSet;
import java.util.logging.Level;
import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListModel;
import javax.swing.DefaultListSelectionModel;
@@ -32,31 +37,41 @@
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
import rappsilber.gui.SimpleXiGui;
import rappsilber.gui.components.GenericTextPopUpMenu;
+import rappsilber.ms.ToleranceUnit;
import rappsilber.utils.Util;
/**
*
* @author Lutz Fischer
*/
-public class BasicConfig extends javax.swing.JPanel implements ConfigProvider{
+public class BasicConfig extends javax.swing.JPanel implements ConfigProvider {
+
boolean enabled = true;
+
+ public void setConfig(String actionCommand) {
+ loadConfig(actionCommand, false);
+ }
+
private class ReducedMultiClickSelection extends DefaultListSelectionModel {
+
@Override
public void setSelectionInterval(int index0, int index1) {
if (enabled) {
- if(super.isSelectedIndex(index0)) {
+ if (super.isSelectedIndex(index0)) {
super.removeSelectionInterval(index0, index1);
- }
- else {
+ } else {
super.addSelectionInterval(index0, index1);
}
}
}
}
-
+
public class NameValuePair {
+
public String name;
public String value;
public boolean stripComments = false;
@@ -67,32 +82,31 @@ public NameValuePair(String name, String Value) {
}
public NameValuePair(String entry) {
- String e[] = entry.split("=",2);
+ String e[] = entry.split("=", 2);
this.name = e[0].trim();
this.value = e[1].trim();
}
-
@Override
public String toString() {
- if (stripComments && name.contains("#"))
- return name.substring(0,name.indexOf("#"));
+ if (stripComments && name.contains("#")) {
+ return name.substring(0, name.indexOf("#"));
+ }
return name;
}
@Override
public boolean equals(Object obj) {
- if (obj == this)
+ if (obj == this) {
return true;
+ }
if (obj instanceof NameValuePair) {
NameValuePair nvp = (NameValuePair) obj;
return name.contentEquals(nvp.name) && value.contentEquals(nvp.value);
}
return false;
}
-
-
-
+
}
NameValuePair[] customSettings;
@@ -100,12 +114,39 @@ public boolean equals(Object obj) {
* When given the config can be exported to this TextConfig-Control
*/
private TextConfig textConfig;
-
+ private static final String customSettingsDefault = "# this is a free text field \n# anything starting with '#' is ignored \n# everything else is passed on as search-parameter \n# click the '+' to see available templates ";
+
/**
- * event listener that get triggered when the config should be transferred to a text
+ * event listener that get triggered when the config should be transferred
+ * to a text
*/
private ArrayList textConfigListener = new ArrayList<>();
-
+
+ /**
+ * list of known crosslinkers
+ */
+ ArrayList crosslinkers = new ArrayList<>();
+ /**
+ * list of known modifications
+ */
+ ArrayList modifications = new ArrayList<>();
+ /**
+ * list of known losses
+ */
+ ArrayList losses = new ArrayList<>();
+ /**
+ * list of known ions
+ */
+ ArrayList ions = new ArrayList<>();
+ /**
+ * list of known enzymes
+ */
+ ArrayList enzymes = new ArrayList<>();
+ /**
+ * list of known custom settings
+ */
+ ArrayList custom = new ArrayList<>();
+
/**
* Creates new form BasicConfig
*/
@@ -116,13 +157,14 @@ public BasicConfig() {
lstLinearMod.setSelectionModel(new ReducedMultiClickSelection());
lstLosses.setSelectionModel(new ReducedMultiClickSelection());
lstIons.setSelectionModel(new ReducedMultiClickSelection());
+ lstCrossLinker.setSelectionModel(new ReducedMultiClickSelection());
try {
initialise();
} catch (IOException ex) {
Logger.getLogger(BasicConfig.class.getName()).log(Level.SEVERE, null, ex);
}
updateTransferButton();
-
+
BufferedReader confReader = null;
try {
File filesource = Util.getFileRelative("BasicConfig.conf", true);
@@ -140,20 +182,21 @@ public BasicConfig() {
} catch (IOException ex) {
Logger.getLogger(BasicConfig.class.getName()).log(Level.SEVERE, null, ex);
}
- spThreads.setValue(Runtime.getRuntime().availableProcessors()-1);
+ spThreads.setValue(Runtime.getRuntime().availableProcessors() - 1);
+ ckMultipleCrosslinkerActionPerformed(null);
}
-
+
public void addTransferListener(ActionListener listener) {
textConfigListener.add(listener);
- updateTransferButton();
+ updateTransferButton();
}
public void removeTransferListener(ActionListener listener) {
textConfigListener.remove(listener);
- updateTransferButton();
+ updateTransferButton();
}
-
+
@Override
public void setEnabled(boolean enabled) {
this.enabled = enabled;
@@ -167,41 +210,27 @@ public void setEnabled(boolean enabled) {
this.spToleranceUnitMS1.setEnabled(enabled);
this.spToleranceUnitMS2.setEnabled(enabled);
}
-
-
-
-
+
public String getConfig() throws IOException {
- File filesource = Util.getFileRelative("BasicConfig.conf", true);
- BufferedReader confReader = null;
StringBuilder config = new StringBuilder();
- if (filesource == null) {
- confReader = Util.readFromClassPath(".rappsilber.data.BasicConfig.conf");
- } else {
- confReader = new BufferedReader(new FileReader(filesource));
- }
-
config.append("\n##################");
config.append("\n# variable modification\n");
for (int p : lstVarMod.getSelectedIndices()) {
config.append(
- lstVarMod.getModel().getElementAt(p).
- value.replaceAll("\\[MODE\\]", "variable")).append("\n");
+ lstVarMod.getModel().getElementAt(p).value.replaceAll("\\[MODE\\]", "variable")).append("\n");
}
config.append("\n##################");
config.append("\n# Fixed modification\n");
for (int p : lstFixedMod.getSelectedIndices()) {
config.append(
- lstFixedMod.getModel().getElementAt(p).
- value.replaceAll("\\[MODE\\]", "fixed")).append("\n");
+ lstFixedMod.getModel().getElementAt(p).value.replaceAll("\\[MODE\\]", "fixed")).append("\n");
}
config.append("\n##################");
config.append("\n# Linear modification\n");
for (int p : lstLinearMod.getSelectedIndices()) {
config.append(
- lstLinearMod.getModel().getElementAt(p).
- value.replaceAll("\\[MODE\\]", "linear")).append("\n");
+ lstLinearMod.getModel().getElementAt(p).value.replaceAll("\\[MODE\\]", "linear")).append("\n");
}
config.append("\n##################");
@@ -209,38 +238,74 @@ public String getConfig() throws IOException {
for (int p : lstIons.getSelectedIndices()) {
config.append(lstIons.getModel().getElementAt(p).value).append("\n");
}
-
+
config.append("\n##################");
config.append("\n# Losses\n");
for (int p : lstLosses.getSelectedIndices()) {
config.append(lstLosses.getModel().getElementAt(p).value).append("\n");
}
-
+
config.append("\n##################");
config.append("\n# Enzyme\n");
- config.append(((NameValuePair)cbEnzyme.getSelectedItem()).value).append("\n");
+ config.append(((NameValuePair) cbEnzyme.getSelectedItem()).value).append("\n");
config.append("\n##################");
config.append("\n## how many misscleavages are considered");
config.append("\nmissedcleavages:" + spMissCleavages.getValue());
config.append("\n##################");
config.append("\n# Crosslinker\n");
- config.append(((NameValuePair)cbCrosslinker.getSelectedItem()).value).append("\n");
-
+ if (spCrosslinker.isVisible()) {
+ for (NameValuePair nvp : lstCrossLinker.getSelectedValuesList()) {
+ config.append(nvp.value).append("\n");
+ }
+ } else {
+ config.append(((NameValuePair) cbCrosslinker.getSelectedItem()).value).append("\n");
+ }
+
config.append("\n##################");
config.append("\n# MS1 tolerance\n");
- config.append("tolerance:precursor:"+spToleranceMS1.getValue() + spToleranceUnitMS1.getSelectedItem()).append("\n");
+ config.append("tolerance:precursor:" + spToleranceMS1.getValue() + spToleranceUnitMS1.getSelectedItem()).append("\n");
config.append("# MS2 tolerance\n");
- config.append("tolerance:fragment:"+spToleranceMS2.getValue() + spToleranceUnitMS2.getSelectedItem()).append("\n");
-
- config.append("# number of search threads");
- config.append("UseCPUs:" + spThreads.getValue());
+ config.append("tolerance:fragment:" + spToleranceMS2.getValue() + spToleranceUnitMS2.getSelectedItem()).append("\n");
+
+ HashSet customLines = new HashSet<>();
+ for (String c : txtCustomSetting.getText().split("\\s*[\\r\\n]\\s*")) {
+ customLines.add(c);
+ }
+
+ for (String c : txtCustomSetting.getText().split("\\s*[\\r\\n]\\s*")) {
+ if (c.contains(":")) {
+ customLines.add(c.substring(0, c.indexOf(":")));
+ }
+ }
config.append("\n\n# ---------------------------------------------\n");
config.append("# Basic settings\n");
config.append("# ---------------------------------------------\n");
- config.append(txtBaseSettings.getText());
-
+ boolean lastIsComment = true;
+ for (String c : this.txtBaseSettings.getText().split("\\s*[\\n\\r]+\\s*")) {
+ // new comment?
+ if (c.startsWith("#") && !lastIsComment) {
+ config.append("\n");
+ }
+ if (c.contains(":") && !c.startsWith("fragment:")) {
+ if (!customLines.contains(c.substring(0, c.indexOf(":")))) {
+ config.append(c + "\n");
+ }
+ } else {
+ config.append(c + "\n");
+ }
+ lastIsComment = c.startsWith("#");
+ }
+
+ config.append("\n#####################\n" +
+ "## how many cpus to use\n" +
+ "## values smaller 0 mean that all avaiblable but the mentioned number will be used\n" +
+ "## e.g. if the computer has 4 cores and UseCPUs is set to -1 then 3 threads are used for search.\n" +
+ "## this is a bit relativated by the buffering, as buffers also use threads to decouple the input and output of the buffer.\n" +
+ "## each thread will also have a small buffer between itself and the input and the output queue - but the overal cpu-usage of these should be smallish\n");
+ config.append("UseCPUs:" + spThreads.getValue());
+
if (!txtCustomSetting.getText().isEmpty()) {
config.append("\n\n# ---------------------------------------------\n");
config.append("\n# Custom Settings\n");
@@ -248,10 +313,9 @@ public String getConfig() throws IOException {
config.append(txtCustomSetting.getText()).append("\n");
}
-
return config.toString();
}
-
+
public void initialise() throws IOException {
File filesource = Util.getFileRelative("BasicConfigEntries.conf", true);
BufferedReader confReader = null;
@@ -260,17 +324,11 @@ public void initialise() throws IOException {
} else {
confReader = new BufferedReader(new FileReader(filesource));
}
- ArrayList crosslinkers = new ArrayList<>();
- ArrayList modifications = new ArrayList<>();
- ArrayList losses = new ArrayList<>();
- ArrayList ions = new ArrayList<>();
- ArrayList enzymes = new ArrayList<>();
- ArrayList custom = new ArrayList<>();
ArrayList currentlist = null;
while (confReader.ready()) {
String line = confReader.readLine();
String lcline = line.trim().toLowerCase();
- switch(lcline){
+ switch (lcline) {
case "[crosslinker]":
currentlist = crosslinkers;
break;
@@ -295,23 +353,15 @@ public void initialise() throws IOException {
}
}
}
-
- cbCrosslinker.setModel(new DefaultComboBoxModel(crosslinkers.toArray(new NameValuePair[0])));
- for (NameValuePair nvp : crosslinkers) {
- if (nvp.name.startsWith("[+]")) {
- nvp.name=nvp.name.substring(3);
- cbCrosslinker.setSelectedItem(nvp);
- }
- }
-
+
cbEnzyme.setModel(new DefaultComboBoxModel(enzymes.toArray(new NameValuePair[0])));
for (NameValuePair nvp : enzymes) {
if (nvp.name.startsWith("[+]")) {
- nvp.name=nvp.name.substring(3);
+ nvp.name = nvp.name.substring(3);
cbEnzyme.setSelectedItem(nvp);
}
}
-
+
DefaultListModel fixed = new DefaultListModel<>();
lstFixedMod.setModel(fixed);
String fid = "[f]";
@@ -324,26 +374,26 @@ public void initialise() throws IOException {
modifications.sort(new Comparator() {
@Override
public int compare(NameValuePair o1, NameValuePair o2) {
- int c1=1;
- int c2=1;
+ int c1 = 1;
+ int c2 = 1;
if (o1.name.startsWith("[")) {
- c1=0;
+ c1 = 0;
}
if (o2.name.startsWith("[")) {
- c2=0;
+ c2 = 0;
}
- if (c1!=c2) {
+ if (c1 != c2) {
return Integer.compare(c1, c2);
}
return o1.name.compareTo(o2.name);
}
});
-
+
int pos = 0;
for (NameValuePair nvp : modifications) {
- fixed.add(pos,nvp);
- variable.add(pos,nvp);
- linear.add(pos,nvp);
+ fixed.add(pos, nvp);
+ variable.add(pos, nvp);
+ linear.add(pos, nvp);
lstVarMod.removeSelectionInterval(pos, pos);
lstFixedMod.removeSelectionInterval(pos, pos);
lstLinearMod.removeSelectionInterval(pos, pos);
@@ -360,7 +410,43 @@ public int compare(NameValuePair o1, NameValuePair o2) {
}
pos++;
}
-
+
+ DefaultListModel crosslinkerlist = new DefaultListModel<>();
+ lstCrossLinker.setModel(crosslinkerlist);
+ pos = 0;
+ int selectCrossLinker = 0;
+ for (NameValuePair nvp : crosslinkers) {
+ crosslinkerlist.add(pos, nvp);
+ lstCrossLinker.removeSelectionInterval(pos, pos);
+ String nv = nvp.name.toLowerCase();
+ if (nv.startsWith("[+]")) {
+ nvp.name = nvp.name.substring(3);
+ lstCrossLinker.addSelectionInterval(pos, pos);
+ selectCrossLinker = pos;
+ }
+ pos++;
+ }
+ cbCrosslinker.setModel(new DefaultComboBoxModel(crosslinkers.toArray(new NameValuePair[0])));
+ cbCrosslinker.setSelectedIndex(selectCrossLinker);
+ cbCrosslinker.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getStateChange() == ItemEvent.SELECTED) {
+ lstCrossLinker.setSelectedValue(null, false);
+ lstCrossLinker.setSelectedValue(e.getItem(), true);
+ }
+
+ }
+ });
+ lstCrossLinker.addListSelectionListener(new ListSelectionListener() {
+ @Override
+ public void valueChanged(ListSelectionEvent e) {
+ if (!lstCrossLinker.getSelectedValuesList().isEmpty()) {
+ cbCrosslinker.setSelectedIndex(lstCrossLinker.getSelectedIndex());
+ }
+ }
+ });
+
DefaultListModel ionsM = new DefaultListModel<>();
lstIons.setModel(ionsM);
pos = 0;
@@ -371,7 +457,7 @@ public int compare(NameValuePair o1, NameValuePair o2) {
if (nv.startsWith("[+]")) {
nvp.name = nvp.name.substring(vid.length());
lstIons.addSelectionInterval(pos, pos);
- }
+ }
pos++;
}
@@ -385,11 +471,11 @@ public int compare(NameValuePair o1, NameValuePair o2) {
if (nv.startsWith("[+]")) {
nvp.name = nvp.name.substring(vid.length());
lstLosses.addSelectionInterval(pos, pos);
- }
+ }
pos++;
}
for (NameValuePair nvp : custom) {
- nvp.stripComments =true;
+ nvp.stripComments = true;
}
this.customSettings = custom.toArray(new NameValuePair[custom.size()]);
}
@@ -449,6 +535,9 @@ private void initComponents() {
btnToText = new javax.swing.JButton();
spThreads = new javax.swing.JSpinner();
jLabel13 = new javax.swing.JLabel();
+ spCrosslinker = new javax.swing.JScrollPane();
+ lstCrossLinker = new javax.swing.JList<>();
+ ckMultipleCrosslinker = new javax.swing.JCheckBox();
spBaseSettings.setMinimumSize(new java.awt.Dimension(100, 100));
spBaseSettings.setPreferredSize(new java.awt.Dimension(300, 300));
@@ -506,7 +595,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(spFixedMods, javax.swing.GroupLayout.DEFAULT_SIZE, 177, Short.MAX_VALUE)
+ .addComponent(spFixedMods, javax.swing.GroupLayout.DEFAULT_SIZE, 185, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel6)
.addGap(0, 0, Short.MAX_VALUE)))
@@ -517,7 +606,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(spFixedMods, javax.swing.GroupLayout.DEFAULT_SIZE, 89, Short.MAX_VALUE))
+ .addComponent(spFixedMods, javax.swing.GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE))
);
jPanel2.add(jPanel3);
@@ -546,7 +635,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 89, Short.MAX_VALUE))
+ .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE))
);
jPanel2.add(jPanel4);
@@ -576,7 +665,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 89, Short.MAX_VALUE))
+ .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE))
);
jPanel2.add(jPanel5);
@@ -605,7 +694,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addContainerGap()
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE))
+ .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE))
);
jPanel2.add(jPanel6);
@@ -634,7 +723,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addContainerGap()
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE))
+ .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE))
);
jPanel2.add(jPanel7);
@@ -642,7 +731,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Custom Settings"));
txtCustomSetting.setColumns(20);
- txtCustomSetting.setText("# this is a free text field\n# anything starting with '#' is ignored\n# everything else is passed on as search-parameter\n# click the '+' to see available templates\n");
+ txtCustomSetting.setText(customSettingsDefault);
txtCustomSetting.setToolTipText("Free text field that can be used to supply additional settings");
jScrollPane6.setViewportView(txtCustomSetting);
@@ -659,7 +748,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
- .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 145, Short.MAX_VALUE)
+ .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 153, Short.MAX_VALUE)
.addGap(2, 2, 2)
.addComponent(btnAddCustom))
);
@@ -704,17 +793,36 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jLabel13.setText("Number of threads");
+ spCrosslinker.setViewportView(lstCrossLinker);
+
+ ckMultipleCrosslinker.setText("Multiple");
+ ckMultipleCrosslinker.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ ckMultipleCrosslinkerActionPerformed(evt);
+ }
+ });
+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 627, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(jLabel2)
.addGap(22, 22, 22)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addGap(2, 2, 2)
+ .addComponent(cbEnzyme, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jLabel13)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(spThreads, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(jLabel12)))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spToleranceMS1)
@@ -725,20 +833,16 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spToleranceMS2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(spToleranceUnitMS2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addGap(2, 2, 2)
- .addComponent(cbEnzyme, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabel13)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(spThreads, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabel12)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(spMissCleavages, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))))))
+ .addComponent(spMissCleavages, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(spToleranceUnitMS2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jLabel1)
+ .addGap(14, 14, 14)
+ .addComponent(ckMultipleCrosslinker)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(cbCrosslinker, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
@@ -748,11 +852,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addContainerGap()
.addComponent(jLabel5)))
.addGap(0, 0, Short.MAX_VALUE))
- .addGroup(layout.createSequentialGroup()
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
- .addComponent(jLabel1)
- .addGap(14, 14, 14)
- .addComponent(cbCrosslinker, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addComponent(spCrosslinker))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -760,8 +862,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cbCrosslinker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel1))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(jLabel1)
+ .addComponent(ckMultipleCrosslinker))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(spCrosslinker, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spToleranceMS1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
@@ -799,15 +904,15 @@ private void btnAddCustomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
add.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- String prev =txtCustomSetting.getText();
+ String prev = txtCustomSetting.getText();
StringBuilder sb = new StringBuilder(prev);
for (NameValuePair nvp : confEntries.getSelectedValuesList()) {
- sb.append("\n# " + nvp.name.replaceAll("#","\n#")+ "\n" +
- nvp.value);
+ sb.append("\n# " + nvp.name.replaceAll("#", "\n#") + "\n"
+ + nvp.value);
}
-
+
txtCustomSetting.setText(sb.toString());
-
+
}
});
final JButton close = new JButton("close");
@@ -822,18 +927,17 @@ public void actionPerformed(ActionEvent e) {
buttonpanel.add(add, BorderLayout.CENTER);
buttonpanel.add(close, BorderLayout.EAST);
//window.setPreferredSize(conf.getPreferredSize());
- window.add(space,BorderLayout.NORTH);
+ window.add(space, BorderLayout.NORTH);
window.add(spSettings, BorderLayout.CENTER);
window.add(buttonpanel, BorderLayout.SOUTH);
window.pack();
-
- window.addWindowFocusListener( new WindowFocusListener() {
+
+ window.addWindowFocusListener(new WindowFocusListener() {
@Override
public void windowLostFocus(WindowEvent e) {
window.setVisible(false);
window.dispose();
-
}
@Override
@@ -854,9 +958,9 @@ private void btnToTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR
textConfig.requestFocus();
textConfig.requestFocusInWindow();
}
-
+
ActionEvent e = new ActionEvent(this, 0, getConfig());
- for (ActionListener al :textConfigListener) {
+ for (ActionListener al : textConfigListener) {
al.actionPerformed(e);
}
} catch (IOException ex) {
@@ -868,10 +972,10 @@ private void btnBaseSettingsActionPerformed(java.awt.event.ActionEvent evt) {//G
final JFrame baseSettingsWindow = new JFrame("Base Settigns");
JButton close = new JButton("Close");
JLabel l = new JLabel("These are the basic settings that are applied by default. You can change them freely to your liking!");
- baseSettingsWindow.getContentPane().setLayout(new BorderLayout(5, 5));
- baseSettingsWindow.getContentPane().add(l,BorderLayout.NORTH);
- baseSettingsWindow.getContentPane().add(spBaseSettings,BorderLayout.CENTER);
- baseSettingsWindow.getContentPane().add(close,BorderLayout.SOUTH);
+ baseSettingsWindow.getContentPane().setLayout(new BorderLayout(5, 5));
+ baseSettingsWindow.getContentPane().add(l, BorderLayout.NORTH);
+ baseSettingsWindow.getContentPane().add(spBaseSettings, BorderLayout.CENTER);
+ baseSettingsWindow.getContentPane().add(close, BorderLayout.SOUTH);
close.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -879,8 +983,7 @@ public void actionPerformed(ActionEvent e) {
baseSettingsWindow.dispose();
}
});
-
-
+
baseSettingsWindow.addWindowListener(new WindowListener() {
@Override
public void windowOpened(WindowEvent e) {
@@ -919,6 +1022,12 @@ public void windowDeactivated(WindowEvent e) {
p.installContextMenu(baseSettingsWindow);
}//GEN-LAST:event_btnBaseSettingsActionPerformed
+ private void ckMultipleCrosslinkerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ckMultipleCrosslinkerActionPerformed
+ cbCrosslinker.setVisible(!ckMultipleCrosslinker.isSelected());
+ spCrosslinker.setVisible(ckMultipleCrosslinker.isSelected());
+ lstCrossLinker.setVisible(ckMultipleCrosslinker.isSelected());
+ }//GEN-LAST:event_ckMultipleCrosslinkerActionPerformed
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnAddCustom;
@@ -926,6 +1035,7 @@ public void windowDeactivated(WindowEvent e) {
private javax.swing.JButton btnToText;
private javax.swing.JComboBox cbCrosslinker;
private javax.swing.JComboBox cbEnzyme;
+ private javax.swing.JCheckBox ckMultipleCrosslinker;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
@@ -952,12 +1062,14 @@ public void windowDeactivated(WindowEvent e) {
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JScrollPane jScrollPane5;
private javax.swing.JScrollPane jScrollPane6;
+ private javax.swing.JList lstCrossLinker;
private javax.swing.JList lstFixedMod;
private javax.swing.JList lstIons;
private javax.swing.JList lstLinearMod;
private javax.swing.JList lstLosses;
private javax.swing.JList lstVarMod;
private javax.swing.JScrollPane spBaseSettings;
+ private javax.swing.JScrollPane spCrosslinker;
private javax.swing.JScrollPane spFixedMods;
private javax.swing.JSpinner spMissCleavages;
private javax.swing.JSpinner spThreads;
@@ -998,7 +1110,7 @@ public void actionPerformed(ActionEvent e) {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
-
+
});
try {
conf.initialise();
@@ -1006,7 +1118,7 @@ public void windowClosing(WindowEvent e) {
} catch (IOException ex) {
Logger.getLogger(SimpleXiGui.class.getName()).log(Level.SEVERE, null, ex);
}
-
+
window.setVisible(true);
}
});
@@ -1015,6 +1127,7 @@ public void windowClosing(WindowEvent e) {
/**
* When given the config can be exported to this TextConfig-Control
+ *
* @return the textConfig
*/
public TextConfig getTextConfig() {
@@ -1023,20 +1136,293 @@ public TextConfig getTextConfig() {
/**
* When given the config can be exported to this TextConfig-Control
+ *
* @param textConfig the textConfig to set
*/
public void setTextConfig(TextConfig textConfig) {
rappsilber.gui.components.config.TextConfig oldTextConfig = this.textConfig;
this.textConfig = textConfig;
propertyChangeSupport.firePropertyChange(PROP_TEXTCONFIG, oldTextConfig, textConfig);
- updateTransferButton();
+ updateTransferButton();
}
protected void updateTransferButton() {
- btnToText.setEnabled(textConfig != null || textConfigListener.size()>0);
- btnToText.setVisible(textConfig != null || textConfigListener.size()>0);
+ btnToText.setEnabled(textConfig != null || textConfigListener.size() > 0);
+ btnToText.setVisible(textConfig != null || textConfigListener.size() > 0);
}
private final transient PropertyChangeSupport propertyChangeSupport = new java.beans.PropertyChangeSupport(this);
public static final String PROP_TEXTCONFIG = "textConfig";
-
+
+ public void loadConfig(String config, boolean append) {
+ if (!append)
+ wipeSelections();
+ String[] configLines = config.split("\\s*[\r\n]+\\s*");
+ for (String line : configLines) {
+ loadConfigLine(line);
+ }
+ }
+
+ public void loadConfig(File f, boolean append) {
+ if (!append)
+ wipeSelections();
+ try {
+ BufferedReader br = new BufferedReader(new FileReader(f));
+ while (br.ready()) {
+ String l = br.readLine();
+ loadConfigLine(l);
+
+ }
+ } catch (IOException ex) {
+ Logger.getLogger(BasicConfig.class.getName()).log(Level.SEVERE, null, ex);
+ }
+
+ }
+
+ public void wipeSelections() {
+ lstCrossLinker.clearSelection();
+ lstFixedMod.clearSelection();
+ lstIons.clearSelection();
+ lstLinearMod.clearSelection();
+ lstLosses.clearSelection();
+ lstVarMod.clearSelection();
+ txtCustomSetting.setText(customSettingsDefault);
+
+ }
+ StringBuilder lastComments = new StringBuilder();
+
+ protected void loadConfigLine(String l) {
+ l = l.trim();
+ if (l.toLowerCase().startsWith("modification:")) {
+ testAddSelectModification(l);
+ lastComments.setLength(0);
+ } else if (l.toLowerCase().startsWith("digestion:")) {
+ testAddEnzyme(l);
+ lastComments.setLength(0);
+ } else if (l.toLowerCase().startsWith("crosslinker:")) {
+ testAddCrosslinker(l);
+ lastComments.setLength(0);
+ } else if (l.toLowerCase().startsWith("missedcleavages:")) {
+ spMissCleavages.setValue(Integer.parseInt(l.substring(l.indexOf(":") + 1).trim()));
+ lastComments.setLength(0);
+ } else if (l.toLowerCase().startsWith("tolerance:precursor:")) {
+ ToleranceUnit tu = new ToleranceUnit(l.substring(l.lastIndexOf(":") + 1).trim());
+ spToleranceMS1.setValue((Double) tu.getValue());
+ spToleranceUnitMS1.setSelectedItem(tu.getUnit());
+ lastComments.setLength(0);
+ } else if (l.toLowerCase().startsWith("tolerance:fragment:")) {
+ ToleranceUnit tu = new ToleranceUnit(l.substring(l.lastIndexOf(":") + 1).trim());
+ spToleranceMS2.setValue((Double) tu.getValue());
+ spToleranceUnitMS2.setSelectedItem(tu.getUnit());
+ lastComments.setLength(0);
+ } else if (l.toLowerCase().startsWith("usecpus:")) {
+ Integer i = Integer.parseInt(l.substring(l.lastIndexOf(":") + 1).trim());
+ if (i<0) {
+ i = Runtime.getRuntime().availableProcessors()+i;
+ if (i<1)
+ i=1;
+ }
+ spThreads.setValue(i);
+ lastComments.setLength(0);
+ } else if (l.toLowerCase().startsWith("fragment:")) {
+ testAddSelectIon(l);
+ lastComments.setLength(0);
+ } else if (l.toLowerCase().startsWith("loss:")) {
+ testAddSelectLoss(l);
+ lastComments.setLength(0);
+ } else if (l.trim().startsWith("#")) {
+ lastComments.append("\n").append(l);
+ } else if (l.toLowerCase().contains(":")) {
+ testAddOther(l, lastComments.toString());
+ lastComments.setLength(0);
+ }
+ }
+
+ private void testAddSelectModification(String l) {
+ String[] mod = l.split(":", 3);
+ String name = mod[2];
+ String modDef = "modification:[MODE]:" + mod[2];
+ String vfl = mod[1].toLowerCase();
+ Pattern np = Pattern.compile(".*symbol(?:ext)?:([^;]*).*", Pattern.CASE_INSENSITIVE);
+ Matcher m = np.matcher(l);
+ if (m.find()) {
+ name = m.group(1);
+ }
+ int found = 0;
+ // see if we have the modification in our list
+ for (NameValuePair nvp : modifications) {
+ if (nvp.value.equals(modDef)) {
+ break;
+ }
+ found++;
+ }
+
+ if (found == modifications.size()) {
+ found = modifications.size();
+ NameValuePair nvp = new NameValuePair(name, modDef);
+ modifications.add(nvp);
+ ((DefaultListModel) lstVarMod.getModel()).add(found, nvp);
+ ((DefaultListModel) lstFixedMod.getModel()).add(found, nvp);
+ ((DefaultListModel) lstLinearMod.getModel()).add(found, nvp);
+ }
+
+ if (vfl.equals("variable")) {
+ lstVarMod.addSelectionInterval(found, found);
+ } else if (vfl.equals("fixed")) {
+ lstFixedMod.addSelectionInterval(found, found);
+ } else if (vfl.equals("linear")) {
+ lstLinearMod.addSelectionInterval(found, found);
+ } else {
+ txtCustomSetting.append("\n" + l);
+ }
+ }
+
+ private void testAddCrosslinker(String l) {
+ l = l.trim();
+ Pattern np = Pattern.compile(".*name:([^;]*).*", Pattern.CASE_INSENSITIVE);
+ Matcher m = np.matcher(l);
+ String name = l;
+ if (m.find()) {
+ name = m.group(1);
+ }
+ int found = 0;
+ // see if we have the modification in our list
+ for (NameValuePair nvp : crosslinkers) {
+ if (nvp.value.equals(l)) {
+ break;
+ }
+ found++;
+ }
+ if (found == crosslinkers.size()) {
+ found = crosslinkers.size();
+ NameValuePair nvp = new NameValuePair(name, l);
+ crosslinkers.add(new NameValuePair(name, l));
+ cbCrosslinker.addItem(nvp);
+ ((DefaultListModel) lstCrossLinker.getModel()).add(found, nvp);
+ }
+
+ lstCrossLinker.addSelectionInterval(found, found);
+
+ if (lstCrossLinker.getSelectedIndices().length > 1) {
+ if (!ckMultipleCrosslinker.isSelected()) {
+ ckMultipleCrosslinker.setSelected(true);
+ ckMultipleCrosslinkerActionPerformed(null);
+ }
+ } else {
+ if (ckMultipleCrosslinker.isSelected()) {
+ ckMultipleCrosslinker.setSelected(false);
+ ckMultipleCrosslinkerActionPerformed(null);
+ }
+ cbCrosslinker.setSelectedIndex(found);
+ }
+
+ }
+
+ private void testAddEnzyme(String l) {
+ l = l.trim();
+ Pattern np = Pattern.compile(".*name:([^;]*).*", Pattern.CASE_INSENSITIVE);
+ Matcher m = np.matcher(l);
+ String name = l;
+ if (m.find()) {
+ name = m.group(1);
+ }
+ int found = 0;
+ // see if we have the modification in our list
+ for (NameValuePair nvp : enzymes) {
+ if (nvp.value.equals(l)) {
+ break;
+ }
+ found++;
+ }
+ if (found == enzymes.size()) {
+ found = enzymes.size();
+ NameValuePair nvp = new NameValuePair(name, l);
+ enzymes.add(new NameValuePair(name, l));
+ cbEnzyme.addItem(nvp);
+ }
+
+ cbEnzyme.setSelectedIndex(found);
+ }
+
+ private void testAddSelectIon(String l) {
+ l = l.trim();
+ Pattern np = Pattern.compile(".*:([^;]*).*", Pattern.CASE_INSENSITIVE);
+ Matcher m = np.matcher(l);
+ String name = l;
+ if (m.find()) {
+ name = m.group(1);
+ }
+ if (name.contentEquals("PeptideIon")) {
+ return;
+ }
+ int found = 0;
+ // see if we have the modification in our list
+ for (NameValuePair nvp : ions) {
+ if (nvp.value.equals(l)) {
+ break;
+ }
+ found++;
+ }
+ if (found == ions.size()) {
+ found = ions.size();
+ NameValuePair nvp = new NameValuePair(name, l);
+ ions.add(new NameValuePair(name, l));
+ ((DefaultListModel) lstIons.getModel()).add(found, nvp);
+ }
+
+ lstIons.addSelectionInterval(found, found);
+
+ }
+
+ private void testAddSelectLoss(String l) {
+ l = l.trim();
+ Pattern np = Pattern.compile(".*name:([^;]*).*", Pattern.CASE_INSENSITIVE);
+ Matcher m = np.matcher(l);
+ String name = l;
+ if (m.find()) {
+ name = m.group(1);
+ }
+ int found = 0;
+ // see if we have the modification in our list
+ for (NameValuePair nvp : losses) {
+ if (nvp.value.equals(l)) {
+ break;
+ }
+ found++;
+ }
+ if (found == losses.size()) {
+ found = losses.size();
+ NameValuePair nvp = new NameValuePair(name, l);
+ losses.add(new NameValuePair(name, l));
+ ((DefaultListModel) lstLosses.getModel()).add(found, nvp);
+ }
+
+ lstLosses.addSelectionInterval(found, found);
+ }
+
+ private void testAddOther(String l, String comments) {
+ l = l.trim();
+ String[] custom = txtCustomSetting.getText().split("\\s*[\\n\\r]+\\s*");
+ boolean found = false;
+ for (String c : this.txtBaseSettings.getText().split("\\s*[\\n\\r]+\\s*")) {
+ if (c.trim().equals(l)) {
+ found = true;
+ }
+ }
+
+ if (!found) {
+ for (String c : custom) {
+ if (c.trim().equals(l)) {
+ found = true;
+ }
+ }
+ }
+ if (!found) {
+ if (comments != null && !comments.isBlank()) {
+ txtCustomSetting.append(comments);
+ }
+ txtCustomSetting.append("\n" + l);
+ }
+
+ }
+
}
diff --git a/src/main/java/rappsilber/gui/components/config/ConfigProvider.java b/src/main/java/rappsilber/gui/components/config/ConfigProvider.java
index fd07179..f0ceb53 100644
--- a/src/main/java/rappsilber/gui/components/config/ConfigProvider.java
+++ b/src/main/java/rappsilber/gui/components/config/ConfigProvider.java
@@ -5,6 +5,7 @@
*/
package rappsilber.gui.components.config;
+import java.io.File;
import java.io.IOException;
/**
@@ -13,4 +14,6 @@
*/
public interface ConfigProvider {
String getConfig() throws IOException;
+ void loadConfig(File f, boolean append);
+
}
diff --git a/src/main/java/rappsilber/gui/components/config/TextConfig.form b/src/main/java/rappsilber/gui/components/config/TextConfig.form
index 1d5d89f..11a4c65 100644
--- a/src/main/java/rappsilber/gui/components/config/TextConfig.form
+++ b/src/main/java/rappsilber/gui/components/config/TextConfig.form
@@ -16,22 +16,16 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -40,17 +34,14 @@
-
-
-
-
-
+
-
+
+
@@ -58,23 +49,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -113,5 +87,13 @@
+
+
+
+
+
+
+
+
diff --git a/src/main/java/rappsilber/gui/components/config/TextConfig.java b/src/main/java/rappsilber/gui/components/config/TextConfig.java
index 8873b33..f6c784e 100644
--- a/src/main/java/rappsilber/gui/components/config/TextConfig.java
+++ b/src/main/java/rappsilber/gui/components/config/TextConfig.java
@@ -5,11 +5,14 @@
*/
package rappsilber.gui.components.config;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.SwingUtilities;
@@ -25,6 +28,10 @@
*/
public class TextConfig extends javax.swing.JPanel implements ConfigProvider{
+ private BasicConfig basicConfig;
+
+ private ArrayList textConfigListener = new ArrayList<>();
+
/**
* Creates new form TextConfig
*/
@@ -56,10 +63,6 @@ public void changedUpdate(DocumentEvent e) {
fbSaveConfig.setExtensions(new String[]{".conf",".txt"});
fbSaveConfig.setDescription("config-files");
- fbLoadConfig.setLocalPropertyKey("XLink_Config");
- fbLoadConfig.setExtensions(new String[]{".cfg",".config",".conf",".txt"});
- fbLoadConfig.setDescription("config-files");
-
}
/**
@@ -71,22 +74,12 @@ public void changedUpdate(DocumentEvent e) {
// //GEN-BEGIN:initComponents
private void initComponents() {
- fbLoadConfig = new rappsilber.gui.components.FileBrowser();
- btnLoadConfig = new javax.swing.JButton();
fbSaveConfig = new rappsilber.gui.components.FileBrowser();
btnSave = new javax.swing.JButton();
btnDefault = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
txtConfig = new javax.swing.JTextArea();
-
- fbLoadConfig.setExtensions(new String[] {"txt"});
-
- btnLoadConfig.setText("Load File");
- btnLoadConfig.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- btnLoadConfigActionPerformed(evt);
- }
- });
+ btnTransfer = new javax.swing.JButton();
fbSaveConfig.setExtensions(new String[] {"txt"});
@@ -109,39 +102,40 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
txtConfig.setRows(5);
jScrollPane1.setViewportView(txtConfig);
+ btnTransfer.setText("To Basic Config");
+ btnTransfer.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnTransferActionPerformed(evt);
+ }
+ });
+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addComponent(btnDefault)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
- .addGap(0, 0, 0)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(btnDefault)
- .addGap(18, 18, 18)
- .addComponent(fbLoadConfig, javax.swing.GroupLayout.DEFAULT_SIZE, 361, Short.MAX_VALUE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(btnLoadConfig))
- .addGroup(layout.createSequentialGroup()
- .addComponent(fbSaveConfig, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(btnSave))))
+ .addComponent(btnTransfer)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(fbSaveConfig, javax.swing.GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(btnSave))
.addComponent(jScrollPane1)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(btnLoadConfig)
- .addComponent(fbLoadConfig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(btnDefault))
+ .addComponent(btnDefault)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 214, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(fbSaveConfig, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(btnSave, javax.swing.GroupLayout.Alignment.TRAILING))
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(fbSaveConfig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnSave)
+ .addComponent(btnTransfer))
.addContainerGap())
);
}// //GEN-END:initComponents
@@ -205,12 +199,6 @@ public void loadDefaultConfig() {
}
- private void btnLoadConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoadConfigActionPerformed
- File f = fbLoadConfig.getFile();
- if (f != null)
- loadConfig(fbLoadConfig.getFile(),false);
- }//GEN-LAST:event_btnLoadConfigActionPerformed
-
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
FileWriter fw = null;
try {
@@ -234,14 +222,45 @@ private void btnDefaultActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI
btnDefault.setEnabled(false);
}//GEN-LAST:event_btnDefaultActionPerformed
+ private void btnTransferActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTransferActionPerformed
+
+ ActionEvent e = new ActionEvent(this, 0, getConfig());
+ for (ActionListener al :textConfigListener) {
+ al.actionPerformed(e);
+ }
+
+ }//GEN-LAST:event_btnTransferActionPerformed
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnDefault;
- private javax.swing.JButton btnLoadConfig;
private javax.swing.JButton btnSave;
- private rappsilber.gui.components.FileBrowser fbLoadConfig;
+ private javax.swing.JButton btnTransfer;
private rappsilber.gui.components.FileBrowser fbSaveConfig;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea txtConfig;
// End of variables declaration//GEN-END:variables
+
+ /**
+ * @return the basicConfig
+ */
+ public BasicConfig getBasicConfig() {
+ return basicConfig;
+ }
+
+ /**
+ * @param basicConfig the basicConfig to set
+ */
+ public void setBasicConfig(BasicConfig basicConfig) {
+ this.basicConfig = basicConfig;
+ }
+
+ public void addTransferListener(ActionListener listener) {
+ textConfigListener.add(listener);
+ }
+
+ public void removeTransferListener(ActionListener listener) {
+ textConfigListener.remove(listener);
+ }
+
}
diff --git a/src/main/java/rappsilber/ms/dataAccess/msm/DBMSMListIterator.java b/src/main/java/rappsilber/ms/dataAccess/msm/DBMSMListIterator.java
index e22b060..23ed286 100644
--- a/src/main/java/rappsilber/ms/dataAccess/msm/DBMSMListIterator.java
+++ b/src/main/java/rappsilber/ms/dataAccess/msm/DBMSMListIterator.java
@@ -122,6 +122,16 @@ protected void publishNextSpectra(Spectra s){
acqid = m_acqids.get(file);
runid = m_runids.get(file);
}
+
+ if (runid == null) {
+ file = s.getSource();
+ if (file.contains("->")) {
+ file=file.substring(0, file.indexOf("->")).trim();
+ }
+ acqid = m_acqids.get(file);
+ runid = m_runids.get(file);
+ }
+
if (runid == null)
s.setRunID(m_defaultRunID);
diff --git a/src/main/java/rappsilber/ms/dataAccess/msm/MSMListIterator.java b/src/main/java/rappsilber/ms/dataAccess/msm/MSMListIterator.java
index f2b5318..e69ae33 100644
--- a/src/main/java/rappsilber/ms/dataAccess/msm/MSMListIterator.java
+++ b/src/main/java/rappsilber/ms/dataAccess/msm/MSMListIterator.java
@@ -137,6 +137,8 @@ protected void setNext() {
m_next = m_iterator.next();
}
m_nextSpectrum = m_current.next();
+ m_nextSpectrum.setSource(this.getInputPath() + "->" + m_nextSpectrum.getSource());
+
Logger.getLogger(MSMListIterator.class.getName()).log(Level.INFO, "now read data from " + m_current.getInputPath());
}
@@ -314,6 +316,8 @@ public synchronized Spectra next() {
m_nextSpectrum = null;
} else {
m_nextSpectrum = m_current.next();
+ m_nextSpectrum.setSource(this.getInputPath() + "->" + m_nextSpectrum.getSource());
+
}
}
publishNextSpectra(m_currentSpectrum);
@@ -359,7 +363,10 @@ public void restart() throws IOException {
ArrayList newIterators = new ArrayList<>();
for (AbstractMSMAccess msm : m_MSMiterators) {
try {
- newIterators.add(AbstractMSMAccess.getMSMIterator(msm.getInputPath(), m_ToleranceUnit, m_minCharge, m_config));
+ String path = msm.getInputPath();
+ if (path.contains("->"))
+ path = path.substring(0, path.indexOf("->")).trim();
+ newIterators.add(AbstractMSMAccess.getMSMIterator(path, m_ToleranceUnit, m_minCharge, m_config));
} catch (FileNotFoundException ex) {
Logger.getLogger(MSMListIterator.class.getName()).log(Level.SEVERE, null, ex);
} catch (ParseException ex) {
diff --git a/src/main/java/rappsilber/ms/dataAccess/msm/ZipStreamIterator.java b/src/main/java/rappsilber/ms/dataAccess/msm/ZipStreamIterator.java
index 433a84b..17642be 100644
--- a/src/main/java/rappsilber/ms/dataAccess/msm/ZipStreamIterator.java
+++ b/src/main/java/rappsilber/ms/dataAccess/msm/ZipStreamIterator.java
@@ -184,6 +184,7 @@ private void readNext() throws IOException, ParseException {
if (currentAccess != null) {
if (currentAccess.hasNext()) {
nextSpectra = currentAccess.next();
+ nextSpectra.setSource(this.getInputPath() + "->" + nextSpectra.getSource());
return;
}
currentAccess.close();
@@ -202,6 +203,7 @@ private void readNext() throws IOException, ParseException {
currentAccess = AbstractMSMAccess.getMSMIterator(ze.getName(), new ZipEntryStream(), tolerance, minCharge, config);
if (currentAccess != null && currentAccess.hasNext()) {
nextSpectra = currentAccess.next();
+ nextSpectra.setSource(this.getInputPath() + "->" + nextSpectra.getSource());
return;
}
@@ -213,6 +215,15 @@ private void readNext() throws IOException, ParseException {
+ /**
+ * @return the m_inputPath
+ */
+ public String getInputPath() {
+ if (currentAccess == null)
+ return m_inputPath ;
+ else
+ return m_inputPath + " -> " + currentAccess.getInputPath();
+ }
diff --git a/src/main/java/rappsilber/ms/sequence/AminoLabel.java b/src/main/java/rappsilber/ms/sequence/AminoLabel.java
index 659d1b3..e875df7 100644
--- a/src/main/java/rappsilber/ms/sequence/AminoLabel.java
+++ b/src/main/java/rappsilber/ms/sequence/AminoLabel.java
@@ -81,9 +81,14 @@ public static AminoLabel parseArgs(String args, RunConfig config) throws ParseEx
if ( x.startsWith("MODIFIED") ){
to_update = config.getAminoAcid(value);
- } else if (x.startsWith("SYMBOL"))
- {
- symbol = value;
+ } else if (x.startsWith("SYMBOL")) {
+ if (rappsilber.utils.Util.AutoCaseSymbols) {
+ if (value.length()>1)
+ symbol = value.substring(0, 1).toUpperCase()+value.substring(1).toLowerCase();
+ else
+ symbol = value.toUpperCase();
+ } else
+ symbol = value;
}else if ( x.startsWith("MASSDIFF") ){
mass_change = Double.parseDouble(value.trim());
diff --git a/src/main/java/rappsilber/ms/sequence/AminoModification.java b/src/main/java/rappsilber/ms/sequence/AminoModification.java
index d810e14..8237688 100644
--- a/src/main/java/rappsilber/ms/sequence/AminoModification.java
+++ b/src/main/java/rappsilber/ms/sequence/AminoModification.java
@@ -214,9 +214,19 @@ public static List parseArgs(String args, RunConfig config) t
x=x.toUpperCase();
if( x.startsWith("SYMBOL:") ){
- symbol = value;
+ if (rappsilber.utils.Util.AutoCaseSymbols) {
+ if (value.length()>1)
+ symbol = value.substring(0, 1).toUpperCase()+value.substring(1).toLowerCase();
+ else
+ symbol = value.toUpperCase();
+ } else
+ symbol = value;
+
} else if( x.startsWith("SYMBOLEXT:") ){
- symbolext = value;
+ if (rappsilber.utils.Util.AutoCaseSymbols) {
+ symbolext = value.toLowerCase();
+ } else
+ symbolext = value;
}else if ( x.startsWith("MODIFIED:") ){
String[] v = value.split(",");
if (value.contentEquals("X") ||value.contentEquals("ANY") || value.contentEquals("*") )
diff --git a/src/main/java/rappsilber/ms/sequence/Sequence.java b/src/main/java/rappsilber/ms/sequence/Sequence.java
index 83995bf..b93372d 100644
--- a/src/main/java/rappsilber/ms/sequence/Sequence.java
+++ b/src/main/java/rappsilber/ms/sequence/Sequence.java
@@ -34,6 +34,7 @@
import rappsilber.ms.sequence.digest.Digestion;
import rappsilber.ms.sequence.fasta.FastaFile;
import rappsilber.ms.sequence.fasta.FastaHeader;
+import rappsilber.utils.MyArrayUtils;
import rappsilber.utils.Util;
/**
@@ -44,7 +45,7 @@ public class Sequence implements AminoAcidSequence{
public static final Sequence EMPTY_SEQUENCE = new Sequence(new AminoAcid[0]);
public static final Peptide EMPTY_PEPTIDE = new Peptide(EMPTY_SEQUENCE, 0, 0);
- private static final Pattern m_sequenceSplit = Pattern.compile("[A-Z][^A-Z]*");
+ public static Pattern m_sequenceSplit = Pattern.compile("[A-Z][^A-Z]*");
private static final Pattern m_expected_mod_pattern = Pattern.compile("[A-Z]\\((([^A-Z]+\\|)*[^A-Z]+\\|?)\\)");
private static final Pattern m_custom_mod_pattern = Pattern.compile("([^=]*=)?\\[([^\\]]+)\\]");
@@ -203,6 +204,7 @@ public Sequence(String sequence, RunConfig config) {
System.err.println("Don't know how to handle \"" + aaStr + "\" at " + m.start() + " in\n\t" + sequence);
System.err.println("Will be replaced by \"X\"");
System.err.println("This will exclude any peptide containing it!!!!!!!!!!!!!");
+ System.err.println("expected_mod_pattern: "+ m_expected_mod_pattern.toString() );
System.err.println("==================================================================" );
System.err.println("==================================================================" );
System.err.println("==================================================================" );
diff --git a/src/main/java/rappsilber/ms/spectra/SpectraPeakCluster.java b/src/main/java/rappsilber/ms/spectra/SpectraPeakCluster.java
index 8812537..6463ecc 100644
--- a/src/main/java/rappsilber/ms/spectra/SpectraPeakCluster.java
+++ b/src/main/java/rappsilber/ms/spectra/SpectraPeakCluster.java
@@ -274,7 +274,7 @@ public SpectraPeak toPeak(boolean sumIntensities) {
/**
- * returns the monoisotopic peak
+ * returns the singly charged monoisotopic peak
* @param sumIntensities
true: the peak has the combined intensities of all peaks;
*
false: the peak has the highest observed intensity of this cluster
* @param deCharge calculate the m/z-value for the singly charge fragment
diff --git a/src/main/java/rappsilber/utils/Util.java b/src/main/java/rappsilber/utils/Util.java
index 16a8599..0546b28 100644
--- a/src/main/java/rappsilber/utils/Util.java
+++ b/src/main/java/rappsilber/utils/Util.java
@@ -58,6 +58,7 @@
*/
public class Util {
+ public static boolean AutoCaseSymbols = false;
/**
* the maximal ratio between two consecutive peeks to be considered part of
* the same isotope cluster
diff --git a/src/main/java/rappsilber/utils/XiVersion.java b/src/main/java/rappsilber/utils/XiVersion.java
index ff4b2a9..7e30bd6 100644
--- a/src/main/java/rappsilber/utils/XiVersion.java
+++ b/src/main/java/rappsilber/utils/XiVersion.java
@@ -21,10 +21,12 @@
* @author Lutz Fischer
*/
public class XiVersion {
- public static Version version = new Version(1, 7, 2);
+ public static Version version = new Version(1, 7, 3);
- public static final String changes = "Version V1.7.2\n" +
+ public static final String changes = "Version V1.7.3\n" +
+ " * Improved Loading of configs.\n" +
+ "Version V1.7.2\n" +
" * Number of search threads can be adjusted during runtime (if a gui is used).\n" +
" * alpha counts writen out.\n" +
" * changed format of the estimed time till search finished\n" +