Class MatchFilter
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
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MatchFilter.FilterType
Enum for the type of possible filter. -
Field Summary
Fields Modifier and Type Field Description protected HashMap<String,FilterItemComparator>
comparatorsMap
Map of the comparators to use.protected String
condition
Description of the condition to meet to pass the filter.protected String
description
Description of the filter.protected HashSet<Long>
exceptions
The exceptions to the rule.protected MatchFilter.FilterType
filterType
The type of filter.static String
MANUAL_SELECTION
Name of the manual selection filter.protected HashSet<Long>
manualValidation
The key of the manually validated matches.protected String
name
Name of the filter.protected String
reportFailed
Report when the filter is not passed.protected String
reportPassed
Report when the filter is passed.protected HashMap<String,Object>
valuesMap
Map of the values to filter on. -
Constructor Summary
Constructors Constructor Description MatchFilter()
Empty default constructor -
Method Summary
Modifier and Type Method Description void
addException(long matchKey)
Adds an exception.void
addManualValidation(long matchKey)
Adds a manually validated Match.void
clear()
Clears the filter items.MatchFilter
clone()
Clones the filter.FilterItemComparator
getComparatorForItem(String itemName)
Returns the comparator set for a given filtering item.String
getCondition()
Returns a description of the condition to match for the filter to validate.String
getDescription()
Returns a description for the filter.HashSet<Long>
getExceptions()
Returns the exceptions to the rule.abstract FilterItem
getFilterItem(String itemName)
Returns the filter item corresponding to the given name.HashSet<String>
getItemsNames()
Returns the name of the items used to filter.HashSet<Long>
getManualValidation()
Returns the manually validated items.String
getName()
Returns the name of the filter.protected abstract MatchFilter
getNew()
Returns a new empty filter.abstract FilterItem[]
getPossibleFilterItems()
Returns the filter items accepted by this filter.String[]
getPossibleFilterItemsNames()
Returns the filter items accepted by this filter.String
getReport(boolean filterPassed)
Returns a filter report depending on whether the condition was met.MatchFilter.FilterType
getType()
Return the type of the filter.Object
getValue(String itemName)
Returns the value used for comparison for a given filtering item.boolean
isActive()
Indicates whether the filter is active.boolean
isSameAs(Filter anotherFilter)
Indicates whether another filter is the same as the current filter.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.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.void
removeException(long matchKey)
Removes an exception.void
removeFilterItem(String itemName)
Removes an item from the filter.void
removeManualValidation(long matchKey)
Removes a manually validated Match.void
setActive(boolean active)
Sets whether the filter is active.void
setComparatorForItem(String itemName, FilterItemComparator filterItemComparator)
Sets the comparator for a given item.void
setCondition(String condition)
Sets the description of the condition to meet.void
setDescription(String description)
Sets the description of the filter.void
setExceptions(HashSet<Long> exceptions)
Sets the excepted matches.void
setFilterItem(String itemName, FilterItemComparator filterItemComparator, Object value)
Sets an item to the filter.void
setManualValidation(HashSet<Long> manualValidation)
Sets the list of manually validated keys.void
setName(String newName)
Sets the name of the filter.void
setReportFailed(String reportFailed)
Sets the report when the filter is not passed.void
setReportPassed(String reportPassed)
Sets the report when the filter is passed.void
setType(MatchFilter.FilterType filterType)
Sets the type of the filter.void
setValueForItem(String itemName, Object value)
Sets the value for a given item.Methods inherited from class com.compomics.util.experiment.personalization.ExperimentObject
addUrParam, asLong, clearParametersMap, getId, getUrParam, getUrParams, removeUrParam, setId, setUrParams
-
Field Details
-
name
Name of the filter. -
description
Description of the filter. -
condition
Description of the condition to meet to pass the filter. -
reportPassed
Report when the filter is passed. -
reportFailed
Report when the filter is not passed. -
manualValidation
The key of the manually validated matches. -
exceptions
The exceptions to the rule. -
MANUAL_SELECTION
Name of the manual selection filter.- See Also:
- Constant Field Values
-
comparatorsMap
Map of the comparators to use. -
valuesMap
Map of the values to filter on. -
filterType
The type of filter.
-
-
Constructor Details
-
MatchFilter
public MatchFilter()Empty default constructor
-
-
Method Details
-
getName
Description copied from interface:Filter
Returns the name of the filter. -
getDescription
Description copied from interface:Filter
Returns a description for the filter.- Specified by:
getDescription
in interfaceFilter
- Returns:
- a description for the filter
-
getCondition
Description copied from interface:Filter
Returns a description of the condition to match for the filter to validate.- Specified by:
getCondition
in interfaceFilter
- Returns:
- the condition to match for the filter to validate
-
getReport
Description copied from interface:Filter
Returns a filter report depending on whether the condition was met. -
setName
Sets the name of the filter.- Parameters:
newName
- the name to be given to the filter
-
setDescription
Sets the description of the filter.- Parameters:
description
- the description of the filter
-
setCondition
Sets the description of the condition to meet.- Parameters:
condition
- the description of the condition to meet
-
setReportPassed
Sets the report when the filter is passed.- Parameters:
reportPassed
- the report when the filter is passed
-
setReportFailed
Sets the report when the filter is not passed.- Parameters:
reportFailed
- the report when the filter is not passed
-
getType
Return the type of the filter.- Returns:
- the type of the filter
-
setType
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
Returns the exceptions to the rule.- Returns:
- the exceptions to the rule
-
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
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
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
Returns a new empty filter.- Returns:
- a new empty filter
-
clone
Description copied from interface:Filter
Clones the filter. -
removeFilterItem
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 onfilterItemComparator
- the comparatorvalue
- the value to filter
-
setComparatorForItem
Sets the comparator for a given item.- Parameters:
itemName
- the name of the item to filter onfilterItemComparator
- the comparator
-
setValueForItem
Sets the value for a given item.- Parameters:
itemName
- the name of the item to filter onvalue
- the comparator
-
getItemsNames
Returns the name of the items used to filter.- Returns:
- the name of the items used to filter
-
getComparatorForItem
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
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 matchidentification
- the identification where to get the information fromgeneMaps
- the gene mapsidentificationFeaturesGenerator
- the identification features generator providing identification featuresidentificationParameters
- the identification parameterssequenceProvider
- the protein sequence providerproteinDetailsProvider
- a provider for protein detailsspectrumProvider
- 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 onfilterItemComparator
- the comparator to usevalue
- the value to use as a thresholdmatchKey
- the key of the match of interestidentification
- the identification objects where to get identification matches fromgeneMaps
- the gene mapsidentificationFeaturesGenerator
- the identification feature generator where to get identification featuresidentificationParameters
- the identification parameters usedsequenceProvider
- the protein sequence providerproteinDetailsProvider
- the protein details providerspectrumProvider
- 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
Description copied from interface:Filter
Indicates whether another filter is the same as the current filter. -
getPossibleFilterItems
Returns the filter items accepted by this filter.- Returns:
- the filter items accepted by this filter
-
getPossibleFilterItemsNames
Returns the filter items accepted by this filter.- Returns:
- the filter items accepted by this filter
-
getFilterItem
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
-