java.lang.Object
com.compomics.util.experiment.personalization.ExperimentObject
com.compomics.util.experiment.identification.filtering.MatchFilter
All Implemented Interfaces:
Filter, Serializable
Direct Known Subclasses:
AssumptionFilter, PeptideFilter, ProteinFilter, PsmFilter

public abstract class MatchFilter
extends ExperimentObject
implements Filter
Abstract representing a filter.
Author:
Marc Vaudel
See Also:
Serialized Form
  • Field Details

  • Constructor Details

    • MatchFilter

      public MatchFilter()
      Empty default constructor
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Filter
      Returns the name of the filter.
      Specified by:
      getName in interface Filter
      Returns:
      the name of the filter
    • getDescription

      public String getDescription()
      Description copied from interface: Filter
      Returns a description for the filter.
      Specified by:
      getDescription in interface Filter
      Returns:
      a description for the filter
    • getCondition

      public String getCondition()
      Description copied from interface: Filter
      Returns a description of the condition to match for the filter to validate.
      Specified by:
      getCondition in interface Filter
      Returns:
      the condition to match for the filter to validate
    • getReport

      public String getReport​(boolean filterPassed)
      Description copied from interface: Filter
      Returns a filter report depending on whether the condition was met.
      Specified by:
      getReport in interface Filter
      Parameters:
      filterPassed - boolean indicating whether the filter was passed
      Returns:
      the report of the filter
    • setName

      public void setName​(String newName)
      Sets the name of the filter.
      Parameters:
      newName - the name to be given to the filter
    • setDescription

      public void setDescription​(String description)
      Sets the description of the filter.
      Parameters:
      description - the description of the filter
    • setCondition

      public void setCondition​(String condition)
      Sets the description of the condition to meet.
      Parameters:
      condition - the description of the condition to meet
    • setReportPassed

      public void setReportPassed​(String reportPassed)
      Sets the report when the filter is passed.
      Parameters:
      reportPassed - the report when the filter is passed
    • setReportFailed

      public void setReportFailed​(String reportFailed)
      Sets the report when the filter is not passed.
      Parameters:
      reportFailed - the report when the filter is not passed
    • getType

      public MatchFilter.FilterType getType()
      Return the type of the filter.
      Returns:
      the type of the filter
    • setType

      public void setType​(MatchFilter.FilterType filterType)
      Sets the type of the filter.
      Parameters:
      filterType - the type of the filter
    • isActive

      public boolean isActive()
      Indicates whether the filter is active.
      Returns:
      a boolean indicating whether the filter is active
    • setActive

      public void setActive​(boolean active)
      Sets whether the filter is active.
      Parameters:
      active - a boolean indicating whether the filter is active
    • getExceptions

      public HashSet<Long> getExceptions()
      Returns the exceptions to the rule.
      Returns:
      the exceptions to the rule
    • getManualValidation

      public HashSet<Long> getManualValidation()
      Returns the manually validated items.
      Returns:
      the manually validated items
    • addManualValidation

      public void addManualValidation​(long matchKey)
      Adds a manually validated Match.
      Parameters:
      matchKey - the key of the match to add
    • setManualValidation

      public void setManualValidation​(HashSet<Long> manualValidation)
      Sets the list of manually validated keys.
      Parameters:
      manualValidation - list of manually validated keys
    • addException

      public void addException​(long matchKey)
      Adds an exception.
      Parameters:
      matchKey - the key of the exception to add
    • setExceptions

      public void setExceptions​(HashSet<Long> exceptions)
      Sets the excepted matches.
      Parameters:
      exceptions - the excepted matches
    • removeManualValidation

      public void removeManualValidation​(long matchKey)
      Removes a manually validated Match.
      Parameters:
      matchKey - the key of the match to remove
    • removeException

      public void removeException​(long matchKey)
      Removes an exception.
      Parameters:
      matchKey - the key of the exception to remove
    • getNew

      protected abstract MatchFilter getNew()
      Returns a new empty filter.
      Returns:
      a new empty filter
    • clone

      public MatchFilter clone()
      Description copied from interface: Filter
      Clones the filter.
      Specified by:
      clone in interface Filter
      Overrides:
      clone in class Object
      Returns:
      a clone of the filter
    • removeFilterItem

      public void removeFilterItem​(String itemName)
      Removes an item from the filter.
      Parameters:
      itemName - the name of the item to remove
    • setFilterItem

      public void setFilterItem​(String itemName, FilterItemComparator filterItemComparator, Object value)
      Sets an item to the filter.
      Parameters:
      itemName - the name of the item to filter on
      filterItemComparator - the comparator
      value - the value to filter
    • setComparatorForItem

      public void setComparatorForItem​(String itemName, FilterItemComparator filterItemComparator)
      Sets the comparator for a given item.
      Parameters:
      itemName - the name of the item to filter on
      filterItemComparator - the comparator
    • setValueForItem

      public void setValueForItem​(String itemName, Object value)
      Sets the value for a given item.
      Parameters:
      itemName - the name of the item to filter on
      value - the comparator
    • getItemsNames

      public HashSet<String> getItemsNames()
      Returns the name of the items used to filter.
      Returns:
      the name of the items used to filter
    • getComparatorForItem

      public FilterItemComparator getComparatorForItem​(String itemName)
      Returns the comparator set for a given filtering item.
      Parameters:
      itemName - the name of the item
      Returns:
      the comparator set for a given filtering item
    • getValue

      public Object getValue​(String itemName)
      Returns the value used for comparison for a given filtering item.
      Parameters:
      itemName - the name of the item
      Returns:
      the value used for comparison for a given filtering item
    • clear

      public void clear()
      Clears the filter items.
    • isValidated

      public boolean isValidated​(long matchKey, Identification identification, GeneMaps geneMaps, IdentificationFeaturesGenerator identificationFeaturesGenerator, IdentificationParameters identificationParameters, SequenceProvider sequenceProvider, ProteinDetailsProvider proteinDetailsProvider, SpectrumProvider spectrumProvider)
      Tests whether a match is validated by this filter.
      Parameters:
      matchKey - the key of the match
      identification - the identification where to get the information from
      geneMaps - the gene maps
      identificationFeaturesGenerator - the identification features generator providing identification features
      identificationParameters - the identification parameters
      sequenceProvider - the protein sequence provider
      proteinDetailsProvider - a provider for protein details
      spectrumProvider - the spectrum provider
      Returns:
      a boolean indicating whether a match is validated by a given filter
    • isValidated

      public abstract boolean isValidated​(String itemName, FilterItemComparator filterItemComparator, Object value, long matchKey, Identification identification, GeneMaps geneMaps, IdentificationFeaturesGenerator identificationFeaturesGenerator, IdentificationParameters identificationParameters, SequenceProvider sequenceProvider, ProteinDetailsProvider proteinDetailsProvider, SpectrumProvider spectrumProvider)
      Indicates whether the match designated by the match key validates the given item using the given comparator and value threshold.
      Parameters:
      itemName - the name of the item to filter on
      filterItemComparator - the comparator to use
      value - the value to use as a threshold
      matchKey - the key of the match of interest
      identification - the identification objects where to get identification matches from
      geneMaps - the gene maps
      identificationFeaturesGenerator - the identification feature generator where to get identification features
      identificationParameters - the identification parameters used
      sequenceProvider - the protein sequence provider
      proteinDetailsProvider - the protein details provider
      spectrumProvider - the spectrum provider
      Returns:
      a boolean indicating whether the match designated by the protein key validates the given item using the given comparator and value threshold.
    • isSameAs

      public boolean isSameAs​(Filter anotherFilter)
      Description copied from interface: Filter
      Indicates whether another filter is the same as the current filter.
      Specified by:
      isSameAs in interface Filter
      Parameters:
      anotherFilter - another filter
      Returns:
      a boolean indicating whether another filter is the same as the current filter
    • getPossibleFilterItems

      public abstract FilterItem[] getPossibleFilterItems()
      Returns the filter items accepted by this filter.
      Returns:
      the filter items accepted by this filter
    • getPossibleFilterItemsNames

      public String[] getPossibleFilterItemsNames()
      Returns the filter items accepted by this filter.
      Returns:
      the filter items accepted by this filter
    • getFilterItem

      public abstract FilterItem getFilterItem​(String itemName)
      Returns the filter item corresponding to the given name.
      Parameters:
      itemName - the name of the filter item
      Returns:
      the filter item corresponding to the given name