Package eu.isas.peptideshaker.myparameters

Source Code of eu.isas.peptideshaker.myparameters.PeptideShakerSettings

package eu.isas.peptideshaker.myparameters;

import com.compomics.util.preferences.PTMScoringPreferences;
import com.compomics.util.preferences.ProcessingPreferences;
import com.compomics.util.experiment.identification.SearchParameters;
import com.compomics.util.experiment.personalization.UrParameter;
import com.compomics.util.preferences.AnnotationPreferences;
import com.compomics.util.preferences.GenePreferences;
import com.compomics.util.preferences.IdFilter;
import com.compomics.util.preferences.SequenceMatchingPreferences;
import eu.isas.peptideshaker.preferences.*;
import eu.isas.peptideshaker.utils.IdentificationFeaturesCache;
import eu.isas.peptideshaker.utils.Metrics;

/**
* This class will be used to save all settings needed in PeptideShaker.
*
* @author Marc Vaudel
*/
public class PeptideShakerSettings implements UrParameter {

    /**
     * Serial version UID for post-serialization compatibility.
     */
    static final long serialVersionUID = -3531908843597367812L;
    /**
     * The search parameters (versions older than 0.19) still present for
     * backward compatibility.
     *
     * @deprecated use utilitiesSearchParamters
     */
    private eu.isas.peptideshaker.preferences.SearchParameters searchParameters;
    /**
     * The parameters linked to the search.
     */
    private SearchParameters utiltiesSearchParameters;
    /**
     * The initial processing preferences.
     */
    private ProcessingPreferences processingPreferences;
    /**
     * The utilities annotation preferences.
     */
    private AnnotationPreferences utilitiesAnnotationPreferences = null;
    /**
     * The spectrum counting preferences.
     */
    private SpectrumCountingPreferences spectrumCountingPreferences;
    /**
     * The GUI filter preferences.
     */
    private FilterPreferences filterPreferences;
    /**
     * The display preferences.
     */
    private DisplayPreferences displayPreferences;
    /**
     * The gene preferences.
     */
    private GenePreferences genePreferences;
    /**
     * The project details.
     */
    private ProjectDetails projectDetails;
    /**
     * The metrics saved when loading the files.
     */
    private Metrics metrics;
    /**
     * The identification features generator with features in cache.
     */
    private IdentificationFeaturesCache identificationFeaturesCache;
    /**
     * The PTM scoring preferences.
     */
    private PTMScoringPreferences ptmScoringPreferences;
    /**
     * The sequence matching preferences.
     */
    private SequenceMatchingPreferences sequenceMatchingPreferences;
    /**
     * The identification filters.
     */
    private IdFilter idFilter;

    /**
     * Blank constructor.
     */
    public PeptideShakerSettings() {
    }

    /**
     * Constructor for a PeptideShaker Settings class.
     *
     * @param searchParameters The parameters linked to the search
     * @param annotationPreferences The annotation preferences
     * @param spectrumCountingPreferences The spectrum counting preferences
     * @param projectDetails The project details
     * @param filterPreferences The filter preferences
     * @param displayPreferences The display preferences
     * @param metrics The metrics saved when loading the files
     * @param processingPreferences The processing preferences
     * @param identificationFeaturesCache The identification features cache
     * @param ptmScoringPreferences The PTM scoring preferences
     * @param genePreferences the gene preferences
     * @param idFilter the identification filters
     * @param sequenceMatchingPreferences the sequence matching preferences
     */
    public PeptideShakerSettings(SearchParameters searchParameters,
            AnnotationPreferences annotationPreferences,
            SpectrumCountingPreferences spectrumCountingPreferences,
            ProjectDetails projectDetails,
            FilterPreferences filterPreferences,
            DisplayPreferences displayPreferences,
            Metrics metrics,
            ProcessingPreferences processingPreferences,
            IdentificationFeaturesCache identificationFeaturesCache,
            PTMScoringPreferences ptmScoringPreferences,
            GenePreferences genePreferences,
            IdFilter idFilter,
            SequenceMatchingPreferences sequenceMatchingPreferences) {
        this.utiltiesSearchParameters = searchParameters;
        this.utilitiesAnnotationPreferences = annotationPreferences;
        this.spectrumCountingPreferences = spectrumCountingPreferences;
        this.projectDetails = projectDetails;
        this.filterPreferences = filterPreferences;
        this.displayPreferences = displayPreferences;
        this.metrics = metrics;
        this.processingPreferences = processingPreferences;
        this.identificationFeaturesCache = identificationFeaturesCache;
        this.ptmScoringPreferences = ptmScoringPreferences;
        this.genePreferences = genePreferences;
        this.idFilter = idFilter;
        this.sequenceMatchingPreferences = sequenceMatchingPreferences;
    }

