use of eu.isas.peptideshaker.export.MzIdentMLExport in project peptide-shaker by compomics.
the class MzIdentMLExportDialog method convertJButtonActionPerformed.
// GEN-LAST:event_contactEmailJTextFieldKeyReleased
/**
* Convert the project to an mzIdentML file.
*
* @param evt
*/
private void convertJButtonActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_convertJButtonActionPerformed
final File finalOutputFile = new File(outputFolderJTextField.getText());
progressDialog = new ProgressDialogX(peptideShakerGUI, Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")), Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker-orange.gif")), true);
progressDialog.setPrimaryProgressCounterIndeterminate(true);
progressDialog.setTitle("Exporting mzIdentML. Please Wait...");
new Thread(new Runnable() {
public void run() {
try {
progressDialog.setVisible(true);
} catch (IndexOutOfBoundsException e) {
// ignore
}
}
}, "ProgressDialog").start();
new Thread("ConvertThread") {
@Override
public void run() {
IdentificationParameters identificationParameters = peptideShakerGUI.getIdentificationParameters();
AnnotationParameters annotationParameters = identificationParameters.getAnnotationParameters();
ProjectDetails projectDetails = peptideShakerGUI.getProjectDetails();
// save the inserted mzid details with the project
projectDetails.setContactFirstName(contactFirstNameJTextField.getText().trim());
projectDetails.setContactLastName(contactLastNameJTextField.getText().trim());
projectDetails.setContactEmail(contactEmailJTextField.getText().trim());
projectDetails.setContactAddress(contactAddressJTextField.getText().trim());
if (!contactUrlJTextField.getText().trim().isEmpty()) {
projectDetails.setContactUrl(contactUrlJTextField.getText().trim());
} else {
projectDetails.setContactUrl(null);
}
projectDetails.setOrganizationName(organizationNameJTextField.getText().trim());
projectDetails.setOrganizationEmail(organizationEmailJTextField.getText().trim());
projectDetails.setOrganizationAddress(organizationAddressJTextField.getText().trim());
if (!organizationUrlJTextField.getText().trim().isEmpty()) {
projectDetails.setOrganizationUrl(organizationUrlJTextField.getText().trim());
} else {
projectDetails.setOrganizationUrl(null);
}
projectDetails.setIncludeProteinSequences(includeSequencesCheckBox.isSelected());
projectDetails.setMzIdentOutputFile(outputFolderJTextField.getText());
peptideShakerGUI.setDataSaved(false);
boolean conversionCompleted = false;
// make sure that all annotations are included
double currentIntensityLimit = annotationParameters.getAnnotationIntensityLimit();
annotationParameters.setIntensityLimit(0.0);
try {
FastaSummary fastaSummary = FastaSummary.getSummary(projectDetails.getFastaFile(), identificationParameters.getFastaParameters(), progressDialog);
MzIdentMLExport mzIdentMLExport = new MzIdentMLExport(PeptideShaker.getVersion(), peptideShakerGUI.getIdentification(), projectDetails, identificationParameters, peptideShakerGUI.getSequenceProvider(), peptideShakerGUI.getProteinDetailsProvider(), peptideShakerGUI.getSpectrumProvider(), ModificationFactory.getInstance(), fastaSummary, peptideShakerGUI.getIdentificationFeaturesGenerator(), finalOutputFile, includeSequencesCheckBox.isSelected(), progressDialog, true);
mzIdentMLExport.createMzIdentMLFile(mzIdentMLVersion);
// validate the mzidentml file
if (validateMzIdentML && !progressDialog.isRunCanceled()) {
progressDialog.setPrimaryProgressCounterIndeterminate(true);
progressDialog.setTitle("Validating mzIdentML. Please Wait...");
String errors = validateMzIdentML(finalOutputFile);
// see if any errors were found, and display them to the user
if (!errors.isEmpty()) {
JOptionPane.showMessageDialog(null, errors, "mzIdentML Errors", JOptionPane.ERROR_MESSAGE);
} else {
conversionCompleted = true;
}
} else {
conversionCompleted = true;
}
} catch (Exception e) {
peptideShakerGUI.catchException(e);
progressDialog.setRunCanceled();
progressDialog.dispose();
return;
} finally {
// reset the annotation level
annotationParameters.setIntensityLimit(currentIntensityLimit);
}
// close the progress dialog
boolean processCancelled = progressDialog.isRunCanceled();
progressDialog.setRunFinished();
// display a conversion complete message to the user
if (conversionCompleted && !processCancelled) {
JOptionPane.showMessageDialog(MzIdentMLExportDialog.this, JOptionEditorPane.getJOptionEditorPane("mzIdentML file \'" + new File(outputFolderJTextField.getText()).getAbsolutePath() + "\' created." + "<br><br>" + "Review your mzIdentML files with <a href=\"https://github.com/PRIDE-Toolsuite/pride-inspector\">PRIDE Inspector</a>.<br>" + "Publish your mzIdentML files via <a href=\"http://www.proteomexchange.org/submission\">ProteomeXchange</a>."), "File Created", JOptionPane.INFORMATION_MESSAGE);
dispose();
}
if (processCancelled) {
JOptionPane.showMessageDialog(peptideShakerGUI, "mzIdentML conversion cancelled by the user.", "mzIdentML Conversion Cancelled", JOptionPane.WARNING_MESSAGE);
}
}
}.start();
}
use of eu.isas.peptideshaker.export.MzIdentMLExport in project peptide-shaker by compomics.
the class CLIExportMethods method exportMzId.
/**
* Exports the project in the mzIdentML format.
*
* @param mzidCLIInputBean the user input
* @param psbdParent a psbd file parent allowing accessing the information it
* contains
* @param waitingHandler a waiting handler allowing display of progress and
* interruption of the export
*
* @throws IOException exception thrown whenever an IO exception occurred
* while reading or writing to a file
*/
public static void exportMzId(MzidCLIInputBean mzidCLIInputBean, PsdbParent psbdParent, WaitingHandler waitingHandler) throws IOException {
ProjectDetails projectDetails = psbdParent.getProjectDetails();
projectDetails.setContactFirstName(mzidCLIInputBean.getContactFirstName());
projectDetails.setContactLastName(mzidCLIInputBean.getContactLastName());
projectDetails.setContactEmail(mzidCLIInputBean.getContactEmail());
projectDetails.setContactAddress(mzidCLIInputBean.getContactAddress());
projectDetails.setContactUrl(mzidCLIInputBean.getContactUrl());
projectDetails.setOrganizationName(mzidCLIInputBean.getOrganizationName());
projectDetails.setOrganizationEmail(mzidCLIInputBean.getOrganizationMail());
projectDetails.setOrganizationAddress(mzidCLIInputBean.getOrganizationAddress());
projectDetails.setOrganizationUrl(mzidCLIInputBean.getOrganizationUrl());
projectDetails.setIncludeProteinSequences(mzidCLIInputBean.getIncludeProteinSequences());
projectDetails.setPrideOutputFolder(mzidCLIInputBean.getOutputFile().getAbsolutePath());
IdentificationParameters identificationParameters = psbdParent.getIdentificationParameters();
FastaSummary fastaSummary = FastaSummary.getSummary(projectDetails.getFastaFile(), identificationParameters.getFastaParameters(), waitingHandler);
MzIdentMLExport mzIdentMLExport = new MzIdentMLExport(PeptideShaker.getVersion(), psbdParent.getIdentification(), psbdParent.getProjectDetails(), identificationParameters, psbdParent.getSequenceProvider(), psbdParent.getProteinDetailsProvider(), psbdParent.getSpectrumProvider(), ModificationFactory.getInstance(), fastaSummary, psbdParent.getIdentificationFeaturesGenerator(), mzidCLIInputBean.getOutputFile(), mzidCLIInputBean.getIncludeProteinSequences(), waitingHandler, mzidCLIInputBean.isGzip());
mzIdentMLExport.createMzIdentMLFile(mzidCLIInputBean.getMzIdentMLVersion());
}
Aggregations