diff --git a/CrossLinker/nbproject/private/private.properties b/CrossLinker/nbproject/private/private.properties index 3fe5c4f..8c66cc2 100644 --- a/CrossLinker/nbproject/private/private.properties +++ b/CrossLinker/nbproject/private/private.properties @@ -4,4 +4,4 @@ do.depend=false do.jar=true javac.debug=true javadoc.preview=true -user.properties.file=C:\\Users\\Tsou\\AppData\\Roaming\\NetBeans\\8.1\\build.properties +user.properties.file=C:\\Users\\Cct\\AppData\\Roaming\\NetBeans\\8.1\\build.properties diff --git a/DIA-Umpire/src/MSUmpire/DIA/DIAPack.java b/DIA-Umpire/src/MSUmpire/DIA/DIAPack.java index 775deaa..05749ee 100644 --- a/DIA-Umpire/src/MSUmpire/DIA/DIAPack.java +++ b/DIA-Umpire/src/MSUmpire/DIA/DIAPack.java @@ -641,9 +641,9 @@ public void SetPepXMLPath(){ public void ParsePepXML(DBSearchParam searchPara, LCMSID refID) throws ParserConfigurationException, SAXException, IOException, XmlPullParserException, ClassNotFoundException, InterruptedException { SetPepXMLPath(); - IDsummary = new LCMSID(FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename),searchPara.DecoyPrefix,searchPara.FastaPath); + IDsummary = new LCMSID(FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename), searchPara.DecoyPrefix, searchPara.FastaPath); for (String pepxml : iProphPepXMLs) { - LCMSID pepxmlid = new LCMSID(FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename),searchPara.DecoyPrefix,searchPara.FastaPath); + LCMSID pepxmlid = new LCMSID(FilenameUtils.getFullPath(Filename) + FilenameUtils.getBaseName(Filename), searchPara.DecoyPrefix, searchPara.FastaPath); PepXMLParser pepxmlparser = new PepXMLParser(pepxmlid, pepxml, 0f); if (refID == null) { pepxmlid.FilterByPepDecoyFDR(searchPara.DecoyPrefix, searchPara.PepFDR); @@ -651,9 +651,9 @@ public void ParsePepXML(DBSearchParam searchPara, LCMSID refID) throws ParserCon Logger.getRootLogger().info("No. of peptide ions:" + pepxmlid.GetPepIonList().size() + "; Peptide level threshold: " + pepxmlid.PepProbThreshold); for (PepIonID pepID : pepxmlid.GetPepIonList().values()) { if (refID != null) { - if(refID.GetPepIonList().containsKey(pepID.GetKey())){ + if (refID.GetPepIonList().containsKey(pepID.GetKey())) { IDsummary.AddPeptideID(pepID); - } + } } else { IDsummary.AddPeptideID(pepID); } @@ -661,7 +661,7 @@ public void ParsePepXML(DBSearchParam searchPara, LCMSID refID) throws ParserCon } IDsummary.ReMapProPep(); Logger.getRootLogger().info("Total number of peptide ions:" + IDsummary.GetPepIonList().size()); - CheckPSMRT(); + CheckPSMRT(); if (MS1FeatureMap != null) { this.MS1FeatureMap.IDsummary = IDsummary; } diff --git a/DIA-Umpire/src/MSUmpire/LCMSPeakStructure/LCMSPeakMS1.java b/DIA-Umpire/src/MSUmpire/LCMSPeakStructure/LCMSPeakMS1.java index 71a7491..3d83a5e 100644 --- a/DIA-Umpire/src/MSUmpire/LCMSPeakStructure/LCMSPeakMS1.java +++ b/DIA-Umpire/src/MSUmpire/LCMSPeakStructure/LCMSPeakMS1.java @@ -32,7 +32,6 @@ import MSUmpire.PeptidePeakClusterDetection.PDHandlerMS1; import MSUmpire.SearchResultParser.PepXMLParser; import MSUmpire.SpectrumParser.SpectrumParserBase; -import MSUmpire.SpectrumParser.mzXMLParser; import java.awt.BasicStroke; import java.awt.Color; import java.awt.geom.Ellipse2D; diff --git a/DIA-Umpire/src/MSUmpire/MathPackage/ChiSquareGOF.java b/DIA-Umpire/src/MSUmpire/MathPackage/ChiSquareGOF.java index 2e19a19..296b9e4 100644 --- a/DIA-Umpire/src/MSUmpire/MathPackage/ChiSquareGOF.java +++ b/DIA-Umpire/src/MSUmpire/MathPackage/ChiSquareGOF.java @@ -33,15 +33,15 @@ public class ChiSquareGOF { public static ChiSquared[] chimodels; public static ReadWriteLock lock = new ReentrantReadWriteLock(); - private ChiSquareGOF(int maxpeak) { + private ChiSquareGOF(int maxpeak) { chimodels = new ChiSquared[maxpeak-1]; - for (int i = 1; i <= maxpeak; i++) { - chimodels[i - 1] = new ChiSquared(i); + for (int i = 1; i < maxpeak; i++) { + chimodels[i-1] = new ChiSquared(i); } } public static ChiSquareGOF GetInstance(int maxpeak) { - if (models == null || (maxpeak>1 && maxpeak >= chimodels.length)) { + if (models == null) { lock.writeLock().lock(); try { if (models == null) { @@ -57,17 +57,22 @@ public static ChiSquareGOF GetInstance(int maxpeak) { public float GetGoodNessOfFitProb(float[] expected, float[] observed) { float gof = 0f; int nopeaks = 0; - for (int i = 0; i < Math.min(observed.length,expected.length); i++) { + for (int i = 0; i < Math.min(observed.length, expected.length); i++) { if (observed[i] > 0) { float error = expected[i] - observed[i]; gof += (error * error) / (expected[i] * expected[i]); nopeaks++; } } - if (Float.isNaN(gof) || nopeaks<2){ + if (Float.isNaN(gof) || nopeaks < 2) { return 0f; } - float prob = 1 - (float) chimodels[nopeaks-2].cdf(gof); + + if(chimodels[nopeaks-2]==null){ + System.out.println(""); + } + + float prob = 1 - (float) chimodels[nopeaks - 2].cdf(gof); return prob; } -} +} \ No newline at end of file diff --git a/DIA_Umpire_ProtQuant/nbproject/private/private.properties b/DIA_Umpire_ProtQuant/nbproject/private/private.properties index 86a2c4a..49e3455 100644 --- a/DIA_Umpire_ProtQuant/nbproject/private/private.properties +++ b/DIA_Umpire_ProtQuant/nbproject/private/private.properties @@ -4,4 +4,4 @@ do.depend=false do.jar=true javac.debug=true javadoc.preview=true -user.properties.file=C:\\Users\\Tsou\\AppData\\Roaming\\NetBeans\\8.1\\build.properties +user.properties.file=C:\\Users\\Cct\\AppData\\Roaming\\NetBeans\\8.1\\build.properties diff --git a/DIA_Umpire_Quant/src/dia_umpire_quant/DIA_Umpire_Quant.java b/DIA_Umpire_Quant/src/dia_umpire_quant/DIA_Umpire_Quant.java index e96a8c9..9df1761 100644 --- a/DIA_Umpire_Quant/src/dia_umpire_quant/DIA_Umpire_Quant.java +++ b/DIA_Umpire_Quant/src/dia_umpire_quant/DIA_Umpire_Quant.java @@ -49,15 +49,11 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; -import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; -import java.util.zip.DataFormatException; -import javax.xml.parsers.ParserConfigurationException; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.log4j.Level; import org.apache.log4j.Logger; -import org.xml.sax.SAXException; /** * @@ -81,213 +77,215 @@ public static void main(String[] args) throws FileNotFoundException, IOException } catch (Exception e) { } - Logger.getRootLogger().info("Version: "+UmpireInfo.GetInstance().Version); - Logger.getRootLogger().info("Parameter file:" + args[0]); - - BufferedReader reader = new BufferedReader(new FileReader(args[0])); - String line = ""; - String WorkFolder = ""; - int NoCPUs = 2; - - String UserMod = ""; - String Combined_Prot = ""; - String InternalLibID = ""; - String ExternalLibPath = ""; - String ExternalLibDecoyTag = "DECOY"; - boolean DefaultProtFiltering=true; - boolean DataSetLevelPepFDR=false; - float ProbThreshold = 0.99f; - float ExtProbThreshold =0.99f; - float Freq = 0f; - int TopNPep = 6; - int TopNFrag = 6; - String FilterWeight = "GW"; - float MinWeight = 0.9f; - float RTWindow_Int=-1f; - float RTWindow_Ext=-1f; - - TandemParam tandemPara = new TandemParam(DBSearchParam.SearchInstrumentType.TOF5600); - HashMap AssignFiles = new HashMap<>(); - boolean InternalLibSearch = false; - boolean ExternalLibSearch = false; - - boolean ExportSaint = false; - boolean SAINT_MS1 = false; - boolean SAINT_MS2 = true; - - HashMap BaitList = new HashMap<>(); - HashMap BaitName = new HashMap<>(); - HashMap ControlList = new HashMap<>(); - HashMap ControlName = new HashMap<>(); - - // - while ((line = reader.readLine()) != null) { - line=line.trim(); - Logger.getRootLogger().info(line); - if (!"".equals(line) && !line.startsWith("#")) { - //System.out.println(line); - if (line.equals("==File list begin")) { - do { - line = reader.readLine(); - line = line.trim(); - if (line.equals("==File list end")) { - continue; - } else if (!"".equals(line)) { - File newfile = new File(line); - if (newfile.exists()) { - AssignFiles.put(newfile.getAbsolutePath(), newfile); - } else { - Logger.getRootLogger().info("File: " + newfile + " does not exist."); - } - } - } while (!line.equals("==File list end")); - } - if (line.split("=").length < 2) { - continue; - } - String type = line.split("=")[0].trim(); - String value = line.split("=")[1].trim(); - switch (type) { - case "TargetedExtraction": { - InternalLibSearch = Boolean.parseBoolean(value); - break; - } - case "InternalLibSearch": { - InternalLibSearch = Boolean.parseBoolean(value); - break; - } - case "ExternalLibSearch": { - ExternalLibSearch = Boolean.parseBoolean(value); - break; - } + try { - case "Path": { - WorkFolder = value; - break; - } - case "path": { - WorkFolder = value; - break; - } - case "Thread": { - NoCPUs = Integer.parseInt(value); - break; - } - case "Fasta": { - tandemPara.FastaPath = value; - break; - } - case "Combined_Prot": { - Combined_Prot = value; - break; - } - case "DefaultProtFiltering": { - DefaultProtFiltering = Boolean.parseBoolean(value); - break; - } - case "DecoyPrefix": { - if (!"".equals(value)) { - tandemPara.DecoyPrefix = value; - } - break; - } - case "UserMod": { - UserMod = value; - break; - } - case "ProteinFDR": { - tandemPara.ProtFDR = Float.parseFloat(value); - break; - } - case "PeptideFDR": { - tandemPara.PepFDR = Float.parseFloat(value); - break; - } - case "DataSetLevelPepFDR": { - DataSetLevelPepFDR = Boolean.parseBoolean(value); - break; - } - case "InternalLibID": { - InternalLibID = value; - break; - } - case "ExternalLibPath": { - ExternalLibPath = value; - break; - } - case "ExtProbThreshold":{ - ExtProbThreshold = Float.parseFloat(value); - break; - } - case "RTWindow_Int": { - RTWindow_Int = Float.parseFloat(value); - break; + Logger.getRootLogger().info("Version: " + UmpireInfo.GetInstance().Version); + Logger.getRootLogger().info("Parameter file:" + args[0]); + + BufferedReader reader = new BufferedReader(new FileReader(args[0])); + String line = ""; + String WorkFolder = ""; + int NoCPUs = 2; + + String UserMod = ""; + String Combined_Prot = ""; + String InternalLibID = ""; + String ExternalLibPath = ""; + String ExternalLibDecoyTag = "DECOY"; + boolean DefaultProtFiltering = true; + boolean DataSetLevelPepFDR = false; + float ProbThreshold = 0.99f; + float ExtProbThreshold = 0.99f; + float Freq = 0f; + int TopNPep = 6; + int TopNFrag = 6; + String FilterWeight = "GW"; + float MinWeight = 0.9f; + float RTWindow_Int = -1f; + float RTWindow_Ext = -1f; + + TandemParam tandemPara = new TandemParam(DBSearchParam.SearchInstrumentType.TOF5600); + HashMap AssignFiles = new HashMap<>(); + boolean InternalLibSearch = false; + boolean ExternalLibSearch = false; + + boolean ExportSaint = false; + boolean SAINT_MS1 = false; + boolean SAINT_MS2 = true; + + HashMap BaitList = new HashMap<>(); + HashMap BaitName = new HashMap<>(); + HashMap ControlList = new HashMap<>(); + HashMap ControlName = new HashMap<>(); + + // + while ((line = reader.readLine()) != null) { + line = line.trim(); + Logger.getRootLogger().info(line); + if (!"".equals(line) && !line.startsWith("#")) { + //System.out.println(line); + if (line.equals("==File list begin")) { + do { + line = reader.readLine(); + line = line.trim(); + if (line.equals("==File list end")) { + continue; + } else if (!"".equals(line)) { + File newfile = new File(line); + if (newfile.exists()) { + AssignFiles.put(newfile.getAbsolutePath(), newfile); + } else { + Logger.getRootLogger().info("File: " + newfile + " does not exist."); + } + } + } while (!line.equals("==File list end")); } - case "RTWindow_Ext": { - RTWindow_Ext = Float.parseFloat(value); - break; + if (line.split("=").length < 2) { + continue; } - case "ExternalLibDecoyTag": { - ExternalLibDecoyTag = value; - if(ExternalLibDecoyTag.endsWith("_")){ - ExternalLibDecoyTag=ExternalLibDecoyTag.substring(0, ExternalLibDecoyTag.length()-1); + String type = line.split("=")[0].trim(); + String value = line.split("=")[1].trim(); + switch (type) { + case "TargetedExtraction": { + InternalLibSearch = Boolean.parseBoolean(value); + break; + } + case "InternalLibSearch": { + InternalLibSearch = Boolean.parseBoolean(value); + break; + } + case "ExternalLibSearch": { + ExternalLibSearch = Boolean.parseBoolean(value); + break; } - break; - } - case "ProbThreshold": { - ProbThreshold = Float.parseFloat(value); - break; - } - case "ReSearchProb": { - //ReSearchProb = Float.parseFloat(value); - break; - } - case "FilterWeight": { - FilterWeight = value; - break; - } - case "MinWeight": { - MinWeight = Float.parseFloat(value); - break; - } - case "TopNFrag": { - TopNFrag = Integer.parseInt(value); - break; - } - case "TopNPep": { - TopNPep = Integer.parseInt(value); - break; - } - case "Freq": { - Freq = Float.parseFloat(value); - break; - } - // - case "ExportSaintInput": { - ExportSaint = Boolean.parseBoolean(value); - break; - } - case "QuantitationType": { - switch (value) { - case "MS1": { - SAINT_MS1 = true; - SAINT_MS2 = false; - break; + case "Path": { + WorkFolder = value; + break; + } + case "path": { + WorkFolder = value; + break; + } + case "Thread": { + NoCPUs = Integer.parseInt(value); + break; + } + case "Fasta": { + tandemPara.FastaPath = value; + break; + } + case "Combined_Prot": { + Combined_Prot = value; + break; + } + case "DefaultProtFiltering": { + DefaultProtFiltering = Boolean.parseBoolean(value); + break; + } + case "DecoyPrefix": { + if (!"".equals(value)) { + tandemPara.DecoyPrefix = value; } - case "MS2": { - SAINT_MS1 = false; - SAINT_MS2 = true; - break; + break; + } + case "UserMod": { + UserMod = value; + break; + } + case "ProteinFDR": { + tandemPara.ProtFDR = Float.parseFloat(value); + break; + } + case "PeptideFDR": { + tandemPara.PepFDR = Float.parseFloat(value); + break; + } + case "DataSetLevelPepFDR": { + DataSetLevelPepFDR = Boolean.parseBoolean(value); + break; + } + case "InternalLibID": { + InternalLibID = value; + break; + } + case "ExternalLibPath": { + ExternalLibPath = value; + break; + } + case "ExtProbThreshold": { + ExtProbThreshold = Float.parseFloat(value); + break; + } + case "RTWindow_Int": { + RTWindow_Int = Float.parseFloat(value); + break; + } + case "RTWindow_Ext": { + RTWindow_Ext = Float.parseFloat(value); + break; + } + case "ExternalLibDecoyTag": { + ExternalLibDecoyTag = value; + if (ExternalLibDecoyTag.endsWith("_")) { + ExternalLibDecoyTag = ExternalLibDecoyTag.substring(0, ExternalLibDecoyTag.length() - 1); } - case "BOTH": { - SAINT_MS1 = true; - SAINT_MS2 = true; - break; + break; + } + case "ProbThreshold": { + ProbThreshold = Float.parseFloat(value); + break; + } + case "ReSearchProb": { + //ReSearchProb = Float.parseFloat(value); + break; + } + case "FilterWeight": { + FilterWeight = value; + break; + } + case "MinWeight": { + MinWeight = Float.parseFloat(value); + break; + } + case "TopNFrag": { + TopNFrag = Integer.parseInt(value); + break; + } + case "TopNPep": { + TopNPep = Integer.parseInt(value); + break; + } + case "Freq": { + Freq = Float.parseFloat(value); + break; + } + + // + case "ExportSaintInput": { + ExportSaint = Boolean.parseBoolean(value); + break; + } + case "QuantitationType": { + switch (value) { + case "MS1": { + SAINT_MS1 = true; + SAINT_MS2 = false; + break; + } + case "MS2": { + SAINT_MS1 = false; + SAINT_MS2 = true; + break; + } + case "BOTH": { + SAINT_MS1 = true; + SAINT_MS2 = true; + break; + } } + break; } - break; - } // case "BaitInputFile": { // SaintBaitFile = value; // break; @@ -300,76 +298,74 @@ public static void main(String[] args) throws FileNotFoundException, IOException // SaintInteractionFile = value; // break; // } - default: { - if (type.startsWith("BaitName_")) { - BaitName.put(type.substring(9), value); - } - if (type.startsWith("BaitFile_")) { - BaitList.put(type.substring(9), value.split("\t")); - } - if (type.startsWith("ControlName_")) { - ControlName.put(type.substring(12), value); - } - if (type.startsWith("ControlFile_")) { - ControlList.put(type.substring(12), value.split("\t")); + default: { + if (type.startsWith("BaitName_")) { + BaitName.put(type.substring(9), value); + } + if (type.startsWith("BaitFile_")) { + BaitList.put(type.substring(9), value.split("\t")); + } + if (type.startsWith("ControlName_")) { + ControlName.put(type.substring(12), value); + } + if (type.startsWith("ControlFile_")) { + ControlList.put(type.substring(12), value.split("\t")); + } + break; } - break; - } // + } } } - } // - //Initialize PTM manager using compomics library - PTMManager.GetInstance(); - if (!UserMod.equals("")) { - PTMManager.GetInstance().ImportUserMod(UserMod); - } + //Initialize PTM manager using compomics library + PTMManager.GetInstance(); + if (!UserMod.equals("")) { + PTMManager.GetInstance().ImportUserMod(UserMod); + } - //Check if the fasta file can be found - if (!new File(tandemPara.FastaPath).exists()) { - Logger.getRootLogger().info("Fasta file :"+tandemPara.FastaPath + " cannot be found, the process will be terminated, please check."); - System.exit(1); - } - - //Check if the prot.xml file can be found - if (!new File(Combined_Prot).exists()) { - Logger.getRootLogger().info("ProtXML file: " +Combined_Prot + " cannot be found, the export protein summary table will be empty."); - } - - - LCMSID protID = null; - - //Parse prot.xml and generate protein master list given an FDR - if (Combined_Prot != null && !Combined_Prot.equals("")) { - protID = LCMSID.ReadLCMSIDSerialization(Combined_Prot); - if (!"".equals(Combined_Prot) && protID == null) { - protID = new LCMSID(Combined_Prot, tandemPara.DecoyPrefix, tandemPara.FastaPath); - ProtXMLParser protxmlparser = new ProtXMLParser(protID, Combined_Prot, 0f); - //Use DIA-Umpire default protein FDR calculation - if (DefaultProtFiltering) { - protID.RemoveLowLocalPWProtein(0.8f); - protID.RemoveLowMaxIniProbProtein(0.9f); - protID.FilterByProteinDecoyFDRUsingMaxIniProb(tandemPara.DecoyPrefix, tandemPara.ProtFDR); - } - //Get protein FDR calculation without other filtering - else{ - protID.FilterByProteinDecoyFDRUsingLocalPW(tandemPara.DecoyPrefix, tandemPara.ProtFDR); + //Check if the fasta file can be found + if (!new File(tandemPara.FastaPath).exists()) { + Logger.getRootLogger().info("Fasta file :" + tandemPara.FastaPath + " cannot be found, the process will be terminated, please check."); + System.exit(1); + } + + //Check if the prot.xml file can be found + if (!new File(Combined_Prot).exists()) { + Logger.getRootLogger().info("ProtXML file: " + Combined_Prot + " cannot be found, the export protein summary table will be empty."); + } + + LCMSID protID = null; + + //Parse prot.xml and generate protein master list given an FDR + if (Combined_Prot != null && !Combined_Prot.equals("")) { + protID = LCMSID.ReadLCMSIDSerialization(Combined_Prot); + if (!"".equals(Combined_Prot) && protID == null) { + protID = new LCMSID(Combined_Prot, tandemPara.DecoyPrefix, tandemPara.FastaPath); + ProtXMLParser protxmlparser = new ProtXMLParser(protID, Combined_Prot, 0f); + //Use DIA-Umpire default protein FDR calculation + if (DefaultProtFiltering) { + protID.RemoveLowLocalPWProtein(0.8f); + protID.RemoveLowMaxIniProbProtein(0.9f); + protID.FilterByProteinDecoyFDRUsingMaxIniProb(tandemPara.DecoyPrefix, tandemPara.ProtFDR); + } //Get protein FDR calculation without other filtering + else { + protID.FilterByProteinDecoyFDRUsingLocalPW(tandemPara.DecoyPrefix, tandemPara.ProtFDR); + } + protID.LoadSequence(); + protID.WriteLCMSIDSerialization(Combined_Prot); } - protID.LoadSequence(); - protID.WriteLCMSIDSerialization(Combined_Prot); + Logger.getRootLogger().info("Protein No.:" + protID.ProteinList.size()); } - Logger.getRootLogger().info("Protein No.:" + protID.ProteinList.size()); - } - HashMap> IDSummaryFragments = new HashMap<>(); + HashMap> IDSummaryFragments = new HashMap<>(); + + //Generate DIA file list + ArrayList FileList = new ArrayList<>(); - //Generate DIA file list - ArrayList FileList = new ArrayList<>(); - try { File folder = new File(WorkFolder); - if(!folder.exists()){ - Logger.getRootLogger().info("The path : "+ WorkFolder + " cannot be found."); + if (!folder.exists()) { + Logger.getRootLogger().info("The path : " + WorkFolder + " cannot be found."); System.exit(1); } for (final File fileEntry : folder.listFiles()) { @@ -394,35 +390,12 @@ public static void main(String[] args) throws FileNotFoundException, IOException Logger.getRootLogger().info("No. of files assigned :" + AssignFiles.size()); for (File fileEntry : AssignFiles.values()) { Logger.getRootLogger().info(fileEntry.getAbsolutePath()); - } - - - LCMSID combinePepID = null; - if (DataSetLevelPepFDR) { - combinePepID = LCMSID.ReadLCMSIDSerialization(WorkFolder + "combinePepID.SerFS"); - if (combinePepID == null) { - FDR_DataSetLevel fdr = new FDR_DataSetLevel(); - fdr.GeneratePepIonList(FileList, tandemPara, WorkFolder + "combinePepID.SerFS"); - combinePepID = fdr.combineID; - combinePepID.WriteLCMSIDSerialization(WorkFolder + "combinePepID.SerFS"); - } - } - - //process each DIA file for quantification based on untargeted identifications - for (File fileEntry : AssignFiles.values()) { String mzXMLFile = fileEntry.getAbsolutePath(); if (mzXMLFile.toLowerCase().endsWith(".mzxml") | mzXMLFile.toLowerCase().endsWith(".mzml")) { - long time = System.currentTimeMillis(); - DIAPack DiaFile = new DIAPack(mzXMLFile, NoCPUs); FileList.add(DiaFile); HashMap FragMap = new HashMap<>(); IDSummaryFragments.put(FilenameUtils.getBaseName(mzXMLFile), FragMap); - if (!new File(FilenameUtils.getFullPath(DiaFile.Filename) + DiaFile.GetQ1Name() + ".mzXML").exists() - | !new File(FilenameUtils.getFullPath(DiaFile.Filename) + DiaFile.GetQ2Name() + ".mzXML").exists() - | !new File(FilenameUtils.getFullPath(DiaFile.Filename) + DiaFile.GetQ3Name() + ".mzXML").exists()) { - return; - } Logger.getRootLogger().info("================================================================================================="); Logger.getRootLogger().info("Processing " + mzXMLFile); if (!DiaFile.LoadDIASetting()) { @@ -433,34 +406,50 @@ public static void main(String[] args) throws FileNotFoundException, IOException Logger.getRootLogger().info("Loading parameters failed, job is incomplete"); System.exit(1); } - Logger.getRootLogger().info("Loading identification results " + mzXMLFile + "...."); - - //If the LCMSID serialization is found - if (!DiaFile.ReadSerializedLCMSID()) { - DiaFile.ParsePepXML(tandemPara, combinePepID); - DiaFile.BuildStructure(); - if (!DiaFile.MS1FeatureMap.ReadPeakCluster()) { - Logger.getRootLogger().info("Loading peak and structure failed, job is incomplete"); - System.exit(1); - } - DiaFile.MS1FeatureMap.ClearMonoisotopicPeakOfCluster(); - //Generate mapping between index of precursor feature and pseudo MS/MS scan index - DiaFile.GenerateClusterScanNomapping(); - //Doing quantification - DiaFile.AssignQuant(); - DiaFile.ClearStructure(); + } + } + + LCMSID combinePepID = null; + if (DataSetLevelPepFDR) { + combinePepID = LCMSID.ReadLCMSIDSerialization(WorkFolder + "combinePepID.SerFS"); + if (combinePepID == null) { + FDR_DataSetLevel fdr = new FDR_DataSetLevel(); + fdr.GeneratePepIonList(FileList, tandemPara, WorkFolder + "combinePepID.SerFS"); + combinePepID = fdr.combineID; + combinePepID.WriteLCMSIDSerialization(WorkFolder + "combinePepID.SerFS"); + } + } + + //process each DIA file for quantification based on untargeted identifications + for (DIAPack DiaFile : FileList) { + long time = System.currentTimeMillis(); + Logger.getRootLogger().info("Loading identification results " + DiaFile.Filename + "...."); + + //If the LCMSID serialization is found + if (!DiaFile.ReadSerializedLCMSID()) { + DiaFile.ParsePepXML(tandemPara, combinePepID); + DiaFile.BuildStructure(); + if (!DiaFile.MS1FeatureMap.ReadPeakCluster()) { + Logger.getRootLogger().info("Loading peak and structure failed, job is incomplete"); + System.exit(1); } - DiaFile.IDsummary.ReduceMemoryUsage(); - time = System.currentTimeMillis() - time; - Logger.getRootLogger().info(mzXMLFile + " processed time:" + String.format("%d hour, %d min, %d sec", TimeUnit.MILLISECONDS.toHours(time), TimeUnit.MILLISECONDS.toMinutes(time) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(time)), TimeUnit.MILLISECONDS.toSeconds(time) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(time)))); + DiaFile.MS1FeatureMap.ClearMonoisotopicPeakOfCluster(); + //Generate mapping between index of precursor feature and pseudo MS/MS scan index + DiaFile.GenerateClusterScanNomapping(); + //Doing quantification + DiaFile.AssignQuant(); + DiaFile.ClearStructure(); } + DiaFile.IDsummary.ReduceMemoryUsage(); + time = System.currentTimeMillis() - time; + Logger.getRootLogger().info(DiaFile.Filename + " processed time:" + String.format("%d hour, %d min, %d sec", TimeUnit.MILLISECONDS.toHours(time), TimeUnit.MILLISECONDS.toMinutes(time) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(time)), TimeUnit.MILLISECONDS.toSeconds(time) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(time)))); } - + // Logger.getRootLogger().info("================================================================================================="); if (InternalLibSearch && FileList.size() > 1) { Logger.getRootLogger().info("Module C: Targeted extraction using internal library"); - + FragmentLibManager libManager = FragmentLibManager.ReadFragmentLibSerialization(WorkFolder, InternalLibID); if (libManager == null) { Logger.getRootLogger().info("Building internal spectral library"); @@ -473,7 +462,7 @@ public static void main(String[] args) throws FileNotFoundException, IOException libManager.WriteFragmentLibSerialization(WorkFolder); } libManager.ReduceMemoryUsage(); - + Logger.getRootLogger().info("Building retention time prediction model and generate candidate peptide list"); for (int i = 0; i < FileList.size(); i++) { FileList.get(i).IDsummary.ClearMappedPep(); @@ -487,7 +476,7 @@ public static void main(String[] args) throws FileNotFoundException, IOException FileList.get(i).ExportID(); FileList.get(i).IDsummary = null; } - + Logger.getRootLogger().info("Targeted matching........"); for (DIAPack diafile : FileList) { if (diafile.IDsummary == null) { @@ -500,10 +489,10 @@ public static void main(String[] args) throws FileNotFoundException, IOException diafile.MS1FeatureMap.ReadPeakCluster(); diafile.MS1FeatureMap.ClearMonoisotopicPeakOfCluster(); diafile.GenerateMassCalibrationRTMap(); - diafile.TargetedExtractionQuant(false, libManager,1.1f,RTWindow_Int); + diafile.TargetedExtractionQuant(false, libManager, 1.1f, RTWindow_Int); diafile.MS1FeatureMap.ClearAllPeaks(); diafile.IDsummary.ReduceMemoryUsage(); - diafile.IDsummary.RemoveLowProbMappedIon(ProbThreshold); + diafile.IDsummary.RemoveLowProbMappedIon(ProbThreshold); diafile.ExportID(); Logger.getRootLogger().info("Peptide ions: " + diafile.IDsummary.GetPepIonList().size() + " Mapped ions: " + diafile.IDsummary.GetMappedPepIonList().size()); diafile.ClearStructure(); @@ -514,18 +503,17 @@ public static void main(String[] args) throws FileNotFoundException, IOException Logger.getRootLogger().info("================================================================================================="); } // - + // - //External library search if (ExternalLibSearch) { Logger.getRootLogger().info("Module C: Targeted extraction using external library"); - + //Read exteranl library FragmentLibManager ExlibManager = FragmentLibManager.ReadFragmentLibSerialization(WorkFolder, FilenameUtils.getBaseName(ExternalLibPath)); if (ExlibManager == null) { ExlibManager = new FragmentLibManager(FilenameUtils.getBaseName(ExternalLibPath)); - + //Import traML file ExlibManager.ImportFragLibByTraML(ExternalLibPath, ExternalLibDecoyTag); //Check if there are decoy spectra @@ -542,33 +530,32 @@ public static void main(String[] args) throws FileNotFoundException, IOException RTMappingExtLib RTmap = new RTMappingExtLib(diafile.IDsummary, ExlibManager, diafile.GetParameter()); RTmap.GenerateModel(); RTmap.GenerateMappedPepIon(); - + diafile.BuildStructure(); diafile.MS1FeatureMap.ReadPeakCluster(); diafile.GenerateMassCalibrationRTMap(); //Perform targeted re-extraction - diafile.TargetedExtractionQuant(false, ExlibManager,ProbThreshold,RTWindow_Ext); + diafile.TargetedExtractionQuant(false, ExlibManager, ProbThreshold, RTWindow_Ext); diafile.MS1FeatureMap.ClearAllPeaks(); diafile.IDsummary.ReduceMemoryUsage(); //Remove target IDs below the defined probability threshold - diafile.IDsummary.RemoveLowProbMappedIon(ExtProbThreshold); + diafile.IDsummary.RemoveLowProbMappedIon(ExtProbThreshold); diafile.ExportID(); diafile.ClearStructure(); Logger.getRootLogger().info("Peptide ions: " + diafile.IDsummary.GetPepIonList().size() + " Mapped ions: " + diafile.IDsummary.GetMappedPepIonList().size()); } } // - + // - Logger.getRootLogger().info("Peptide and fragment selection across the whole dataset"); ArrayList SummaryList = new ArrayList<>(); for (DIAPack diafile : FileList) { if (diafile.IDsummary == null) { - diafile.ReadSerializedLCMSID(); + diafile.ReadSerializedLCMSID(); diafile.IDsummary.ClearAssignPeakCluster(); //diafile.IDsummary.ClearPSMs(); - } + } if (protID != null) { //Generate protein list according to mapping of peptide ions for each DIA file to the master protein list diafile.IDsummary.GenerateProteinByRefIDByPepSeq(protID, true); @@ -588,7 +575,7 @@ public static void main(String[] args) throws FileNotFoundException, IOException fragselection.GenerateProtPepScoreMap(MinWeight); fragselection.GenerateTopPepMap(TopNPep); // - + // ExportTable export = new ExportTable(WorkFolder, SummaryList, IDSummaryFragments, protID, fragselection); export.Export(TopNPep, TopNFrag, Freq); @@ -653,7 +640,6 @@ public static void main(String[] args) throws FileNotFoundException, IOException } // - Logger.getRootLogger().info("Job done"); Logger.getRootLogger().info("================================================================================================="); @@ -684,5 +670,4 @@ private static void SaintOutput(LCMSID protID, LCMSID IDsummary, FragmentSelecti } } - }