Package com.compomics.util.experiment.identification

Examples of com.compomics.util.experiment.identification.SearchParameters


                // add the spectrum annotations
                spectrum.setAnnotations(SpectrumAnnotator.getSpectrumAnnotation(annotations));
                spectrum.showAnnotatedPeaksOnly(!annotationPreferences.showAllPeaks());
                spectrum.setYAxisZoomExcludesBackgroundPeaks(annotationPreferences.yAxisZoomExcludesBackgroundPeaks());

                SearchParameters searchParameters = peptideShakerGUI.getSearchParameters();
                int forwardIon = searchParameters.getIonSearched1();
                int rewindIon = searchParameters.getIonSearched2();

                // add de novo sequencing
                spectrum.addAutomaticDeNovoSequencing(peptide, annotations,
                        forwardIon, rewindIon, annotationPreferences.getDeNovoCharge(),
                        annotationPreferences.showForwardIonDeNovoTags(),
View Full Code Here


        if (sequenceFactory.getCurrentFastaFile() != null) {
            fastaFileTxt.setText(sequenceFactory.getFileName());
            checkFastaFile();
            if (searchParameters == null) {
                searchParameters = new SearchParameters();
                searchParameters.setEnzyme(EnzymeFactory.getInstance().getEnzyme("Trypsin"));
            }
            searchParameters.setFastaFile(sequenceFactory.getCurrentFastaFile());
        }
        validateInput();
View Full Code Here

                if (identification.matchExists(key)) {

                    SpectrumMatch spectrumMatch = identification.getSpectrumMatch(key);

                    SearchParameters searchParameters = peptideShakerGUI.getSearchParameters();
                    int forwardIon = searchParameters.getIonSearched1();
                    int rewindIon = searchParameters.getIonSearched2();
                    ModificationProfile modificationProfile = searchParameters.getModificationProfile();

                    if (currentSpectrum != null && tempSpectrumPanel != null) {

                        if (currentSpectrum.getMzValuesAsArray().length > 0 && currentSpectrum.getIntensityValuesAsArray().length > 0) {
View Full Code Here

        Integer validationType = probabilities.getMatchValidationLevel().getIndex();

        String sequence;
        if (currentAssumption instanceof PeptideAssumption) {
            SearchParameters searchParameters = peptideShakerGUI.getSearchParameters();
            ModificationProfile modificationProfile = searchParameters.getModificationProfile();
            Peptide peptide = ((PeptideAssumption) currentAssumption).getPeptide();

            boolean showFixed = false; // @TODO: has to be a better way of doing this?
            for (String ptmName : peptideShakerGUI.getDisplayPreferences().getDisplayedPtms()) {
                if (modificationProfile.getFixedModifications().contains(ptmName)) {
View Full Code Here

    /**
     * Update the PTM map.
     */
    private void updatePtmMap() {

        SearchParameters searchParameters = peptideShakerGUI.getSearchParameters();
        PtmToPrideMap ptmToPrideMap = new PtmToPrideMap();
        try {
            ptmToPrideMap = PtmToPrideMap.loadPtmToPrideMap(searchParameters);
        } catch (Exception e) {
            peptideShakerGUI.catchException(e);
View Full Code Here

                updatePtmCoveragePlot(proteinAccession);
            }

            currentProteinAccession = proteinAccession;

            SearchParameters searchParameters = peptideShakerGUI.getSearchParameters();
            ArrayList<Integer> selectedPeptideStart = new ArrayList<Integer>();
            int selectionLength = 0;

            if (peptideTable.getSelectedRow() != -1) {
View Full Code Here

     * @param evt
     */
    private void clearIdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearIdActionPerformed
        idFiles = new ArrayList<File>();
        idFilesTxt.setText(idFiles.size() + " file(s) selected");
        searchParameters = new SearchParameters();
        validateInput();
}//GEN-LAST:event_clearIdActionPerformed
View Full Code Here

            @Override
            public void run() {

                try {
                    // set up the identification parameters
                    SearchParameters prideSearchParameters = new SearchParameters();

                    // set the database
                    prideSearchParameters.setFastaFile(new File(database));

                    // default settings to be used, set the enzyme to trypsin
                    if (searchSettingsProjectFile == null) {
                        prideSearchParameters.setEnzyme(EnzymeFactory.getUtilitiesEnzyme("Trypsin"));
                    }

                    String prideSearchParametersReport = null;
                    ArrayList<File> mgfFiles = new ArrayList<File>();
                    boolean mgfConversionOk = true;
                    Boolean useLocalFiles = null;

                    for (int i = 0; i < allFiles.size() && mgfConversionOk; i++) {

                        String currentFile = allFiles.get(i);
                        String currentFileName = currentFile.substring(currentFile.lastIndexOf("/")).toLowerCase();
                        boolean unzipped = true;

                        if (currentFileName.lastIndexOf(".gz") != -1) {
                            currentFileName = currentFileName.substring(0, currentFileName.lastIndexOf(".gz"));
                            unzipped = false;
                        }
                        if (progressDialog.isRunCanceled()) {
                            progressDialog.setRunFinished();
                            PrideReshakeGUI.this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")));
                            return;
                        }

                        progressDialog.setTitle("Downloading Files (" + (i + 1) + "/" + allFiles.size() + "). Please Wait...");

                        try {
                            currentPrideDataFileUrl = new URL(currentFile);
                            currentZippedPrideDataFile = new File(outputFolder, currentFile.substring(currentFile.lastIndexOf("/")));
                            if (unzipped) {
                                currentPrideDataFile = new File(outputFolder, currentFile.substring(currentFile.lastIndexOf("/")));
                                if (i < selectedSpectrumFiles.size()) {
                                    if (currentFile.toLowerCase().endsWith(".mgf")) {
                                        currentMgfFile = new File(outputFolder, currentFile.substring(currentFile.lastIndexOf("/")));
                                    } else {
                                        currentMgfFile = new File(outputFolder, currentFile.substring(currentFile.lastIndexOf("/"), currentFile.lastIndexOf(".xml")) + ".mgf");
                                    }
                                }
                            } else {
                                currentPrideDataFile = new File(outputFolder, currentFile.substring(currentFile.lastIndexOf("/"), currentFile.lastIndexOf(".gz")));
                                if (i < selectedSpectrumFiles.size()) {
                                    if (currentFile.toLowerCase().endsWith(".mgf.gz")) {
                                        currentMgfFile = new File(outputFolder, currentFile.substring(currentFile.lastIndexOf("/"), currentFile.lastIndexOf(".mgf.gz")) + ".mgf");
                                    } else {
                                        currentMgfFile = new File(outputFolder, currentFile.substring(currentFile.lastIndexOf("/"), currentFile.lastIndexOf(".xml.gz")) + ".mgf");
                                    }
                                }
                            }
                            if (i < selectedSpectrumFiles.size()) {
                                mgfFiles.add(currentMgfFile);
                            }
                        } catch (MalformedURLException ex) {
                            JOptionPane.showMessageDialog(PrideReshakeGUI.this, JOptionEditorPane.getJOptionEditorPane("The file could not be downloaded:<br>"
                                    + ex.getMessage() + ".<br>"
                                    + "Please <a href=\"http://code.google.com/p/peptide-shaker/issues/list\">contact the developers</a>."),
                                    "Download Error", JOptionPane.ERROR_MESSAGE);
                            ex.printStackTrace();
                            currentPrideDataFileUrl = null;
                        } catch (IOException ex) {
                            JOptionPane.showMessageDialog(PrideReshakeGUI.this, JOptionEditorPane.getJOptionEditorPane("The file could not be downloaded:<br>"
                                    + ex.getMessage() + ".<br>"
                                    + "Please <a href=\"http://code.google.com/p/peptide-shaker/issues/list\">contact the developers</a>."),
                                    "Download Error", JOptionPane.ERROR_MESSAGE);
                            ex.printStackTrace();
                            currentPrideDataFileUrl = null;
                        }

                        if (progressDialog.isRunCanceled()) {
                            progressDialog.setRunFinished();
                            PrideReshakeGUI.this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")));
                            return;
                        }

                        if (currentPrideDataFileUrl != null) {

                            if (!new File(peptideShakerGUI.getUtilitiesUserPreferences().getLocalPrideFolder(), currentFileName).exists()) {

                                boolean downloadFile = true;

                                if (currentPrideDataFile.exists()) {

                                    if (useLocalFiles == null) {

                                        int option = JOptionPane.showConfirmDialog(PrideReshakeGUI.this,
                                                "The file \'" + currentPrideDataFile.getName() + "\' already exists locally.\nUse local copy?",
                                                "Use Local File?", JOptionPane.YES_NO_OPTION);

                                        if (allFiles.size() > 1) {
                                            int option2 = JOptionPane.showConfirmDialog(PrideReshakeGUI.this,
                                                    "Do this for all following files?",
                                                    "Use Local Files?", JOptionPane.YES_NO_OPTION);

                                            if (option2 == JOptionPane.YES_OPTION) {
                                                useLocalFiles = (option == JOptionPane.YES_OPTION);
                                            }
                                        }

                                        downloadFile = (option == JOptionPane.NO_OPTION);
                                    } else {
                                        downloadFile = !useLocalFiles;
                                    }
                                }

                                if (downloadFile) {

                                    // download the pride data file
                                    saveUrl(currentZippedPrideDataFile, currentFile, fileSizes.get(i), progressDialog);

                                    // file downloaded, unzip file
                                    progressDialog.setTitle("Unzipping Files (" + (i + 1) + "/" + allFiles.size() + "). Please Wait...");

                                    progressDialog.setPrimaryProgressCounterIndeterminate(true);
                                    if (!unzipped) {
                                        unzipProject();
                                    }
                                }
                            } else {
                                currentPrideDataFile = new File(peptideShakerGUI.getUtilitiesUserPreferences().getLocalPrideFolder(), currentFileName);
                            }

                            if (progressDialog.isRunCanceled()) {
                                progressDialog.setRunFinished();
                                PrideReshakeGUI.this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")));
                                return;
                            }

                            // file unzipped, time to start the conversion to mgf
                            if (i < selectedSpectrumFiles.size()) {
                                if (currentFile.toLowerCase().endsWith(".mgf")
                                        || currentFile.toLowerCase().endsWith(".mgf.gz")) {
                                    // already mgf, no conversion needed
                                } else {
                                    progressDialog.setTitle("Converting Spectrum Data (" + (i + 1) + "/" + allFiles.size() + "). Please Wait...");
                                    mgfConversionOk = convertPrideXmlToMgf();
                                }
                            }

                            if (progressDialog.isRunCanceled()) {
                                progressDialog.setRunFinished();
                                PrideReshakeGUI.this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")));
                                return;
                            }

                            // get the search params from the pride xml or mzid file
                            if (mgfConversionOk) {
                                if (searchSettingsProjectFile != null
                                        && currentFile.equalsIgnoreCase(searchSettingsProjectFile)) {
                                    progressDialog.setTitle("Extracting Search Settings. Please Wait...");

                                    if (currentFile.toLowerCase().endsWith(".xml")
                                            || currentFile.toLowerCase().endsWith(".xml.gz")) {
                                        prideSearchParametersReport = getSearchParams(prideSearchParameters);
                                    } else { // mzid

                                        progressDialog.setPrimaryProgressCounterIndeterminate(true); // @TODO: better display of progress

                                        // convert the parameters from the assay
                                        prideSearchParametersReport = MzIdentMLIdfileSearchParametersConverter.getSearchParameters(currentPrideDataFile, prideSearchParameters, currentSpecies, progressDialog);

                                        // add the ptms from the project/assay
                                        String allPtms;
                                        if (assaysTable.getSelectedRow() != -1) {
                                            allPtms = (String) assaysTable.getValueAt(assaysTable.getSelectedRow(), assaysTable.getColumn("PTMs").getModelIndex());
                                        } else {
                                            allPtms = (String) projectsTable.getValueAt(projectsTable.getSelectedRow(), projectsTable.getColumn("PTMs").getModelIndex());
                                        }

                                        prideSearchParametersReport += convertPtms(allPtms, prideSearchParameters.getModificationProfile());

                                        // save the report to disk
                                        File searchSettingsReportFile = new File(outputFolder, "search_settings_report.html");
                                        String tempReport = "<html>" + prideSearchParametersReport;
                                        tempReport += "<br></html>";
                                        FileWriter fw = new FileWriter(searchSettingsReportFile);
                                        BufferedWriter bw = new BufferedWriter(fw);
                                        bw.write(tempReport);
                                        bw.close();
                                        fw.close();

                                        prideSearchParametersReport += "<br><br>Report saved to <a href=\"" + searchSettingsReportFile.getAbsolutePath() + "\">" + searchSettingsReportFile.getAbsolutePath() + "</a><br>";
                                        prideSearchParametersReport += "<br></html>";
                                        prideSearchParametersReport = "<html>" + prideSearchParametersReport;
                                    }
                                }
                            }
                        } else {
                            mgfConversionOk = false;
                        }
                    }

                    if (mgfConversionOk) {
                        // save the search params
                        prideSearchParameters.setParametersFile(new File(outputFolder, "pride.parameters"));
                        SearchParameters.saveIdentificationParameters(prideSearchParameters, new File(outputFolder, "pride.parameters"));
                    }

                    progressDialog.setRunFinished();
                    PrideReshakeGUI.this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")));
View Full Code Here

        annotationPreferences = new AnnotationPreferences();
        spectrumCountingPreferences = new SpectrumCountingPreferences();
        ptmScoringPreferences = new PTMScoringPreferences();
        filterPreferences = new FilterPreferences();
        displayPreferences = new DisplayPreferences();
        searchParameters = new SearchParameters();
        processingPreferences = new ProcessingPreferences();
        genePreferences = new GenePreferences();
        sequenceMatchingPreferences = null;
        idFilter = new IdFilter();
    }
View Full Code Here

    /**
     * Set the default preferences.
     */
    public void setDefaultPreferences() {
        searchParameters = new SearchParameters();
        annotationPreferences = new AnnotationPreferences();
        annotationPreferences.setAnnotationLevel(0.75);
        annotationPreferences.useAutomaticAnnotation(true);
        spectrumCountingPreferences = new SpectrumCountingPreferences();
        spectrumCountingPreferences.setSelectedMethod(SpectralCountingMethod.NSAF);
View Full Code Here

TOP

Related Classes of com.compomics.util.experiment.identification.SearchParameters

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.