Search in sources :

Example 11 with ValidationQcParameters

use of com.compomics.util.parameters.identification.advanced.ValidationQcParameters in project peptide-shaker by compomics.

the class MatchesValidator method updateProteinMatchValidationLevel.

/**
 * Updates the validation status of a protein match. If the match was
 * manually validated nothing will be changed.
 *
 * @param identification the identification object
 * @param targetDecoyMap the protein level target/decoy map
 * @param sequenceProvider a protein sequence provider
 * @param spectrumProvider The spectrum provider.
 * @param proteinDetailsProvider a protein details provider
 * @param geneMaps the gene maps
 * @param scoreThreshold the validation score doubtfulThreshold
 * @param confidenceThreshold the confidence doubtfulThreshold after which a
 * match should be considered as confident
 * @param noValidated boolean indicating whether no validation was actually
 * conducted
 * @param nTargetLimit the limit in number of target hits before the first
 * decoy hit
 * @param identificationFeaturesGenerator the identification features
 * generator
 * @param proteinKey the key of the protein match of interest
 * @param identificationParameters the identification parameters
 */
public static void updateProteinMatchValidationLevel(Identification identification, IdentificationFeaturesGenerator identificationFeaturesGenerator, SequenceProvider sequenceProvider, ProteinDetailsProvider proteinDetailsProvider, SpectrumProvider spectrumProvider, GeneMaps geneMaps, IdentificationParameters identificationParameters, TargetDecoyMap targetDecoyMap, double scoreThreshold, double nTargetLimit, double confidenceThreshold, boolean noValidated, long proteinKey) {
    PSParameter psParameter = new PSParameter();
    ProteinMatch proteinMatch = (ProteinMatch) identification.retrieveObject(proteinKey);
    psParameter = (PSParameter) proteinMatch.getUrParam(psParameter);
    psParameter.resetQcResults();
    ValidationQcParameters validationQCParameters = identificationParameters.getIdValidationParameters().getValidationQCParameters();
    if (!psParameter.getManualValidation()) {
        if (identificationParameters.getFastaParameters().isTargetDecoy()) {
            if (!noValidated && psParameter.getScore() <= scoreThreshold) {
                boolean filtersPassed = true;
                if (validationQCParameters.getProteinFilters() != null) {
                    for (Filter filter : validationQCParameters.getProteinFilters()) {
                        ProteinFilter proteinFilter = (ProteinFilter) filter;
                        boolean validation = proteinFilter.isValidated(proteinKey, identification, geneMaps, identificationFeaturesGenerator, identificationParameters, sequenceProvider, proteinDetailsProvider, spectrumProvider);
                        psParameter.setQcResult(filter.getName(), validation);
                        if (!validation) {
                            filtersPassed = false;
                        }
                    }
                }
                // @TODO: not sure whether we should include all 100% confidence hits by default?
                boolean confidenceThresholdPassed = psParameter.getConfidence() >= confidenceThreshold;
                if (filtersPassed && confidenceThresholdPassed) {
                    psParameter.setMatchValidationLevel(MatchValidationLevel.confident);
                } else {
                    psParameter.setMatchValidationLevel(MatchValidationLevel.doubtful);
                }
            } else {
                psParameter.setMatchValidationLevel(MatchValidationLevel.not_validated);
            }
        } else {
            psParameter.setMatchValidationLevel(MatchValidationLevel.none);
        }
        identification.updateObject(proteinKey, proteinMatch);
    }
}
Also used : PsmFilter(com.compomics.util.experiment.identification.filtering.PsmFilter) ProteinFilter(com.compomics.util.experiment.identification.filtering.ProteinFilter) PeptideFilter(com.compomics.util.experiment.identification.filtering.PeptideFilter) AssumptionFilter(com.compomics.util.experiment.identification.filtering.AssumptionFilter) Filter(com.compomics.util.experiment.filtering.Filter) ValidationQcParameters(com.compomics.util.parameters.identification.advanced.ValidationQcParameters) ProteinMatch(com.compomics.util.experiment.identification.matches.ProteinMatch) PSParameter(com.compomics.util.experiment.identification.peptide_shaker.PSParameter) ProteinFilter(com.compomics.util.experiment.identification.filtering.ProteinFilter)

Aggregations

ValidationQcParameters (com.compomics.util.parameters.identification.advanced.ValidationQcParameters)11 Filter (com.compomics.util.experiment.filtering.Filter)6 AssumptionFilter (com.compomics.util.experiment.identification.filtering.AssumptionFilter)6 PsmFilter (com.compomics.util.experiment.identification.filtering.PsmFilter)6 TargetDecoyResults (eu.isas.peptideshaker.scoring.targetdecoy.TargetDecoyResults)6 PeptideFilter (com.compomics.util.experiment.identification.filtering.PeptideFilter)5 ProteinFilter (com.compomics.util.experiment.identification.filtering.ProteinFilter)5 PSParameter (com.compomics.util.experiment.identification.peptide_shaker.PSParameter)5 SpectrumMatch (com.compomics.util.experiment.identification.matches.SpectrumMatch)3 IdentificationParameters (com.compomics.util.parameters.identification.IdentificationParameters)3 SearchParameters (com.compomics.util.parameters.identification.search.SearchParameters)3 ArrayList (java.util.ArrayList)3 PeptideMatch (com.compomics.util.experiment.identification.matches.PeptideMatch)2 ProteinMatch (com.compomics.util.experiment.identification.matches.ProteinMatch)2 MatchValidationLevel (com.compomics.util.experiment.identification.validation.MatchValidationLevel)2 FastaParameters (com.compomics.util.experiment.io.biology.protein.FastaParameters)2 FastaSummary (com.compomics.util.experiment.io.biology.protein.FastaSummary)2 IdMatchValidationParameters (com.compomics.util.parameters.identification.advanced.IdMatchValidationParameters)2 ProcessingParameters (com.compomics.util.parameters.tools.ProcessingParameters)2 TargetDecoyMap (eu.isas.peptideshaker.scoring.targetdecoy.TargetDecoyMap)2