Gene Identifier Filtering Strategies

Description

idFilter provides access to a small registry that contains a set of filtering strategy functions, which can be used in calls to the mapIDs function.

Usage

idFilter(name, ..., .wrap = FALSE)

idFilterAll(map, ...)

idFilterFirstN(map, n = 1L, exact.first = TRUE, ...)

idFilterOneToOne(map, ...)

idFilterInjective(map, strict = TRUE, ..., .last)

idFilterOneToMany(map, ..., .last)

idFilterAffy(map, secondary = NULL, ...)

idFilterAuto(map, ..., .last)

idFilterMAuto(map, ..., .last)

Arguments

name
name of the strategy
...
in idFilter, these are extra arguments that are used to pre-build a call to the strategy, which is wrapped into a function. These arguments are only used when .wrap=TRUE. For the different filtering stratgies, e.g., idFilterAuto, these arguments are either passed to internal calls to other strategies, or not used, but required so that filters can be composed.
.wrap
logical that indicates if the function call should be build and wrapped into a caller function, which takes only two arguments, map and .last, that will receive the current mapping and a logical that is TRUE only when map is the last mapping in the whole sequence of mappings. The value of .last will only be passed to the original filter function if this one has an argument of the same name.
map
mapping list object that maps source identifiers to another type of identifier.
n
maximum number of matches to keep. The default is 1, which only keeps the first match
exact.first
logical that indicates if exact matches should be prioritized, and appear as first match.
strict
logical that indicates if all intermediate mappings are required to be injective one to one, or only the last mapping step.
.last
logical that indicates if map constitutes the last mapping or an intermediate mapping.
secondary
specifies what should be done with secondary probes. If secondary=TRUE then secondary probes are kept in the mapping but primary probes are prioritized, in the sense that they will appear in front of secondary probes in each element of the mapping. If secondary=FALSE then secondary probes are removed from the mapping, meaning that identifiers that only mapped to secondary probes are then unmapped. If secondary=NULL (default), then the filter is applied as when secondary=TRUE, except when source identifiers are also Affymetrix probes and do not contain any secondary probes, in which case the the filters is applied as when secondary=FALSE. Any other value for secondary makes the filter to behave as a pass through, i.e. the map is returned unchanged.

Value

a function

Details

Filter strategies are functions that take a mapping as its first argument and returns it after performing some filtering. They should always also have argument ..., so that they can be combined in sequences. Filter strategies may optionally have an argument .last, whose value will be filled by mapIDs: TRUE if and only if the mapping constitutes the last step in the identifier conversion.

The following filter strategies are currently defined:

idFilterAll [key ‘all’]: does not filter at all, and simply return the input map unchanged.

idFilterFirstN [key ‘firstN’]: keeps the first n matches.

idFilterOneToOne [key ‘1:1’]: only keeps single matches.

idFilterBiOnetoOne [key ‘1:1’]: only keeps bidirectional one to one mapping, i.e. that the reverse mapping is also one to one. In other words it return the largest injective mapping.

idFilterOneToMany [key ‘1:*’]: only keeps single matches for intermediate mappings, but keeps all matches (i.e. single and multiple) when mapping to the last identifier type.

idFilterAffy [key ‘affy’]: enables to filter out secondary affy probes, i.e., that do not match the primary pattern "^[0-9]+_at$". This filter only applies when the destination identifiers are suitable Affymetrix probes.

idFilterAuto [key ‘auto’]: this filter is a composed filter, that successively applies filters ‘affy’ and ‘firstN’. It is suitable when one wants to map 1 to 1 as many identifiers as possible.

idFilterMAuto [key ‘mauto’]: this filter is a composed filter, that successively applies filters ‘affy’ and ‘1:*’.

Examples


# list of all available filters
idFilter()
## [1] "all"    "firstN" "1:1"    "1-1"    "1:*"    "affy"   "auto"   "mauto"

# show a given filter function
idFilter('1:1')
## function(map, ...){
##             if( !length(map) ) return(map) 
##             l <- sapply(map, length)
##             ok <- l==1L
##             if( (n <- length(l) - sum(ok)) ){
##                 log_append('(dropped ', n, ' 1:2+ maps) ')
##             }
##             map[ok]
##         }
## <environment: namespace:CellMix>

# composed filter
f <- idFilter(c('1:1', 'affy'))