use of com.compomics.util.parameters.identification.advanced.ValidationQcParameters in project peptide-shaker by compomics.
the class NewDialog method setIdentificationParameters.
/**
* Sets the search parameters in the identification parameters and updates
* the GUI.
*
* @param newIdentificationParameters the new identification parameters
*/
private void setIdentificationParameters(IdentificationParameters newIdentificationParameters) {
try {
ValidationQcParameters validationQcParameters = newIdentificationParameters.getIdValidationParameters().getValidationQCParameters();
if (validationQcParameters == null || validationQcParameters.getPsmFilters() == null || validationQcParameters.getPeptideFilters() == null || validationQcParameters.getProteinFilters() == null || validationQcParameters.getPsmFilters().isEmpty() && validationQcParameters.getPeptideFilters().isEmpty() && validationQcParameters.getProteinFilters().isEmpty()) {
MatchesValidator.setDefaultMatchesQCFilters(validationQcParameters);
identificationParametersFactory.addIdentificationParameters(newIdentificationParameters);
}
this.identificationParameters = newIdentificationParameters;
Vector parameterList = new Vector();
parameterList.add("-- Select --");
for (String tempParameters : identificationParametersFactory.getParametersList()) {
parameterList.add(tempParameters);
}
settingsComboBox.setModel(new javax.swing.DefaultComboBoxModel(parameterList));
settingsComboBox.setSelectedItem(identificationParameters.getName());
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Failed to import identification parameters from: " + newIdentificationParameters.getName() + ".", "Identification Parameters", JOptionPane.WARNING_MESSAGE);
e.printStackTrace();
// set the search settings to default
this.identificationParameters = null;
}
validateInput();
}
use of com.compomics.util.parameters.identification.advanced.ValidationQcParameters in project peptide-shaker by compomics.
the class PeptideShakerCLI method createProject.
/**
* Creates the PeptideShaker project based on the identification files
* provided in the command line input
*
* @throws java.io.IOException exception thrown if an error occurs while
* reading or writing a file
* @throws java.lang.InterruptedException exception thrown if a thread is
* interrupted
* @throws java.util.concurrent.TimeoutException exception thrown if a
* process times out
*/
public void createProject() throws IOException, InterruptedException, TimeoutException {
// define new project reference
projectParameters = new ProjectParameters(cliInputBean.getExperimentID());
// set the project details
projectDetails = new ProjectDetails();
projectDetails.setCreationDate(new Date());
projectDetails.setPeptideShakerVersion(new Properties().getVersion());
// set up spectrum provider
msFileHandler = new MsFileHandler();
// get the input files
ArrayList<File> identificationFilesInput = cliInputBean.getIdFiles();
ArrayList<File> dataFolders = new ArrayList<>();
ArrayList<File> spectrumFiles = cliInputBean.getSpectrumFiles();
File fastaFile = null;
// Extract data from zip files, try to find the search parameter and spectrum files
ArrayList<File> identificationFiles = new ArrayList<>();
IdentificationParameters tempIdentificationParameters = null;
for (File inputFile : identificationFilesInput) {
File parentFile = inputFile.getParentFile();
if (!dataFolders.contains(parentFile)) {
dataFolders.add(parentFile);
}
File dataFolder = new File(parentFile, "mgf");
if (dataFolder.exists() && !dataFolders.contains(dataFolder)) {
dataFolders.add(dataFolder);
}
dataFolder = new File(parentFile, "mzml");
if (dataFolder.exists() && !dataFolders.contains(dataFolder)) {
dataFolders.add(dataFolder);
}
dataFolder = new File(parentFile, "cms");
if (dataFolder.exists() && !dataFolders.contains(dataFolder)) {
dataFolders.add(dataFolder);
}
dataFolder = new File(parentFile, "fasta");
if (dataFolder.exists() && !dataFolders.contains(dataFolder)) {
dataFolders.add(dataFolder);
}
dataFolder = new File(parentFile, PeptideShaker.DATA_DIRECTORY);
if (dataFolder.exists() && !dataFolders.contains(dataFolder)) {
dataFolders.add(dataFolder);
}
String fileName = inputFile.getName();
if (fileName.toLowerCase().endsWith(".zip")) {
waitingHandler.appendReport("Unzipping " + fileName + ".", true, true);
String newName = PsZipUtils.getTempFolderName(fileName);
String parentFolder = PsZipUtils.getUnzipParentFolder();
if (parentFolder == null) {
parentFolder = parentFile.getAbsolutePath();
}
File parentFolderFile = new File(parentFolder, PsZipUtils.getUnzipSubFolder());
File destinationFolder = new File(parentFolderFile, newName);
destinationFolder.mkdir();
TempFilesManager.registerTempFolder(parentFolderFile);
ZipUtils.unzip(inputFile, destinationFolder, waitingHandler);
if (waitingHandler instanceof WaitingHandlerCLIImpl) {
waitingHandler.appendReportEndLine();
}
dataFolder = new File(destinationFolder, PeptideShaker.DATA_DIRECTORY);
if (dataFolder.exists() && !dataFolders.contains(dataFolder)) {
dataFolders.add(dataFolder);
}
dataFolder = new File(destinationFolder, ".mgf");
if (dataFolder.exists() && !dataFolders.contains(dataFolder)) {
dataFolders.add(dataFolder);
}
dataFolder = new File(parentFile, "mzml");
if (dataFolder.exists() && !dataFolders.contains(dataFolder)) {
dataFolders.add(dataFolder);
}
dataFolder = new File(destinationFolder, ".cms");
if (dataFolder.exists() && !dataFolders.contains(dataFolder)) {
dataFolders.add(dataFolder);
}
dataFolder = new File(destinationFolder, ".fasta");
if (dataFolder.exists() && !dataFolders.contains(dataFolder)) {
dataFolders.add(dataFolder);
}
for (File unzippedFile : destinationFolder.listFiles()) {
String nameLowerCase = unzippedFile.getName().toLowerCase();
if (nameLowerCase.endsWith(".omx") || nameLowerCase.endsWith(".t.xml") || nameLowerCase.endsWith(".pep.xml") || nameLowerCase.endsWith(".dat") || nameLowerCase.endsWith(".mzid") || nameLowerCase.endsWith(".ms-amanda.csv") || nameLowerCase.endsWith(".res") || nameLowerCase.endsWith(".tide-search.target.txt") || nameLowerCase.endsWith(".tags") || nameLowerCase.endsWith(".pnovo.txt") || nameLowerCase.endsWith(".novor.csv") || nameLowerCase.endsWith(".psm") || nameLowerCase.endsWith(".omx.gz") || nameLowerCase.endsWith(".t.xml.gz") || nameLowerCase.endsWith(".pep.xml.gz") || nameLowerCase.endsWith(".mzid.gz") || nameLowerCase.endsWith(".ms-amanda.csv.gz") || nameLowerCase.endsWith(".res.gz") || nameLowerCase.endsWith(".tide-search.target.txt.gz") || nameLowerCase.endsWith(".tags.gz") || nameLowerCase.endsWith(".pnovo.txt.gz") || nameLowerCase.endsWith(".novor.csv.gz") || nameLowerCase.endsWith(".psm.gz")) {
identificationFiles.add(unzippedFile);
} else if (nameLowerCase.endsWith(".par")) {
try {
tempIdentificationParameters = IdentificationParameters.getIdentificationParameters(unzippedFile);
ValidationQcParameters validationQCParameters = tempIdentificationParameters.getIdValidationParameters().getValidationQCParameters();
if (validationQCParameters == null || validationQCParameters.getPsmFilters() == null || validationQCParameters.getPeptideFilters() == null || validationQCParameters.getProteinFilters() == null || validationQCParameters.getPsmFilters().isEmpty() && validationQCParameters.getPeptideFilters().isEmpty() && validationQCParameters.getProteinFilters().isEmpty()) {
MatchesValidator.setDefaultMatchesQCFilters(validationQCParameters);
}
} catch (Exception e) {
e.printStackTrace();
waitingHandler.appendReport("An error occurred while parsing the parameters file " + unzippedFile.getName() + ". " + getLogFileMessage(), true, true);
waitingHandler.setRunCanceled();
}
}
}
} else {
identificationFiles.add(inputFile);
}
}
// list the spectrum files found
HashSet<String> dataFileNamesRequired = new HashSet<>();
for (File spectrumFile : spectrumFiles) {
dataFileNamesRequired.add(IoUtil.getFileName(spectrumFile));
}
for (File dataFolder : dataFolders) {
for (File file : dataFolder.listFiles()) {
String name = file.getName();
if (name.endsWith(".mgf") || name.endsWith(".mgf.gz") || name.endsWith(".mzml") || name.endsWith(".mzml.gz") || name.endsWith(".cms")) {
if (!dataFileNamesRequired.contains(name)) {
spectrumFiles.add(file);
dataFileNamesRequired.add(name);
}
} else if (name.endsWith(".fasta")) {
if (!dataFileNamesRequired.contains(name)) {
fastaFile = file;
dataFileNamesRequired.add(name);
}
}
}
}
// Load the spectrum files
for (File spectrumFile : spectrumFiles) {
File folder = CmsFolder.getParentFolder() == null ? spectrumFile.getParentFile() : new File(CmsFolder.getParentFolder());
msFileHandler.register(spectrumFile, folder, waitingHandler);
}
// If there is a specific fasta file chosen, it is used insted of the one included in the searchgui zip
if (cliInputBean.getFastaFile() != null) {
fastaFile = cliInputBean.getFastaFile();
}
// get the identification parameters
IdentificationParametersInputBean identificationParametersInputBean = cliInputBean.getIdentificationParametersInputBean();
if (tempIdentificationParameters != null && identificationParametersInputBean.getInputFile() == null) {
identificationParametersInputBean.setIdentificationParameters(tempIdentificationParameters);
identificationParametersInputBean.updateIdentificationParameters();
}
identificationParameters = identificationParametersInputBean.getIdentificationParameters();
ValidationQcParameters validationQCParameters = identificationParameters.getIdValidationParameters().getValidationQCParameters();
if (validationQCParameters == null || validationQCParameters.getPsmFilters() == null || validationQCParameters.getPeptideFilters() == null || validationQCParameters.getProteinFilters() == null || validationQCParameters.getPsmFilters().isEmpty() && validationQCParameters.getPeptideFilters().isEmpty() && validationQCParameters.getProteinFilters().isEmpty()) {
MatchesValidator.setDefaultMatchesQCFilters(validationQCParameters);
}
if (identificationParameters == null) {
waitingHandler.appendReport("Identification parameters not found!", true, true);
waitingHandler.setRunCanceled();
}
SearchParameters searchParameters = identificationParameters.getSearchParameters();
String error = PeptideShaker.loadModifications(searchParameters);
if (error != null) {
System.out.println(error);
}
// try to locate the fasta file
if (fastaFile == null) {
waitingHandler.appendReport("FASTA file not set (or not in zip file)!", true, true);
waitingHandler.setRunCanceled();
} else if (!fastaFile.exists()) {
boolean found = false;
// look in the database folder
try {
File tempDbFolder = utilitiesUserParameters.getDbFolder();
File newFile = new File(tempDbFolder, fastaFile.getName());
if (newFile.exists()) {
fastaFile = newFile;
projectDetails.setFastaFile(fastaFile);
found = true;
}
} catch (Exception e) {
e.printStackTrace();
}
if (!found) {
// look in the data folders
for (File dataFolder : dataFolders) {
File newFile = new File(dataFolder, fastaFile.getName());
if (newFile.exists()) {
fastaFile = newFile;
projectDetails.setFastaFile(fastaFile);
found = true;
break;
}
}
if (!found) {
waitingHandler.appendReport("FASTA file \'" + fastaFile.getName() + "\' not found.", true, true);
waitingHandler.setRunCanceled();
}
}
} else {
projectDetails.setFastaFile(fastaFile);
}
// get the summary information for the FASTA file
try {
// get the FASTA summary
FastaSummary fastaSummary = loadFastaFile(waitingHandler);
// set the background species
identificationParameters.getGeneParameters().setBackgroundSpeciesFromFastaSummary(fastaSummary);
} catch (IOException e) {
e.printStackTrace();
waitingHandler.appendReport("An error occurred while parsing the FASTA file.", true, true);
waitingHandler.setRunCanceled();
}
// set the processing settings
ProcessingParameters processingParameters = new ProcessingParameters();
Integer nThreads = cliInputBean.getnThreads();
if (nThreads != null) {
processingParameters.setnThreads(nThreads);
}
// set the spectrum counting prefrences
spectrumCountingParameters = new SpectrumCountingParameters();
// set the project type
projectType = cliInputBean.getProjectType();
// check the project reference
for (String forbiddenChar : Util.FORBIDDEN_CHARACTERS) {
if (cliInputBean.getExperimentID().contains(forbiddenChar)) {
waitingHandler.appendReport("The project name cannot not contain " + forbiddenChar + ".", true, true);
waitingHandler.setRunCanceled();
}
}
// incrementing the counter for a new PeptideShaker start run via CLI
if (utilitiesUserParameters.isAutoUpdate()) {
Util.sendGAUpdate("UA-36198780-1", "startrun-cl", "peptide-shaker-" + PeptideShaker.getVersion());
}
// create a shaker which will perform the analysis
PeptideShaker peptideShaker = new PeptideShaker(projectParameters);
// import the files
int outcome = peptideShaker.importFiles(waitingHandler, identificationFiles, msFileHandler, identificationParameters, projectDetails, processingParameters, exceptionHandler);
if (outcome == 0) {
peptideShaker.createProject(identificationParameters, processingParameters, spectrumCountingParameters, msFileHandler, projectDetails, projectType, waitingHandler, false, exceptionHandler);
}
if (!waitingHandler.isRunCanceled()) {
// identification as created by PeptideShaker
identification = peptideShaker.getIdentification();
// metrics saved while processing the data
metrics = peptideShaker.getMetrics();
// fene maps
geneMaps = peptideShaker.getGeneMaps();
// the identification feature generator
identificationFeaturesGenerator = peptideShaker.getIdentificationFeaturesGenerator();
// the sequence provider
sequenceProvider = peptideShaker.getSequenceProvider();
// the protein details provider
proteinDetailsProvider = peptideShaker.getProteinDetailsProvider();
if (waitingHandler instanceof WaitingDialog) {
projectDetails.setReport(((WaitingDialog) waitingHandler).getReport(null));
((WaitingDialog) waitingHandler).setRunNotFinished();
((WaitingDialog) waitingHandler).setCloseDialogWhenImportCompletes(true, false);
}
} else {
if (waitingHandler instanceof WaitingDialog) {
saveReport();
}
TempFilesManager.deleteTempFolders();
waitingHandler.setWaitingText("PeptideShaker Processing Canceled.");
System.out.println("<CompomicsError>PeptideShaker processing canceled. " + getLogFileMessage() + "</CompomicsError>");
}
}
use of com.compomics.util.parameters.identification.advanced.ValidationQcParameters in project peptide-shaker by compomics.
the class MatchValidationDialog method populateGUI.
/**
* Populates the GUI with information on a protein match.
*
* @param identificationFeaturesGenerator
* @param proteinMap
*/
private void populateGUI(TargetDecoyMap targetDecoyMap) {
ValidationQcParameters validationQCPreferences = identificationParameters.getIdValidationParameters().getValidationQCParameters();
// Validation level
validationLevelJComboBox.setSelectedItem(psParameter.getMatchValidationLevel().getName());
// Database info
FastaParameters fastaParameters = identificationParameters.getFastaParameters();
boolean targetDecoy = fastaParameters.isTargetDecoy();
if (!targetDecoy) {
targetDecoyLbl.setText("Target only");
targetDecoyLbl.setForeground(Color.red);
} else {
targetDecoyLbl.setForeground(GREEN);
}
try {
FastaSummary fastaSummary = FastaSummary.getSummary(fastaFile, fastaParameters, null);
int nTarget = fastaSummary.nTarget;
nTargetLbl.setText(nTarget + " target sequences");
if (nTarget < 10000) {
nTargetLbl.setForeground(Color.red);
} else if (nTarget > 1000000) {
nTargetLbl.setForeground(ORANGE);
} else {
nTargetLbl.setForeground(GREEN);
}
} catch (IOException iOException) {
nTargetLbl.setText("Database size not available");
nTargetLbl.setForeground(Color.red);
}
// Target/Decoy group
((TitledBorder) targetDecoyGroupPanel.getBorder()).setTitle("Target/Decoy Distributions");
targetDecoyGroupPanel.repaint();
if (targetDecoy) {
int nTargetOnly = targetDecoyMap.getnTargetOnly();
matchesBeforeFirstDecoyLbl.setText(nTargetOnly + " matches before the first decoy hit");
TargetDecoyResults targetDecoyResults = targetDecoyMap.getTargetDecoyResults();
double desiredThreshold = targetDecoyResults.getUserInput();
double nTargetLimit = 100.0 / desiredThreshold;
if (nTargetOnly < nTargetLimit) {
matchesBeforeFirstDecoyLbl.setForeground(Color.red);
} else {
matchesBeforeFirstDecoyLbl.setForeground(GREEN);
}
recommendedNumberOfTargetHitsLbl.setText("Recommended: " + Util.roundDouble(nTargetLimit, 0) + " matches before the first decoy hit");
double resolution = targetDecoyMap.getResolution();
confidenceResolutionLbl.setText("PEP/Confidence resolution of " + Util.roundDouble(resolution, 2) + "%");
double minResolution = desiredThreshold;
if (resolution > 10 * minResolution) {
confidenceResolutionLbl.setForeground(Color.red);
} else if (resolution > minResolution) {
confidenceResolutionLbl.setForeground(ORANGE);
} else {
confidenceResolutionLbl.setForeground(GREEN);
}
recommendedResolutionLbl.setText("Recommended: resolution < " + Util.roundDouble(minResolution, 2) + "%");
} else {
matchesBeforeFirstDecoyLbl.setText("No decoy");
matchesBeforeFirstDecoyLbl.setForeground(Color.gray);
confidenceResolutionLbl.setText("Impossible to estimate confidence resolution");
confidenceResolutionLbl.setForeground(Color.gray);
}
// Target/decoy results
if (targetDecoy) {
double confidence = psParameter.getConfidence();
MatchValidationLevel matchValidationLevel = psParameter.getMatchValidationLevel();
validationStatusLbl.setText("Validation Status: " + matchValidationLevel.getName());
switch(matchValidationLevel) {
case confident:
validationStatusLbl.setForeground(GREEN);
break;
case doubtful:
validationStatusLbl.setForeground(ORANGE);
break;
case not_validated:
validationStatusLbl.setForeground(Color.red);
break;
case none:
validationStatusLbl.setForeground(Color.gray);
}
TargetDecoyResults targetDecoyResults = targetDecoyMap.getTargetDecoyResults();
String validationThresholdTxt = "";
double threshold = targetDecoyResults.getUserInput();
int thresholdType = targetDecoyResults.getInputType();
if (thresholdType == 0) {
validationThresholdTxt += "Validation Threshold: " + Util.roundDouble(threshold, 2) + "%";
} else if (targetDecoyResults.getInputType() == 1) {
validationThresholdTxt += "FDR Threshold: " + Util.roundDouble(threshold, 2) + "%";
} else if (targetDecoyResults.getInputType() == 2) {
validationThresholdTxt += "FNR Threshold: " + Util.roundDouble(threshold, 2) + "%";
}
validationThresholdLbl.setText(validationThresholdTxt);
confidenceLbl.setText("Confidence: " + Util.roundDouble(confidence, 2) + "%");
double validationThreshold = targetDecoyResults.getConfidenceLimit();
confidenceThresholdLbl.setText("Expected Confidence: " + Util.roundDouble(validationThreshold, 2) + "%");
double margin = validationQCPreferences.getConfidenceMargin() * targetDecoyMap.getResolution();
double confidenceThreshold = validationThreshold + margin;
if (confidenceThreshold > 100) {
confidenceThreshold = 100;
}
confidenceThresholdLbl.setText("Confident confidence: " + Util.roundDouble(confidenceThreshold, 2) + "%");
if (confidence < validationThreshold) {
confidenceLbl.setForeground(Color.red);
} else if (confidence < confidenceThreshold) {
confidenceLbl.setForeground(ORANGE);
} else {
confidenceLbl.setForeground(GREEN);
}
} else {
validationStatusLbl.setText("Validation Status: " + psParameter.getMatchValidationLevel().getName());
validationThresholdLbl.setText("Impossible to estimate validation threshold");
confidenceLbl.setText("Impossible to estimate confidence");
confidenceThresholdLbl.setText("Impossible to estimate confidence threshold");
validationStatusLbl.setForeground(Color.gray);
confidenceLbl.setForeground(Color.gray);
}
// Quality filters
final DefaultTableModel tableModel = new FiltersTableModel();
qualityFiltersTable.setModel(tableModel);
qualityFiltersTable.getColumn("").setMaxWidth(50);
qualityFiltersTable.getColumn(" ").setMaxWidth(50);
qualityFiltersTable.getColumn(" ").setCellRenderer(new TrueFalseIconRenderer(new ImageIcon(this.getClass().getResource("/icons/accept-new.png")), new ImageIcon(this.getClass().getResource("/icons/error-new.png")), "Yes", "No"));
int valid = 0;
for (String qcCheck : psParameter.getQcCriteria()) {
if (psParameter.isQcPassed(qcCheck)) {
valid++;
}
}
((TitledBorder) qualityFiltersPanel.getBorder()).setTitle("Quality Filters (" + valid + "/" + psParameter.getQcCriteria().size() + ")");
}
use of com.compomics.util.parameters.identification.advanced.ValidationQcParameters in project peptide-shaker by compomics.
the class NewDialog method importSearchParameters.
/**
* Imports the search parameters from a file.
*
* @param file the selected searchGUI file
* @param dataFolders folders where to look for the FASTA file
* @param progressDialog the progress dialog
*
* @throws java.io.IOException exception thrown whenever an error occurred
* while importing the search parameters
* @throws java.io.FileNotFoundException exception thrown whenever an error
* occurred while importing the search parameters
* @throws java.lang.ClassNotFoundException exception thrown whenever an
* error occurred while importing the search parameters
*/
public void importSearchParameters(File file, ArrayList<File> dataFolders, ProgressDialogX progressDialog) throws IOException, FileNotFoundException, ClassNotFoundException {
progressDialog.setTitle("Importing Search Parameters. Please Wait...");
IdentificationParameters tempIdentificationParameters = IdentificationParameters.getIdentificationParameters(file);
SearchParameters searchParameters = tempIdentificationParameters.getSearchParameters();
String toCheck = PeptideShaker.loadModifications(searchParameters);
if (toCheck != null) {
JOptionPane.showMessageDialog(this, toCheck, "Modification Definition Changed", JOptionPane.WARNING_MESSAGE);
}
ModificationParameters modificationProfile = searchParameters.getModificationParameters();
ArrayList<String> missing = new ArrayList<>();
for (String name : modificationProfile.getAllModifications()) {
if (!modificationFactory.containsModification(name)) {
missing.add(name);
Modification mod = modificationFactory.getModification(name);
mod.getMass();
} else if (!modificationProfile.contains(name)) {
modificationProfile.setColor(name, Color.lightGray.getRGB());
}
}
if (!missing.isEmpty()) {
if (missing.size() == 1) {
JOptionPane.showMessageDialog(this, "The following modification is currently not recognized by PeptideShaker: " + missing.get(0) + ".\nPlease import it by editing the search parameters.", "Modification Not Found", JOptionPane.WARNING_MESSAGE);
} else {
String output = "The following modifications are currently not recognized by PeptideShaker:\n" + String.join(", ", missing) + ".\nPlease import it by editing the search parameters.";
JOptionPane.showMessageDialog(this, output, "Modification Not Found", JOptionPane.WARNING_MESSAGE);
}
}
boolean matchesValidationAdded;
ValidationQcParameters validationQcParameters = tempIdentificationParameters.getIdValidationParameters().getValidationQCParameters();
if (validationQcParameters == null || validationQcParameters.getPsmFilters() == null || validationQcParameters.getPeptideFilters() == null || validationQcParameters.getProteinFilters() == null || validationQcParameters.getPsmFilters().isEmpty() && validationQcParameters.getPeptideFilters().isEmpty() && validationQcParameters.getProteinFilters().isEmpty()) {
MatchesValidator.setDefaultMatchesQCFilters(validationQcParameters);
matchesValidationAdded = true;
} else {
matchesValidationAdded = false;
}
if (!identificationParametersFactory.getParametersList().contains(tempIdentificationParameters.getName())) {
identificationParametersFactory.addIdentificationParameters(tempIdentificationParameters);
} else {
boolean parametersChanged = !identificationParametersFactory.getIdentificationParameters(tempIdentificationParameters.getName()).equals(tempIdentificationParameters);
if (parametersChanged && !matchesValidationAdded) {
int value = JOptionPane.showOptionDialog(null, "A settings file with the name \'" + tempIdentificationParameters.getName() + "\' already exists.\n" + "What do you want to do?", "Identification Settings", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Replace File", "Use Existing File", "Keep Both Files" }, "default");
switch(value) {
case JOptionPane.YES_OPTION:
identificationParametersFactory.addIdentificationParameters(tempIdentificationParameters);
break;
case JOptionPane.NO_OPTION:
tempIdentificationParameters = identificationParametersFactory.getIdentificationParameters(tempIdentificationParameters.getName());
break;
case JOptionPane.CANCEL_OPTION:
tempIdentificationParameters.setName(getIdentificationSettingsFileName(tempIdentificationParameters));
identificationParametersFactory.addIdentificationParameters(tempIdentificationParameters);
break;
default:
break;
}
} else if (matchesValidationAdded) {
identificationParametersFactory.addIdentificationParameters(tempIdentificationParameters);
}
}
setIdentificationParameters(tempIdentificationParameters);
}
use of com.compomics.util.parameters.identification.advanced.ValidationQcParameters in project peptide-shaker by compomics.
the class PeptideShakerGUI method validationQcMenuItemActionPerformed.
// GEN-LAST:event_configurationFilesSettingsActionPerformed
/**
* Open the ValidationQCPreferencesDialog.
*
* @param evt
*/
private void validationQcMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_validationQcMenuItemActionPerformed
final IdMatchValidationParameters idValidationParameters = getIdentificationParameters().getIdValidationParameters();
final ValidationQcParameters validationQCParameters = idValidationParameters.getValidationQCParameters();
ValidationQCParametersDialog validationQCParametersDialog = new ValidationQCParametersDialog(this, validationQCParameters, getIdentificationParameters().getSearchParameters().getModificationParameters().getAllModifications(), true);
if (!validationQCParametersDialog.isCanceled()) {
ValidationQcParameters newParameters = validationQCParametersDialog.getValidationQCParameters();
if (!newParameters.isSameAs(validationQCParameters)) {
idValidationParameters.setValidationQCParameters(newParameters);
// Update the assumptions QC filters
for (Filter filter : newParameters.getPsmFilters()) {
PsmFilter psmFilter = (PsmFilter) filter;
AssumptionFilter assumptionFilter = psmFilter.getAssumptionFilter();
assumptionFilter.clear();
for (String itemName : psmFilter.getItemsNames()) {
assumptionFilter.setFilterItem(itemName, psmFilter.getComparatorForItem(itemName), psmFilter.getValue(itemName));
}
}
progressDialog = new ProgressDialogX(PeptideShakerGUI.this, Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")), Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker-orange.gif")), true);
progressDialog.setTitle("Validating. Please Wait...");
progressDialog.setPrimaryProgressCounterIndeterminate(false);
new Thread(new Runnable() {
public void run() {
try {
progressDialog.setVisible(true);
} catch (IndexOutOfBoundsException e) {
// ignore
}
}
}, "ProgressDialog").start();
new Thread("RecalculateThread") {
@Override
public void run() {
PeptideShakerGUI peptideShakerGUI = PeptideShakerGUI.this;
try {
PSMaps pSMaps = new PSMaps();
pSMaps = (PSMaps) peptideShakerGUI.getIdentification().getUrParam(pSMaps);
MatchesValidator matchesValidator = new MatchesValidator(pSMaps.getPsmMap(), pSMaps.getPeptideMap(), pSMaps.getProteinMap());
matchesValidator.validateIdentifications(peptideShakerGUI.getIdentification(), peptideShakerGUI.getMetrics(), pSMaps.getInputMap(), progressDialog, exceptionHandler, peptideShakerGUI.getIdentificationFeaturesGenerator(), peptideShakerGUI.getSequenceProvider(), peptideShakerGUI.getProteinDetailsProvider(), peptideShakerGUI.getSpectrumProvider(), peptideShakerGUI.getGeneMaps(), peptideShakerGUI.getIdentificationParameters(), peptideShakerGUI.getProjectType(), peptideShakerGUI.getProcessingParameters());
progressDialog.setPrimaryProgressCounterIndeterminate(true);
ProteinProcessor proteinProcessor = new ProteinProcessor(peptideShakerGUI.getIdentification(), peptideShakerGUI.getIdentificationParameters(), peptideShakerGUI.getIdentificationFeaturesGenerator(), peptideShakerGUI.getSequenceProvider());
proteinProcessor.processProteins(new ModificationLocalizationScorer(), peptideShakerGUI.getMetrics(), modificationFactory, progressDialog, peptideShakerGUI.getExceptionHandler(), peptideShakerGUI.getProcessingParameters());
if (!progressDialog.isRunCanceled()) {
// update the other tabs
peptideShakerGUI.getMetrics().setnValidatedProteins(-1);
peptideShakerGUI.getMetrics().setnConfidentProteins(-1);
peptideShakerGUI.setUpdated(PeptideShakerGUI.OVER_VIEW_TAB_INDEX, false);
peptideShakerGUI.setUpdated(PeptideShakerGUI.PROTEIN_FRACTIONS_TAB_INDEX, false);
peptideShakerGUI.setUpdated(PeptideShakerGUI.STRUCTURES_TAB_INDEX, false);
peptideShakerGUI.setUpdated(PeptideShakerGUI.MODIFICATIONS_TAB_INDEX, false);
peptideShakerGUI.setUpdated(PeptideShakerGUI.QC_PLOTS_TAB_INDEX, false);
peptideShakerGUI.setUpdated(PeptideShakerGUI.SPECTRUM_ID_TAB_INDEX, false);
peptideShakerGUI.setDataSaved(false);
} else {
idValidationParameters.setValidationQCParameters(validationQCParameters);
}
} catch (Exception e) {
peptideShakerGUI.catchException(e);
}
progressDialog.setRunFinished();
PeptideShakerGUI.this.repaintPanels();
}
}.start();
}
}
}
Aggregations