morinlab / GAMBLR

Set of standardized functions to operate with genomic data
https://morinlab.github.io/GAMBLR/
MIT License
3 stars 2 forks source link

Can't specify a gene list and minMutationPercent together in prettyOncoplot #162

Closed faranehym closed 1 year ago

faranehym commented 1 year ago

I was trying to narrow down the genes in the maf file to those used in the target panel which works but I can't seem to narrow down the genes I specified by minMutationPercent nor with removeNonMutated. When I used minMutationPercent it produced the error below and nothing was removed when I used removeNonMutated. I tried those arguments without a specified gene list but I think it'd be useful to be able to look at and narrow down specific genes from the target panel in the oncoplot.

Here's the code I was working with and the error message!


  metadata <- read_tsv("/projects/lymphoma_tfri_ppg/LySeq_FL/data/metadata/LST_metadata.tsv")
  metadata <- metadata %>% 
    select(sample_id, everything()) 

  metadata["pathology"] = "FL"

  # retrieve maf file 
  maf <- read_tsv("results/slms_3-1.0_vcf2maf-1.3/level_3/capture--grch37/LySeqST_merged.maf")

  # maftools object containing the variants to plot
  mafobj_data = maf
  mafobj = read.maf(maf = mafobj_data)

  # define genes of interest (specified in lyseqst_fl_targets.bed) 
  targets_bed <- read_tsv("/projects/lymphoma_tfri_ppg/LySeq_FL/data/bed/lyseqst_fl_targets.bed")
  gene_names <- pull(targets_bed[,c(4)]) %>% 
    str_extract(".+?(?=_)") %>% 
    unique()

  prettyOncoplot(maftools_obj = mafobj,
                 genes = gene_names,
                 these_samples_metadata = metadata,
                 removeNonMutated = TRUE,
                 minMutationPercent = 5)```

```Error in (function (cond)  : 
  error in evaluating the argument 'x' in selecting a method for function 'as.data.frame': Assigned data `values` must be compatible with existing data.
ℹ Error occurred for column `Hugo_Symbol`.
✖ Can't convert <double> to <character>```
lkhilton commented 1 year ago

@faranehym is going to work on updating the prettyOncoplot function to resolve this, so this doesn't require attention from other GAMBLRs until the PR stage. Thanks!

rdmorin commented 1 year ago

Depending on the underlying cause the fix for this may be the addition/improvement of a function I had started working on that checks metadata for completeness (i.e. that all expected columns are present)

Kdreval commented 1 year ago

The latest update to master (PR #165 ) fixes this, closing the issue. Thanks Faraneh!