Assigning clones doesn't work for heavy-only single cell data

Issue #23 resolved
Edel Aron created an issue

As brought up in Nina Yoshitake’s email (Dec 24th, 2020), following the 10x tutorial then going to scoper to assign clones if you have a non-bimodal sequence distance plot won’t work for the filtered_contig_heavy_productive-T.tsv file.

This code in identicalClones seems to be the main issue (db_l is empty and leads to a # Error: Can't combine `..1$clone_id` <character> and `..2$clone_id` <logical>.)

if (single_cell) {
        db_l <- db_l[, !(names(db_l) %in% temp_cols)]
        db_l[[clone]] <- NA
        # copy clone ids from heavy chains into light chains
        cell_ids_h <- unique(db_cloned[[cell_id]])
        cell_ids_l <- unique(db_l[[cell_id]])
        for (cellid in cell_ids_l) {
            if (cellid %in% cell_ids_h) {
                db_l[[clone]][db_l[[cell_id]] == cellid] <- db_cloned[[clone]][db_cloned[[cell_id]] == cellid]
            } 
        }
        # bind heavy and light chain data.frames
        stopifnot(all(names(db_cloned) == names(db_l)))
        db_cloned <- bind_rows(db_cloned, db_l)

Maybe adding in an if statement and having only_heavy specified would be a good way to deal with this? Or just doing a check that db_l isn’t empty before trying to bind_rows.

In any case, having a single-cell ExampleDb and expanding on the vignette (or making a new one) and tests could help with this. We talk about single cell data in the function’s documentation, but it isn’t super clear in the tutorials how to read it in and then what to run (like with Nina moving between steps).

Comments (2)

  1. Log in to comment