Description Usage Arguments Value Examples
Manipulating GDCQuery filters
The filter
is simply a safe accessor for
the filter element in GDCQuery
objects.
The get_filter
is simply a safe accessor for
the filter element in GDCQuery
objects.
1 2 3 4 5 6 7 8 9 | filter(x, expr)
## S3 method for class 'GDCQuery'
filter(x, expr)
get_filter(x)
## S3 method for class 'GDCQuery'
get_filter(x)
|
x |
the object on which to set the filter list member |
expr |
a filter expression in the form of
the right hand side of a formula, where bare names
(without quotes) are allowed if they are available
fields associated with the GDCQuery object, |
A GDCQuery
object with the filter
field replaced by specified filter expression
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | # make a GDCQuery object to start
#
# Projects
#
pQuery = projects()
# check for the default fields
# so that we can use one of them to build a filter
default_fields(pQuery)
pQuery = filter(pQuery,~ project_id == 'TCGA-LUAC')
get_filter(pQuery)
#
# Files
#
fQuery = files()
default_fields(fQuery)
fQuery = filter(fQuery,~ data_format == 'VCF')
# OR
# with recent GenomicDataCommons versions:
# no "~" needed
fQuery = filter(fQuery, data_format == 'VCF')
get_filter(fQuery)
fQuery = filter(fQuery,~ data_format == 'VCF'
& experimental_strategy == 'WXS'
& type == 'simple_somatic_mutation')
files() %>% filter(~ data_format == 'VCF'
& experimental_strategy=='WXS'
& type == 'simple_somatic_mutation') %>% count()
files() %>% filter( data_format == 'VCF'
& experimental_strategy=='WXS'
& type == 'simple_somatic_mutation') %>% count()
# Filters may be chained for the
# equivalent query
#
# When chained, filters are combined with logical AND
files() %>%
filter(~ data_format == 'VCF') %>%
filter(~ experimental_strategy == 'WXS') %>%
filter(~ type == 'simple_somatic_mutation') %>%
count()
# OR
files() %>%
filter( data_format == 'VCF') %>%
filter( experimental_strategy == 'WXS') %>%
filter( type == 'simple_somatic_mutation') %>%
count()
# Use str() to get a cleaner picture
str(get_filter(fQuery))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.