Skip to contents

Filter interactions by extra attribute values

Usage

filter_extra_attrs(data, ..., na_ok = TRUE)

Arguments

data

An interaction data frame with extra_attrs column.

...

Extra attribute names and values. The contents of the extra attribute name for each record will be checked against the values provided. The check by default is a set intersection: if any element is common between the user provided values and the values of the extra attribute for the record, the record will be matched. Alternatively, any value can be a custom function which accepts the value of the extra attribute and returns a single logical value. Finally, if the extra attribute name starts with a dot, the result of the check will be negated.

na_ok

Logical: keep the records which do not have the extra attribute. Typically these are the records which are not from the resource providing the extra attribute.

Value

The input data frame with records removed according to the filtering criteria.

Examples

cl <- post_translational(
    resources = "Cellinker",
    fields = "extra_attrs"
)
# Only cell adhesion interactions from Cellinker
filter_extra_attrs(cl, Cellinker_type = "Cell adhesion")
#> # A tibble: 1,749 × 16
#>    source target source_genesymbol target_genesymbol is_directed is_stimulation
#>    <chr>  <chr>  <chr>             <chr>                   <dbl>          <dbl>
#>  1 O60674 P19235 JAK2              EPOR                        1              1
#>  2 Q9Y219 P46531 JAG2              NOTCH1                      1              1
#>  3 O00548 P46531 DLL1              NOTCH1                      1              1
#>  4 P78504 P46531 JAG1              NOTCH1                      1              1
#>  5 P04899 P48039 GNAI2             MTNR1A                      1              0
#>  6 P42081 P10747 CD86              CD28                        1              1
#>  7 P33681 P10747 CD80              CD28                        1              1
#>  8 P04083 P25090 ANXA1             FPR2                        1              1
#>  9 O43557 P36941 TNFSF14           LTBR                        1              1
#> 10 Q06643 P36941 LTB               LTBR                        1              1
#> # ℹ 1,739 more rows
#> # ℹ 10 more variables: is_inhibition <dbl>, consensus_direction <dbl>,
#> #   consensus_stimulation <dbl>, consensus_inhibition <dbl>,
#> #   extra_attrs <list>, sources <chr>, references <chr>, curation_effort <dbl>,
#> #   n_references <int>, n_resources <int>

op <- omnipath(fields = "extra_attrs")
# Any mechanism except phosphorylation
filter_extra_attrs(op, .SIGNOR_mechanism = "phosphorylation")
#> # A tibble: 77,203 × 16
#>    source target source_genesymbol target_genesymbol is_directed is_stimulation
#>    <chr>  <chr>  <chr>             <chr>                   <dbl>          <dbl>
#>  1 P0DP23 P48995 CALM1             TRPC1                       1              0
#>  2 P0DP25 P48995 CALM3             TRPC1                       1              0
#>  3 P0DP24 P48995 CALM2             TRPC1                       1              0
#>  4 Q03135 P48995 CAV1              TRPC1                       1              1
#>  5 P14416 P48995 DRD2              TRPC1                       1              1
#>  6 Q99750 P48995 MDFI              TRPC1                       1              0
#>  7 Q14571 P48995 ITPR2             TRPC1                       1              1
#>  8 P29966 P48995 MARCKS            TRPC1                       1              0
#>  9 Q13255 P48995 GRM1              TRPC1                       1              1
#> 10 Q13586 P48995 STIM1             TRPC1                       1              1
#> # ℹ 77,193 more rows
#> # ℹ 10 more variables: is_inhibition <dbl>, consensus_direction <dbl>,
#> #   consensus_stimulation <dbl>, consensus_inhibition <dbl>,
#> #   extra_attrs <list>, sources <chr>, references <chr>, curation_effort <dbl>,
#> #   n_references <int>, n_resources <int>