Skip to content

getIGHreadType() fails with “NA in coercion to boolean” on 10x 5′ Cell Ranger BAM after successful getIGHmapping() #16

Description

@denvercal1234GitHub

Hello there,

Thank you for the tool.

I am running sciCSR on human 10x Genomics 5′ scRNA-seq B-cell data using Cell Ranger possorted_genome_bam.bam files. getIGHmapping() appears to complete successfully for each BAM, but getIGHreadType(out1$read_count) fails consistently with:

NA in coercion to boolean

This happens for all three BAMs I tested.

Data context

  • Human 10x Genomics 5′ scRNA-seq BAMs from Cell Ranger.
  • BAM files are indexed.
  • BAM reference names include chr14.
  • BAM tags are present. On a sample of 1000 alignments:
Run168_4:  CB 940, UB 994, CR 1000, UR 1000
Run168_8:  CB 817, UB 997, CR 1000, UR 1000
Run170_11: CB 941, UB 949, CR 1000, UR 1000

Minimal code

library(sciCSR)

utils::data("human_definitions", package = "sciCSR", envir = .GlobalEnv)
human_definitions <- get("human_definitions", envir = .GlobalEnv)

bam <- "path/to/possorted_genome_bam.bam"

out1 <- sciCSR::getIGHmapping(bam, human_definitions)

dim(out1$read_count)
colnames(out1$read_count)
sum(is.na(out1$read_count))

out2 <- sciCSR::getIGHreadType(out1$read_count)

Observed behavior

getIGHmapping() prints:

Fetching reads mapped to VDJ genes ...
Fetching reads mapped to C gene coding regions ...
Fetching reads mapped to C gene 5' regions ...

and returns a read_count data frame.

For one BAM:

class: data.frame
n_rows: 546063
n_cols: 19
columns:
CB; UB; IGHM_C; IGHM_I; IGHG3_C; IGHG3_I; IGHG1_C; IGHG1_I;
IGHA1_C; IGHA1_I; IGHG2_C; IGHG2_I; IGHG4_C; IGHG4_I;
IGHE_C; IGHE_I; IGHA2_C; IGHA2_I; VDJ

n_total_NA: 0

However:

sciCSR::getIGHreadType(out1$read_count)

fails with:

NA in coercion to boolean

Molecule-level summary of out1$read_count

For one BAM:

n_molecules: 546063
n_multi_C: 11389
prop_multi_C: 0.02085657
n_multi_feature: 21345
prop_multi_feature: 0.0390889
n_C_and_VDJ: 6057
prop_C_and_VDJ: 0.01109213

Breakdown:

n_positive_C  n_positive_I  has_VDJ  n
0             0             TRUE     363309
1             0             FALSE    153566
2             0             FALSE    10145
0             1             FALSE    7843
1             0             TRUE     5270
1             1             FALSE    4079
3             0             FALSE    688
1             1             TRUE     403
2             0             TRUE     337
0             2             FALSE    139
2             1             FALSE    128
1             2             FALSE    35
2             1             TRUE     35
4             0             FALSE    24
0             1             TRUE     20
0             3             FALSE    10
2             2             FALSE    10
3             0             TRUE     10
3             1             FALSE    10
3             1             TRUE     2

Question

Would you mind giving me some advice as to whether this may be an expected edge case in getIGHreadType() when a molecule has multiple C-region or C + VDJ signals? If so, is there a recommended filtering strategy before getIGHreadType(), or should getIGHreadType() internally handle these rows and assign them to -C rather than erroring?

I want to avoid modifying the read_count object incorrectly before sciCSR.

Thank you for your help.

Note that the BAM files appear to have the expected Cell Ranger tags and chromosome naming:

Reference contains chr14: TRUE
CB/UB tags present: TRUE
CR/UR tags present: TRUE

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions