Skip to content

Error in get_dbs_context(): There should not be any variants with multiple alternative alleles. #89

@anabbi

Description

@anabbi

Hello,
thank you for your great package!
I am encountering a problem get dbs contexts from a granges list that was given to me.
I subsetted to dbs first

dbs_grl <- get_mut_type(gr_list, type = "dbs", predefined_dbs_mbs = TRUE)

Then I realized the Ref and Alt columns needed to be DNAStringSet:

gr_list_1 <- lapply(dbs_grl, function(gr) {
  # Convert the REF column to DNAStringSet
  mcols(gr)$ref <- DNAStringSet(mcols(gr)$ref)
  if (is.character(mcols(gr)$alt)) {
    mcols(gr)$alt <- DNAStringSet(mcols(gr)$alt)
  } else if (is.list(mcols(gr)$alt)) {
    mcols(gr)$alt <- DNAStringSetList(lapply(mcols(gr)$alt, DNAStringSet))
  }
  return(gr)
})

However, I am getting the error when calling get_dbs_context:

Error: There should not be any variants with multiple alternative alleles.
You can remove these by using the `get_mut_type` function.
Traceback:

1. .get_dbs_context_gr(vcf_list)
2. .check_no_indels(gr)
3. .check_no_indels_gr(gr)
4. .find_substitution(gr)
5. .check_no_multi_alts(gr)
6. .check_no_multi_alts_gr(gr)
7. stop(paste0("There should not be any variants with multiple alternative alleles.\n", 
 .     "You can remove these by using the `get_mut_type` function."), 
 .     call. = FALSE)
8. .handleSimpleError(function (cnd) 
 . {
 .     watcher$capture_plot_and_output()
 .     cnd <- sanitize_call(cnd)
 .     watcher$push(cnd)
 .     switch(on_error, continue = invokeRestart("eval_continue"), 
 .         stop = invokeRestart("eval_stop"), error = invokeRestart("eval_error", 
 .             cnd))
 . }, "There should not be any variants with multiple alternative alleles.\nYou can remove these by using the `get_mut_type` function.", 
 .     base::quote(NULL))

I looked at the source code for .check_no_multi_alts_gr(gr).

.check_no_multi_alts_gr <- function(gr) {
  alt <- .get_alt(gr)
  nr_alts <- alt %>%
    unlist() %>%
    length()
  if (length(gr) != nr_alts) {
    stop(paste0(
      "There should not be any variants with multiple alternative alleles.\n",
      "You can remove these by using the `get_mut_type` function."
    ), call. = FALSE)
  }
  invisible(gr)
}

I manually looked at a few samples and confirmed length(gr) == nr_alts. I am not sure why I am getting the error.

Thank you for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions