For each cell (defined by ccdb$cell_pk) count the number of each level of chain_key occurs, and cross tabulate. Also for each cell, paste together all values chain_key. Return a tibble, keyed by cells that includes the counts of the chains, the raw_chain_type and any additional output from running chain_recode_fun.

ig_chain_recode(tbl)

tcr_chain_recode(tbl)

enumerate_pairing(ccdb, chain_key = "chain", chain_recode_fun = NULL)

Arguments

tbl

output from enumerate_pairing containing TRA/TRB or IGH/IHK/IHL columns

ccdb

ContigCellDB

chain_key

character naming the field in the contig_tbl identifying chain

chain_recode_fun

a function that operates on the output of this function that further reduces the chain combinations to some other summary. Set to 'guess' to apply functions that may work for 10X data or NULL to skip. See CellaRepertorium::tcr_chain_recode for an example.

Value

a tibble keyed by cells.

Functions

  • ig_chain_recode: Recode a table with IG chains

  • tcr_chain_recode: Recode a table with TCR chains

Examples

data(ccdb_ex)
enumerate_pairing(ccdb_ex)
#> # A tibble: 832 × 6
#>    pop   sample barcode              TRA   TRB raw_chain_type
#>    <chr> <chr>  <chr>              <dbl> <dbl> <chr>         
#>  1 b6    4      AAAGTAGTCGCGCCAA-1     1     2 TRA_TRB_TRB   
#>  2 b6    4      AACCATGCATTTGCCC-1     1     0 TRA           
#>  3 b6    4      AACTGGTGTCTGATCA-1     1     1 TRA_TRB       
#>  4 b6    4      AAGCCGCAGTAAGTAC-1     0     1 TRB           
#>  5 b6    4      AAGTCTGGTTCAACCA-1     1     1 TRA_TRB       
#>  6 b6    4      ACACCAAAGTCCAGGA-1     1     1 TRA_TRB       
#>  7 b6    4      ACATGGTAGTGTTTGC-1     1     1 TRA_TRB       
#>  8 b6    4      ACCCACTTCCACGACG-1     1     1 TRA_TRB       
#>  9 b6    4      ACGCCAGGTCCGAATT-1     0     1 TRB           
#> 10 b6    4      ACGCCAGTCCAATGGT-1     0     1 TRB           
#> # … with 822 more rows
enumerate_pairing(ccdb_ex, chain_recode_fun = 'guess')
#> # A tibble: 832 × 8
#>    pop   sample barcode              TRA   TRB raw_chain_type pairing canonical 
#>    <chr> <chr>  <chr>              <dbl> <dbl> <chr>          <chr>   <chr>     
#>  1 b6    4      AAAGTAGTCGCGCCAA-1     1     2 TRA_TRB_TRB    paired  double-be…
#>  2 b6    4      AACCATGCATTTGCCC-1     1     0 TRA            alpha   classical 
#>  3 b6    4      AACTGGTGTCTGATCA-1     1     1 TRA_TRB        paired  classical 
#>  4 b6    4      AAGCCGCAGTAAGTAC-1     0     1 TRB            beta    classical 
#>  5 b6    4      AAGTCTGGTTCAACCA-1     1     1 TRA_TRB        paired  classical 
#>  6 b6    4      ACACCAAAGTCCAGGA-1     1     1 TRA_TRB        paired  classical 
#>  7 b6    4      ACATGGTAGTGTTTGC-1     1     1 TRA_TRB        paired  classical 
#>  8 b6    4      ACCCACTTCCACGACG-1     1     1 TRA_TRB        paired  classical 
#>  9 b6    4      ACGCCAGGTCCGAATT-1     0     1 TRB            beta    classical 
#> 10 b6    4      ACGCCAGTCCAATGGT-1     0     1 TRB            beta    classical 
#> # … with 822 more rows