Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GenVisR: Error in waterfall_hierarchyTRV(data_frame, fileType, variant_class_order) or in heatmap_grob[["grobs"]][[ind_legend]] : no such index at level 2 #398

Open
tanbiswas opened this issue Jun 19, 2024 · 2 comments

Comments

@tanbiswas
Copy link

tanbiswas commented Jun 19, 2024

Hi,
I want to make good plots using GenVisR. I am getting the below errors while using waterfall function. If use Variant_Classification column which has a value like Missense_Mutation, Nonsense_Mutation, Silent etc. then I am getting error in waterfall_hierarchyTRV(data_frame, fileType, variant_class_order). Below is the error attached:

mutationData <- read.delim("batch3_with_VAF.txt")
mutationData <- mutationData[,c("Tumor_Sample_Barcode", "Hugo_Symbol", "Variant_Classification", "HGVSp_Short")]
colnames(mutationData) <- c("sample", "gene", "variant_class", "amino.acid.change")
mutation_priority <- as.character(unique(mutationData$variant_class))
waterfall(mutationData, fileType = "Custom", variant_class_order=mutation_priority)
Checking if input is properly formatted...
Detected "Custom" file_type flag, looking for correct column names...
Calculating frequency of mutations...
setting mutation hierarchy...
Error in heatmap_grob[["grobs"]][[ind_legend]] : no such index at level 2
In addition: Warning messages:
1: The melt generic in data.table has been passed a table and will attempt to redirect to the relevant reshape2 method; please note that reshape2 is superseded and is no longer actively developed, and this redirection is now deprecated. To continue using melt methods from reshape2 while both libraries are attached, e.g. melt.list, you can prepend the namespace, i.e. reshape2::melt(mutation_counts). In the next version, this warning will become an error.
2: The dcast generic in data.table has been passed a data.frame and will attempt to redirect to the relevant reshape2 method; please note that reshape2 is superseded and is no longer actively developed, and this redirection is now deprecated. Please do this redirection yourself like reshape2::dcast(x). In the next version, this warning will become an error.
3: In waterfall_select_palette(file_type = file_type, custom_palette = plot_palette) :
Defining a palette in mainPalette is recommended when file_type is set to "Custom", defaulting to a predefined palette with 20 levels

If I use Variant_Type column which has value like SNP, DNP, DEL etc. then I am getting another type of error!

mutationData <- mutationData[,c("Tumor_Sample_Barcode", "Hugo_Symbol", "Variant_Type", "HGVSp_Short")]
colnames(mutationData) <- c("sample", "gene", "variant_class", "amino.acid.change")
mutation_priority <- as.character(unique(mutationData$variant_class))
waterfall(mutationData, fileType = "Custom", variant_class_order=mutation_priority)
Checking if input is properly formatted...
Detected "Custom" file_type flag, looking for correct column names...
Calculating frequency of mutations...
setting mutation hierarchy...
Error in heatmap_grob[["grobs"]][[ind_legend]] : no such index at level 2
In addition: Warning messages:
1: In waterfall_Custom2anno(x, label_col) :
Did not detect silent mutations in input, is this expected?
2: The melt generic in data.table has been passed a table and will attempt to redirect to the relevant reshape2 method; please note that reshape2 is superseded and is no longer actively developed, and this redirection is now deprecated. To continue using melt methods from reshape2 while both libraries are attached, e.g. melt.list, you can prepend the namespace, i.e. reshape2::melt(mutation_counts). In the next version, this warning will become an error.
3: The dcast generic in data.table has been passed a data.frame and will attempt to redirect to the relevant reshape2 method; please note that reshape2 is superseded and is no longer actively developed, and this redirection is now deprecated. Please do this redirection yourself like reshape2::dcast(x). In the next version, this warning will become an error.
4: In waterfall_select_palette(file_type = file_type, custom_palette = plot_palette) :
Defining a palette in mainPalette is recommended when file_type is set to "Custom", defaulting to a predefined palette with 20 levels

If i directly use the maf file for plot. Thene I am getting the below error:

mutationData <- read.delim("batch3_with_VAF.txt")
waterfall(mutationData, fileType="MAF")
Checking if input is properly formatted...
Calculating frequency of mutations...
setting mutation hierarchy...
Error in waterfall_hierarchyTRV(data_frame, fileType, variant_class_order) :
Detected an invalid mutation type, valid values for MAF are: Nonsense_Mutation, Frame_Shift_Ins, Frame_Shift_Del, Translation_Start_Site, Splice_Site, Nonstop_Mutation, In_Frame_Ins, In_Frame_Del, Missense_Mutation, 5'Flank, 3'Flank, 5'UTR, 3'UTR, RNA, Intron, IGR, Silent, Targeted_Region, NA
In addition: Warning message:
The melt generic in data.table has been passed a table and will attempt to redirect to the relevant reshape2 method; please note that reshape2 is superseded and is no longer actively developed, and this redirection is now deprecated. To continue using melt methods from reshape2 while both libraries are attached, e.g. melt.list, you can prepend the namespace, i.e. reshape2::melt(mutation_counts). In the next version, this warning will become an error.
Waterfall(mutationData, fileType="MAF")
Error in Waterfall(mutationData, fileType = "MAF") :
unused argument (fileType = "MAF")

Please let me know where is the problem.

Regards,
Tanay

@Ilaria-Pirona
Copy link

Ilaria-Pirona commented Sep 25, 2024

I am getting the same error using also the data from the vignette/tutorial (https://bioconductor.org/packages/release/bioc/vignettes/GenVisR/inst/doc/Intro.R):

library(GenVisR)
set.seed(383)

Plot only genes with mutations in 6% or more of samples
waterfall(brcaMAF, mainRecurCutoff=.06)

waterfall(brcaMAF, mainRecurCutoff=.06)
Checking if input is properly formatted...
Calculating frequency of mutations...
setting mutation hierarchy...
Performing recurrence cutoff...
Error in heatmap_grob[["grobs"]][[ind_legend]] : no such index at level 2
In addition: Warning messages:
1: The melt generic in data.table has been passed a table and will attempt to redirect to the relevant reshape2 method; please note that reshape2 is superseded and is no longer actively developed, and this redirection is now deprecated. To continue using melt methods from reshape2 while both libraries are attached, e.g. melt.list, you can prepend the namespace, i.e. reshape2::melt(mutation_counts). In the next version, this warning will become an error.
2: The dcast generic in data.table has been passed a data.frame and will attempt to redirect to the relevant reshape2 method; please note that reshape2 is superseded and is no longer actively developed, and this redirection is now deprecated. Please do this redirection yourself like reshape2::dcast(x). In the next version, this warning will become an error.

@AukeVanSighem
Copy link

AukeVanSighem commented Nov 21, 2024

Hi,

I just ran into the same issue (no such index at level 2 error when running waterfall_align). I fixed the issue by downgrading my ggplot2 package from version 3.5.0 to 3.4.4.

The origin of the issue seems to be a change in ggplot2 grob structure, that includes multiple guide-box components instead of one.

On ggplot2 version 3.5.0:
image

On the working version (3.4.4):
image

This code is taken from the waterfall_align function in the GenVisR package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants