Skip to contents

You can subset associations by identifier or by position using the `[` operator.

Usage

# S4 method for associations,missing,missing,missing
[(x, i, j, ..., drop = FALSE)

# S4 method for associations,numeric,missing,missing
[(x, i, j, ..., drop = FALSE)

# S4 method for associations,character,missing,missing
[(x, i, j, ..., drop = FALSE)

Arguments

x

A associations object.

i

Position of the identifier or the name of the identifier itself.

j

Not used.

...

Additional arguments not used here.

drop

Not used.

Value

A associations object.

Examples

# Subset an associations object by identifier
associations_ex01['22505']
#> An object of class "associations"
#> Slot "associations":
#> # A tibble: 1 × 17
#>   association_id   pvalue pvalue_description pvalue_mantissa pvalue_exponent
#>   <chr>             <dbl> <chr>                        <int>           <int>
#> 1 22505          0.000007 NA                               7              -6
#> # ℹ 12 more variables: multiple_snp_haplotype <lgl>, snp_interaction <lgl>,
#> #   snp_type <chr>, standard_error <dbl>, range <chr>,
#> #   or_per_copy_number <dbl>, beta_number <dbl>, beta_unit <chr>,
#> #   beta_direction <chr>, beta_description <chr>, last_mapping_date <dttm>,
#> #   last_update_date <dttm>
#> 
#> Slot "loci":
#> # A tibble: 1 × 4
#>   association_id locus_id haplotype_snp_count description   
#>   <chr>             <int>               <int> <chr>         
#> 1 22505                 1                  NA Single variant
#> 
#> Slot "risk_alleles":
#> # A tibble: 1 × 7
#>   association_id locus_id variant_id     risk_allele risk_frequency genome_wide
#>   <chr>             <int> <chr>          <chr>                <dbl> <lgl>      
#> 1 22505                 1 chr22:45895495 T                       NA NA         
#> # ℹ 1 more variable: limited_list <lgl>
#> 
#> Slot "genes":
#> # A tibble: 2 × 3
#>   association_id locus_id gene_name   
#>   <chr>             <int> <chr>       
#> 1 22505                 1 TBC1D22A    
#> 2 22505                 1 LOC100128818
#> 
#> Slot "ensembl_ids":
#> # A tibble: 2 × 4
#>   association_id locus_id gene_name    ensembl_id     
#>   <chr>             <int> <chr>        <chr>          
#> 1 22505                 1 TBC1D22A     ENSG00000054611
#> 2 22505                 1 LOC100128818 NA             
#> 
#> Slot "entrez_ids":
#> # A tibble: 2 × 4
#>   association_id locus_id gene_name    entrez_id
#>   <chr>             <int> <chr>        <chr>    
#> 1 22505                 1 TBC1D22A     25771    
#> 2 22505                 1 LOC100128818 NA       
#> 

# Or by its position in table associations
associations_ex01[2]
#> An object of class "associations"
#> Slot "associations":
#> # A tibble: 1 × 17
#>   association_id   pvalue pvalue_description pvalue_mantissa pvalue_exponent
#>   <chr>             <dbl> <chr>                        <int>           <int>
#> 1 22505          0.000007 NA                               7              -6
#> # ℹ 12 more variables: multiple_snp_haplotype <lgl>, snp_interaction <lgl>,
#> #   snp_type <chr>, standard_error <dbl>, range <chr>,
#> #   or_per_copy_number <dbl>, beta_number <dbl>, beta_unit <chr>,
#> #   beta_direction <chr>, beta_description <chr>, last_mapping_date <dttm>,
#> #   last_update_date <dttm>
#> 
#> Slot "loci":
#> # A tibble: 1 × 4
#>   association_id locus_id haplotype_snp_count description   
#>   <chr>             <int>               <int> <chr>         
#> 1 22505                 1                  NA Single variant
#> 
#> Slot "risk_alleles":
#> # A tibble: 1 × 7
#>   association_id locus_id variant_id     risk_allele risk_frequency genome_wide
#>   <chr>             <int> <chr>          <chr>                <dbl> <lgl>      
#> 1 22505                 1 chr22:45895495 T                       NA NA         
#> # ℹ 1 more variable: limited_list <lgl>
#> 
#> Slot "genes":
#> # A tibble: 2 × 3
#>   association_id locus_id gene_name   
#>   <chr>             <int> <chr>       
#> 1 22505                 1 TBC1D22A    
#> 2 22505                 1 LOC100128818
#> 
#> Slot "ensembl_ids":
#> # A tibble: 2 × 4
#>   association_id locus_id gene_name    ensembl_id     
#>   <chr>             <int> <chr>        <chr>          
#> 1 22505                 1 TBC1D22A     ENSG00000054611
#> 2 22505                 1 LOC100128818 NA             
#> 
#> Slot "entrez_ids":
#> # A tibble: 2 × 4
#>   association_id locus_id gene_name    entrez_id
#>   <chr>             <int> <chr>        <chr>    
#> 1 22505                 1 TBC1D22A     25771    
#> 2 22505                 1 LOC100128818 NA       
#> 

# Keep all associations except the second
associations_ex01[-2]
#> An object of class "associations"
#> Slot "associations":
#> # A tibble: 3 × 17
#>   association_id pvalue pvalue_description pvalue_mantissa pvalue_exponent
#>   <chr>           <dbl> <chr>                        <int>           <int>
#> 1 22509           3e- 9 NA                               3              -9
#> 2 19537565        7e-31 NA                               7             -31
#> 3 19537593        1e-11 NA                               1             -11
#> # ℹ 12 more variables: multiple_snp_haplotype <lgl>, snp_interaction <lgl>,
#> #   snp_type <chr>, standard_error <dbl>, range <chr>,
#> #   or_per_copy_number <dbl>, beta_number <dbl>, beta_unit <chr>,
#> #   beta_direction <chr>, beta_description <chr>, last_mapping_date <dttm>,
#> #   last_update_date <dttm>
#> 
#> Slot "loci":
#> # A tibble: 3 × 4
#>   association_id locus_id haplotype_snp_count description   
#>   <chr>             <int>               <int> <chr>         
#> 1 22509                 1                  NA Single variant
#> 2 19537565              1                  NA Single variant
#> 3 19537593              1                  NA Single variant
#> 
#> Slot "risk_alleles":
#> # A tibble: 3 × 7
#>   association_id locus_id variant_id risk_allele risk_frequency genome_wide
#>   <chr>             <int> <chr>      <chr>                <dbl> <lgl>      
#> 1 22509                 1 rs7089814  C                       NA NA         
#> 2 19537565              1 rs10110651 NA                      NA FALSE      
#> 3 19537593              1 rs9397437  NA                      NA FALSE      
#> # ℹ 1 more variable: limited_list <lgl>
#> 
#> Slot "genes":
#> # A tibble: 7 × 3
#>   association_id locus_id gene_name
#>   <chr>             <int> <chr>    
#> 1 22509                 1 ADO      
#> 2 22509                 1 ZNF365   
#> 3 22509                 1 ALDH7A1P4
#> 4 19537565              1 KCNU1    
#> 5 19537565              1 ZNF703   
#> 6 19537593              1 CCDC170  
#> 7 19537593              1 ESR1     
#> 
#> Slot "ensembl_ids":
#> # A tibble: 7 × 4
#>   association_id locus_id gene_name ensembl_id     
#>   <chr>             <int> <chr>     <chr>          
#> 1 22509                 1 ADO       ENSG00000181915
#> 2 22509                 1 ZNF365    ENSG00000138311
#> 3 22509                 1 ALDH7A1P4 ENSG00000234489
#> 4 19537565              1 KCNU1     ENSG00000215262
#> 5 19537565              1 ZNF703    ENSG00000183779
#> 6 19537593              1 CCDC170   ENSG00000120262
#> 7 19537593              1 ESR1      ENSG00000091831
#> 
#> Slot "entrez_ids":
#> # A tibble: 7 × 4
#>   association_id locus_id gene_name entrez_id
#>   <chr>             <int> <chr>     <chr>    
#> 1 22509                 1 ADO       84890    
#> 2 22509                 1 ZNF365    22891    
#> 3 22509                 1 ALDH7A1P4 544      
#> 4 19537565              1 KCNU1     157855   
#> 5 19537565              1 ZNF703    80139    
#> 6 19537593              1 CCDC170   80129    
#> 7 19537593              1 ESR1      2099     
#>