Package com.compomics.util.experiment.identification

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


                                    geneFactory.initialize(geneMappingsFile, null);
                                    goFactory.initialize(goMappingsFile, progressDialog);

                                    PSParameter psParameter = new PSParameter();

                                    Identification identification = peptideShakerGUI.getIdentification();
                                    identification.loadProteinMatchParameters(psParameter, null);

                                    progressDialog.setTitle("Getting GO Mappings (2/3). Please Wait...");
                                    progressDialog.setPrimaryProgressCounterIndeterminate(false);
                                    progressDialog.setMaxPrimaryProgressCounter(identification.getProteinIdentification().size());
                                    progressDialog.setValue(0);
                                    int totalNumberOfGoMappedProteinsInProject = 0;

                                    for (String proteinKey : identification.getProteinIdentification()) {

                                        psParameter = (PSParameter) peptideShakerGUI.getIdentification().getProteinMatchParameter(proteinKey, psParameter);

                                        if (psParameter.getMatchValidationLevel().isValidated() && !ProteinMatch.isDecoy(proteinKey) && !psParameter.isHidden()) {
                                            ArrayList<String> goTerms = goFactory.getProteinGoAccessions(proteinKey);
View Full Code Here


                        selectedGoAccession = selectedGoAccession.substring(selectedGoAccession.lastIndexOf("GTerm?id=") + "GTerm?id=".length(), selectedGoAccession.lastIndexOf("\"><font"));

                        // get the list of matching proteins
                        ArrayList<String> goProteins = goFactory.getAccessions(selectedGoAccession);
                        ArrayList<String> proteinKeys = new ArrayList<String>();
                        Identification identification = peptideShakerGUI.getIdentification();
                        HashMap<String, ArrayList<String>> proteinMap = identification.getProteinMap();
                        for (String goProtein : goProteins) {
                            ArrayList<String> tempKeys = proteinMap.get(goProtein);
                            if (tempKeys != null) {
                                for (String proteinKey : tempKeys) {
                                    if (!proteinKeys.contains(proteinKey)) {
                                        proteinKeys.add(proteinKey);
                                    }
                                }
                            }
                        }

                        identification.loadProteinMatches(proteinKeys, null);
                        identification.loadProteinMatchParameters(proteinKeys, new PSParameter(), null);

                        // update the table
                        if (proteinTable.getModel() instanceof ProteinGoTableModel) {
                            ((ProteinGoTableModel) proteinTable.getModel()).updateDataModel(peptideShakerGUI, proteinKeys);
                        } else {
                            ProteinGoTableModel proteinTableModel = new ProteinGoTableModel(peptideShakerGUI, proteinKeys);
                            proteinTable.setModel(proteinTableModel);
                        }

                        setProteinGoTableProperties();
                        ((DefaultTableModel) proteinTable.getModel()).fireTableDataChanged();

                        if (proteinTable.getRowCount() > 0) {

                            // get the number of confident and doubtful matches
                            int nConfident = 0;
                            int nDoubtful = 0;
                            PSParameter psParameter = new PSParameter();

                            for (String proteinKey : proteinKeys) {
                                psParameter = (PSParameter) identification.getProteinMatchParameter(proteinKey, psParameter);
                                MatchValidationLevel level = psParameter.getMatchValidationLevel();

                                if (level == MatchValidationLevel.confident) {
                                    nConfident++;
                                } else if (level == MatchValidationLevel.doubtful) {
View Full Code Here

        progressDialog.setMaxPrimaryProgressCounter(peptideShakerGUI.getIdentification().getProteinIdentification().size());
        progressDialog.setValue(0);

        try {

            Identification identification = peptideShakerGUI.getIdentification();
            IdentificationFeaturesGenerator identificationFeaturesGenerator = peptideShakerGUI.getIdentificationFeaturesGenerator();

            PSParameter proteinParameter = new PSParameter();
            maxValue = Double.MIN_VALUE;

            validatedValues = new ArrayList<Double>();
            validatedDoubtfulValues = new ArrayList<Double>();
            nonValidatedValues = new ArrayList<Double>();
            validatedDecoyValues = new ArrayList<Double>();
            nonValidatedDecoyValues = new ArrayList<Double>();

            for (String proteinKey : identification.getProteinIdentification()) {

                if (progressDialog.isRunCanceled()) {
                    break;
                }

                double value = 0;

                if (proteinNumberValidatedPeptidesJRadioButton.isSelected()) {
                    value = identificationFeaturesGenerator.getNValidatedPeptides(proteinKey);
                } else if (proteinSpectrumCountingScoreJRadioButton.isSelected()) {
                    value = identificationFeaturesGenerator.getSpectrumCounting(proteinKey);
                } else if (proteinSequenceCoverageJRadioButton.isSelected()) {
                        HashMap<Integer, Double> sequenceCoverage;
                        try {
                            sequenceCoverage = peptideShakerGUI.getIdentificationFeaturesGenerator().getSequenceCoverage(proteinKey);
                        } catch (Exception e) {
                            peptideShakerGUI.catchException(e);
                            sequenceCoverage = new HashMap<Integer, Double>();
                        }
                        Double sequenceCoverageConfident = 100 * sequenceCoverage.get(MatchValidationLevel.confident.getIndex());
                        Double sequenceCoverageDoubtful = 100 * sequenceCoverage.get(MatchValidationLevel.doubtful.getIndex());
                        value = sequenceCoverageConfident + sequenceCoverageDoubtful;
                } else if (proteinSequenceLengthJRadioButton.isSelected()) {
                    ProteinMatch proteinMatch = identification.getProteinMatch(proteinKey);
                    Protein currentProtein = sequenceFactory.getProtein(proteinMatch.getMainMatch());
                    value = currentProtein.getSequence().length();
                }

                proteinParameter = (PSParameter) identification.getProteinMatchParameter(proteinKey, proteinParameter);

                if (!proteinParameter.isHidden()) {

                    if (value > maxValue) {
                        maxValue = value;
View Full Code Here

        progressDialog.setValue(0);

        try {
            PSParameter psmParameter = new PSParameter();
            maxValue = Double.MIN_VALUE;
            Identification identification = peptideShakerGUI.getIdentification();

            if (psmPrecursorMassErrorJRadioButton.isSelected()) {

                // Values for the precursor mass deviation
                validatedValues = new ArrayList<Double>();
                validatedDoubtfulValues = new ArrayList<Double>();
                nonValidatedValues = new ArrayList<Double>();
                validatedDecoyValues = new ArrayList<Double>();
                nonValidatedDecoyValues = new ArrayList<Double>();

                for (String spectrumFileName : identification.getSpectrumFiles()) {
                    identification.loadSpectrumMatches(spectrumFileName, progressDialog);
                    identification.loadSpectrumMatchParameters(spectrumFileName, psmParameter, progressDialog);
                    for (String spectrumKey : identification.getSpectrumIdentification(spectrumFileName)) {

                        if (progressDialog.isRunCanceled()) {
                            break;
                        }

                        SpectrumMatch spectrumMatch = identification.getSpectrumMatch(spectrumKey);
                        psmParameter = (PSParameter) identification.getSpectrumMatchParameter(spectrumKey, psmParameter);

                        if (!psmParameter.isHidden() && spectrumMatch.getBestPeptideAssumption() != null) {

                            Precursor precursor = peptideShakerGUI.getPrecursor(spectrumKey);
                            double value = spectrumMatch.getBestPeptideAssumption().getDeltaMass(
                                    precursor.getMz(),
                                    peptideShakerGUI.getSearchParameters().isPrecursorAccuracyTypePpm());
                            if (value > maxValue) {
                                maxValue = value;
                            }

                            if (!spectrumMatch.getBestPeptideAssumption().getPeptide().isDecoy(peptideShakerGUI.getSequenceMatchingPreferences())) {
                                if (psmParameter.getMatchValidationLevel().isValidated()) {
                                    if (psmParameter.getMatchValidationLevel() == MatchValidationLevel.confident) {
                                        validatedValues.add(value);
                                    } else {
                                        validatedDoubtfulValues.add(value);
                                    }
                                } else {
                                    nonValidatedValues.add(value);
                                }
                            } else {
                                if (psmParameter.getMatchValidationLevel().isValidated()) {
                                    validatedDecoyValues.add(value);
                                } else {
                                    nonValidatedDecoyValues.add(value);
                                }
                            }
                        }

                        progressDialog.increasePrimaryProgressCounter();
                    }
                }
            } else if (psmPrecursorChargeJRadioButton.isSelected()) {

                // Values for the precursor charge
                validatedValues = new ArrayList<Double>();
                validatedDoubtfulValues = new ArrayList<Double>();
                nonValidatedValues = new ArrayList<Double>();
                validatedDecoyValues = new ArrayList<Double>();
                nonValidatedDecoyValues = new ArrayList<Double>();

                for (String spectrumFileName : identification.getSpectrumFiles()) {
                    identification.loadSpectrumMatches(spectrumFileName, progressDialog);
                    identification.loadSpectrumMatchParameters(spectrumFileName, psmParameter, progressDialog);
                    for (String spectrumKey : identification.getSpectrumIdentification(spectrumFileName)) {
                        if (progressDialog.isRunCanceled()) {
                            break;
                        }

                        SpectrumMatch spectrumMatch = peptideShakerGUI.getIdentification().getSpectrumMatch(spectrumKey);
View Full Code Here

            } else if (waitingDialog.isRunCanceled()) {

                // close the database
                try {
                    ProteomicAnalysis proteomicAnalysis = experiment.getAnalysisSet(sample).getProteomicAnalysis(replicateNumber);
                    Identification identification = proteomicAnalysis.getIdentification(IdentificationMethod.MS2_IDENTIFICATION);
                    identification.close();
                } catch (SQLException e) {
                    System.out.println("Failed to close the database!");
                    e.printStackTrace();
                }
            }
View Full Code Here

            // open the match validation level dialog
            if (column == psmTable.getColumn("").getModelIndex() && evt != null && evt.getButton() == MouseEvent.BUTTON1) {
                SelfUpdatingTableModel tableModel = (SelfUpdatingTableModel) psmTable.getModel();
                String key = psmKeys.get(tableModel.getViewIndex(row));
                Identification identification = peptideShakerGUI.getIdentification();
                PSMaps pSMaps = new PSMaps();
                pSMaps = (PSMaps) identification.getUrParam(pSMaps);
                try {
                    MatchValidationDialog matchValidationDialog = new MatchValidationDialog(peptideShakerGUI, peptideShakerGUI.getExceptionHandler(),
                            identification, peptideShakerGUI.getIdentificationFeaturesGenerator(), pSMaps.getPsmSpecificMap(), key,
                            peptideShakerGUI.getSearchParameters(), peptideShakerGUI.getAnnotationPreferences(), peptideShakerGUI.getSequenceMatchingPreferences());
                    if (matchValidationDialog.isValidationChanged()) {
View Full Code Here

                    new ProteinInferenceDialog(peptideShakerGUI, proteinKey, peptideShakerGUI.getIdentification());
                }

                // open the match validation level dialog
                if (column == proteinTable.getColumn("").getModelIndex() && evt != null && evt.getButton() == MouseEvent.BUTTON1) {
                    Identification identification = peptideShakerGUI.getIdentification();
                    PSMaps pSMaps = new PSMaps();
                    pSMaps = (PSMaps) identification.getUrParam(pSMaps);
                    try {
                        MatchValidationDialog matchValidationDialog = new MatchValidationDialog(peptideShakerGUI, peptideShakerGUI.getExceptionHandler(),
                                identification, peptideShakerGUI.getIdentificationFeaturesGenerator(), pSMaps.getProteinMap(), proteinKey,
                                peptideShakerGUI.getSearchParameters(), peptideShakerGUI.getAnnotationPreferences(), peptideShakerGUI.getSequenceMatchingPreferences());
                        if (matchValidationDialog.isValidationChanged()) {
View Full Code Here

                }
            }

            // open the match validation level dialog
            if (column == peptideTable.getColumn("").getModelIndex() && evt != null && evt.getButton() == MouseEvent.BUTTON1) {
                Identification identification = peptideShakerGUI.getIdentification();
                PSMaps pSMaps = new PSMaps();
                pSMaps = (PSMaps) identification.getUrParam(pSMaps);
                try {
                    MatchValidationDialog matchValidationDialog = new MatchValidationDialog(peptideShakerGUI, peptideShakerGUI.getExceptionHandler(),
                            identification, peptideShakerGUI.getIdentificationFeaturesGenerator(), pSMaps.getPeptideSpecificMap(), peptideKey,
                            peptideShakerGUI.getSearchParameters(), peptideShakerGUI.getAnnotationPreferences(), peptideShakerGUI.getSequenceMatchingPreferences());
                    if (matchValidationDialog.isValidationChanged()) {
View Full Code Here

                int unmodifiedCounter = 0;

                // get the fixed ptms
                HashMap<Integer, String> fixedPtms = new HashMap<Integer, String>(); // @TODO: note this this only supports one fixed ptm per residue

                Identification identification = peptideShakerGUI.getIdentification();
                identification.loadPeptideMatches(peptideKeys, null);
                DisplayPreferences displayPreferences = peptideShakerGUI.getDisplayPreferences();

                for (String peptideKey : peptideKeys) {
                    boolean modified = false;
                    for (String ptmName : displayPreferences.getDisplayedPtms()) {
                        if (Peptide.isModified(peptideKey, ptmName)) {
                            modified = true;
                            break;
                        }
                    }
                    if (modified) {
                        PeptideMatch peptideMatch = identification.getPeptideMatch(peptideKey);
                        for (ModificationMatch modMatch : peptideMatch.getTheoreticPeptide().getModificationMatches()) {
                            if (!modMatch.isVariable()) {
                                String ptmName = modMatch.getTheoreticPtm();
                                if (displayPreferences.isDisplayedPTM(ptmName)) {
                                    ArrayList<Integer> indexes = sequenceFactory.getProtein(proteinAccession).getPeptideStart(Peptide.getSequence(peptideKey),
View Full Code Here

        if (row != -1) {
            this.setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));

            try {
                Identification identification = peptideShakerGUI.getIdentification();
                IdentificationFeaturesGenerator identificationFeaturesGenerator = peptideShakerGUI.getIdentificationFeaturesGenerator();
                SelfUpdatingTableModel tableModel = (SelfUpdatingTableModel) peptideTable.getModel();
                int peptideIndex = tableModel.getViewIndex(row);
                String peptideKey = peptideKeys.get(peptideIndex);
                try {
                    psmKeys = identificationFeaturesGenerator.getSortedPsmKeys(peptideKey);
                } catch (Exception e) {
                    peptideShakerGUI.catchException(e);
                    try {
                        // ok let's try without order
                        PeptideMatch peptideMatch = identification.getPeptideMatch(peptideKey);
                        psmKeys = peptideMatch.getSpectrumMatches();
                    } catch (Exception e1) {
                        // just hope the GUI holds...
                        peptideShakerGUI.catchException(e1);
                        psmKeys = new ArrayList<String>();
View Full Code Here

TOP

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

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.