select: Using the "select" interface on src_organism objects

Description Usage Arguments Details Value Author(s) See Also Examples

Description

select, columns and keys can be used together to extract data from a src_organism object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## S4 method for signature 'src_organism'
keytypes(x)

## S4 method for signature 'src_organism'
columns(x)

## S4 method for signature 'src_organism'
keys(x, keytype, ...)

select_tbl(x, keys, columns, keytype)

## S4 method for signature 'src_organism'
select(x, keys, columns, keytype)

## S4 method for signature 'src_organism'
mapIds(x, keys, column, keytype, ..., multiVals)

Arguments

x

a src_organism object

keytype

specifies the kind of keys that will be returned. By default keys will return the keys for schema of the src_organism object.

...

other arguments. These include:

pattern: the pattern to match.

column: the column to search on.

fuzzy: TRUE or FALSE value. Use fuzzy matching? (this is used with pattern)

keys

the keys to select records for from the database. All possible keys are returned by using the keys method.

columns

the columns or kinds of things that can be retrieved from the database. As with keys, all possible columns are returned by using the columns method.

column

character(1) the column to search on, can only have a single element for the value

multiVals

What should mapIds do when there are multiple values that could be returned. Options include:

first: when there are multiple matches only the 1st thing that comes back will be returned. This is the default behavior.

list: return a list object to the end user

filter: remove all elements that contain multiple matches and will therefore return a shorter vector than what came in whenever some of the keys match more than one value

asNA: return an NA value whenever there are multiple matches

CharacterList: returns a SimpleCharacterList object

FUN: can also supply a function to the multiVals argument for custom behaviors. The function must take a single argument and return a single value. This function will be applied to all the elements and will serve a 'rule' that for which thing to keep when there is more than one element. So for example this example function will always grab the last element in each result: last <- function(x){x[[length(x)]]}

Details

keytypes(): discover which keytypes can be passed to keytype argument of methods select or keys.

keys(): returns keys for the src_organism object. By default it returns the primary keys for the database, and returns the keys from that keytype when the keytype argument is used.

columns(): discover which kinds of data can be returned for the src_organism object.

select(): retrieves the data as a tibble based on parameters for selected keys columns and keytype arguments. If requested columns that have multiple matches for the keys, 'select()' will return a tibble with one row for each possible match.

mapIds(): gets the mapped ids (column) for a set of keys that are of a particular keytype. Usually returned as a named character vector.

Value

keys, columns and keytypes each returns a character vector of possible values. select returns a tibble.

Author(s)

Yubo Cheng.

See Also

AnnotationDb-class for more descriptsion of methods select, keytypes, keys and columns.

src_organism for creating a src_organism object.

transcripts_tbl for generic functions to extract genomic features from a src_organism object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: src <- src_organism("TxDb.Hsapiens.UCSC.hg38.knownGene")
src <- src_organism(dbpath=hg38light())

## keytypes
keytypes(src)

## columns
columns(src)

## keys
keys(src, "entrez")

keytype <- "symbol"
keys <- c("ADA", "NAT2")
columns <- c("entrez", "tx_id", "tx_name","exon_id")

## select
select_tbl(src, keys, columns, keytype)
select(src, keys, columns, keytype)

## mapIds
mapIds(src, keys, column = "tx_name", keytype)

Bioconductor/Organism.dplyr documentation built on Nov. 6, 2019, 7:04 a.m.