diff --git a/nbactions-release-profile.xml b/nbactions-release-profile.xml index 244d825..349a515 100644 --- a/nbactions-release-profile.xml +++ b/nbactions-release-profile.xml @@ -1,46 +1,46 @@ - - - - run - - jar - - - process-classes - org.codehaus.mojo:exec-maven-plugin:1.2.1:exec - - - -classpath %classpath org.rappsilber.fdr.gui.FDRGUI - java - - - - debug - - jar - - - process-classes - org.codehaus.mojo:exec-maven-plugin:1.2.1:exec - - - -Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath org.rappsilber.fdr.gui.FDRGUI - java - true - - - - profile - - jar - - - process-classes - org.codehaus.mojo:exec-maven-plugin:1.2.1:exec - - - -classpath %classpath org.rappsilber.fdr.gui.FDRGUI - java - - - + + + + run + + jar + + + process-classes + org.codehaus.mojo:exec-maven-plugin:1.2.1:exec + + + -classpath %classpath org.rappsilber.fdr.CommandLine + java + + + + debug + + jar + + + process-classes + org.codehaus.mojo:exec-maven-plugin:1.2.1:exec + + + -agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath org.rappsilber.fdr.CommandLine + java + true + + + + profile + + jar + + + process-classes + org.codehaus.mojo:exec-maven-plugin:1.2.1:exec + + + -classpath %classpath org.rappsilber.fdr.CommandLine + java + + + diff --git a/nbactions.xml b/nbactions.xml index 1078daa..3a340e4 100644 --- a/nbactions.xml +++ b/nbactions.xml @@ -10,7 +10,7 @@ org.codehaus.mojo:exec-maven-plugin:1.2.1:exec - -classpath %classpath org.rappsilber.fdr.CommandLine --pepfdr=5.0 --boost=link --csvOutDir=/home/lfischer/temp/test --csvBaseName=test_XiVersion1.7.754.RC1_2 --xiconfig=/home/lfischer/temp/test/test_XiVersion1.7.754.RC1.csv.config --fasta=/Users/salman/xi_data/xi/sequenceDB/pool8_BSCL-17_46_41-12_Sep_2019/DATABASE.fasta /home/lfischer/temp/test/test_XiVersion1.7.754.RC1.csv --gui + -classpath %classpath org.rappsilber.fdr.CommandLine --linkfdr=5.0 --boost=link --csvOutDir=/home/lfischer/temp/test/FDR_rpfdr5.0 --csvBaseName=4pm_dsso_Xi1.7.0.RC1_grouped --xiconfig=/home/lfischer/temp/test/4pm_dsso_Xi1.7.0.RC1.csv.config --fasta=/Users/salman/xi_data/xi/sequenceDB/4_protein_mix-17_59_11-19_Jan_2018/4ProtMix.fasta /home/lfischer/temp/test/4pm_dsso_Xi1.7.0.RC1.csv --gui java /home/lfischer @@ -25,7 +25,7 @@ org.codehaus.mojo:exec-maven-plugin:1.2.1:exec - -agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath org.rappsilber.fdr.CommandLine --pepfdr=5.0 --boost=link --csvOutDir=/home/lfischer/temp/test --csvBaseName=test_XiVersion1.7.754.RC1_2 --xiconfig=/home/lfischer/temp/test/test_XiVersion1.7.754.RC1.csv.config --fasta=/Users/salman/xi_data/xi/sequenceDB/pool8_BSCL-17_46_41-12_Sep_2019/DATABASE.fasta /home/lfischer/temp/test/test_XiVersion1.7.754.RC1.csv --gui + -agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath org.rappsilber.fdr.CommandLine --linkfdr=5.0 --boost=link --csvOutDir=/home/lfischer/temp/test/FDR_rpfdr5.0 --csvBaseName=4pm_dsso_Xi1.7.0.RC1_grouped --xiconfig=/home/lfischer/temp/test/4pm_dsso_Xi1.7.0.RC1.csv.config --fasta=/Users/salman/xi_data/xi/sequenceDB/4_protein_mix-17_59_11-19_Jan_2018/4ProtMix.fasta /home/lfischer/temp/test/4pm_dsso_Xi1.7.0.RC1.csv --gui java true /home/lfischer @@ -41,7 +41,7 @@ org.codehaus.mojo:exec-maven-plugin:1.2.1:exec - -classpath %classpath org.rappsilber.fdr.CommandLine --pepfdr=5.0 --boost=link --csvOutDir=/home/lfischer/temp/test --csvBaseName=test_XiVersion1.7.754.RC1_2 --xiconfig=/home/lfischer/temp/test/test_XiVersion1.7.754.RC1.csv.config --fasta=/Users/salman/xi_data/xi/sequenceDB/pool8_BSCL-17_46_41-12_Sep_2019/DATABASE.fasta /home/lfischer/temp/test/test_XiVersion1.7.754.RC1.csv --gui + -classpath %classpath org.rappsilber.fdr.CommandLine --linkfdr=5.0 --boost=link --csvOutDir=/home/lfischer/temp/test/FDR_rpfdr5.0 --csvBaseName=4pm_dsso_Xi1.7.0.RC1_grouped --xiconfig=/home/lfischer/temp/test/4pm_dsso_Xi1.7.0.RC1.csv.config --fasta=/Users/salman/xi_data/xi/sequenceDB/4_protein_mix-17_59_11-19_Jan_2018/4ProtMix.fasta /home/lfischer/temp/test/4pm_dsso_Xi1.7.0.RC1.csv --gui java /home/lfischer diff --git a/pom.xml b/pom.xml index 5bca27a..6f19a6e 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.rappsilberlab xiFDR - 1.3.37 + 1.4.0 jar @@ -145,5 +145,5 @@ Application for FDR estimation cross-linking massspectrometry data - xiFDR-1.3.37 + xiFDR-1.4.0 diff --git a/src/main/java/org/rappsilber/fdr/CSVinFDR.java b/src/main/java/org/rappsilber/fdr/CSVinFDR.java index ddd9b95..6b6eb20 100644 --- a/src/main/java/org/rappsilber/fdr/CSVinFDR.java +++ b/src/main/java/org/rappsilber/fdr/CSVinFDR.java @@ -88,6 +88,8 @@ public class CSVinFDR extends OfflineFDR { {"peptide coverage2", "peptide2 unique matched non lossy coverage", "unique_peak_primary_coverage_p2"}, {"peptide1 fragments", "peptide1 unique matched conservative", "conservative_fragsites_p1"}, {"peptide2 fragments", "peptide2 unique matched conservative", "conservative_fragsites_p2"}, + {"peptides with stubs", "fragment CCPepFragment"}, + {"peptides with doublets", "fragment CCPepDoubletFound"}, {"minimum peptide coverage", "min coverage pp"}, {"delta", "delta score", "dscore"}, }; @@ -193,6 +195,8 @@ public void readCSV(CsvParser csv, CsvCondition filter) throws FileNotFoundExcep Integer cDelta = getColumn(csv,"delta",true); Integer cPep1Coverage = getColumn(csv,"peptide coverage1",true); Integer cPep2Coverage = getColumn(csv,"peptide coverage1",true); + Integer cPepStubs = getColumn(csv,"peptides with stubs",true); + Integer cPepDoublets = getColumn(csv,"peptides with doublets",true); Integer cPepMinCoverage = getColumn(csv,"minimum peptide coverage",true); Integer cRank = getColumn(csv,"rank",true); @@ -293,12 +297,12 @@ public void readCSV(CsvParser csv, CsvCondition filter) throws FileNotFoundExcep peptide2score=score*(1-ratio); } - String[] accessions1 =saccession1.split(";"); - String[] accessions2 =saccession2.split(";"); - String[] descriptions1 =sdescription1.split(";",-1); - String[] descriptions2 =sdescription2.split(";",-1); - String[] pepPositions1 =spepPosition1.split(";",-1); - String[] pepPositions2 =spepPosition2.split(";",-1); + String[] accessions1 =saccession1.split("\\s*;\\s*"); + String[] accessions2 =saccession2.split("\\s*;\\s*"); + String[] descriptions1 =sdescription1.split("\\s*;\\s*",-1); + String[] descriptions2 =sdescription2.split("\\s*;\\s*",-1); + String[] pepPositions1 =spepPosition1.split("\\s*;\\s*",-1); + String[] pepPositions2 =spepPosition2.split("\\s*;\\s*",-1); if (!sdescription1.isEmpty()) { if (descriptions1.length != accessions1.length) @@ -346,7 +350,7 @@ public void readCSV(CsvParser csv, CsvCondition filter) throws FileNotFoundExcep int[] ipeppos1 = new int[pepPositions1.length]; for (int i = 0; i0) { + stubsFound(true); + } + + } + if (cPepDoublets != null) { + + psm.addOtherInfo("PeptidesWithDoublets", csv.getDouble(cPepDoublets)); + + } + if (cPepMinCoverage != null) { psm.addOtherInfo("minPepCoverage", csv.getDouble(cPepMinCoverage)); diff --git a/src/main/java/org/rappsilber/fdr/FDRSettings.java b/src/main/java/org/rappsilber/fdr/FDRSettings.java index 11a438f..383b6f2 100644 --- a/src/main/java/org/rappsilber/fdr/FDRSettings.java +++ b/src/main/java/org/rappsilber/fdr/FDRSettings.java @@ -169,5 +169,7 @@ public interface FDRSettings { public void ignoreValidityChecks(boolean ignore); // public double getSubScoreCutOff(); // public void setSubScoreCutOff(double localfdr); + public void setGroupByCrosslinkerStubs(boolean group); + public boolean getGroupByCrosslinkerStubs(); } diff --git a/src/main/java/org/rappsilber/fdr/FDRSettingsImpl.java b/src/main/java/org/rappsilber/fdr/FDRSettingsImpl.java index 1f73afe..6771982 100644 --- a/src/main/java/org/rappsilber/fdr/FDRSettingsImpl.java +++ b/src/main/java/org/rappsilber/fdr/FDRSettingsImpl.java @@ -32,7 +32,7 @@ public class FDRSettingsImpl implements FDRSettings { double ProteinGroupFDR; double ProteinGroupLinkFDR; double ProteinGroupPairFDR; - int BoostingSteps; + int BoostingSteps = 4; boolean BoostBetween; boolean LinkDirectional; boolean PPIDirectional; @@ -61,7 +61,8 @@ public class FDRSettingsImpl implements FDRSettings { private boolean combineScoreAndDelta; private int minFragments; private boolean boostMinFragments = false; - private boolean ignoreValidityChecks; + private boolean ignoreValidityChecks = true; + private boolean groubByCrosslinkerStubs; @Override public void addCalcListener(ActionListener al) { @@ -320,6 +321,7 @@ public static void transferSettings(FDRSettings from, FDRSettings to) { to.boostDeltaScore(from.boostDeltaScore()); to.combineScoreAndDelta(from.combineScoreAndDelta()); to.ignoreValidityChecks(from.ignoreValidityChecks()); + to.setGroupByCrosslinkerStubs(from.getGroupByCrosslinkerStubs()); } public boolean combineScoreAndDelta() { @@ -528,6 +530,16 @@ public boolean ignoreValidityChecks() { public void ignoreValidityChecks(boolean ignore) { this.ignoreValidityChecks = ignore; } + + @Override + public void setGroupByCrosslinkerStubs(boolean group) { + this.groubByCrosslinkerStubs = group; + } + + @Override + public boolean getGroupByCrosslinkerStubs() { + return this.groubByCrosslinkerStubs; + } } diff --git a/src/main/java/org/rappsilber/fdr/OfflineFDR.java b/src/main/java/org/rappsilber/fdr/OfflineFDR.java index 15b55d2..79c6eaf 100644 --- a/src/main/java/org/rappsilber/fdr/OfflineFDR.java +++ b/src/main/java/org/rappsilber/fdr/OfflineFDR.java @@ -29,7 +29,6 @@ import java.util.Locale; import java.util.Map; import java.util.RandomAccess; -import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import org.rappsilber.data.csv.CSVRandomAccess; @@ -52,7 +51,6 @@ import org.rappsilber.fdr.entities.AbstractFDRElement; import org.rappsilber.fdr.entities.FDRSelfAdd; import org.rappsilber.fdr.filter.DeltaScorePercentFilter; -import org.rappsilber.fdr.gui.FDRGUI; import org.rappsilber.fdr.utils.HashedArrayList; import org.rappsilber.fdr.utils.MaximisingStatus; import org.rappsilber.fdr.utils.MaximizeLevelInfo; @@ -65,7 +63,6 @@ import org.rappsilber.utils.IntArrayList; import org.rappsilber.utils.RArrayUtils; import org.rappsilber.utils.NullOutputStream; -import org.rappsilber.utils.SelfAdd; import org.rappsilber.utils.SelfAddHashSet; import org.rappsilber.utils.UpdateableInteger; import org.rappsilber.utils.Version; @@ -163,7 +160,12 @@ public abstract class OfflineFDR { public int commandlineFDRDigits = 2; private boolean uniquePSMs = true; - + + /** + * do we have PSMs with crosslinker-stubs. + * Basically do we have a ms2 cleavable crosslinker search. + */ + private boolean stubsFound = false; /** * We normalize psm-scores by median and MAD - but to go around some quirks * of our score propagation scores then get shifted so that the lowest score @@ -800,6 +802,19 @@ protected String registerRun(String run) { return r; } + /** + * returns if a calculateWrite will only do a single calculation or a range of FDR calculations + * @return + */ + public boolean singleCalculation() { + return getPsmFDRSetting()[0]==getPsmFDRSetting()[1] && + getPeptidePairFDRSetting()[0]==getPeptidePairFDRSetting()[1] && + getProteinGroupFDRSetting()[0]==getProteinGroupFDRSetting()[1] && + getLinkFDRSetting()[0]==getLinkFDRSetting()[1] && + getPpiFDRSetting()[0]==getPpiFDRSetting()[1] ; + } + + public FDRResult calculateWriteFDR(String path, String baseName, String seperator, FDRSettings settings) throws FileNotFoundException { return calculateWriteFDR(path, baseName, seperator, commandlineFDRDigits, settings); } @@ -1026,6 +1041,28 @@ public void calculatePSMFDR(boolean setElementFDR, boolean ignoreGroups, FDRResu result.maximumProteinAmbiguity = m_maximumProteinAmbiguity; result.maximumLinkAmbiguity = m_maximumLinkAmbiguity; + if (settings.getGroupByCrosslinkerStubs()) { + for (PSM p : inputPSM) { + int gr = 0; + if ((Double)p.getOtherInfo("PeptidesWithStubs") >1) + gr=1; + if ((Double)p.getOtherInfo("PeptidesWithDoublets") >0) + gr++; + if (gr==0) { + p.addNegativeGrouping("low stub support"); + } else if (gr>1){ + p.addPositiveGrouping("high stub support"); + } + } + } else { + for (PSM p : inputPSM) { + if (p.getNegativeGrouping()!=null) + p.getNegativeGrouping().remove("low stub support"); + if (p.getPositiveGrouping()!=null) + p.getPositiveGrouping().remove("high stub support"); + } + } + fdr(settings.getPSMFDR(), settings, inputPSM, GroupedFDRs, targetPepDBSize, decoyPepDBSize, 1, ignoreGroups, setElementFDR, settings.psmLocalFDR(), settings.isGroupByPSMCount()); @@ -1051,10 +1088,11 @@ public void calculatePSMFDR(boolean setElementFDR, boolean ignoreGroups, FDRResu fdr(settings.getPSMFDR(), settings, inputPSM, GroupedFDRs, targetPepDBSize, decoyPepDBSize, 1, ignoreGroups, setElementFDR, settings.psmLocalFDR(), settings.isGroupByPSMCount()); GroupedFDRs = GroupedFDRsS; } + for (SubGroupFdrInfo rl : GroupedFDRs.getGroups()) { - if (rl.didntPassCheck) { - result.excludedGroups.add("PSM -> " + rl.fdrGroup); + if (rl.didntPassCheck != null) { + result.excludedGroups.add("PSM -> " + rl.fdrGroup + "(" + rl.didntPassCheck + ")"); } } @@ -1181,8 +1219,8 @@ public void calculatePeptidePairFDR(boolean setElementFDR, FDRResult result, FDR fdr(settings.getPeptidePairFDR(), settings, psmPeps, GroupedFDRs, targetPepDBSize, decoyPepDBSize, 1, ignoreGroups, setElementFDR, settings.peppairLocalFDR(), settings.isGroupByPSMCount()); for (SubGroupFdrInfo rl : GroupedFDRs.getGroups()) { - if (rl.didntPassCheck) { - result.excludedGroups.add("PeptidePair -> " + rl.fdrGroup); + if (rl.didntPassCheck != null) { + result.excludedGroups.add("PeptidePair -> " + rl.fdrGroup+ "(" + rl.didntPassCheck + ")"); } } @@ -1263,8 +1301,8 @@ public void calculateProteinGroupFDR(boolean ignoreGroups, boolean setElementFDR fdr(settings.getProteinGroupFDR(), settings, pepProteinGroups, GroupedFDRs, targetProtDBSize, decoyProtDBSize, settings.getMinProteinPepCount(), ignoreGroups, setElementFDR, settings.protLocalFDR(), false); for (SubGroupFdrInfo rl : GroupedFDRs.getGroups()) { - if (rl.didntPassCheck) { - result.excludedGroups.add("ProteinGroup -> " + rl.fdrGroup); + if (rl.didntPassCheck != null) { + result.excludedGroups.add("ProteinGroup -> " + rl.fdrGroup + "(" + rl.didntPassCheck + ")"); } } @@ -1368,8 +1406,8 @@ public void calculateLinkFDR(boolean ignoreGroups, boolean setElementFDR, FDRSet } for (SubGroupFdrInfo rl : GroupedFDRs.getGroups()) { - if (rl.didntPassCheck) { - result.excludedGroups.add("ResiduePair -> " + rl.fdrGroup); + if (rl.didntPassCheck != null) { + result.excludedGroups.add("ResiduePair -> " + rl.fdrGroup + "(" + rl.didntPassCheck + ")"); } } @@ -1459,8 +1497,8 @@ public void calculateProteinGroupPairFDR(boolean ignoreGroups, boolean setElemen fdr(settings.getProteinGroupPairFDR(), settings, linkPPIs, GroupedFDRs, targetProtDBSize, decoyProtDBSize, minPepCount, ignoreGroups, setElementFDR, settings.ppiLocalFDR(), false); for (SubGroupFdrInfo rl : GroupedFDRs.getGroups()) { - if (rl.didntPassCheck) { - result.excludedGroups.add("ProteinGroupPair -> " + rl.fdrGroup); + if (rl.didntPassCheck != null) { + result.excludedGroups.add("ProteinGroupPair -> " + rl.fdrGroup + "(" + rl.didntPassCheck + ")"); } } @@ -1621,7 +1659,11 @@ public FDRResult calculateFDR(FDRSettings settings, boolean setElementFDR) { Logger.getLogger(this.getClass().getName()).log(Level.INFO, "fdr protein groups :" + result.proteinGroupFDR.getResultCount()); if (!result.excludedGroups.isEmpty()) { - Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "Some FDR groups where ignored as being unreliable: "+ MyArrayUtils.toString(result.excludedGroups, "; ")); + if (settings.ignoreValidityChecks()) { + Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "For some subgroups the FDR calculation is likely unreliable:\n"+ MyArrayUtils.toString(result.excludedGroups, ";\n")); + } else { + Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "Some FDR groups where ignored as being unreliable:\n"+ MyArrayUtils.toString(result.excludedGroups, ";\n")); + } } return result; @@ -1660,8 +1702,18 @@ public void writeFiles(String path, String baseName, String seperator, FDRResult public void writeFiles(String path, String baseName, String fileextension, String seperator, FDRResult result) throws FileNotFoundException { CSVRandomAccess csvFormater = new CSVRandomAccess(seperator.charAt(0), '"'); csvFormater.setLocale(outputlocale); + File folder = new File(path); + int n=0; + if (!folder.exists()) { + folder.mkdirs(); + } else if (!folder.isDirectory()){ + while (folder.exists() && folder.isDirectory()){ + folder = new File(path+ "_" + (++n)); + } + path = folder.getAbsolutePath(); + } - String extension = "_xiFDR" + OfflineFDR.xiFDRVersion + fileextension; + String extension = "_xiFDR" + getXiFDRVersion() + fileextension; CountOccurence fdrPSMGroupCounts = new CountOccurence(); @@ -1782,7 +1834,7 @@ public int compare(PeptidePair o1, PeptidePair o2) { String xlPepsHeader = csvFormater.valuesToString(getXLPepsHeader()); pepsOut.println(xlPepsHeader); - pepsLinearOut = new PrintWriter(path + "/" + baseName + "_Linear_Peptides" + OfflineFDR.xiFDRVersion + extension); + pepsLinearOut = new PrintWriter(path + "/" + baseName + "_Linear_Peptides" + getXiFDRVersion() + extension); String linearPepsHeader = csvFormater.valuesToString(getLinearPepsHeader()); pepsLinearOut.println(linearPepsHeader); @@ -2491,28 +2543,27 @@ private > void defineConnectedness(Collection * * @param * @param info - * @param result - * @return + * @return null pass; otherwise reason */ - public > boolean checkValid(SubGroupFdrInfo info, ArrayList result, double factor, int minTDCount) { + public > String checkValid(SubGroupFdrInfo info, double factor, int minTDCount) { // make sure we have enough targets that we could theoretically thsi number of TD if (info.resultTT * info.targteFDR < (double) minTDCount) { - return false; + return "not enough TT"; } if ((info.targteFDR < 1 && info.resultTT < info.resultDD) || info.resultTD < info.resultDD) { - return false; + return "to many DD"; } if ((info.resultDD + 0.00001) / (info.resultTD + 0.0001) > 1 - factor) { - return false; + return "resolution to bad"; } if (info.resultTT * info.targteFDR < factor * 10) { - return false; + return "resolution to bad"; } - return true; + return null; } @@ -2732,40 +2783,44 @@ private > void fdr(double fdr, FDRSettings setti } groupResult = filtered; } - + String valid = checkValid(info, 0, minTDChance); // if (info.resultTT*fdr{1}({2})", new Object[]{group.get(0).getClass(), fdrgroup, group.get(0).getFDRGroup()}); - //between - if (fdrgroup.toLowerCase().contains("between")) { - toosmallsum += groupResult.size(); - toosmall.add(fdrgroup); - collectedToSmallNames.add(fdrgroup); - collectedToSmall.TT += info.TT; - collectedToSmall.TD += info.TD; - collectedToSmall.DD += info.DD; - collectedToSmall.DCount += info.DCount; - collectedToSmall.TCount += info.TCount; - collectedToSmall.inputCount += info.inputCount; - tooSmallGroup.addAll(group); - groupResult.clear(); - } else { - // within group - collectedToSmallWithinNames.add(fdrgroup); - toosmallsumWithin += groupResult.size(); - toosmallWithin.add(fdrgroup); - collectedToSmallWithin.TT += info.TT; - collectedToSmallWithin.TD += info.TD; - collectedToSmallWithin.DD += info.DD; - collectedToSmallWithin.DCount += info.DCount; - collectedToSmallWithin.TCount += info.TCount; - collectedToSmallWithin.inputCount += info.inputCount; - tooSmallGroupWithin.addAll(group); - groupResult.clear(); + if (valid != null) { + if ((!settings.ignoreValidityChecks())) { + Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Discarded group {0}->{1}({2})", new Object[]{group.get(0).getClass(), fdrgroup, group.get(0).getFDRGroup()}); + //between + if (fdrgroup.toLowerCase().contains("between")) { + toosmallsum += groupResult.size(); + toosmall.add(fdrgroup); + collectedToSmallNames.add(fdrgroup); + collectedToSmall.TT += info.TT; + collectedToSmall.TD += info.TD; + collectedToSmall.DD += info.DD; + collectedToSmall.DCount += info.DCount; + collectedToSmall.TCount += info.TCount; + collectedToSmall.inputCount += info.inputCount; + tooSmallGroup.addAll(group); + groupResult.clear(); + } else { + // within group + collectedToSmallWithinNames.add(fdrgroup); + toosmallsumWithin += groupResult.size(); + toosmallWithin.add(fdrgroup); + collectedToSmallWithin.TT += info.TT; + collectedToSmallWithin.TD += info.TD; + collectedToSmallWithin.DD += info.DD; + collectedToSmallWithin.DCount += info.DCount; + collectedToSmallWithin.TCount += info.TCount; + collectedToSmallWithin.inputCount += info.inputCount; + tooSmallGroupWithin.addAll(group); + groupResult.clear(); + } + info.filteredResult = new HashedArrayList<>(); + } else { + Logger.getLogger(this.getClass().getName()).log(Level.FINE, "FDR-Group {0}->{1}({2}) deemed unreliable - be carefull", new Object[]{group.get(0).getClass(), fdrgroup, group.get(0).getFDRGroup()}); } - info.filteredResult = new HashedArrayList<>(); - info.didntPassCheck = true; + info.didntPassCheck = valid; } //else { groupInfo.addGroup(fdrgroup, info); // group, fdr, safetyfactor, groupResult, tCount, dCount,setElementFDR); @@ -2809,7 +2864,7 @@ private > void fdr(double fdr, FDRSettings setti groupResult = filtered; } } - if (settings.ignoreValidityChecks() || checkValid(collectedToSmall, groupResult, 0, minTDChance)) { + if (settings.ignoreValidityChecks() || checkValid(collectedToSmall, 0, minTDChance) == null) { groupInfo.addGroup(collectedToSmall.fdrGroup, collectedToSmall); // group, fdr, safetyfactor, groupResult, tCount, dCount,setElementFDR); // nextFDR.put(fdrgroup, prevFDR); @@ -2848,7 +2903,7 @@ private > void fdr(double fdr, FDRSettings setti groupResultwithin = filtered; } } - if (settings.ignoreValidityChecks() || checkValid(collectedToSmallWithin, groupResultwithin, 0, minTDChance)) { + if (settings.ignoreValidityChecks() || checkValid(collectedToSmallWithin, 0, minTDChance) == null) { groupInfo.addGroup(collectedToSmallWithin.fdrGroup, collectedToSmallWithin); // group, fdr, safetyfactor, groupResult, tCount, dCount,setElementFDR); // nextFDR.put(fdrgroup, prevFDR); @@ -2865,7 +2920,6 @@ private > void fdr(double fdr, FDRSettings setti // we didn't get any results through. try a non grouped SubGroupFdrInfo info = new SubGroupFdrInfo(); info.fdrGroup = "NoSubResults"; - groupInfo.addGroup(info.fdrGroup, info); for (String fdrgroup : groupedList.keySet()) { info.TT += gTT.get(fdrgroup).value; info.TD += gTD.get(fdrgroup).value; @@ -2899,14 +2953,14 @@ private > void fdr(double fdr, FDRSettings setti allResult = filtered; } } - if (allResult.size() * fdr < minTDChance) { - allResult.clear(); - } else { + if (settings.ignoreValidityChecks() || checkValid(info, 0, minTDChance) == null) { + groupInfo.addGroup(info.fdrGroup, info); groupInfo.setLinear(groupInfo.getLinear() + info.linear); groupInfo.setWithin(groupInfo.getWithin() + info.within); groupInfo.setBetween(groupInfo.getBetween() + info.between); - } - + } else { + allResult.clear(); + } } // return ret; @@ -4392,8 +4446,8 @@ protected ArrayList getPSMOutputLine(PSM pp) { protected void peptidePositionsToPSMOutString(HashMap positions, StringBuilder sbaccessions, StringBuilder sbdescriptions, StringBuilder sbPositions, StringBuilder sbProtLink, int peplink) { for (Protein p : positions.keySet()) { for (int i : positions.get(p)) { - sbaccessions.append(";").append(p.getAccession()); - sbdescriptions.append(";").append(p.getDescription()); + sbaccessions.append(";").append((p.isDecoy()?"decoy:":"")+ p.getAccession()); + sbdescriptions.append(";").append(p.isDecoy()?"decoy":p.getDescription()); sbPositions.append(";").append(i2s(i)); sbProtLink.append(";").append(i2s(i + peplink - 1)); } @@ -6052,4 +6106,22 @@ public boolean groupPSMsByRun() { return this.groupPSMsByRun; } + /** + * do we have PSMs with crosslinker-stubs. + * Basically do we have a ms2 cleavable crosslinker search. + * @return the stubsFound + */ + public boolean stubsFound() { + return stubsFound; + } + + /** + * do we have PSMs with crosslinker-stubs. + * Basically do we have a ms2 cleavable crosslinker search. + * @param stubsFound the stubsFound to set + */ + public void stubsFound(boolean stubsFound) { + this.stubsFound = stubsFound; + } + } diff --git a/src/main/java/org/rappsilber/fdr/XiCSVinFDR.java b/src/main/java/org/rappsilber/fdr/XiCSVinFDR.java index ef68303..b4ba158 100644 --- a/src/main/java/org/rappsilber/fdr/XiCSVinFDR.java +++ b/src/main/java/org/rappsilber/fdr/XiCSVinFDR.java @@ -26,6 +26,7 @@ import java.util.HashMap; import java.util.logging.Level; import java.util.logging.Logger; +import javax.swing.SwingUtilities; import org.rappsilber.data.csv.ColumnAlternatives; import org.rappsilber.data.csv.CsvParser; import org.rappsilber.data.csv.condition.CsvCondition; @@ -34,6 +35,10 @@ import org.rappsilber.fdr.entities.Peptide; import org.rappsilber.fdr.entities.Protein; import org.rappsilber.fdr.gui.FDRGUI; +import org.rappsilber.fdr.gui.components.MZIdentMLOwnerGUI; +import org.rappsilber.fdr.result.FDRResult; +import org.rappsilber.fdr.utils.MZIdentMLExport; +import org.rappsilber.fdr.utils.MZIdentMLOwner; import org.rappsilber.utils.IntArrayList; import org.rappsilber.utils.UpdatableChar; import rappsilber.config.RunConfig; @@ -278,7 +283,7 @@ public String[] parseArgs(String[] argv, FDRSettings settings) { } if (startGUI) { - FDRGUI fg = FDRGUI.startGUI(); + final FDRGUI fg = FDRGUI.startGUI(); if (unknown.size() > 0) { fg.setInput(unknown.get(0)); } @@ -289,6 +294,17 @@ public String[] parseArgs(String[] argv, FDRSettings settings) { fg.setXiConfig(confpath); } fg.setFDRSettings(settings); + + String outdir = getCsvOutDirSetting(); + String basename = getCsvOutBaseSetting(); + fg.setCSVOutFile(outdir + ((outdir.endsWith("/") || outdir.endsWith("\\")) ? "":File.separator) + basename +".csv"); +// SwingUtilities.invokeLater(new Runnable() { +// @Override +// public void run() { +// fg.readAdditionalCSV(); +// } +// }); +// unknown.clear(); unknown.add("--GUI--"); @@ -380,8 +396,23 @@ public static void main (String[] argv) throws SQLException, FileNotFoundExcepti } Logger.getLogger(XiCSVinFDR.class.getName()).log(Level.INFO, "Calculate FDR"); - ofdr.calculateWriteFDR(ofdr.getCsvOutDirSetting(), ofdr.getCsvOutBaseSetting(), ",", settings); + FDRResult res = ofdr.calculateWriteFDR(ofdr.getCsvOutDirSetting(), ofdr.getCsvOutBaseSetting(), ",", settings); + Logger.getLogger(XiCSVinFDR.class.getName()).log(Level.INFO, ofdr.singleCalculation() + + " " + (ofdr.getConfig() != null) + " " + (ofdr.searchedFastas != null && ofdr.searchedFastas.size()>0) + "\n"); + + if (ofdr.singleCalculation() && ofdr.getConfig() != null && (ofdr.searchedFastas != null && ofdr.searchedFastas.size()>0)) { + // we should be able to write out an mzIdentML + String path =ofdr.getCsvOutDirSetting(); + String baseName = ofdr.getCsvOutBaseSetting(); + String out = path + (path.endsWith(File.separator)?"":File.separator) + baseName + ".mzid"; + try { + Logger.getLogger(XiCSVinFDR.class.getName()).log(Level.INFO, "Writing mzIdentML to " + out); + MZIdentMLExport mze = new MZIdentMLExport(ofdr, res, out, MZIdentMLOwnerGUI.getSetOwner(new MZIdentMLOwner())); + } catch (Exception ex) { + Logger.getLogger(XiCSVinFDR.class.getName()).log(Level.SEVERE, null, ex); + } + } System.exit(0); @@ -489,7 +520,7 @@ public void matchFastas() throws IOException { p.setSequence(proteinsToSequence.get(fastaheader)); } else { // did not find a decoy protein - so will try the target protein - fastaheader = parts2Proteins.get(p.getAccession()); + fastaheader = parts2Proteins.get(p.getAccession().toLowerCase()); if (fastaheader != null) { // only found target protein - assume same size p.setSize(proteinsToSequence.get(fastaheader).length()); @@ -500,7 +531,7 @@ public void matchFastas() throws IOException { } } else { - String fastaheader = parts2Proteins.get(p.getAccession()); + String fastaheader = parts2Proteins.get(p.getAccession().toLowerCase()); if (fastaheader != null) { p.setSequence(proteinsToSequence.get(fastaheader)); } else { @@ -539,7 +570,6 @@ public void readCSV(CsvParser csv, CsvCondition filter) throws FileNotFoundExcep super.readCSV(csv, filter); //To change body of generated methods, choose Tools | Templates. matchFastas(); } - - - + + } diff --git a/src/main/java/org/rappsilber/fdr/entities/AbstractFDRElement.java b/src/main/java/org/rappsilber/fdr/entities/AbstractFDRElement.java index 39ee4bb..64c8004 100644 --- a/src/main/java/org/rappsilber/fdr/entities/AbstractFDRElement.java +++ b/src/main/java/org/rappsilber/fdr/entities/AbstractFDRElement.java @@ -111,6 +111,12 @@ public HashSet getPositiveGrouping() { return m_positiveGroups; } + public void addPositiveGrouping(String av) { + if (this.m_positiveGroups == null) + this.m_positiveGroups = new HashSet(1); + this.m_positiveGroups.add(av); + } + /** * indicates this passed some form of Negative value that makes this diff --git a/src/main/java/org/rappsilber/fdr/entities/PeptidePair.java b/src/main/java/org/rappsilber/fdr/entities/PeptidePair.java index abd1460..736a040 100644 --- a/src/main/java/org/rappsilber/fdr/entities/PeptidePair.java +++ b/src/main/java/org/rappsilber/fdr/entities/PeptidePair.java @@ -32,21 +32,34 @@ * by setting the second peptide to the {@link Peptide#NOPEPTIDE} place-holder. */ public class PeptidePair extends AbstractFDRElement {//implements Comparable{ - /** counts up each instance of PeptidePairs used to assign unique IDs */ + + /** + * counts up each instance of PeptidePairs used to assign unique IDs + */ public static int PEPTIDEPAIRCOUNT = 0; - /** a link represented by this peptide pair that passed the fdr */ + /** + * a link represented by this peptide pair that passed the fdr + */ private ProteinGroupLink m_link; - /** unique id for this peptide pair */ + /** + * unique id for this peptide pair + */ protected int peptidePairID = PEPTIDEPAIRCOUNT++; - /** sorry is used in the rappsilber group for a search type specific FDR */ + /** + * sorry is used in the rappsilber group for a search type specific FDR + */ public static boolean ISTARGETED = false; - /** length groups used for doing a length depended FDR-grouping */ + /** + * length groups used for doing a length depended FDR-grouping + */ protected static int[] lenghtGroup; // /** meaningful names for the FDR-groups */ // public static HashMap fdrGroupNames = new HashMap(); - /** is used in the rappsilber group internally for a a specific search type */ + /** + * is used in the rappsilber group internally for a a specific search type + */ private static Pattern targetMod = Pattern.compile("X(-?[0-9]+(\\.[0-9]+)?)"); - + /** * id of peptide1 */ @@ -68,12 +81,12 @@ public class PeptidePair extends AbstractFDRElement {//implements C * overall score of this pair */ private double score = Double.NaN; - + /** * overall score of this pair */ private double peptide1score = Double.NaN; - + /** * overall score of this pair */ @@ -110,44 +123,71 @@ public class PeptidePair extends AbstractFDRElement {//implements C * it could be a protein internal link */ private boolean isInternal = false; - /** only one peptide */ + /** + * only one peptide + */ protected boolean isLinear = false; - /** single loop-linked peptide */ + /** + * single loop-linked peptide + */ private boolean isLoop = false; - /** no decoy */ + /** + * no decoy + */ private boolean isTT = false; - /** one decoy */ + /** + * one decoy + */ private boolean isTD = false; - /** two decoy */ + /** + * two decoy + */ private boolean isDD = false; - /** FDR group assigned to this peptide pair */ + /** + * FDR group assigned to this peptide pair + */ private String fdrGroup; - /** fdr assigned to the score of this peptidepair */ + /** + * fdr assigned to the score of this peptidepair + */ public double m_fdr = -1; - /** the fdr of the link that is supported by this peptide pair*/ + /** + * the fdr of the link that is supported by this peptide pair + */ protected double m_LinkFdr = -1; - /** the fdr of the protein pair that is supported by this peptide pair */ + /** + * the fdr of the protein pair that is supported by this peptide pair + */ protected double m_PPIFdr = -1; - /** proteingroup supported by this peptidepair that passed the fdr */ + /** + * proteingroup supported by this peptidepair that passed the fdr + */ public ProteinGroup fdrProteinGroup1 = null; - /** proteingroup supported by this peptidepair that passed the fdr */ + /** + * proteingroup supported by this peptidepair that passed the fdr + */ public ProteinGroup fdrProteinGroup2 = null; - /** are all supporting PSMs special cases? */ + /** + * are all supporting PSMs special cases? + */ // private HashSet negativeGroups = null; - /** indicates that the two peptides where in the same spectrum but non-covalently linked */ + /** + * indicates that the two peptides where in the same spectrum but + * non-covalently linked + */ private boolean isNonCovalent = false; // private HashSet positiveGroups; - /** + /** * is this a cross-link of consecutive peptides */ private Boolean isConsecutive; - - + /** * constructor - * @param psm + * + * @param psm */ public PeptidePair(PSM psm) { this.peptide1 = psm.getPeptide1(); @@ -172,7 +212,7 @@ public PeptidePair(PSM psm) { // this.chargeTopScores.set(psm.getCharge(), psm.getScore()); // this.chargeTopScoresPSMId.set(psm.getCharge(), psm.getPsmID()); this.psms.add(psm); - this.chargeTopScoresPSM = new PSM[psm.getCharge()+1]; + this.chargeTopScoresPSM = new PSM[psm.getCharge() + 1]; this.chargeTopScoresPSM[psm.getCharge()] = psm; //this.chargeTopScoresRatios.set(psm.getCharge(), psm.getScoreRatio()); @@ -199,19 +239,21 @@ public int hashCode() { @Override public boolean equals(Object l) { PeptidePair c = (PeptidePair) l; - if (isNonCovalent != c.isNonCovalent) + if (isNonCovalent != c.isNonCovalent) { return false; - - return crosslinker == c.crosslinker && - ((c.peptide1.equals(peptide1) && c.peptide2.equals(peptide2) && c.pepsite1 == pepsite1 && c.pepsite2 == pepsite2) + } + + return crosslinker == c.crosslinker + && ((c.peptide1.equals(peptide1) && c.peptide2.equals(peptide2) && c.pepsite1 == pepsite1 && c.pepsite2 == pepsite2) || (c.peptide2.equals(peptide1) && c.peptide1.equals(peptide2) && c.pepsite2 == pepsite1 && c.pepsite1 == pepsite2)); } - /** - * adds the information of another peptide pair to this one. - * Is used to join the PeptidePairs that are generated from different PSMs - * but are actually the same PeptidePairs. - * @param p + /** + * adds the information of another peptide pair to this one. Is used to join + * the PeptidePairs that are generated from different PSMs but are actually + * the same PeptidePairs. + * + * @param p */ public void add(PeptidePair p) { if (p == this) { @@ -225,60 +267,63 @@ public void add(PeptidePair p) { chargeTopScoresPSM = new PSM[p.chargeTopScoresPSM.length]; System.arraycopy(dummy, 0, chargeTopScoresPSM, 0, dummy.length); } - for (int i = 0 ; i< p.chargeTopScoresPSM.length;i++) { + for (int i = 0; i < p.chargeTopScoresPSM.length; i++) { PSM ppsm = p.chargeTopScoresPSM[i]; - if (ppsm == null) + if (ppsm == null) { continue; + } + + PSM cpsm = null; + if (chargeTopScoresPSM.length > i) { + cpsm = chargeTopScoresPSM[i]; + } - PSM cpsm =null; - if (chargeTopScoresPSM.length>i) - cpsm= chargeTopScoresPSM[i]; - if (cpsm == null || ppsm.getScore() > cpsm.getScore()) { - chargeTopScoresPSM[i]= ppsm; + chargeTopScoresPSM[i] = ppsm; // if (invertScoreRatio) { // chargeTopScoresRatios.set(i, 1 - p.chargeTopScoresRatios.get(i)); // } else { // chargeTopScoresRatios.set(i, p.chargeTopScoresRatios.get(i)); // } - + } - + } boolean setFDR = false; addFDRGroups(p); - + if (p.isInternal && !isInternal) { isInternal = true; setFDR = true; - } - - if (setFDR) + } + + if (setFDR) { setFDRGroup(); - + } + } /** - * calculate the score of this Peptide pair based on the scores of the + * calculate the score of this Peptide pair based on the scores of the * supporting PSMs */ public void setScore() { score = 0; - peptide1score=0; - peptide2score=0; + peptide1score = 0; + peptide2score = 0; for (PSM psm : chargeTopScoresPSM) { - if (psm!=null) { + if (psm != null) { score += psm.getScore() * psm.getScore(); if (psm.getPeptide1() == getPeptide1()) { - peptide1score+=psm.getPeptide1Score()*psm.getPeptide1Score(); - peptide2score+=psm.getPeptide2Score()*psm.getPeptide2Score(); + peptide1score += psm.getPeptide1Score() * psm.getPeptide1Score(); + peptide2score += psm.getPeptide2Score() * psm.getPeptide2Score(); } else { - peptide1score+=psm.getPeptide2Score()*psm.getPeptide2Score(); - peptide2score+=psm.getPeptide1Score()*psm.getPeptide1Score(); + peptide1score += psm.getPeptide2Score() * psm.getPeptide2Score(); + peptide2score += psm.getPeptide1Score() * psm.getPeptide1Score(); } } - + } score = Math.sqrt(score); peptide1score = Math.sqrt(peptide1score); @@ -286,9 +331,10 @@ public void setScore() { } /** - * returns the link that is supported by this peptidepair encapsulated in a + * returns the link that is supported by this peptidepair encapsulated in a * ArrayList. - * @return + * + * @return */ public ArrayList getLinks() { ArrayList links = new ArrayList(); @@ -297,20 +343,22 @@ public ArrayList getLinks() { } /** - * returns the link that is supported by this peptidepair - * @return + * returns the link that is supported by this peptidepair + * + * @return */ public ProteinGroupLink getLink() { return new ProteinGroupLink(this); } /** - * returns the link supported by this peptidepair but filtered through the - * supplied SelfAddHashSet. This ensures that all peptidepairs that would - * support the same link will actually return references to the same + * returns the link supported by this peptidepair but filtered through the + * supplied SelfAddHashSet. This ensures that all peptidepairs that would + * support the same link will actually return references to the same * instance of the ProteinGroupLink. + * * @param allLinks - * @return + * @return */ public ArrayList getLinks(SelfAddHashSet allLinks) { return allLinks.registerAll(getLinks()); @@ -318,7 +366,8 @@ public ArrayList getLinks(SelfAddHashSet all /** * returns a list of proteins supported by this peptide pair. - * @return + * + * @return */ public ArrayList getProteins() { HashSet prots = new HashSet(); @@ -331,34 +380,36 @@ public ArrayList getProteins() { } /** - * returns the proteins supported by this peptidepair but filtered through the - * supplied SelfAddHashSet. This ensures that all peptidepairs that would - * support the same proteins will actually return references to the same - * instances of the Protein. - * @param allProteins - * @return + * returns the proteins supported by this peptidepair but filtered through + * the supplied SelfAddHashSet. This ensures that all peptidepairs that + * would support the same proteins will actually return references to the + * same instances of the Protein. + * + * @param allProteins + * @return */ public ArrayList getProteins(SelfAddHashSet allProteins) { return allProteins.registerAll(getProteins()); } - /** - * calculate the score for the given protein based on the score of the + * calculate the score for the given protein based on the score of the * current PeptidePair + * * @param prot - * @return + * @return */ public double getProteinScore(Protein prot) { - if (Double.isNaN(peptide1score)) + if (Double.isNaN(peptide1score)) { setScore(); + } double score = 0; // is the protein among the first site of proteins ArrayList prot1 = peptide1.getProteins(); int prot1size = prot1.size(); for (Protein p : prot1) { if (p.equals(prot)) { - score += peptide1score * peptide1score/prot1size; + score += peptide1score * peptide1score / prot1size; break; } } @@ -367,7 +418,7 @@ public double getProteinScore(Protein prot) { int prot2size = prot2.size(); for (Protein p : prot2) { if (p.equals(prot)) { - score += peptide1score * peptide1score/prot2size; + score += peptide1score * peptide1score / prot2size; break; } } @@ -376,12 +427,14 @@ public double getProteinScore(Protein prot) { /** * calculate the score of a Peptide based on the current PeptidePair + * * @param pep - * @return + * @return */ public double getPeptideScore(Peptide pep) { - if (Double.isNaN(peptide1score)) + if (Double.isNaN(peptide1score)) { setScore(); + } // is the protein among the first site of proteins if (pep.equals(peptide1)) { score += peptide1score * peptide1score; @@ -403,7 +456,8 @@ public Peptide getPeptide1() { /** * the second peptide of the pair - * @return + * + * @return */ public Peptide getPeptide2() { return peptide2; @@ -430,7 +484,7 @@ public int getPeptideLinkSite2() { public int getPeptideLinkSite(int peptide) { return peptide == 0 ? pepsite1 : pepsite2; } - + /** * @return the length of peptide 1 */ @@ -457,7 +511,8 @@ public double getScore() { /** * whether the first peptide is decoy - * @return + * + * @return */ public boolean isDecoy1() { return isDecoy1; @@ -465,7 +520,8 @@ public boolean isDecoy1() { /** * whether the second peptide is decoy - * @return + * + * @return */ public boolean isDecoy2() { return isDecoy2; @@ -473,8 +529,9 @@ public boolean isDecoy2() { /** * whether this could be an protein internal link.
- * Meaning whether there is an overlap between the proteins that the first + * Meaning whether there is an overlap between the proteins that the first * and the second peptide could originate from. + * * @return the isInternal */ @Override @@ -483,16 +540,19 @@ public boolean isInternal() { } /** - * Whether it is definitely not an internal and also not a linear peptide pair + * Whether it is definitely not an internal and also not a linear peptide + * pair + * * @return the isInternal */ @Override public boolean isBetween() { return (!isInternal) && (!isLinear); } - + /** * all peptides are target + * * @return the isTT */ @Override @@ -502,6 +562,7 @@ public boolean isTT() { /** * one peptide is decoy + * * @return the isTD */ @Override @@ -511,23 +572,24 @@ public boolean isTD() { /** * two peptides are decoy + * * @return the isDD */ @Override public boolean isDD() { return isDD; } - + /** * the assigned FDR group for this peptide pair - * @return + * + * @return */ @Override public String getFDRGroup() { return fdrGroup; } - // /** // * translates FDR-group IDs into FDR-group names // * @param fdrgroup @@ -541,10 +603,10 @@ public String getFDRGroup() { // } // return fdrGroupNames.get(fdrgroup); // } - /** * returns all supporting peptide pairs - meaning itself - * @return + * + * @return */ public Collection getPeptidePairs() { ArrayList ret = new ArrayList(1); @@ -554,7 +616,8 @@ public Collection getPeptidePairs() { /** * list of the peptides of this peptide pair - * @return + * + * @return */ public ArrayList getPeptides() { ArrayList ret = new ArrayList(2); @@ -566,30 +629,35 @@ public ArrayList getPeptides() { } /** - * returns a list of IDs of the top scoring PSMs for each precursor charge state - * of the PSMs that support this peptide pair. - * @return + * returns a list of IDs of the top scoring PSMs for each precursor charge + * state of the PSMs that support this peptide pair. + * + * @return */ public String getTopPSMIDs() { return RArrayUtils.toStringNoNull(chargeTopScoresPSM, ";"); } - + /** - * returns a list of the top scoring PSMs for each precursor charge state - * of the PSMs that support this peptide pair. - * @return + * returns a list of the top scoring PSMs for each precursor charge state of + * the PSMs that support this peptide pair. + * + * @return */ public Collection getTopPSMs() { ArrayList psms = new ArrayList<>(); - for (PSM p : chargeTopScoresPSM) - if (p!=null) + for (PSM p : chargeTopScoresPSM) { + if (p != null) { psms.add(p); + } + } return psms; } /** * A string representation of this peptide pair - * @return + * + * @return */ @Override public String toString() { @@ -607,7 +675,8 @@ public String toString() { /** * is any peptide a decoy - * @return + * + * @return */ public boolean isDecoy() { return isDecoy1 || isDecoy2; @@ -622,7 +691,8 @@ public static int[] getLenghtGroup() { /** * set maximum length groups for fdr - * @param aLenghtGroup + * + * @param aLenghtGroup */ public static void setLenghtGroup(int[] aLenghtGroup) { // make sure every value exists only ones @@ -649,33 +719,23 @@ public static void setLenghtGroup(int[] aLenghtGroup) { lenghtGroup[i] = dl[dl.length - 1 - i]; } - -// // give groups a name -// String[] groupNames = new String[]{"Linear", "Within", "Between", "Linear Special", "Within Special", "Between Special"}; -// fdrGroupNames.put(-1, "all combined"); -// for (int gn = 0; gn < groupNames.length; gn++) { -// int g = gn * (lenghtGroup.length); -// for (int i = 0; i < lenghtGroup.length; i++) { -// fdrGroupNames.put(g + i, groupNames[gn] + " >" + lenghtGroup[i]); -// } -// } - } - /** - * define a fdr-group id based on the inputs + /** + * define a fdr-group id based on the inputs + * * @param pep1 * @param pep2 * @param isLinear * @param isInternal * @param specialCase - * @return + * @return */ public static String getFDRGroup(Peptide pep1, Peptide pep2, boolean isLinear, boolean isInternal, Collection negativeGroups, Collection positiveGroups, String groupExt) { - String group = (isLinear ? "linear" : (isInternal ? "internal" :"between")); - groupExt=" " + groupExt; + String group = (isLinear ? "linear" : (isInternal ? "internal" : "between")); + groupExt = " " + groupExt; if (negativeGroups != null && negativeGroups.size() > 0) { - ArrayList ng = new ArrayList<>(negativeGroups); + ArrayList ng = new ArrayList<>(negativeGroups); java.util.Collections.sort(ng); groupExt += " n:" + RArrayUtils.toString(ng, " n:"); } @@ -689,61 +749,64 @@ public static String getFDRGroup(Peptide pep1, Peptide pep2, boolean isLinear, b // sorry is used rappsilber internally for targeted modification search Matcher m = targetMod.matcher(pep1.getSequence()); if (m.matches()) { - int mass = (int)(Math.round(Double.parseDouble(m.group(1))*10)); + int mass = (int) (Math.round(Double.parseDouble(m.group(1)) * 10)); // fdrGroup +=100 * mass; - groupExt = " " + (mass/10.0) + groupExt; - + groupExt = " " + (mass / 10.0) + groupExt; + } else { m = targetMod.matcher(pep2.getSequence()); if (m.matches()) { - int mass = (int)(Math.round(Double.parseDouble(m.group(1))*10)); - groupExt = " " + (mass/10.0) + groupExt; + int mass = (int) (Math.round(Double.parseDouble(m.group(1)) * 10)); + groupExt = " " + (mass / 10.0) + groupExt; } } - } - - if (isLinear) { - // and the next decision is based on minimum peptide length - for (int lg = 0; lg < lenghtGroup.length; lg++) { - if (pep1.length() > lenghtGroup[lg]) { - group += " > " + lenghtGroup[lg]; - break; + } + + if (lenghtGroup.length > 0 + && (lenghtGroup.length > 1 || lenghtGroup[0] > 0)) { + if (isLinear) { + // and the next decision is based on minimum peptide length + for (int lg = 0; lg < lenghtGroup.length; lg++) { + if (pep1.length() > lenghtGroup[lg]) { + group += " > " + lenghtGroup[lg]; + break; + } } - } - } else { - int peplength1 = pep1.length(); - int peplength2 = pep2.length(); - int pepMinLen; - if (peplength1 == 1 && pep1.getSequence().matches("^X-?[0-9\\.,]*")) { - pepMinLen = peplength2; - } else if (peplength2 == 1 && pep2.getSequence().matches("^X-?[0-9\\.,]*")) { - pepMinLen = peplength1; } else { - pepMinLen = Math.min(peplength1, peplength2); - } - - // and the next decision is based on minimum peptide length - for (int lg = 0; lg < lenghtGroup.length; lg++) { - if (pepMinLen > lenghtGroup[lg] ) { - group += " > " + lenghtGroup[lg]; - break; + int peplength1 = pep1.length(); + int peplength2 = pep2.length(); + int pepMinLen; + if (peplength1 == 1 && pep1.getSequence().matches("^X-?[0-9\\.,]*")) { + pepMinLen = peplength2; + } else if (peplength2 == 1 && pep2.getSequence().matches("^X-?[0-9\\.,]*")) { + pepMinLen = peplength1; + } else { + pepMinLen = Math.min(peplength1, peplength2); + } + + // and the next decision is based on minimum peptide length + for (int lg = 0; lg < lenghtGroup.length; lg++) { + if (pepMinLen > lenghtGroup[lg]) { + group += " > " + lenghtGroup[lg]; + break; + } } } } - - String g = FDRGroupNames.get(group+groupExt); + String g = FDRGroupNames.get(group + groupExt); return g; - + } - + /** * define the fdr-group for this match */ public void setFDRGroup() { String sc = null; - fdrGroup = getFDRGroup(peptide1, peptide2, isLinear, isInternal, m_negativeGroups, m_positiveGroups, isNonCovalent ? "NonCovalent":""); + fdrGroup = getFDRGroup(peptide1, peptide2, isLinear, isInternal, m_negativeGroups, m_positiveGroups, isNonCovalent ? "NonCovalent" : ""); } + /** * define the fdr-group for this match */ @@ -753,6 +816,7 @@ public void setFDRGroup(String fdrGroup) { /** * is this actually a single peptide + * * @return the isLinear */ @Override @@ -762,6 +826,7 @@ public boolean isLinear() { /** * is this actually a single peptide + * * @param isLinear the isLinear to set */ public void setLinear(boolean isLinear) { @@ -770,19 +835,23 @@ public void setLinear(boolean isLinear) { /** * The fdr assigned to the score of this peptide pair - * @param fdr + * + * @param fdr */ public void setFDR(double fdr) { m_fdr = fdr; for (PSM psm : chargeTopScoresPSM) { - if (psm != null) + if (psm != null) { psm.setFdrPeptidePair(this); + } } } + /** * The fdr assigned to the score of this peptide pair - * @return + * + * @return */ public double getFDR() { return m_fdr; @@ -790,22 +859,24 @@ public double getFDR() { /** * a link supported by this peptidepair that passed the fdr + * * @param l */ public void setFdrLink(ProteinGroupLink l) { this.m_link = l; if (l != null) { for (PSM psm : chargeTopScoresPSM) { - if (psm != null) + if (psm != null) { psm.setFdrPeptidePair(this); + } } } } - /** * a ProteinGroup supported by this peptidepair that passed the fdr - * @param pg + * + * @param pg */ public void setFdrProteinGroup(ProteinGroup pg) { @@ -813,8 +884,9 @@ public void setFdrProteinGroup(ProteinGroup pg) { this.fdrProteinGroup1 = null; this.fdrProteinGroup2 = null; for (PSM psm : chargeTopScoresPSM) { - if (psm != null) + if (psm != null) { psm.setFdrProteinGroup(null); + } } } else { if (pg.equals(peptide1.getProteinGroup())) { @@ -826,16 +898,18 @@ public void setFdrProteinGroup(ProteinGroup pg) { } for (PSM psm : chargeTopScoresPSM) { - if (psm != null) + if (psm != null) { psm.setFdrProteinGroup(pg); + } } } - + } /** * the first ProteinGroup supported by this peptidepair that passed the fdr - * @return + * + * @return */ public ProteinGroup getFdrProteinGroup1() { return this.fdrProteinGroup1; @@ -843,7 +917,8 @@ public ProteinGroup getFdrProteinGroup1() { /** * the second ProteinGroup supported by this peptidepair that passed the fdr - * @return + * + * @return */ public ProteinGroup getFdrProteinGroup2() { return this.fdrProteinGroup2; @@ -851,15 +926,16 @@ public ProteinGroup getFdrProteinGroup2() { /** * PSM id for the supporting PSM (only top scoring PSM per Charge state) - * @return + * + * @return */ public String[] getPSMids() { //String[] ret = new String[chargeTopScoresPSM.size()]; ArrayList ret = new ArrayList<>(chargeTopScoresPSM.length); - + int c = 0; for (PSM psm : chargeTopScoresPSM) { - if (psm!=null) { + if (psm != null) { ret.add(psm.getPsmID()); } } @@ -869,6 +945,7 @@ public String[] getPSMids() { /** * Unique id for this peptidepair + * * @return the peptidePairID */ public int getPeptidePairID() { @@ -877,7 +954,8 @@ public int getPeptidePairID() { /** * a link supported by this peptidepair that passed the FDR - * @return + * + * @return */ public ProteinGroupLink getFdrLink() { return this.m_link; @@ -885,7 +963,8 @@ public ProteinGroupLink getFdrLink() { /** * number of supporting peptides. Meaning 1 (itself) - * @return + * + * @return */ public int getPeptidePairCount() { return 1; @@ -931,32 +1010,35 @@ public int getPeptidePairCount() { // public HashSet getNegativeGrouping() { // return this.negativeGroups; // } - - /** * get the peptide at the given site + * * @param n - * @return + * @return */ public Object getSite(int n) { - return n==0 ? getPeptide1() : getPeptide2(); + return n == 0 ? getPeptide1() : getPeptide2(); } - /** + /** * how many site do we have - *

  • 2 - cross-linked peptides
  • + *

    + *

    • 2 - cross-linked peptides
    • *
    • 1 - linear peptide

    - * @return + * + * @return */ public int getSites() { - if (isLinear) + if (isLinear) { return 1; - else + } else { return 2; - } + } + } /** * is this a loop linked peptide + * * @return the isLoop */ public boolean isLoop() { @@ -965,25 +1047,28 @@ public boolean isLoop() { /** * is this a loop linked peptide + * * @param isLoop the isLoop to set */ public void setLoop(boolean isLoop) { this.isLoop = isLoop; } - + @Override public Site getLinkSite1() { - if (peptide1 == Peptide.NOPEPTIDE) + if (peptide1 == Peptide.NOPEPTIDE) { return null; - return new PeptideSite(peptide1,pepsite1); + } + return new PeptideSite(peptide1, pepsite1); } @Override public Site getLinkSite2() { - if (peptide2 == Peptide.NOPEPTIDE) + if (peptide2 == Peptide.NOPEPTIDE) { return null; - return new PeptideSite(peptide2,pepsite2); - } + } + return new PeptideSite(peptide2, pepsite2); + } /** * @return the psms @@ -1010,7 +1095,9 @@ public ProteinGroup getProteinGroup2() { } /** - * indicates that the two peptides where in the same spectrum but non-covalently linked + * indicates that the two peptides where in the same spectrum but + * non-covalently linked + * * @return the isNonCovalent */ public boolean isNonCovalent() { @@ -1018,13 +1105,15 @@ public boolean isNonCovalent() { } /** - * indicates that the two peptides where in the same spectrum but non-covalently linked + * indicates that the two peptides where in the same spectrum but + * non-covalently linked + * * @param isNonCovalent the isNonCovalent to set */ public void setNonCovalent(boolean isNonCovalent) { this.isNonCovalent = isNonCovalent; } - + // @Override // public boolean hasPositiveGrouping() { // return this.positiveGroups != null; @@ -1044,9 +1133,9 @@ public void setNonCovalent(boolean isNonCovalent) { // public HashSet getPositiveGrouping() { // return this.positiveGroups; // } - /** * is this a cross-link of consecutive peptides + * * @return the isConsecutive */ public boolean isConsecutive() { @@ -1055,10 +1144,11 @@ public boolean isConsecutive() { /** * is this a cross-link of consecutive peptides + * * @param isConsecutive the isConsecutive to set */ public void setConsecutive(boolean isConsecutive) { this.isConsecutive = isConsecutive; } - + } diff --git a/src/main/java/org/rappsilber/fdr/entities/Protein.java b/src/main/java/org/rappsilber/fdr/entities/Protein.java index 9d31195..ba50a5c 100644 --- a/src/main/java/org/rappsilber/fdr/entities/Protein.java +++ b/src/main/java/org/rappsilber/fdr/entities/Protein.java @@ -65,9 +65,9 @@ public Protein(long id, String accession, String description, boolean isDecoy, b this.id = id; // at some points we consider decoy and non decoy proteins the same. So // both get the same accession to make my life easier - if (accession.startsWith("REV_") || accession.startsWith("RAN_")) + if (accession.toUpperCase().startsWith("REV_") || accession.toUpperCase().startsWith("RAN_")) this.accession = accession.substring(4); - else if (accession.startsWith("DECOY:")) + else if (accession.toUpperCase().startsWith("DECOY:")) this.accession = accession.substring(6); else this.accession = accession; diff --git a/src/main/java/org/rappsilber/fdr/entities/ProteinGroup.java b/src/main/java/org/rappsilber/fdr/entities/ProteinGroup.java index 685edde..f7116f4 100644 --- a/src/main/java/org/rappsilber/fdr/entities/ProteinGroup.java +++ b/src/main/java/org/rappsilber/fdr/entities/ProteinGroup.java @@ -337,12 +337,8 @@ public void addPeptidePair(PeptidePair pp) { public String accessions() { StringBuffer sb = new StringBuffer(); - if (isDecoy()) { - sb.append("DECOY:"); - } - for (Protein p : groupproteins) { - sb.append(p.getAccession()); + sb.append((p.isDecoy()?"decoy:":"")+ p.getAccession()); sb.append(";"); } return sb.substring(0,sb.length() - 1); @@ -362,7 +358,7 @@ public String descriptions() { StringBuffer sb = new StringBuffer(); for (Protein p : groupproteins) { sb.append(";"); - sb.append(p.getDescription()); + sb.append(p.isDecoy()?"decoy:":p.getDescription()); } return sb.substring(1); } diff --git a/src/main/java/org/rappsilber/fdr/entities/ProteinGroupLink.java b/src/main/java/org/rappsilber/fdr/entities/ProteinGroupLink.java index e6109cf..cadb362 100644 --- a/src/main/java/org/rappsilber/fdr/entities/ProteinGroupLink.java +++ b/src/main/java/org/rappsilber/fdr/entities/ProteinGroupLink.java @@ -551,12 +551,10 @@ protected String getAccessions(HashMap positions) { isdecoy|= p.isDecoy(); IntArrayList pos = positions.get(p); for (Integer i : pos) { - sb.append(";"); - sb.append(p.getAccession()); + sb.append(";" ); + sb.append((p.isDecoy()?"decoy:":"") + p.getAccession()); } } - if (isdecoy) - return "DECOY:" + sb.substring(1); return sb.substring(1); } @@ -568,11 +566,9 @@ protected String getDescriptions(HashMap positions) { IntArrayList pos = positions.get(p); for (Integer i : pos) { sb.append(";"); - sb.append(p.getDescription()); + sb.append(p.isDecoy()?"decoy:":p.getDescription()); } } - if (isdecoy) - return "DECOY:" + sb.substring(1); return sb.substring(1); } diff --git a/src/main/java/org/rappsilber/fdr/gui/FDRGUI.form b/src/main/java/org/rappsilber/fdr/gui/FDRGUI.form index 9596533..b77afc0 100644 --- a/src/main/java/org/rappsilber/fdr/gui/FDRGUI.form +++ b/src/main/java/org/rappsilber/fdr/gui/FDRGUI.form @@ -43,6 +43,19 @@ + + + + + + + + + + + + + @@ -71,7 +84,7 @@ - + @@ -113,7 +126,7 @@ - + @@ -170,7 +183,7 @@ - + @@ -193,7 +206,7 @@ - + @@ -210,7 +223,7 @@ - + @@ -241,7 +254,7 @@ - + @@ -372,8 +385,8 @@ - - + + @@ -394,9 +407,9 @@ - + @@ -450,7 +463,7 @@ - + @@ -579,16 +592,16 @@ - + - + - + @@ -596,7 +609,7 @@ - + @@ -624,6 +637,7 @@ + @@ -643,7 +657,9 @@ - + + + @@ -718,6 +734,12 @@ + + + + + + @@ -841,7 +863,7 @@ - + @@ -1277,7 +1299,7 @@ - + @@ -1440,7 +1462,7 @@ - + @@ -1591,10 +1613,11 @@ - - - - + + + + + @@ -1645,14 +1668,14 @@ - + - + @@ -1727,7 +1750,7 @@ - + @@ -1823,7 +1846,7 @@ - + diff --git a/src/main/java/org/rappsilber/fdr/gui/FDRGUI.java b/src/main/java/org/rappsilber/fdr/gui/FDRGUI.java index 4145b8b..389d36e 100644 --- a/src/main/java/org/rappsilber/fdr/gui/FDRGUI.java +++ b/src/main/java/org/rappsilber/fdr/gui/FDRGUI.java @@ -56,6 +56,7 @@ import org.rappsilber.fdr.CSVinFDR; import org.rappsilber.fdr.DBinFDR; import org.rappsilber.fdr.FDRSettings; +import org.rappsilber.fdr.FDRSettingsImpl; import org.rappsilber.fdr.result.FDRResult; import org.rappsilber.fdr.result.FDRResultLevel; import org.rappsilber.fdr.MZIdentXLFDR; @@ -72,7 +73,7 @@ import org.rappsilber.fdr.utils.MaximisingStatus; import org.rappsilber.fdr.utils.MaximizingUpdate; import org.rappsilber.fdr.utils.MiscUtils; -import org.rappsilber.fdr.utils.mzIdentMLOwner; +import org.rappsilber.fdr.utils.MZIdentMLOwner; import org.rappsilber.gui.components.AutoAddTableModelListener; import org.rappsilber.gui.GenericTextPopUpMenu; import org.rappsilber.gui.components.JoinedThreadedTextOuput; @@ -164,6 +165,7 @@ public boolean isLoggable(LogRecord record) { ArrayList spins = new ArrayList(); con.add(this); con.add(fdrSettingsComplete); + con.add(fdrSettingsMedium); con.add(fdrSettingsSimple); makeSpinnersSelectTextOnEnter(con, spinSet, spins); @@ -172,9 +174,6 @@ public boolean isLoggable(LogRecord record) { // hide the FDR-groups panel ckDefineGroupsActionPerformed(null); - // preset minimum peptide-length - fdrSettingsComplete.setMinPeptideLength(6); - fdrSettingsSimple.setMinPeptideLength(6); ActionListener stopMaximizingAl = new ActionListener() { @@ -185,11 +184,16 @@ public void actionPerformed(ActionEvent e) { }; fdrSettingsComplete.addStopMaximizingListener(stopMaximizingAl); + fdrSettingsMedium.addStopMaximizingListener(stopMaximizingAl); fdrSettingsSimple.addStopMaximizingListener(stopMaximizingAl); + // preset minimum peptide-length fdrSettingsComplete.setMinPeptideLength(6); + fdrSettingsMedium.setMinPeptideLength(6); fdrSettingsSimple.setMinPeptideLength(6); + fdrSettingsComplete.setReportFactor(100000); + fdrSettingsMedium.setReportFactor(100000); fdrSettingsSimple.setReportFactor(100000); ActionListener calcListener = new ActionListener() { @@ -198,13 +202,14 @@ public void actionPerformed(ActionEvent e) { if (e.getActionCommand().contentEquals("boost")) { fdrSettingsComplete.btnStopBoost.setEnabled(true); fdrSettingsSimple.btnStopBoost.setEnabled(true); + fdrSettingsMedium.btnStopBoost.setEnabled(true); } basicCalc(); } }; fdrSettingsSimple.addCalcListener(calcListener); - + fdrSettingsMedium.addCalcListener(calcListener); fdrSettingsComplete.addCalcListener(calcListener); spDistanceGroup.setSpecialValueText("No distance group"); @@ -484,6 +489,7 @@ public OfflineFDR getFdr() { */ public void setFdr(OfflineFDR m_fdr) { this.m_fdr = m_fdr; + ckGroupByCrossLinkerStubs.setEnabled(m_fdr.stubsFound()); } /** @@ -593,7 +599,7 @@ protected void exportMZIdentML() { if ( getFdr() instanceof MZIdentXLFDR) { writeMZIdentML(); } else if (getFdr()instanceof XiInFDR) { - MZIdentMLExport export = new MZIdentMLExport(getFdr(), getResult(), new mzIdentMLOwner(getMzIdentMLOwnerFirst(), getMzIdentMLOwnerLast(), getMzIdentMLOwnerEmail(), getMzIdentMLOwnerOrg(), getMzIdentMLOwnerAdress())); + MZIdentMLExport export = new MZIdentMLExport(getFdr(), getResult(), new MZIdentMLOwner(getMzIdentMLOwnerFirst(), getMzIdentMLOwnerLast(), getMzIdentMLOwnerEmail(), getMzIdentMLOwnerOrg(), getMzIdentMLOwnerAdress())); export.setForceExtension(cmbPeakListFormat.getSelectedItem().toString()); export.setMZMLTemplate(cmbMzMLScan2ID.getSelectedItem().toString()); export.convertFile(f.getAbsolutePath()); @@ -837,8 +843,8 @@ public void run() { }else { ofdr = new CSVinFDR(); } - setFdr(ofdr); addCSV(ofdr, null, csv,filter); + setFdr(ofdr); while (csvs.hasNext()) { csv = csvs.next(); @@ -1181,45 +1187,15 @@ protected void reportResultToSumaryTab(OfflineFDR ofdr, FDRResult result) { private void basicCalc() { if (getFdr() != null) { - fdrSettingsComplete.setPSMDirectional(fdrSettings.isPSMDirectional()); - fdrSettingsComplete.setPeptidePairDirectional(fdrSettings.isPeptidePairDirectional()); - fdrSettingsComplete.setLinkDirectional(fdrSettings.isLinkDirectional()); - fdrSettingsComplete.setPPIDirectional(fdrSettings.isPPIDirectional()); - - fdrSettingsComplete.setPSMFDR(fdrSettings.getPSMFDR()); - fdrSettingsComplete.setPeptidePairFDR(fdrSettings.getPeptidePairFDR()); - fdrSettingsComplete.setProteinGroupFDR(fdrSettings.getProteinGroupFDR()); - fdrSettingsComplete.setProteinGroupLinkFDR(fdrSettings.getProteinGroupLinkFDR()); - fdrSettingsComplete.setProteinGroupPairFDR(fdrSettings.getProteinGroupPairFDR()); - - fdrSettingsComplete.setMaxLinkAmbiguity(fdrSettings.getMaxLinkAmbiguity()); - fdrSettingsComplete.setMaxProteinAmbiguity(fdrSettings.getMaxProteinAmbiguity()); - fdrSettingsComplete.setMinLinkPepCount(fdrSettings.getMinLinkPepCount()); - fdrSettingsComplete.setMinPPIPepCount(fdrSettings.getMinPPIPepCount()); - fdrSettingsComplete.setMinPeptideLength(fdrSettings.getMinPeptideLength()); - fdrSettingsComplete.setMinProteinPepCount(fdrSettings.getMinProteinPepCount()); - - fdrSettingsSimple.setPSMDirectional(fdrSettings.isPSMDirectional()); - fdrSettingsSimple.setPeptidePairDirectional(fdrSettings.isPeptidePairDirectional()); - fdrSettingsSimple.setLinkDirectional(fdrSettings.isLinkDirectional()); - fdrSettingsSimple.setPPIDirectional(fdrSettings.isPPIDirectional()); - - fdrSettingsSimple.setPSMFDR(fdrSettings.getPSMFDR()); - fdrSettingsSimple.setPeptidePairFDR(fdrSettings.getPeptidePairFDR()); - fdrSettingsSimple.setProteinGroupFDR(fdrSettings.getProteinGroupFDR()); - fdrSettingsSimple.setProteinGroupLinkFDR(fdrSettings.getProteinGroupLinkFDR()); - fdrSettingsSimple.setProteinGroupPairFDR(fdrSettings.getProteinGroupPairFDR()); - - fdrSettingsSimple.setMaxLinkAmbiguity(fdrSettings.getMaxLinkAmbiguity()); - fdrSettingsSimple.setMaxProteinAmbiguity(fdrSettings.getMaxProteinAmbiguity()); - fdrSettingsSimple.setMinLinkPepCount(fdrSettings.getMinLinkPepCount()); - fdrSettingsSimple.setMinPPIPepCount(fdrSettings.getMinPPIPepCount()); - fdrSettingsSimple.setMinPeptideLength(fdrSettings.getMinPeptideLength()); - fdrSettingsSimple.setMinProteinPepCount(fdrSettings.getMinProteinPepCount()); + FDRSettingsImpl.transferSettings(fdrSettings, fdrSettingsComplete); + FDRSettingsImpl.transferSettings(fdrSettings, fdrSettingsMedium); + FDRSettingsImpl.transferSettings(fdrSettings, fdrSettingsSimple); getFdr().setGroupByProteinPair(fdrSettings.isGroupByPSMCount()); getFdr().setMinDecoys(fdrSettings.getMinTD()); - + + fdrSettings.setGroupByCrosslinkerStubs(ckGroupByCrossLinkerStubs.isEnabled() && ckGroupByCrossLinkerStubs.isSelected()); + if (fdrSettings.doOptimize() != null) { final OfflineFDR.FDRLevel l = fdrSettings.doOptimize(); if (l == OfflineFDR.FDRLevel.PSM) @@ -1229,6 +1205,7 @@ private void basicCalc() { public void run() { maximise(l, fdrSettings.getBoostBetween()); fdrSettingsComplete.btnStopBoost.setEnabled(false); + fdrSettingsMedium.btnStopBoost.setEnabled(false); fdrSettingsSimple.btnStopBoost.setEnabled(false); } @@ -1236,27 +1213,6 @@ public void run() { ml.start(); } - -// switch (fdrSettings.doOptimize()) { -// case PROTEINGROUPLINK: -// Thread ml = new Thread() { -// public void run() { -// maximiseLink(fdrSettings.getBoostBetween()); -// } -// }; -// ml.start(); -// return; -// -// case PROTEINGROUPPAIR: -// Thread mp = new Thread() { -// public void run() { -// maximisePPI(fdrSettings.getBoostBetween()); -// } -// }; -// mp.start(); -// return; -// } -// JOptionPane.showMessageDialog(this, "Boosting of that Level currently not supported!"); } else { calculateFDR(); } @@ -1303,6 +1259,7 @@ public void run() { // btnMaxLink.setEnabled(enable); // btnMaxPPI.setEnabled(enable); fdrSettingsComplete.setEnabled(enable); + fdrSettingsMedium.setEnabled(enable); fdrSettingsSimple.setEnabled(enable); } }; @@ -1360,6 +1317,12 @@ public void run() { fdrSettingsComplete.setProteinGroupFDR(state.showProtFDR); fdrSettingsComplete.setProteinGroupLinkFDR(state.showLinkFDR); + fdrSettingsMedium.setPeptidePairFDR(state.showPepFDR); + fdrSettingsMedium.setPSMFDR(state.showPSMFDR); + fdrSettingsMedium.setPeptidePairFDR(state.showPepFDR); + fdrSettingsMedium.setProteinGroupFDR(state.showProtFDR); + fdrSettingsMedium.setProteinGroupLinkFDR(state.showLinkFDR); + txtSumPSM.setText(state.showPSMCount); txtSumPepPairs.setText(state.showPepCount); @@ -1409,7 +1372,6 @@ public void run() { private void changeFDRSettings(java.awt.event.ActionEvent evt) { - if (rbFDRSimple.isSelected()) { if (fdrSettings != null) { fdrSettingsSimple.setAll(fdrSettings); @@ -1419,6 +1381,15 @@ private void changeFDRSettings(java.awt.event.ActionEvent evt) { } spFDRSettingsWrapper.setViewportView(fdrSettingsSimple); fdrSettings = fdrSettingsSimple; + } else if (rbFDRMedium.isSelected()) { + if (fdrSettings != null) { + fdrSettingsMedium.setAll(fdrSettings); + } + if (spFDRSettingsWrapper.getComponentCount() > 3) { + spFDRSettingsWrapper.remove(spFDRSettingsWrapper.getComponent(3)); + } + spFDRSettingsWrapper.setViewportView(fdrSettingsMedium); + fdrSettings = fdrSettingsMedium; } else if (rbFDRComplete.isSelected()) { if (fdrSettings != null) { fdrSettingsComplete.setAll(fdrSettings); @@ -1436,11 +1407,13 @@ public void setFDRSettings(final FDRSettings settings) { EventQueue.invokeLater(new Runnable() { @Override public void run() { - rbFDRComplete.setSelected(true); + rbFDRMedium.setSelected(true); + rbFDRComplete.setSelected(false); rbFDRSimple.setSelected(false); rbFDRCompleteActionPerformed(null); fdrSettingsSimple.setAll(settings); + fdrSettingsMedium.setAll(settings); fdrSettingsComplete.setAll(settings); } }); @@ -1450,7 +1423,8 @@ public void setInput(final String fileName) { EventQueue.invokeLater(new Runnable() { @Override public void run() { - csvSelect.setInputFile(fileName); + csvSelect.setInputFile(fileName); + tpInput.setSelectedComponent(pCSVInput); } }); } @@ -1477,6 +1451,9 @@ public void run() { }); } + public void setCSVOutFile(String path) { + fbFolder.setFile(path); + } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always @@ -1493,15 +1470,17 @@ private void initComponents() { bgFDRSettingType = new javax.swing.ButtonGroup(); fdrSettingsComplete = new org.rappsilber.fdr.gui.components.FDRSettingsComplete(); fdrSettingsSimple = new org.rappsilber.fdr.gui.components.FDRSettingsSimple(); + fdrSettingsMedium = new org.rappsilber.fdr.gui.components.FDRSettingsMedium(); + rbFDRSimple = new javax.swing.JRadioButton(); jScrollPane6 = new javax.swing.JScrollPane(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel2 = new javax.swing.JPanel(); tpInput = new javax.swing.JTabbedPane(); pDatabase = new javax.swing.JPanel(); getDBFDR = new org.rappsilber.fdr.gui.components.GetDBFDR(); - jPanel6 = new javax.swing.JPanel(); + pCSVInput = new javax.swing.JPanel(); csvSelect = new org.rappsilber.fdr.gui.components.CSVSelection(); - jPanel11 = new javax.swing.JPanel(); + pMZIdentMLInput = new javax.swing.JPanel(); fbMZIdentMLIn = new org.rappsilber.gui.components.FileBrowser(); jLabel19 = new javax.swing.JLabel(); btnReadMZIdent = new javax.swing.JButton(); @@ -1523,7 +1502,7 @@ private void initComponents() { spTargetDBLinks = new javax.swing.JSpinner(); lblLinkDB = new javax.swing.JLabel(); ckDBSize = new javax.swing.JCheckBox(); - rbFDRSimple = new javax.swing.JRadioButton(); + rbFDRMedium = new javax.swing.JRadioButton(); rbFDRComplete = new javax.swing.JRadioButton(); spFDRSettingsWrapper = new javax.swing.JScrollPane(); pFDRGroups = new javax.swing.JPanel(); @@ -1536,6 +1515,7 @@ private void initComponents() { cbGroupLinksBySelf = new javax.swing.JCheckBox(); cbGroupPPIBySelf = new javax.swing.JCheckBox(); cbGroupRun = new javax.swing.JCheckBox(); + ckGroupByCrossLinkerStubs = new javax.swing.JCheckBox(); ckDefineGroups = new javax.swing.JCheckBox(); pResult = new javax.swing.JPanel(); tpResult = new javax.swing.JTabbedPane(); @@ -1641,6 +1621,14 @@ private void initComponents() { fdrSettingsSimple.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + bgFDRSettingType.add(rbFDRSimple); + rbFDRSimple.setText("Simple FDR"); + rbFDRSimple.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + changFDRSettingsInterface(evt); + } + }); + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Cross-Link FDR"); addFocusListener(new java.awt.event.FocusAdapter() { @@ -1681,24 +1669,24 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); - jPanel6.setLayout(jPanel6Layout); - jPanel6Layout.setHorizontalGroup( - jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel6Layout.createSequentialGroup() + javax.swing.GroupLayout pCSVInputLayout = new javax.swing.GroupLayout(pCSVInput); + pCSVInput.setLayout(pCSVInputLayout); + pCSVInputLayout.setHorizontalGroup( + pCSVInputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pCSVInputLayout.createSequentialGroup() .addContainerGap() .addComponent(csvSelect, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); - jPanel6Layout.setVerticalGroup( - jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel6Layout.createSequentialGroup() + pCSVInputLayout.setVerticalGroup( + pCSVInputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pCSVInputLayout.createSequentialGroup() .addContainerGap() - .addComponent(csvSelect, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(csvSelect, javax.swing.GroupLayout.DEFAULT_SIZE, 361, Short.MAX_VALUE) .addContainerGap()) ); - tpInput.addTab("CSV", jPanel6); + tpInput.addTab("CSV", pCSVInput); fbMZIdentMLIn.setDescription("MZIdentML-Files"); fbMZIdentMLIn.setExtensions(new String[] {"mzid"}); @@ -1739,36 +1727,36 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11); - jPanel11.setLayout(jPanel11Layout); - jPanel11Layout.setHorizontalGroup( - jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel11Layout.createSequentialGroup() + javax.swing.GroupLayout pMZIdentMLInputLayout = new javax.swing.GroupLayout(pMZIdentMLInput); + pMZIdentMLInput.setLayout(pMZIdentMLInputLayout); + pMZIdentMLInputLayout.setHorizontalGroup( + pMZIdentMLInputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pMZIdentMLInputLayout.createSequentialGroup() .addContainerGap() - .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel11Layout.createSequentialGroup() + .addGroup(pMZIdentMLInputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pMZIdentMLInputLayout.createSequentialGroup() .addComponent(jLabel19) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(fbMZIdentMLIn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnReadMZIdent)) - .addGroup(jPanel11Layout.createSequentialGroup() + .addGroup(pMZIdentMLInputLayout.createSequentialGroup() .addComponent(jLabel22) .addGap(239, 239, 239) - .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel11Layout.createSequentialGroup() - .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pMZIdentMLInputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pMZIdentMLInputLayout.createSequentialGroup() + .addGroup(pMZIdentMLInputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(rbMZLowBetter) .addComponent(rbMZHighBetter)) - .addGap(88, 375, Short.MAX_VALUE)) + .addGap(88, 437, Short.MAX_VALUE)) .addComponent(cbMZMatchScoreName, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addContainerGap()) ); - jPanel11Layout.setVerticalGroup( - jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel11Layout.createSequentialGroup() + pMZIdentMLInputLayout.setVerticalGroup( + pMZIdentMLInputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(pMZIdentMLInputLayout.createSequentialGroup() .addContainerGap() - .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(pMZIdentMLInputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel22) .addComponent(cbMZMatchScoreName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(1, 1, 1) @@ -1776,22 +1764,22 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(rbMZLowBetter) .addGap(18, 18, 18) - .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(pMZIdentMLInputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(pMZIdentMLInputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnReadMZIdent) .addComponent(jLabel19)) .addComponent(fbMZIdentMLIn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(259, Short.MAX_VALUE)) ); - tpInput.addTab("mzIdentML", jPanel11); + tpInput.addTab("mzIdentML", pMZIdentMLInput); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() - .addComponent(tpInput, javax.swing.GroupLayout.PREFERRED_SIZE, 824, Short.MAX_VALUE) + .addComponent(tpInput) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( @@ -1864,7 +1852,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(spDecoyDBProt, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(spTargetDBProt, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblProtein, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(321, Short.MAX_VALUE)) + .addContainerGap(384, Short.MAX_VALUE)) ); pDatabseSizeLayout.setVerticalGroup( pDatabseSizeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -1899,17 +1887,17 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - bgFDRSettingType.add(rbFDRSimple); - rbFDRSimple.setSelected(true); - rbFDRSimple.setText("Simple FDR"); - rbFDRSimple.addActionListener(new java.awt.event.ActionListener() { + bgFDRSettingType.add(rbFDRMedium); + rbFDRMedium.setSelected(true); + rbFDRMedium.setText("Reduced"); + rbFDRMedium.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - changFDRSettingsInterface(evt); + rbFDRMediumActionPerformed(evt); } }); bgFDRSettingType.add(rbFDRComplete); - rbFDRComplete.setText("complete FDR"); + rbFDRComplete.setText("Complete FDR"); rbFDRComplete.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rbFDRCompleteActionPerformed(evt); @@ -1961,6 +1949,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { cbGroupRun.setText("PSMs by Run"); + ckGroupByCrossLinkerStubs.setText("MS Cleavable XL Grouping"); + ckGroupByCrossLinkerStubs.setToolTipText("If the present PSMs will be groupped by presents of peptides with crosslinker stub fragments"); + javax.swing.GroupLayout pFDRGroupsLayout = new javax.swing.GroupLayout(pFDRGroups); pFDRGroups.setLayout(pFDRGroupsLayout); pFDRGroupsLayout.setHorizontalGroup( @@ -1976,7 +1967,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(spDistanceGroup, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(ckIgnoreGroups1, javax.swing.GroupLayout.PREFERRED_SIZE, 226, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(cbGroupPepsBySelf)) + .addComponent(cbGroupPepsBySelf) + .addComponent(ckGroupByCrossLinkerStubs)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pFDRGroupsLayout.setVerticalGroup( @@ -1993,7 +1985,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(cbGroupLinksBySelf) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(cbGroupPPIBySelf) - .addGap(35, 35, 35) + .addGap(4, 4, 4) + .addComponent(ckGroupByCrossLinkerStubs) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(pFDRGroupsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(spDistanceGroup, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)) @@ -2019,7 +2013,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(ckDBSize) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(spExtraLongLayout.createSequentialGroup() - .addComponent(rbFDRSimple) + .addComponent(rbFDRMedium) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(rbFDRComplete) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -2035,9 +2029,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(spExtraLongLayout.createSequentialGroup() .addContainerGap() .addGroup(spExtraLongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(rbFDRSimple) .addComponent(rbFDRComplete) - .addComponent(ckDefineGroups)) + .addComponent(ckDefineGroups) + .addComponent(rbFDRMedium)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(spExtraLongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(spFDRSettingsWrapper) @@ -2238,7 +2232,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup() .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jPanel18, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jPanel20, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 635, Short.MAX_VALUE) + .addComponent(jPanel20, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 698, Short.MAX_VALUE) .addComponent(jPanel16, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel15, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -2369,7 +2363,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGap(0, 0, Short.MAX_VALUE)) .addGroup(jPanel10Layout.createSequentialGroup() .addComponent(rbCSV) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 466, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 538, Short.MAX_VALUE) .addComponent(btnWrite)) .addComponent(lpCsvOutLocal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(23, 23, 23)) @@ -2452,7 +2446,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { lblPeaklistExtension.setText("Peak-list file extension"); - cmbPeakListFormat.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "mzML", "raw", "mgf" })); + cmbPeakListFormat.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "mgf", "mzML", "raw", " " })); cmbMzMLScan2ID.setEditable(true); cmbMzMLScan2ID.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "controllerType=0 controllerNumber=1 scan=%s%", "controllerType=0 controllerNumber=1 scan=%s-1%", "scan=%s%", "scan=%s-1%", "%s%" })); @@ -2491,7 +2485,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(txtmzIdentOwnerEmail) .addComponent(txtmzIdentOwnerOrg) .addComponent(cmbPeakListFormat, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, 302, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, 350, Short.MAX_VALUE) .addComponent(btnWriteMzIdentML))))) .addContainerGap()) ); @@ -2546,13 +2540,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { pPeakListLookupLayout.setHorizontalGroup( pPeakListLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pPeakListLookupLayout.createSequentialGroup() - .addContainerGap(739, Short.MAX_VALUE) + .addContainerGap(805, Short.MAX_VALUE) .addComponent(btnPeakListParse) .addContainerGap()) .addGroup(pPeakListLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pPeakListLookupLayout.createSequentialGroup() .addContainerGap() - .addComponent(flPeakLists, javax.swing.GroupLayout.DEFAULT_SIZE, 802, Short.MAX_VALUE) + .addComponent(flPeakLists, javax.swing.GroupLayout.DEFAULT_SIZE, 865, Short.MAX_VALUE) .addContainerGap())) ); pPeakListLookupLayout.setVerticalGroup( @@ -2606,7 +2600,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addContainerGap() .addGroup(pLogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(spLog) - .addComponent(memory2, javax.swing.GroupLayout.DEFAULT_SIZE, 801, Short.MAX_VALUE) + .addComponent(memory2, javax.swing.GroupLayout.DEFAULT_SIZE, 870, Short.MAX_VALUE) .addComponent(cbLevel, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); @@ -2639,7 +2633,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(pVersionLayout.createSequentialGroup() .addContainerGap() .addGroup(pVersionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 789, Short.MAX_VALUE) + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 865, Short.MAX_VALUE) .addGroup(pVersionLayout.createSequentialGroup() .addComponent(jLabel29) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -2707,7 +2701,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 839, Short.MAX_VALUE) + .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 902, Short.MAX_VALUE) .addComponent(jSplitPane1) ); layout.setVerticalGroup( @@ -2948,6 +2942,10 @@ public void run() { peaklistparser.start(); }//GEN-LAST:event_btnPeakListParseActionPerformed + private void rbFDRMediumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbFDRMediumActionPerformed + changeFDRSettings(evt); + }//GEN-LAST:event_rbFDRMediumActionPerformed + // private void fdrSpinnerMaximumCheck(JSpinner sp, double max) { // SpinnerModel sm = sp.getModel(); // Double fdr = (Double) sm.getValue(); @@ -3021,6 +3019,7 @@ public void run() { private javax.swing.JComboBox cbMZMatchScoreName; private javax.swing.JCheckBox ckDBSize; private javax.swing.JCheckBox ckDefineGroups; + private javax.swing.JCheckBox ckGroupByCrossLinkerStubs; private javax.swing.JCheckBox ckIgnoreGroups1; public javax.swing.JCheckBox ckPrePostAA; protected javax.swing.JComboBox cmbMzMLScan2ID; @@ -3033,6 +3032,7 @@ public void run() { private org.rappsilber.gui.components.FileBrowser fbMZIdentMLIn; private org.rappsilber.gui.components.FileBrowser fbMzIdentMLOut; private org.rappsilber.fdr.gui.components.FDRSettingsComplete fdrSettingsComplete; + private org.rappsilber.fdr.gui.components.FDRSettingsMedium fdrSettingsMedium; private org.rappsilber.fdr.gui.components.FDRSettingsSimple fdrSettingsSimple; private org.rappsilber.gui.components.FileList flPeakLists; private org.rappsilber.fdr.gui.components.GetDBFDR getDBFDR; @@ -3059,7 +3059,6 @@ public void run() { private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel10; - private javax.swing.JPanel jPanel11; private javax.swing.JPanel jPanel12; private javax.swing.JPanel jPanel14; private javax.swing.JPanel jPanel15; @@ -3069,7 +3068,6 @@ public void run() { private javax.swing.JPanel jPanel20; private javax.swing.JPanel jPanel21; private javax.swing.JPanel jPanel22; - private javax.swing.JPanel jPanel6; private javax.swing.JPanel jPanel8; private javax.swing.JPanel jPanel9; private javax.swing.JScrollPane jScrollPane1; @@ -3096,15 +3094,18 @@ public void run() { private org.rappsilber.gui.components.memory.Memory memory2; private org.rappsilber.gui.components.memory.Memory memory3; private javax.swing.JPanel pAbout; + private javax.swing.JPanel pCSVInput; private javax.swing.JPanel pDatabase; private javax.swing.JPanel pDatabseSize; private javax.swing.JPanel pFDRGroups; private javax.swing.JPanel pLog; + private javax.swing.JPanel pMZIdentMLInput; private javax.swing.JPanel pPeakListLookup; private javax.swing.JPanel pResult; private javax.swing.JPanel pVersion; private javax.swing.JRadioButton rbCSV; private javax.swing.JRadioButton rbFDRComplete; + private javax.swing.JRadioButton rbFDRMedium; private javax.swing.JRadioButton rbFDRSimple; private javax.swing.JRadioButton rbMZHighBetter; private javax.swing.JRadioButton rbMZLowBetter; diff --git a/src/main/java/org/rappsilber/fdr/gui/FDRLevelInformations.java b/src/main/java/org/rappsilber/fdr/gui/FDRLevelInformations.java index 13fbdad..77f9d0d 100644 --- a/src/main/java/org/rappsilber/fdr/gui/FDRLevelInformations.java +++ b/src/main/java/org/rappsilber/fdr/gui/FDRLevelInformations.java @@ -18,7 +18,6 @@ import java.util.Set; import org.rappsilber.data.csv.CSVRandomAccess; import org.rappsilber.fdr.result.FDRResultLevel; -import org.rappsilber.fdr.OfflineFDR; import org.rappsilber.fdr.result.SubGroupFdrInfo; import org.rappsilber.fdr.utils.MiscUtils; @@ -65,7 +64,7 @@ public FDRLevelInformations(FDRResultLevel level, String title) { rowString[7] = "" + sg.filteredResult.size() ; rowString[8] = "" + sg.worstAcceptedScore; - rowString[9] = "" + !sg.didntPassCheck; + rowString[9] = (sg.didntPassCheck == null ? "true" : sg.didntPassCheck); csv.insertLine(csv.getRowCount(), rowString); } diff --git a/src/main/java/org/rappsilber/fdr/gui/components/CSVSelection.form b/src/main/java/org/rappsilber/fdr/gui/components/CSVSelection.form index 44096c9..2b314d2 100644 --- a/src/main/java/org/rappsilber/fdr/gui/components/CSVSelection.form +++ b/src/main/java/org/rappsilber/fdr/gui/components/CSVSelection.form @@ -30,6 +30,17 @@ + + + + + + + + + + + @@ -68,7 +79,7 @@ - + @@ -79,11 +90,11 @@ - + - + @@ -103,8 +114,8 @@ - - + + @@ -146,7 +157,7 @@ - + @@ -169,6 +180,9 @@ + + + @@ -187,6 +201,9 @@ + + + @@ -479,120 +496,102 @@ - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/org/rappsilber/fdr/gui/components/CSVSelection.java b/src/main/java/org/rappsilber/fdr/gui/components/CSVSelection.java index 3d6b962..d7d359b 100644 --- a/src/main/java/org/rappsilber/fdr/gui/components/CSVSelection.java +++ b/src/main/java/org/rappsilber/fdr/gui/components/CSVSelection.java @@ -163,6 +163,69 @@ public void actionPerformed(ActionEvent e) { columnNamesColumn.setCellEditor(new NeededOptionalComboBoxCellEditor(cbCSVHeaders, cbCSVHeaderOptional)); resetColumnMappings(); //spAdditional.setVisible(false); + + tblCSVColumns.setModel(new javax.swing.table.DefaultTableModel( + new Object [][] { + {"run", new Boolean(true), "raw file name that the spectrum derived from", ""}, + {"scan", new Boolean(true), "scan number within that run", null}, + {"psmid", new Boolean(true), "a unique ID for the PSM - if not given will be defined based on run and scan", null}, + {"peak list file", new Boolean(true), "the name of the actual peak file containing the spectrum (needed for mzML export)", null}, + {"peak list index", new Boolean(true), "an index for the spectrum within the file(needed for mzML export)", null}, + {"rank", new Boolean(true), "The rank of the PSM (e.g. 1=best match for a spectrum ;2 second best ...)", null}, + {"peptide1", null, "sequence of the first peptide", null}, + {"peptide2", null, "sequence of the second peptide", null}, + {"peptide length 1", new Boolean(true), "length (in amino acids) of the first peptide", null}, + {"peptide length 2", new Boolean(true), "length (in amino acids) of the second peptide", null}, + {"peptide link 1", null, "which residue of the first peptide does the cross-linker attach to", null}, + {"peptide link 2", null, "which residue of the second peptide does the cross-linker attach to", null}, + {"is decoy 1", null, "is the first peptide from the decoy database", null}, + {"is decoy 2", null, "is the second peptide from the decoy database", null}, + {"precursor charge", null, "charge state of the precursor ion", null}, + {"score", new Boolean(true), "score of the spectrum match", null}, + {"score ratio", new Boolean(true), "if there is a joined score given for the match how to separate the score for cases where each peptide individually has to be considered (only affects protein fdr)", null}, + {"peptide1 score", new Boolean(true), "a score for the first peptide", null}, + {"peptide2 score", new Boolean(true), "a score for the second peptide", null}, + {"accession1", null, "protein accession number(s) for the source of the first peptide", null}, + {"accession2", null, "protein accession number(s) for the source of the second peptide", null}, + {"description1", new Boolean(true), "description of the first protein", null}, + {"description2", new Boolean(true), "description of the second protein", null}, + {"peptide position 1", null, "position(s) of the first peptide in the protein(s)", null}, + {"peptide position 2", null, "position(s) of the second peptide in the protein(s)", null}, + {"crosslinker", new Boolean(true), "name of the cross-linker involved in this PSM", null}, + {"crossLinkerModMass", new Boolean(true), "mass difference between the sum of the non-cross-linked peptides and teh cross-linked peptides", null}, + {"experimental mz", new Boolean(true), "experimental precursor M/Z", null}, + {"calculated mass", new Boolean(true), "calculated mass of the precursor", null}, + {"negative grouping", new Boolean(true), "if some matches have an inherently higher chance to be false positive then they can be flaged here", null}, + {"positive grouping", new Boolean(true), "if some matches have an inherently lower chance to be false positive then they can be flaged here", null}, + {"info", new Boolean(true), "arbitrary info field to be forwarded to the results table", null}, + {"delta score", new Boolean(true), "the delta score of the match", null}, + {"peptide coverage1", new Boolean(true), "how well is peptide explained", null}, + {"peptide coverage2", new Boolean(true), "how well is peptide 2 explained", null}, + {"minimum peptide coverage", new Boolean(true), "how well is the wors explained peptide explained", null}, + {"peptide1 fragments", new Boolean(true), "How many fragments where assigned to peptide 1", null}, + {"peptide2 fragments", new Boolean(true), "How many fragments where assigned to peptide 2", null}, + {"peptides with stubs", new Boolean(true), "For how many peptides was an cross-linker stub identified", null}, + {"peptides with doublets", new Boolean(true), "For how many peptides was an doublet of cross-linker stubs identified", null} + }, + new String [] { + "Column", "Optional", "Description", "Name in CSV" + } + ) { + Class[] types = new Class [] { + java.lang.String.class, java.lang.Boolean.class, java.lang.String.class, java.lang.String.class + }; + boolean[] canEdit = new boolean [] { + false, false, false, true + }; + + public Class getColumnClass(int columnIndex) { + return types [columnIndex]; + } + + public boolean isCellEditable(int rowIndex, int columnIndex) { + return canEdit [columnIndex]; + } + }); } public void resetColumnMappings() { @@ -292,7 +355,7 @@ public File[] getFiles() { return fbCsvIn.getFiles(); } - protected void doActionPerformed() { + public void doActionPerformed() { ActionEvent ae = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "file selected",Calendar.getInstance().getTimeInMillis(), 0); for (java.awt.event.ActionListener al : m_actionlisteners) al.actionPerformed(null); @@ -489,6 +552,7 @@ private void initComponents() { cbCSVHeaderOptional = new javax.swing.JComboBox(); bgScoreDirectionCSV = new javax.swing.ButtonGroup(); filter = new org.rappsilber.data.csv.gui.filter.ConditionList(); + pAdditional = new javax.swing.JPanel(); jLabel26 = new javax.swing.JLabel(); cbCSVQuote = new javax.swing.JComboBox(); cbCSVDElimiter = new javax.swing.JComboBox(); @@ -504,14 +568,12 @@ private void initComponents() { btnAddCSV = new javax.swing.JButton(); ckSmartMatch = new javax.swing.JCheckBox(); spAdditional = new javax.swing.JScrollPane(); - pAdditional = new javax.swing.JPanel(); pXiConfig = new javax.swing.JPanel(); fbConfigIn = new org.rappsilber.gui.components.FileBrowser(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); fbFastaIn = new org.rappsilber.gui.components.FileBrowser(); ckCSVMarkModifications = new javax.swing.JCheckBox(); - jPanel2 = new javax.swing.JPanel(); ckFilter = new javax.swing.JCheckBox(); btnFilter = new javax.swing.JButton(); localPicker1 = new org.rappsilber.gui.components.LocalPicker(); @@ -521,10 +583,14 @@ private void initComponents() { cbCSVHeaderOptional.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + pAdditional.setPreferredSize(new java.awt.Dimension(300, 90)); + pAdditional.setLayout(new javax.swing.BoxLayout(pAdditional, javax.swing.BoxLayout.Y_AXIS)); + jLabel26.setText("Delimiter"); cbCSVQuote.setEditable(true); cbCSVQuote.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "\"", "'" })); + cbCSVQuote.setPreferredSize(new java.awt.Dimension(100, 24)); cbCSVQuote.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cbCSVQuoteActionPerformed(evt); @@ -533,6 +599,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { cbCSVDElimiter.setEditable(true); cbCSVDElimiter.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Comma(,)", "Semicolon(;)", "Tab", "Space", "|", " " })); + cbCSVDElimiter.setPreferredSize(new java.awt.Dimension(100, 24)); cbCSVDElimiter.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cbCSVDElimiterActionPerformed(evt); @@ -648,7 +715,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - pAdditional.setLayout(new javax.swing.BoxLayout(pAdditional, javax.swing.BoxLayout.Y_AXIS)); + pXiConfig.setPreferredSize(new java.awt.Dimension(300, 107)); fbConfigIn.setDescription("Xi-Config"); fbConfigIn.setExtensions(new String[] {"config", "conf"}); @@ -674,8 +741,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(pXiConfigLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pXiConfigLayout.createSequentialGroup() - .addComponent(ckCSVMarkModifications) - .addGap(0, 663, Short.MAX_VALUE)) + .addComponent(ckCSVMarkModifications, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(0, 522, Short.MAX_VALUE)) .addComponent(fbFastaIn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(fbConfigIn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) @@ -696,22 +763,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); - pAdditional.add(pXiConfig); - - javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); - jPanel2.setLayout(jPanel2Layout); - jPanel2Layout.setHorizontalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 917, Short.MAX_VALUE) - ); - jPanel2Layout.setVerticalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 100, Short.MAX_VALUE) - ); - - pAdditional.add(jPanel2); - - spAdditional.setViewportView(pAdditional); + spAdditional.setViewportView(pXiConfig); ckFilter.setEnabled(false); ckFilter.addActionListener(new java.awt.event.ActionListener() { @@ -760,7 +812,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(ckCSVHasHeader) - .addComponent(cbCSVDElimiter, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(cbCSVDElimiter, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() @@ -769,11 +821,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createSequentialGroup() .addComponent(jLabel27) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cbCSVQuote, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(cbCSVQuote, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel28) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(localPicker1, javax.swing.GroupLayout.DEFAULT_SIZE, 106, Short.MAX_VALUE))) + .addComponent(localPicker1, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(rbCSVHighBetter) @@ -786,8 +838,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(spAdditional, javax.swing.GroupLayout.DEFAULT_SIZE, 881, Short.MAX_VALUE))) + .addComponent(jScrollPane2) + .addComponent(spAdditional, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))) ); layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btnAddCSV, btnReadCsv}); @@ -824,7 +876,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(rbCSVLowBetter) .addComponent(ckSmartMatch))) - .addGap(23, 23, 23) + .addGap(18, 18, 18) .addComponent(spAdditional, javax.swing.GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 201, Short.MAX_VALUE)) @@ -985,7 +1037,6 @@ private void localPicker1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN- private javax.swing.JLabel jLabel26; private javax.swing.JLabel jLabel27; private javax.swing.JLabel jLabel28; - private javax.swing.JPanel jPanel2; private javax.swing.JScrollPane jScrollPane2; private org.rappsilber.gui.components.LocalPicker localPicker1; private javax.swing.JPanel pAdditional; diff --git a/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsComplete.form b/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsComplete.form index e1a8ccd..e364078 100644 --- a/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsComplete.form +++ b/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsComplete.form @@ -461,7 +461,7 @@ - + diff --git a/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsComplete.java b/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsComplete.java index b500f72..4effacc 100644 --- a/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsComplete.java +++ b/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsComplete.java @@ -380,6 +380,7 @@ public void doOptimize(OfflineFDR.FDRLevel level) { if (level == null) ckMaximize.setSelected(false); else { + ckMaximize.setSelected(true); cbBoostWhat.getModel().setSelectedItem(level); } } @@ -719,7 +720,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); spMinTDChance.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1)); - spMinTDChance.setToolTipText("The total number of matches times the fdr should be larger then the given number - otherwise the subgroup will not be considered on its own"); + spMinTDChance.setToolTipText("The total number of matches times the fdr should be larger then the given number - otherwise the subgroup will be considered unreliable"); spMinTDChance.setSpecialValue(0); jLabel7.setText("Min TD Chance"); @@ -967,7 +968,7 @@ private void ckMoreOptionsActionPerformed(java.awt.event.ActionEvent evt) {//GEN }//GEN-LAST:event_ckMoreOptionsActionPerformed private void ckIgnoreValidityActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ckIgnoreValidityActionPerformed - spMinTDChance.setEnabled(!ckIgnoreValidity.isSelected()); + //spMinTDChance.setEnabled(!ckIgnoreValidity.isSelected()); }//GEN-LAST:event_ckIgnoreValidityActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables diff --git a/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsMedium.form b/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsMedium.form new file mode 100644 index 0000000..96904f4 --- /dev/null +++ b/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsMedium.form @@ -0,0 +1,283 @@ + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsMedium.java b/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsMedium.java new file mode 100644 index 0000000..ae1ecf0 --- /dev/null +++ b/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsMedium.java @@ -0,0 +1,805 @@ +/* + * Copyright 2015 Lutz Fischer . + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.rappsilber.fdr.gui.components; + +import javax.swing.AbstractButton; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JCheckBox; +import javax.swing.JRadioButton; +import javax.swing.JSpinner; +import javax.swing.SpinnerModel; +import javax.swing.SwingUtilities; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import org.rappsilber.fdr.OfflineFDR; +import org.rappsilber.fdr.OfflineFDR.FDRLevel; +import static org.rappsilber.fdr.gui.components.FDRSettingsComplete.setSpinnerModel; + +/** + * + * @author lfischer + */ +public class FDRSettingsMedium extends FDRSettingsPanel { + +// private ArrayList m_calc_listener = new ArrayList(); +// +// private OfflineFDR.FDRLevel m_optimizeWhat; + + private int m_minPepLength = 0; + private int m_boostingSteps = 4; + private double m_protfdr = 100; + private int m_minTD = DEFAULT_MIN_TD_COUNT; + + + private boolean m_filterToUniquePSM = true; + + private boolean scaleByContectedness = false; + private Boolean ppiLocalFDR; + private Boolean linkLocalFDR; + private Boolean protLocalFDR; + private Boolean peppairLocalFDR; + private Boolean psmLocalFDR; + private double minPeptideCoverageFilter; + private double minDeltaScoreFilter; + private boolean combineScoreAndDelta; + private int minFragments; + private boolean ignoreValidityChecks = true; + private boolean psmDirectional; + private boolean peptidePairDirectional; + private boolean linkDirectional; + private boolean ppiDirectional; + private double reportFactor; + + @Override + public boolean getBoostBetween() { + return ckBoostBetween.isSelected(); + } + + @Override + public void setBoostBetween(final boolean between) { + SwingUtilities.invokeLater(new Runnable() { + + public void run() { + ckBoostBetween.setSelected(between); + } + }); + } + + + + private void setValueLater(final JSpinner sp, final Object value) { + SwingUtilities.invokeLater(new Runnable() { + + public void run() { + sp.setValue(value); + } + }); + + } + + private void setValueLater(final JCheckBox ck, final boolean value) { + SwingUtilities.invokeLater(new Runnable() { + + public void run() { + ck.setSelected(value); + } + }); + + } + + /** + * Creates new form FDRSettingsComplete + */ + public FDRSettingsMedium() { + initComponents(); + + ChangeListener max100Listener = new ChangeListener() { + public void stateChanged(ChangeEvent e) { + SpinnerModel sp = (SpinnerModel) e.getSource(); + if (((Double)sp.getValue()) >100) + sp.setValue(100d); + } + }; + setSpinnerModel(spPsmFDR, 100); + setSpinnerModel(spPepFDR, 100); + setSpinnerModel(spLinkFDR, 5); + setSpinnerModel(spPPIFdr, 100); + cbBoostOther.setVisible(false); + rbBoostOther.setVisible(false); + } + + private void doCalc() { + // if (ckMaximize.isSelected()) { + m_protfdr = 1; + + this.psmLocalFDR = tsLocalFDR.getSelectionState(); + this.peppairLocalFDR = tsLocalFDR.getSelectionState(); + this.protLocalFDR = tsLocalFDR.getSelectionState(); + this.linkLocalFDR = tsLocalFDR.getSelectionState(); + this.ppiLocalFDR = tsLocalFDR.getSelectionState(); + + btnStopBoost.setEnabled(ckMaximize.isSelected()); + raiseStartCalc(ckMaximize.isSelected()); + + } + + + + @Override + public double getPSMFDR() { + return Double.parseDouble(spPsmFDR.getValue().toString())/100.0; + } + + + @Override + public double getPeptidePairFDR() { + return Double.parseDouble(spPepFDR.getValue().toString())/100.0; + } + + @Override + public double getProteinGroupFDR() { + return m_protfdr; + } + + @Override + public double getProteinGroupLinkFDR() { + return Double.parseDouble(spLinkFDR.getValue().toString())/100.0; + } + + @Override + public double getProteinGroupPairFDR() { + return Double.parseDouble(spPPIFdr.getValue().toString())/100.0; + } + + @Override + public void setPSMFDR( Double fdr) { + setValueLater(spPsmFDR,fdr*100); + } + + + @Override + public void setPeptidePairFDR( Double fdr) { + setValueLater(spPepFDR,fdr*100); + } + + @Override + public void setProteinGroupLinkFDR( Double fdr) { + setValueLater(spLinkFDR,fdr*100); + } + + @Override + public void setProteinGroupPairFDR( Double fdr) { + setValueLater(spPPIFdr,fdr*100); + } + + @Override + public void setProteinGroupFDR( Double fdr) { + m_protfdr = fdr; + } + + @Override + public int getMinProteinPepCount() { + return 1; + } + + @Override + public int getMinLinkPepCount() { + return 1; + } + + @Override + public int getMinPPIPepCount() { + return 1; + } + + @Override + public void setMinProteinPepCount(Integer minPep) { + } + + @Override + public void setMinLinkPepCount(Integer minPep) { + } + + @Override + public void setMinPPIPepCount(Integer minPep) { + } + + + + + @Override + public int getMinPeptideLength() { + return m_minPepLength; + } + + @Override + public void setMinPeptideLength(Integer minLength) { + m_minPepLength = minLength; + } + + + @Override + public int getMaxLinkAmbiguity() { + return 0; + } + + @Override + public void setMaxLinkAmbiguity(Integer maxAmbiguity) { + + } + + @Override + public int getMaxProteinAmbiguity() { + return 0; + } + + @Override + public void setMaxProteinAmbiguity(Integer maxAmbiguity) { + } + + @Override + public boolean isPSMDirectional() { + return this.psmDirectional; + } + + @Override + public boolean isPeptidePairDirectional() { + return this.peptidePairDirectional; + } + + @Override + public boolean isLinkDirectional() { + return this.linkDirectional; + } + + @Override + public boolean isPPIDirectional() { + return this.ppiDirectional; + } + + @Override + public void setPSMDirectional(boolean directional) { + psmDirectional=directional; + } + + @Override + public void setPeptidePairDirectional(boolean directional) { + peptidePairDirectional = directional; + } + + @Override + public void setLinkDirectional(boolean directional) { + linkDirectional = directional; + } + + @Override + public void setPPIDirectional(boolean directional) { + ppiDirectional = directional; + } + + + @Override + public OfflineFDR.FDRLevel doOptimize() { + if (!ckMaximize.isSelected()) + return null; + if (rbBoostPeptidePairs.isSelected()) { + return OfflineFDR.FDRLevel.PEPTIDE_PAIR; + } + if (rbBoostLinks.isSelected()) { + return OfflineFDR.FDRLevel.PROTEINGROUPLINK; + } + if (rbBoostPPI.isSelected()) { + return OfflineFDR.FDRLevel.PROTEINGROUPPAIR; + } + return (OfflineFDR.FDRLevel) cbBoostOther.getSelectedItem(); + } + + @Override + public void doOptimize(OfflineFDR.FDRLevel level) { + if (level == null) { + ckMaximize.setSelected(false); + ckMaximizeActionPerformed(null); + }else { + ckMaximize.setSelected(true); + ckMaximizeActionPerformed(null); + switch(level) { + case PEPTIDE_PAIR: + bgBoost.setSelected(rbBoostPeptidePairs.getModel(), true); + cbBoostOther.setVisible(false); + rbBoostOther.setVisible(false); + break; + case PROTEINGROUPLINK: + bgBoost.setSelected(rbBoostLinks.getModel(), true); + cbBoostOther.setVisible(false); + rbBoostOther.setVisible(false); + break; + case PROTEINGROUPPAIR: + bgBoost.setSelected(rbBoostPPI.getModel(), true); + cbBoostOther.setVisible(false); + rbBoostOther.setVisible(false); + break; + default: + bgBoost.getSelection().setSelected(false); + cbBoostOther.setSelectedItem(level); + cbBoostOther.setVisible(true); + rbBoostOther.setVisible(true); + bgBoost.setSelected(rbBoostOther.getModel(), true); + } + } + } + + public int getBoostingSteps() { + return m_boostingSteps; + } + + public void setBoostingSteps(int steps) { + m_boostingSteps = steps; + } + + public double getReportFactor() { + return this.reportFactor; + } + + public void setReportFactor(double factor) { + this.reportFactor = factor; + } + + + public boolean filterToUniquePSM() { + return m_filterToUniquePSM; + } + + public void setFilterToUniquePSM(boolean filterToUniquePSM) { + m_filterToUniquePSM = filterToUniquePSM; + } + + public boolean combineScoreAndDelta() { + return this.combineScoreAndDelta; + } + public void combineScoreAndDelta(boolean c) { + this.combineScoreAndDelta = c; + } + + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + bgBoost = new javax.swing.ButtonGroup(); + ckBoostBetween = new javax.swing.JCheckBox(); + btnCalc = new javax.swing.JButton(); + btnStopBoost = new javax.swing.JButton(); + jLabel5 = new javax.swing.JLabel(); + spPsmFDR = new javax.swing.JSpinner(); + jLabel9 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + spPepFDR = new javax.swing.JSpinner(); + jLabel3 = new javax.swing.JLabel(); + spLinkFDR = new javax.swing.JSpinner(); + jLabel4 = new javax.swing.JLabel(); + spPPIFdr = new javax.swing.JSpinner(); + rbBoostLinks = new javax.swing.JRadioButton(); + rbBoostPPI = new javax.swing.JRadioButton(); + rbBoostPeptidePairs = new javax.swing.JRadioButton(); + ckMaximize = new javax.swing.JCheckBox(); + cbBoostOther = new javax.swing.JComboBox<>(); + rbBoostOther = new javax.swing.JRadioButton(); + tsLocalFDR = new org.rappsilber.gui.components.TriStateCheckBox(); + jLabel6 = new javax.swing.JLabel(); + + ckBoostBetween.setText("Between"); + + btnCalc.setText("Calculate"); + btnCalc.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnCalcActionPerformed(evt); + } + }); + + btnStopBoost.setText("stop boost"); + btnStopBoost.setEnabled(false); + btnStopBoost.setMargin(new java.awt.Insets(2, 7, 2, 7)); + btnStopBoost.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnStopBoostActionPerformed(evt); + } + }); + + jLabel5.setText("PSM"); + + spPsmFDR.setToolTipText("FDR value accepted for PSMs"); + + jLabel9.setText("Max FDRs"); + + jLabel2.setText("Peptide Pair"); + + spPepFDR.setToolTipText("FDR value accepted for Peptide Pairs (including linksite within the peptide)"); + + jLabel3.setText("Residue Pairs"); + + spLinkFDR.setToolTipText("FDR value accepted for Links (Protein-group-links)"); + + jLabel4.setText("Protein Pairs"); + + spPPIFdr.setToolTipText("FDR value accepted for protein-pairs"); + + bgBoost.add(rbBoostLinks); + rbBoostLinks.setSelected(true); + rbBoostLinks.setToolTipText("try to maximize the number of residue pairs"); + rbBoostLinks.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + setBoostingLevel(evt); + } + }); + + bgBoost.add(rbBoostPPI); + rbBoostPPI.setToolTipText("try to maximize the number of protein pairs"); + rbBoostPPI.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + setBoostingLevel(evt); + } + }); + + bgBoost.add(rbBoostPeptidePairs); + rbBoostPeptidePairs.setToolTipText("try to maximize the number of peptide pairs"); + rbBoostPeptidePairs.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + setBoostingLevel(evt); + } + }); + + ckMaximize.setText("Boost"); + ckMaximize.setToolTipText("should we try to boost the results reported for a specified maximum FDR"); + ckMaximize.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + ckMaximizeActionPerformed(evt); + } + }); + + cbBoostOther.setModel(new DefaultComboBoxModel(new OfflineFDR.FDRLevel[]{OfflineFDR.FDRLevel.PSM, OfflineFDR.FDRLevel.PROTEINGROUP})); + cbBoostOther.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cbBoostOtherActionPerformed(evt); + } + }); + + bgBoost.add(rbBoostOther); + rbBoostOther.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + rbBoostOthersetBoostingLevel(evt); + } + }); + + tsLocalFDR.setToolTipText("calculate Local FDR(=PEP) (square); calculate and filter by Local FDR (tick); or do not calculate Local FDR(empty)"); + tsLocalFDR.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + tsLocalFDRActionPerformed(evt); + } + }); + + jLabel6.setText("Local FDR"); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel5) + .addComponent(jLabel2) + .addComponent(jLabel3) + .addComponent(jLabel4) + .addComponent(jLabel6)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(16, 16, 16) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(spPPIFdr, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(spLinkFDR, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(spPepFDR, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(spPsmFDR, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(layout.createSequentialGroup() + .addGap(18, 18, 18) + .addComponent(tsLocalFDR, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) + .addComponent(ckMaximize) + .addComponent(rbBoostPeptidePairs) + .addComponent(rbBoostLinks) + .addComponent(rbBoostPPI) + .addComponent(rbBoostOther)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cbBoostOther, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 86, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(btnCalc) + .addComponent(btnStopBoost)) + .addContainerGap()) + ); + + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btnCalc, btnStopBoost}); + + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel9) + .addComponent(ckMaximize)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(spPsmFDR, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5)) + .addGap(11, 11, 11) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(spPepFDR, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2)) + .addComponent(rbBoostPeptidePairs)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(spLinkFDR, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel3)) + .addComponent(rbBoostLinks, javax.swing.GroupLayout.Alignment.TRAILING)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(spPPIFdr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel4)) + .addComponent(rbBoostPPI, javax.swing.GroupLayout.Alignment.TRAILING)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(cbBoostOther, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(jLabel6) + .addComponent(tsLocalFDR, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addComponent(rbBoostOther)) + .addGap(0, 57, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(btnStopBoost) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnCalc) + .addContainerGap()) + ); + }// //GEN-END:initComponents + + private void btnCalcActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCalcActionPerformed + // TODO add your handling code here: + doCalc(); + + }//GEN-LAST:event_btnCalcActionPerformed + + private void btnStopBoostActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStopBoostActionPerformed + raiseStopMaximizing(); + }//GEN-LAST:event_btnStopBoostActionPerformed + + private void ckMaximizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ckMaximizeActionPerformed + rbBoostLinks.setEnabled(ckMaximize.isSelected()); + rbBoostPPI.setEnabled(ckMaximize.isSelected()); + rbBoostPeptidePairs.setEnabled(ckMaximize.isSelected()); + rbBoostOther.setEnabled(ckMaximize.isSelected()); + cbBoostOther.setEnabled(ckMaximize.isSelected()); + ckBoostBetween.setEnabled(ckMaximize.isSelected()); + + }//GEN-LAST:event_ckMaximizeActionPerformed + + private void setBoostingLevel(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_setBoostingLevel + if (evt.getSource() instanceof JRadioButton) { + cbBoostOther.setVisible(false); + rbBoostOther.setVisible(false); + } + }//GEN-LAST:event_setBoostingLevel + + private void rbBoostOthersetBoostingLevel(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rbBoostOthersetBoostingLevel + // TODO add your handling code here: + }//GEN-LAST:event_rbBoostOthersetBoostingLevel + + private void cbBoostOtherActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbBoostOtherActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_cbBoostOtherActionPerformed + + private void tsLocalFDRActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tsLocalFDRActionPerformed + + + }//GEN-LAST:event_tsLocalFDRActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.ButtonGroup bgBoost; + private javax.swing.JButton btnCalc; + public javax.swing.JButton btnStopBoost; + private javax.swing.JComboBox cbBoostOther; + private javax.swing.JCheckBox ckBoostBetween; + private javax.swing.JCheckBox ckMaximize; + 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; + private javax.swing.JLabel jLabel9; + private javax.swing.JRadioButton rbBoostLinks; + private javax.swing.JRadioButton rbBoostOther; + private javax.swing.JRadioButton rbBoostPPI; + private javax.swing.JRadioButton rbBoostPeptidePairs; + private javax.swing.JSpinner spLinkFDR; + private javax.swing.JSpinner spPPIFdr; + private javax.swing.JSpinner spPepFDR; + private javax.swing.JSpinner spPsmFDR; + private org.rappsilber.gui.components.TriStateCheckBox tsLocalFDR; + // End of variables declaration//GEN-END:variables + + @Override + public void setEnabled(boolean e) { + super.setEnabled(e); + btnCalc.setEnabled(e); + if (e) + btnStopBoost.setEnabled(false); + } + +// @Override +// public boolean isEnabeled(boolean e) { +// } + + @Override + public void setMinTD(Integer c) { + m_minTD = c; + } + + @Override + public int getMinTD() { + return m_minTD; + } + + @Override + public Boolean psmLocalFDR() { + return this.psmLocalFDR; + } + + @Override + public Boolean peppairLocalFDR() { + return this.peppairLocalFDR; + } + + @Override + public Boolean protLocalFDR() { + return this.protLocalFDR; + } + + @Override + public Boolean linkLocalFDR() { + return this.linkLocalFDR; + } + + @Override + public Boolean ppiLocalFDR() { + return this.ppiLocalFDR; + } + + @Override + public void psmLocalFDR(Boolean local) { + this.psmLocalFDR = local; + setLocalFDR(); + } + + protected void setLocalFDR() { + Boolean hasTrue = false; + Boolean hasFalse = false; + if (this.peppairLocalFDR!= null) { + hasTrue |= this.peppairLocalFDR; + hasFalse &= !this.peppairLocalFDR; + } + if (this.psmLocalFDR!= null) { + hasTrue |= this.psmLocalFDR; + hasFalse &= !this.psmLocalFDR; + } + if (this.protLocalFDR!= null) { + hasTrue |= this.protLocalFDR; + hasFalse &= !this.protLocalFDR; + } + if (this.linkLocalFDR!= null) { + hasTrue |= this.linkLocalFDR; + hasFalse &= !this.linkLocalFDR; + } + if (this.ppiLocalFDR!= null) { + hasTrue |= this.ppiLocalFDR; + hasFalse &= !this.ppiLocalFDR; + } + if (hasTrue) { + this.tsLocalFDR.setSelectionState(true); + } else if (hasFalse) { + this.tsLocalFDR.setSelectionState(false); + } else { + this.tsLocalFDR.setSelectionState(null); + } + } + + @Override + public void peppairLocalFDR(Boolean local) { + this.peppairLocalFDR = local; + setLocalFDR(); + } + + @Override + public void protLocalFDR(Boolean local) { + this.protLocalFDR = local; + setLocalFDR(); + } + + @Override + public void linkLocalFDR(Boolean local) { + this.linkLocalFDR = local; + setLocalFDR(); + } + + @Override + public void ppiLocalFDR(Boolean local) { + this.ppiLocalFDR = local; + setLocalFDR(); + } + + + @Override + public double getMinPeptideCoverageFilter() { + return this.minPeptideCoverageFilter; + } + @Override + public void setMinPeptideCoverageFilter(double d) { + this.minPeptideCoverageFilter = d; + } + + @Override + public double getMinDeltaScoreFilter() { + return this.minDeltaScoreFilter; + } + + @Override + public void setMinDeltaScoreFilter(double d) { + this.minDeltaScoreFilter = d; + } + + @Override + public int getMinPeptideFragmentsFilter() { + return this.minFragments; + } + + @Override + public void setMinPeptideFragmentsFilter(int frags) { + this.minFragments = frags; + } + + @Override + public boolean ignoreValidityChecks() { + return this.ignoreValidityChecks; + } + + @Override + public void ignoreValidityChecks(boolean ignore) { + this.ignoreValidityChecks = ignore; + } + + + +} diff --git a/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsPanel.java b/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsPanel.java index 6bfce40..3097061 100644 --- a/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsPanel.java +++ b/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsPanel.java @@ -49,6 +49,7 @@ public abstract class FDRSettingsPanel extends javax.swing.JPanel implements FDR private boolean boostPepCoverage = true; private boolean boostPepDeltaScore = true; private boolean boostMinFragments = false; + private boolean groubByCrosslinkerStubs; /** * Creates new form FDRSettingsPanel @@ -265,4 +266,15 @@ public void boostMinFragments(boolean boost){ // public void setSubScoreCutOff(double localfdr) { // this.subScoreCutOff = localfdr; // } + + @Override + public void setGroupByCrosslinkerStubs(boolean group) { + this.groubByCrosslinkerStubs = group; + } + + @Override + public boolean getGroupByCrosslinkerStubs() { + return this.groubByCrosslinkerStubs; + } + } diff --git a/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsSimple.form b/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsSimple.form index 7a8accb..3e213a4 100644 --- a/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsSimple.form +++ b/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsSimple.form @@ -17,11 +17,10 @@ - + - @@ -32,16 +31,13 @@ - - - - - + + - + @@ -61,19 +57,18 @@ - - - - - + - + + + + @@ -113,11 +108,6 @@
    - - - - - @@ -135,15 +125,6 @@
    - - - - - - - - - diff --git a/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsSimple.java b/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsSimple.java index 1bc7f12..b5207dc 100644 --- a/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsSimple.java +++ b/src/main/java/org/rappsilber/fdr/gui/components/FDRSettingsSimple.java @@ -55,8 +55,11 @@ public class FDRSettingsSimple extends FDRSettingsPanel { private double minDeltaScoreFilter; private boolean combineScoreAndDelta; private int minFragments; - private boolean boostMinFragments; - private boolean ignoreValidityChecks; + private boolean ignoreValidityChecks = true; + private boolean psmDirectional; + private boolean peptidePairDirectional; + private boolean linkDirectional; + private boolean ppiDirectional; @Override public boolean getBoostBetween() { @@ -279,42 +282,42 @@ public void setMaxProteinAmbiguity(Integer maxAmbiguity) { @Override public boolean isPSMDirectional() { - return ckDirectional.isSelected(); + return this.psmDirectional; } @Override public boolean isPeptidePairDirectional() { - return ckDirectional.isSelected(); + return this.peptidePairDirectional; } @Override public boolean isLinkDirectional() { - return ckDirectional.isSelected(); + return this.linkDirectional; } @Override public boolean isPPIDirectional() { - return ckDirectional.isSelected(); + return this.ppiDirectional; } @Override public void setPSMDirectional(boolean directional) { - setValueLater(ckDirectional,directional); + psmDirectional=directional; } @Override public void setPeptidePairDirectional(boolean directional) { - setValueLater(ckDirectional,directional); + peptidePairDirectional = directional; } @Override public void setLinkDirectional(boolean directional) { - setValueLater(ckDirectional,directional); + linkDirectional = directional; } @Override public void setPPIDirectional(boolean directional) { - setValueLater(ckDirectional,directional); + ppiDirectional = directional; } @@ -330,6 +333,7 @@ public void doOptimize(OfflineFDR.FDRLevel level) { if (level == null) ckMaximize.setSelected(false); else { + ckMaximize.setSelected(true); cbFDRLevel.getModel().setSelectedItem(level); } } @@ -379,10 +383,8 @@ private void initComponents() { lblReportFactor = new javax.swing.JLabel(); spReportFactor = new javax.swing.JSpinner(); jLabel1 = new javax.swing.JLabel(); - ckDirectional = new javax.swing.JCheckBox(); btnCalc = new javax.swing.JButton(); ckMaximize = new javax.swing.JCheckBox(); - lblDirectional = new javax.swing.JLabel(); lblBoost = new javax.swing.JLabel(); spFDR = new javax.swing.JSpinner(); cbFDRLevel = new org.rappsilber.fdr.gui.components.FDRLevelComboBox(); @@ -397,8 +399,6 @@ private void initComponents() { jLabel1.setText("FDR"); - ckDirectional.setToolTipText("Is the Cross-linking considered directional (A links to B is different to B links to A)"); - btnCalc.setText("Calculate"); btnCalc.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -414,14 +414,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { } }); - lblDirectional.setText("Is directional"); - lblDirectional.setToolTipText("Is the Cross-linking considered directional (A links to B is different to B links to A)"); - lblDirectional.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - lblDirectionalMouseClicked(evt); - } - }); - lblBoost.setText("Boost result"); lblBoost.setToolTipText("Use prefiltering on lower level to boost the results on the chossen level of information"); lblBoost.addMouseListener(new java.awt.event.MouseAdapter() { @@ -456,7 +448,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(btnStopBoost, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1) - .addComponent(lblDirectional) .addComponent(lblBoost) .addComponent(lblReportFactor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -466,13 +457,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(spReportFactor, javax.swing.GroupLayout.Alignment.LEADING) .addComponent(spFDR) .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(ckDirectional) - .addComponent(ckMaximize)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 58, Short.MAX_VALUE) + .addComponent(ckMaximize) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE) .addComponent(ckBoostBetween))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cbFDRLevel, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)) + .addComponent(cbFDRLevel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(btnCalc))) @@ -486,16 +475,15 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(jLabel1) .addComponent(spFDR, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(cbFDRLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(ckDirectional) - .addComponent(lblDirectional)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ckMaximize) .addComponent(lblBoost))) - .addComponent(ckBoostBetween, javax.swing.GroupLayout.Alignment.TRAILING)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(ckBoostBetween))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblReportFactor) @@ -514,10 +502,6 @@ private void btnCalcActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST }//GEN-LAST:event_btnCalcActionPerformed - private void lblDirectionalMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblDirectionalMouseClicked - ckDirectional.setSelected(!ckDirectional.isSelected()); - }//GEN-LAST:event_lblDirectionalMouseClicked - private void lblBoostMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblBoostMouseClicked ckMaximize.setSelected(!ckMaximize.isSelected()); @@ -536,11 +520,9 @@ private void ckMaximizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI public javax.swing.JButton btnStopBoost; private org.rappsilber.fdr.gui.components.FDRLevelComboBox cbFDRLevel; private javax.swing.JCheckBox ckBoostBetween; - private javax.swing.JCheckBox ckDirectional; private javax.swing.JCheckBox ckMaximize; private javax.swing.JLabel jLabel1; private javax.swing.JLabel lblBoost; - private javax.swing.JLabel lblDirectional; public javax.swing.JLabel lblReportFactor; private javax.swing.JSpinner spFDR; private javax.swing.JSpinner spReportFactor; diff --git a/src/main/java/org/rappsilber/fdr/gui/components/MZIdentMLOwnerGUI.form b/src/main/java/org/rappsilber/fdr/gui/components/MZIdentMLOwnerGUI.form new file mode 100644 index 0000000..0f884f4 --- /dev/null +++ b/src/main/java/org/rappsilber/fdr/gui/components/MZIdentMLOwnerGUI.form @@ -0,0 +1,134 @@ + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/src/main/java/org/rappsilber/fdr/gui/components/MZIdentMLOwnerGUI.java b/src/main/java/org/rappsilber/fdr/gui/components/MZIdentMLOwnerGUI.java new file mode 100644 index 0000000..fed6bb2 --- /dev/null +++ b/src/main/java/org/rappsilber/fdr/gui/components/MZIdentMLOwnerGUI.java @@ -0,0 +1,326 @@ +/* + * Copyright 2019 Lutz Fischer . + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.rappsilber.fdr.gui.components; + +import java.awt.BorderLayout; +import java.awt.GraphicsEnvironment; +import java.awt.HeadlessException; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.lang.invoke.MethodHandles; +import java.util.Locale; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import org.rappsilber.config.LocalProperties; +import org.rappsilber.fdr.utils.MZIdentMLOwner; + +/** + * + * @author Lutz Fischer + */ +public class MZIdentMLOwnerGUI extends javax.swing.JPanel { + + /** + * Creates new form MzIdenMLOwner + */ + public MZIdentMLOwnerGUI() { + initComponents(); + setMZIdentMLOwner(); + } + + + public void setMZIdentMLOwner() { + txtmzIdentOwnerFirst.setText(LocalProperties.getProperty("mzIdenMLOwnerFirst", txtmzIdentOwnerFirst.getText())); + txtmzIdentOwnerLast.setText(LocalProperties.getProperty("mzIdenMLOwnerLast", txtmzIdentOwnerLast.getText())); + txtmzIdentOwnerEmail.setText(LocalProperties.getProperty("mzIdenMLOwnerEmail", txtmzIdentOwnerEmail.getText())); + txtmzIdentAddress.setText(LocalProperties.getProperty("mzIdenMLOwnerAddress", txtmzIdentAddress.getText())); + txtmzIdentOwnerOrg.setText(LocalProperties.getProperty("mzIdenMLOwnerOrg", txtmzIdentOwnerOrg.getText())); + } + + public void setMZIdentMLOwner(MZIdentMLOwner owner) { + txtmzIdentOwnerFirst.setText(owner.first); + txtmzIdentOwnerLast.setText(owner.last); + txtmzIdentOwnerEmail.setText(owner.email); + txtmzIdentAddress.setText(owner.address); + txtmzIdentOwnerOrg.setText(owner.org); + } + + public static MZIdentMLOwner getLastOwner() { + return new MZIdentMLOwner( + LocalProperties.getProperty("mzIdenMLOwnerFirst", ""), + LocalProperties.getProperty("mzIdenMLOwnerLast", ""), + LocalProperties.getProperty("mzIdenMLOwnerEmail", ""), + LocalProperties.getProperty("mzIdenMLOwnerOrg", ""), + LocalProperties.getProperty("mzIdenMLOwnerAddress", "")); + + } + + public static void saveDefaultOwner(MZIdentMLOwner owner) { + LocalProperties.setProperty("mzIdenMLOwnerFirst", owner.first); + LocalProperties.setProperty("mzIdenMLOwnerLast", owner.last); + LocalProperties.setProperty("mzIdenMLOwnerEmail", owner.email); + LocalProperties.setProperty("mzIdenMLOwnerAddress", owner.address); + LocalProperties.setProperty("mzIdenMLOwnerOrg", owner.org); + } + + + public static void resetDefaultOwner() { + LocalProperties.setProperty("mzIdenMLOwnerFirst", null); + LocalProperties.setProperty("mzIdenMLOwnerLast", null); + LocalProperties.setProperty("mzIdenMLOwnerEmail", null); + LocalProperties.setProperty("mzIdenMLOwnerAddress", null); + LocalProperties.setProperty("mzIdenMLOwnerOrg", null); + } + + + public MZIdentMLOwner getOwnerInfo() { + return new MZIdentMLOwner(txtmzIdentOwnerFirst.getText(), txtmzIdentOwnerLast.getText(), txtmzIdentOwnerEmail.getText(), txtmzIdentOwnerOrg.getText(), txtmzIdentAddress.getText()); + } + + public static MZIdentMLOwner getDocumentOwner() { + MZIdentMLOwner o = getLastOwner(); + if (o.isEmpty()) { + return getNewOwner(o); + } + return o; + } + + public static MZIdentMLOwner getSetOwner(MZIdentMLOwner defaultOwner) throws HeadlessException, UnsupportedOperationException { + MZIdentMLOwner o = getNewOwner(defaultOwner); + saveDefaultOwner(o); + return o; + } + + public static MZIdentMLOwner getNewOwner(MZIdentMLOwner defaultOwner) throws HeadlessException, UnsupportedOperationException { + if (GraphicsEnvironment.isHeadless()) { + Logger.getLogger(MethodHandles.lookup().lookupClass().getName()).log(Level.WARNING, "NO OWNER PREDEFINED AND CAN'T ASK FOR ONE!"); + return defaultOwner; + } + if (SwingUtilities.isEventDispatchThread()) { + Logger.getLogger(MethodHandles.lookup().lookupClass().getName()).log(Level.WARNING, "NO OWNER PREDEFINED AND CAN'T ASK FOR ONE!"); + throw new UnsupportedOperationException("This Method should not be run from the EventDispachThread"); + } + final Object lock = new Object(); + final JFrame window = new JFrame("mzIdentML Document Owner"); + JLabel desc = new JLabel("mzIdentML-files need to provide information about the owner of the document"); + MZIdentMLOwnerGUI og = new MZIdentMLOwnerGUI(); + window.getContentPane().setLayout(new BorderLayout()); + window.add(desc,BorderLayout.NORTH); + window.add(og,BorderLayout.CENTER); + JPanel pButtons = new JPanel(new BorderLayout()); + window.getContentPane().add(pButtons,BorderLayout.SOUTH); + JButton close = new JButton("OK"); + pButtons.add(close,BorderLayout.EAST); + window.pack(); + close.addActionListener(new ActionListener(){ + @Override + public void actionPerformed(ActionEvent e) { + window.setVisible(false); + synchronized (lock) { + lock.notify(); + } + } + }); + window.addWindowListener(new WindowAdapter() { + + @Override + public void windowClosing(WindowEvent arg0) { + synchronized (lock) { + //window.setVisible(false); + lock.notify(); + } + } + + }); + window.setVisible(true); + Thread t = new Thread(new Runnable() { + public void run() { + while (window.isVisible()) { + try { + synchronized(lock) { + lock.wait(); + } + } catch (InterruptedException e) { + e.printStackTrace(); + } + Logger.getLogger(MZIdentMLOwnerGUI.class.getName()).log(Level.INFO,"Window Closed"); + } + } + }); + t.start(); + try { + t.join(); + } catch (InterruptedException ex) { + Logger.getLogger(MZIdentMLOwnerGUI.class.getName()).log(Level.SEVERE, null, ex); + } + MZIdentMLOwner ret = og.getCurrentDocumentOwner(); + return ret; + } + + public MZIdentMLOwner getCurrentDocumentOwner() { + return new MZIdentMLOwner( + txtmzIdentOwnerFirst.getText(), + txtmzIdentOwnerLast.getText(), + txtmzIdentOwnerEmail.getText(), + txtmzIdentOwnerOrg.getText(), + txtmzIdentAddress.getText()); + } + + public static void main(String[] args) { + getNewOwner(getLastOwner()); + } + + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel2 = new javax.swing.JLabel(); + txtmzIdentOwnerFirst = new javax.swing.JTextField(); + txtmzIdentOwnerLast = new javax.swing.JTextField(); + txtmzIdentOwnerEmail = new javax.swing.JTextField(); + jLabel3 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + txtmzIdentOwnerOrg = new javax.swing.JTextField(); + jLabel4 = new javax.swing.JLabel(); + jScrollPane1 = new javax.swing.JScrollPane(); + txtmzIdentAddress = new javax.swing.JTextArea(); + + jLabel2.setText("Document Owner"); + + txtmzIdentOwnerFirst.setText("First"); + txtmzIdentOwnerFirst.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + txtmzIdentOwnerFirstActionPerformed(evt); + } + }); + + txtmzIdentOwnerLast.setText("Last"); + txtmzIdentOwnerLast.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + txtmzIdentOwnerLastActionPerformed(evt); + } + }); + + txtmzIdentOwnerEmail.setText("reseacher@organisation.org"); + txtmzIdentOwnerEmail.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + txtmzIdentOwnerEmailActionPerformed(evt); + } + }); + + jLabel3.setText("E-Mail"); + + jLabel5.setText("Organisation"); + + txtmzIdentOwnerOrg.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + txtmzIdentOwnerOrgActionPerformed(evt); + } + }); + + jLabel4.setText("Address"); + + txtmzIdentAddress.setColumns(20); + txtmzIdentAddress.setRows(5); + jScrollPane1.setViewportView(txtmzIdentAddress); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel2) + .addComponent(jLabel3) + .addComponent(jLabel4) + .addComponent(jLabel5)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1) + .addGroup(layout.createSequentialGroup() + .addComponent(txtmzIdentOwnerFirst) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(txtmzIdentOwnerLast) + .addGap(3, 3, 3)) + .addComponent(txtmzIdentOwnerEmail) + .addComponent(txtmzIdentOwnerOrg))) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(txtmzIdentOwnerFirst, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(txtmzIdentOwnerLast, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel3) + .addComponent(txtmzIdentOwnerEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(txtmzIdentOwnerOrg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5)) + .addGap(9, 9, 9) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jScrollPane1) + .addComponent(jLabel4))) + ); + }// //GEN-END:initComponents + + private void txtmzIdentOwnerFirstActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtmzIdentOwnerFirstActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_txtmzIdentOwnerFirstActionPerformed + + private void txtmzIdentOwnerLastActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtmzIdentOwnerLastActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_txtmzIdentOwnerLastActionPerformed + + private void txtmzIdentOwnerEmailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtmzIdentOwnerEmailActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_txtmzIdentOwnerEmailActionPerformed + + private void txtmzIdentOwnerOrgActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtmzIdentOwnerOrgActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_txtmzIdentOwnerOrgActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JTextArea txtmzIdentAddress; + private javax.swing.JTextField txtmzIdentOwnerEmail; + private javax.swing.JTextField txtmzIdentOwnerFirst; + private javax.swing.JTextField txtmzIdentOwnerLast; + private javax.swing.JTextField txtmzIdentOwnerOrg; + // End of variables declaration//GEN-END:variables +} diff --git a/src/main/java/org/rappsilber/fdr/result/SubGroupFdrInfo.java b/src/main/java/org/rappsilber/fdr/result/SubGroupFdrInfo.java index 1422363..bd38466 100644 --- a/src/main/java/org/rappsilber/fdr/result/SubGroupFdrInfo.java +++ b/src/main/java/org/rappsilber/fdr/result/SubGroupFdrInfo.java @@ -72,7 +72,7 @@ public class SubGroupFdrInfo implements Iterable { public int between; public int linear; - public boolean didntPassCheck = false; + public String didntPassCheck = null; public Iterator iterator() { return filteredResult.iterator(); diff --git a/src/main/java/org/rappsilber/fdr/utils/MZIdentMLExport.java b/src/main/java/org/rappsilber/fdr/utils/MZIdentMLExport.java index 8ab2d25..cb5cac6 100644 --- a/src/main/java/org/rappsilber/fdr/utils/MZIdentMLExport.java +++ b/src/main/java/org/rappsilber/fdr/utils/MZIdentMLExport.java @@ -232,7 +232,7 @@ public class MZIdentMLExport { XLMOD xlmod; - private mzIdentMLOwner owner = new mzIdentMLOwner("fisrt", "last", "email", "org", "adress"); + private MZIdentMLOwner owner = new MZIdentMLOwner("fisrt", "last", "email", "org", "address"); private PSMToMzIdentScanId mgfScanID = new PSMToMzIdentScanId() { @@ -291,7 +291,7 @@ public String getID(DBPSM psm) { * @throws Exception */ //CV also available at http://psidev.cvs.sourceforge.net/viewvc/*checkout*/psidev/psi/psi-ms/mzML/controlledVocabulary/psi-ms.obo - public MZIdentMLExport(OfflineFDR fdr, FDRResult fdrResult, String outputfile, String databaseFileFormatID, String massSpecFileFormatID, mzIdentMLOwner owner) throws Exception { + public MZIdentMLExport(OfflineFDR fdr, FDRResult fdrResult, String outputfile, String databaseFileFormatID, String massSpecFileFormatID, MZIdentMLOwner owner) throws Exception { //XTandemFile xfile = new XTandemFile(inputfile); this.owner = owner; initializeVariables(fdr, fdrResult, databaseFileFormatID, massSpecFileFormatID); @@ -329,17 +329,17 @@ public MZIdentMLExport(OfflineFDR fdr, FDRResult fdrResult, String outputfile, S * @throws Exception */ //CV also available at http://psidev.cvs.sourceforge.net/viewvc/*checkout*/psidev/psi/psi-ms/mzML/controlledVocabulary/psi-ms.obo - public MZIdentMLExport(OfflineFDR fdr, FDRResult fdrResult, String databaseFileFormatID, String massSpecFileFormatID, mzIdentMLOwner owner) throws Exception { + public MZIdentMLExport(OfflineFDR fdr, FDRResult fdrResult, String databaseFileFormatID, String massSpecFileFormatID, MZIdentMLOwner owner) throws Exception { //XTandemFile xfile = new XTandemFile(inputfile); this.owner = owner; initializeVariables(fdr, fdrResult, databaseFileFormatID, massSpecFileFormatID); } - public MZIdentMLExport(OfflineFDR fdr, FDRResult fdrResult, String outputfile, mzIdentMLOwner owner) throws Exception { + public MZIdentMLExport(OfflineFDR fdr, FDRResult fdrResult, String outputfile, MZIdentMLOwner owner) throws Exception { this(fdr, fdrResult, outputfile, "MS:1001348", "MS:1001062", owner); } - public MZIdentMLExport(OfflineFDR fdr, FDRResult fdrResult, mzIdentMLOwner owner) throws Exception { + public MZIdentMLExport(OfflineFDR fdr, FDRResult fdrResult, MZIdentMLOwner owner) throws Exception { this(fdr, fdrResult, "MS:1001348", "MS:1001062", owner); } @@ -518,7 +518,7 @@ public void readInFDR(OfflineFDR fdr, FDRResult result, double massError) { int pagID =0; handleAnalysisSoftware(OfflineFDR.getXiFDRVersion().toString()); - handleAuditCollection(owner.first, owner.last, owner.email, owner.adress, owner.org); + handleAuditCollection(owner.first, owner.last, owner.email, owner.address, owner.org); handleProvider(); //Performed after auditcollection, since contact is needed for provider boolean fragmentIsMono = handleAnalysisProtocolCollection(fdr, result); @@ -684,7 +684,7 @@ public void readInFDR(OfflineFDR fdr, FDRResult result, double massError) { xlModId++; org.rappsilber.fdr.entities.PeptidePair peppair = psm.getPeptidePair(); - SpectraData specData = getSpectraData(psm.getSearchID(), psm.getRun()); + SpectraData specData = getSpectraData(psm.getSearchID(), psm.getPeakListName()); double calcMass = psm.getCalcMass(); double psmXLMass = psm.getCalcMass(); @@ -1893,7 +1893,7 @@ public void handleAuditCollection(String firstName, String lastName, String emai public SpectrumIdentificationList getSpectrumIdentificationList(DBPSM psm) { - return getSpectrumIdentificationList(psm.getSearchID(),psm.getRun()); + return getSpectrumIdentificationList(psm.getSearchID(),psm.getPeakListName()); } public SpectrumIdentificationList getSpectrumIdentificationList(int searchid,String run) { @@ -1961,18 +1961,25 @@ public SpectraData getSpectraData(int searchid, String run) { if (sd == null) { sd = new SpectraData(); SpectrumIDFormat sif = new SpectrumIDFormat(); - if (forceExtension.toLowerCase().contentEquals("mzml")) { + if (forceExtension != null && forceExtension.toLowerCase().contentEquals("mzml")) { sif.setCvParam(makeCvParam("MS:1001530", "mzML unique identifier",psiCV)); } else { sif.setCvParam(makeCvParam("MS:1000774", "multiple peak list nativeID format", psiCV)); } sd.setSpectrumIDFormat(sif); String runOut = run; + String extension = ""; + // get the file extension of the run-name + if (runOut.contains(".")) { + extension = runOut.substring(runOut.lastIndexOf(".")+1); + } + if (forceExtension != null) { if (runOut.contains(".")) runOut = runOut.substring(0,runOut.lastIndexOf("."))+"."+forceExtension; else runOut = runOut + "." + forceExtension; + extension = forceExtension; } sd.setLocation(runOut); @@ -1986,12 +1993,15 @@ public SpectraData getSpectraData(int searchid, String run) { */ FileFormat ff = new FileFormat(); - if (forceExtension.toLowerCase().contentEquals("mzml")) { + if (extension.toLowerCase().contentEquals("mzml")) { ff.setCvParam(makeCvParam("MS:1000584", "mzML format",psiCV)); - scanIDTranslation= this.mzMLscanIDTranslation; - } else if (forceExtension.toLowerCase().contentEquals("raw")) { + scanIDTranslation= this.mzMLscanIDTranslation; + } else if (extension.toLowerCase().contentEquals("raw")) { ff.setCvParam(makeCvParam("MS:1000563","Thermo RAW format", psiCV)); - scanIDTranslation= this.thermoRawScaNumber; + scanIDTranslation= this.thermoRawScaNumber; + } else if (extension.toLowerCase().contentEquals("apl")) { + ff.setCvParam(makeCvParam("MS:1002996","Andromeda:apl file format", psiCV)); + scanIDTranslation= this.thermoRawScaNumber; } else { ff.setCvParam(makeCvParam("MS:1001062","Mascot MGF format", psiCV)); scanIDTranslation= this.mgfScanID; @@ -2905,14 +2915,14 @@ public void setOwnerOrg(String ownerOrg) { * @return the ownerAddress */ public String getOwnerAddress() { - return owner.adress; + return owner.address; } /** * @param ownerAddress the ownerAddress to set */ public void setOwnerAddress(String ownerAddress) { - this.owner.adress = ownerAddress; + this.owner.address = ownerAddress; } /** diff --git a/src/main/java/org/rappsilber/fdr/utils/MZIdentMLOwner.java b/src/main/java/org/rappsilber/fdr/utils/MZIdentMLOwner.java new file mode 100644 index 0000000..8475a00 --- /dev/null +++ b/src/main/java/org/rappsilber/fdr/utils/MZIdentMLOwner.java @@ -0,0 +1,66 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.rappsilber.fdr.utils; + +import java.util.Objects; + +/** + * + * @author lfischer + */ +public class MZIdentMLOwner { + public String first; + public String last; + public String email; + public String org; + public String address; + + public MZIdentMLOwner() { + + } + public MZIdentMLOwner(String first, String last, String email, String org, String adress) { + this.first = first; + this.last = last; + this.email = email; + this.org = org; + this.address = adress; + } + + public boolean isEmpty() { + return (this.first == null || this.first.isEmpty()) && + (this.last == null || this.last.isEmpty()) && + (this.email == null || this.email.isEmpty()) && + (this.org == null || this.email.isEmpty()) && + (this.address == null|| this.address.isEmpty()); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof MZIdentMLOwner) { + MZIdentMLOwner o = (MZIdentMLOwner) obj; + return ((this.first == null && o.first == null) || (this.first != null && this.first.contentEquals(o.first))) && + ((this.last == null && o.last == null) || (this.last != null && this.last.contentEquals(o.last))) && + ((this.email == null && o.email == null) || (this.email != null && this.email.contentEquals(o.email))) && + ((this.org == null && o.org == null) || (this.org != null && this.org.contentEquals(o.org))) && + ((this.address == null && o.address == null) || (this.address != null && this.address.contentEquals(o.address))); + } + return false; + } + + @Override + public int hashCode() { + // somewhat autogenerated + int hash = 5; + hash = 97 * hash + this.first.hashCode(); + hash = 97 * hash + this.last.hashCode(); + hash = 97 * hash + this.email.hashCode(); + hash = 97 * hash + this.org.hashCode(); + hash = 97 * hash + this.address.hashCode(); + return hash; + } + + +} diff --git a/src/main/java/org/rappsilber/fdr/utils/mzIdentMLOwner.java b/src/main/java/org/rappsilber/fdr/utils/mzIdentMLOwner.java deleted file mode 100644 index 37b2b43..0000000 --- a/src/main/java/org/rappsilber/fdr/utils/mzIdentMLOwner.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package org.rappsilber.fdr.utils; - -/** - * - * @author lfischer - */ -public class mzIdentMLOwner { - String first; - String last; - String email; - String org; - String adress; - - public mzIdentMLOwner(String first, String last, String email, String org, String adress) { - this.first = first; - this.last = last; - this.email = email; - this.org = org; - this.adress = adress; - } - -} diff --git a/src/main/resources/xifdrproject.properties b/src/main/resources/xifdrproject.properties index 586133a..3811705 100644 --- a/src/main/resources/xifdrproject.properties +++ b/src/main/resources/xifdrproject.properties @@ -1,6 +1,18 @@ xifdr.version=${project.version} xifdr.artifactId=${project.artifactId} xifdr.changelog=\ +1.4.0\n\ +* Medium complexity level of FDR interface replaces (previous simple one)\n\ +* Some cleavable cross-linker related columns are read in\n\ +** specific grouping for these can be selected\n\ +* Validity check disabled by default but still reports warning\n\ +* Validity check warnings more verbose\n\ +* When writing csv-files from the command line mzIdentML files get writen out as well\n\ +** a window asking for document-owner will be displayed\n\ +* decoy:psms better marked\n\ +* Improved synchronisation between settings-panel\n\ +* Some adaptation to forward settings from the command-line to the GUI\n\ +* BugFix for spaces in ambiguous accession list\n\ 1.3.37\n\ * BUGFIX local FDR not working correctly\n\ * Forward arguments from command-line to GUI\n\