Package eu.isas.peptideshaker.utils

Examples of eu.isas.peptideshaker.utils.Metrics


            MatchValidationLevel matchValidationLevel = MatchValidationLevel.getMatchValidationLevel(newValue);
            psParameter.setMatchValidationLevel(matchValidationLevel);
            psParameter.setManualValidation(true);

            try {
                Metrics metrics = identificationFeaturesGenerator.getMetrics();

                if (type == Type.PROTEIN) {
                    identification.updateProteinMatchParameter(matchKey, psParameter);
                    if (matchValidationLevel == MatchValidationLevel.confident) {
                        metrics.setnConfidentProteins(metrics.getnConfidentProteins() + 1);
                    } else if (matchValidationLevel == MatchValidationLevel.doubtful) {
                        metrics.setnConfidentProteins(metrics.getnConfidentProteins() - 1);
                    }
                } else if (type == Type.PEPTIDE) {

                    identification.updatePeptideMatchParameter(matchKey, psParameter);
                    PSMaps pSMaps = new PSMaps();
                    pSMaps = (PSMaps) identification.getUrParam(pSMaps);
                    ProteinMap proteinMap = pSMaps.getProteinMap();
                    PeptideMatch peptideMatch = identification.getPeptideMatch(matchKey);

                    for (String accession : peptideMatch.getTheoreticPeptide().getParentProteins(sequenceMatchingPreferences)) {

                        ArrayList<String> proteinMatches = identification.getProteinMap().get(accession);

                        if (proteinMatches != null) {

                            identification.loadProteinMatchParameters(proteinMatches, psParameter, null);

                            for (String proteinMatchKey : proteinMatches) {

                                identificationFeaturesGenerator.updateNConfidentPeptides(proteinMatchKey);
                                PSParameter proteinPSParameter = (PSParameter) identification.getProteinMatchParameter(proteinMatchKey, psParameter);
                                MatchValidationLevel proteinValidation = proteinPSParameter.getMatchValidationLevel();

                                if (proteinValidation.isValidated()) {

                                    MatchesValidator.updateProteinMatchValidationLevel(identification, identificationFeaturesGenerator, searchParameters, annotationPreferences, proteinMap, proteinMatchKey);
                                    proteinPSParameter = (PSParameter) identification.getProteinMatchParameter(proteinMatchKey, proteinPSParameter);
                                    MatchValidationLevel newValidation = proteinPSParameter.getMatchValidationLevel();

                                    if (newValidation == MatchValidationLevel.confident && proteinValidation == MatchValidationLevel.doubtful) {
                                        metrics.setnConfidentProteins(metrics.getnConfidentProteins() + 1);
                                    } else if (newValidation == MatchValidationLevel.doubtful && proteinValidation == MatchValidationLevel.confident) {
                                        metrics.setnConfidentProteins(metrics.getnConfidentProteins() - 1);
                                    }
                                }
                            }
                        }
                    }
                } else if (type == Type.PSM) {

                    PSMaps pSMaps = new PSMaps();
                    pSMaps = (PSMaps) identification.getUrParam(pSMaps);
                    PeptideSpecificMap peptideMap = pSMaps.getPeptideSpecificMap();
                    ProteinMap proteinMap = pSMaps.getProteinMap();
                    SpectrumMatch spectrumMatch = identification.getSpectrumMatch(matchKey);
                    if (spectrumMatch.getBestPeptideAssumption() != null) {
                        Peptide peptide = spectrumMatch.getBestPeptideAssumption().getPeptide();
                        String peptideKey = peptide.getMatchingKey(sequenceMatchingPreferences);
                        identificationFeaturesGenerator.updateNConfidentSpectraForPeptide(peptideKey);
                        PSParameter peptidePSParameter = (PSParameter) identification.getPeptideMatchParameter(peptideKey, psParameter);

                        if (peptidePSParameter.getMatchValidationLevel().isValidated()) {

                            MatchesValidator.updatePeptideMatchValidationLevel(identification, identificationFeaturesGenerator, searchParameters, peptideMap, peptideKey);
                            identification.updateSpectrumMatchParameter(matchKey, psParameter);
                            PeptideMatch peptideMatch = identification.getPeptideMatch(peptideKey);

                            for (String accession : peptideMatch.getTheoreticPeptide().getParentProteins(sequenceMatchingPreferences)) {

                                ArrayList<String> proteinMatches = identification.getProteinMap().get(accession);

                                if (proteinMatches != null) {

                                    identification.loadProteinMatchParameters(proteinMatches, psParameter, null);

                                    for (String proteinMatchKey : proteinMatches) {

                                        identificationFeaturesGenerator.updateNConfidentPeptides(proteinMatchKey);
                                        identificationFeaturesGenerator.updateNConfidentSpectra(proteinMatchKey);
                                        PSParameter proteinPSParameter = (PSParameter) identification.getProteinMatchParameter(proteinMatchKey, psParameter);
                                        MatchValidationLevel proteinValidation = proteinPSParameter.getMatchValidationLevel();

                                        if (proteinValidation.isValidated()) {

                                            MatchesValidator.updateProteinMatchValidationLevel(identification, identificationFeaturesGenerator,
                                                    searchParameters, annotationPreferences, proteinMap, proteinMatchKey);
                                            proteinPSParameter = (PSParameter) identification.getProteinMatchParameter(proteinMatchKey, proteinPSParameter);
                                            MatchValidationLevel newValidation = proteinPSParameter.getMatchValidationLevel();

                                            if (newValidation == MatchValidationLevel.confident && proteinValidation == MatchValidationLevel.doubtful) {
                                                metrics.setnConfidentProteins(metrics.getnConfidentProteins() + 1);
                                            } else if (newValidation == MatchValidationLevel.doubtful && proteinValidation == MatchValidationLevel.confident) {
                                                metrics.setnConfidentProteins(metrics.getnConfidentProteins() - 1);
                                            }
                                        }
                                    }
                                }
                            }
View Full Code Here


     *
     * @return the metrics saved when loading the files
     */
    public Metrics getMetrics() {
        if (metrics == null) {
            metrics = new Metrics();
        }
        return metrics;
    }
View Full Code Here

     *
     * @return the metrics saved when loading the files
     */
    public Metrics getMetrics() {
        if (metrics == null) {
            metrics = new Metrics();
        }
        return metrics;
    }
View Full Code Here

TOP

Related Classes of eu.isas.peptideshaker.utils.Metrics

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.