Filter interactions by extra attribute values
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.
Examples
cl <- import_post_translational_interactions(
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 sourc…¹ targe…² is_di…³ is_st…⁴ is_in…⁵ conse…⁶ conse…⁷ conse…⁸
#> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 O60674 P19235 JAK2 EPOR 1 1 0 1 1 0
#> 2 Q9Y219 P46531 JAG2 NOTCH1 1 1 1 1 1 0
#> 3 O00548 P46531 DLL1 NOTCH1 1 1 0 1 1 0
#> 4 P78504 P46531 JAG1 NOTCH1 1 1 1 1 1 0
#> 5 P04899 P48039 GNAI2 MTNR1A 1 0 0 0 0 0
#> 6 O43557 P36941 TNFSF14 LTBR 1 1 0 1 1 0
#> 7 Q06643 P36941 LTB LTBR 1 1 0 1 1 0
#> 8 Q14451 P21860 GRB7 ERBB3 1 0 0 0 0 0
#> 9 Q96D42 Q96H15 HAVCR1 TIMD4 1 0 0 0 0 0
#> 10 P48357 O60674 LEPR JAK2 1 1 0 1 1 0
#> # … with 1,739 more rows, 6 more variables: extra_attrs <list>, sources <chr>,
#> # references <chr>, curation_effort <dbl>, n_references <int>,
#> # n_resources <int>, and abbreviated variable names ¹source_genesymbol,
#> # ²target_genesymbol, ³is_directed, ⁴is_stimulation, ⁵is_inhibition,
#> # ⁶consensus_direction, ⁷consensus_stimulation, ⁸consensus_inhibition
op <- import_omnipath_interactions(fields = 'extra_attrs')
# Any mechanism except phosphorylation
filter_extra_attrs(op, .SIGNOR_mechanism = 'phosphorylation')
#> # A tibble: 35,765 × 16
#> source target sourc…¹ targe…² is_di…³ is_st…⁴ is_in…⁵ conse…⁶ conse…⁷ conse…⁸
#> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 P0DP25 P48995 CALM3 TRPC1 1 0 1 1 0 1
#> 2 P0DP23 P48995 CALM1 TRPC1 1 0 1 1 0 1
#> 3 P0DP24 P48995 CALM2 TRPC1 1 0 1 1 0 1
#> 4 Q03135 P48995 CAV1 TRPC1 1 1 0 1 1 0
#> 5 P14416 P48995 DRD2 TRPC1 1 1 0 1 1 0
#> 6 Q99750 P48995 MDFI TRPC1 1 0 1 1 0 1
#> 7 Q14571 P48995 ITPR2 TRPC1 1 1 0 1 1 0
#> 8 P29966 P48995 MARCKS TRPC1 1 0 1 1 0 1
#> 9 Q13255 P48995 GRM1 TRPC1 1 1 0 1 1 0
#> 10 Q13586 P48995 STIM1 TRPC1 1 1 0 1 1 0
#> # … with 35,755 more rows, 6 more variables: extra_attrs <list>, sources <chr>,
#> # references <chr>, curation_effort <dbl>, n_references <dbl>,
#> # n_resources <int>, and abbreviated variable names ¹source_genesymbol,
#> # ²target_genesymbol, ³is_directed, ⁴is_stimulation, ⁵is_inhibition,
#> # ⁶consensus_direction, ⁷consensus_stimulation, ⁸consensus_inhibition