    /**
     * Returns the annotation preferences.
     *
     * @return the annotation preferences
     */
    public AnnotationPreferences getAnnotationPreferences() {
        if (utilitiesAnnotationPreferences == null) {
            // most likely a compatibility issue, reset the annotation preferences
            utilitiesAnnotationPreferences = new AnnotationPreferences();
        }
        return utilitiesAnnotationPreferences;
    }

    /**
     * Returns the parameters linked to the search.
     *
     * @return the parameters linked to the search
     */
    public SearchParameters getSearchParameters() {
        if (utiltiesSearchParameters == null) {
            utiltiesSearchParameters = searchParameters.getUpdatedVersion();
        }
        return utiltiesSearchParameters;
    }

    /**
     * Returns the spectrum counting preferences of the project.
     *
     * @return the spectrum counting preferences of the project
     */
    public SpectrumCountingPreferences getSpectrumCountingPreferences() {
        return spectrumCountingPreferences;
    }

    /**
     * Returns the project details.
     *
     * @return the project details
     */
    public ProjectDetails getProjectDetails() {
        return projectDetails;
    }

    /**
     * Returns the GUI display preferences.
     *
     * @return the GUI display preferences
     */
    public FilterPreferences getFilterPreferences() {
        return filterPreferences;
    }

    /**
     * Returns the GUI display preferences.
     *
     * @return the GUI display preferences
     */
    public DisplayPreferences getDisplayPreferences() {
        return displayPreferences;
    }

    /**
     * Returns the gene preferences.
     *
     * @return the gene preferences
     */
    public GenePreferences getGenePreferences() {
        if (genePreferences == null) {
            genePreferences = new GenePreferences();
        }
        return genePreferences;
    }

    /**
     * Set the gene preferences.
     *
     * @param genePreferences
     */
    public void setGenePreferences(GenePreferences genePreferences) {
        this.genePreferences = genePreferences;
    }

    /**
     * Returns the initial processing preferences.
     *
     * @return the initial processing preferences
     */
    public ProcessingPreferences getProcessingPreferences() {
        if (processingPreferences == null) {
            processingPreferences = new ProcessingPreferences();
        }
        return processingPreferences;
    }

    /**
     * Sets the initial processing preferences.
     *
     * @param processingPreferences the initial processing preferences
     */
    public void setProcessingPreferences(ProcessingPreferences processingPreferences) {
        this.processingPreferences = processingPreferences;
    }

    /**
     * Returns the metrics saved when loading the files.
     *
     * @return the metrics saved when loading the files
     */
    public Metrics getMetrics() {
        if (metrics == null) {
            metrics = new Metrics();
        }
        return metrics;
    }

    /**
     * Returns the identification features cache used by the identification
     * features generator before saving the file. Null for versions older than
     * 0.18.0.
     *
     * @return the identification features cache
     */
    public IdentificationFeaturesCache getIdentificationFeaturesCache() {
        return identificationFeaturesCache;
    }

    /**
     * Returns the PTM scoring preferences.
     *
     * @return the PTM scoring preferences
     */
    public PTMScoringPreferences getPTMScoringPreferences() {
        if (ptmScoringPreferences == null) {
            // backward compatibility check
            ptmScoringPreferences = new PTMScoringPreferences();
            ptmScoringPreferences.setFlrThreshold(1);
            ptmScoringPreferences.setProbabilisticScoreNeutralLosses(true);
            try {
                ptmScoringPreferences.setProbabilitsticScoreCalculation(processingPreferences.isAScoreCalculated());
            } catch (Exception e) {
                ptmScoringPreferences.setProbabilitsticScoreCalculation(true);
            }
        }
        return ptmScoringPreferences;
    }

    @Override
    public String getFamilyName() {
        return "PeptideShaker";
    }

    @Override
    public int getIndex() {
        return 2;
    }

    /**
     * Returns the ID filters.
     *
     * @return the idFilter
     */
    public IdFilter getIdFilter() {
        return idFilter;
    }

    /**
     * Sets the ID filter.
     *
     * @param idFilter the idFilter to set
     */
    public void setIdFilter(IdFilter idFilter) {
        this.idFilter = idFilter;
    }

    /**
     * Returns the sequence matching preferences.
     *
     * @return the sequence matching preferences
     */
    public SequenceMatchingPreferences getSequenceMatchingPreferences() {
        return sequenceMatchingPreferences;
    }

    /**
     * Sets the sequence matching preferences.
     *
     * @param sequenceMatchingPreferences the sequence matching preferences
     */
    public void setSequenceMatchingPreferences(SequenceMatchingPreferences sequenceMatchingPreferences) {
        this.sequenceMatchingPreferences = sequenceMatchingPreferences;
    }
}
TOP

Related Classes of eu.isas.peptideshaker.myparameters.PeptideShakerSettings

TOP
Copyright © 2018 www.massapi.com. 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.