maftools
maftools copied to clipboard
Bug report with oncoplot and its potential cause
Bug about the oncoplot
relying function createOncoMatrix
https://github.com/PoisonAlien/maftools/blob/eba7343b6d902f07c747869a315b9bd48b31341d/R/oncoplot.R#L88
When using oncoplot
with parameter genes = c("some charactor vector")
and fill = TRUE
https://github.com/PoisonAlien/maftools/blob/af202ed5a590e87fdcc38b61ec559e8f4d235e11/R/oncomatrix.R#L29
the levels = g
in this line will become unreliable especially when you pass the maf
of oncoplot
with a column named 'g'.
The function now will use the 'g' column in the subMaf
(in this case derived from laml
) but not the argument of the function:
https://github.com/PoisonAlien/maftools/blob/a62aa15ee561363615bf17d8d1fff3c9a7833d1e/R/oncomatrix.R#L1
I think this line is designed as
subMaf[, Hugo_Symbol := factor(x = Hugo_Symbol, levels = {{ g }})]
where the g
refers to the parameter of the function createOncoMatrix
but now it firstly refers to the column in the subMaf
then refers to the parameter of the function if there is no column named 'g'
in subMaf
.
but unfortunately this code subMaf[, Hugo_Symbol := factor(x = Hugo_Symbol, levels = {{ g }})]
does not work.
As I am a beginner of R, I don't know how to fix the bug. Please Help.
@PoisonAlien, @ShixiangWang, Please Help with the R Grammar Problem~ How to refer to the function parameter rather than the column name in the dataframe manipulate sentence when they have the same name.
@biosunsci Thanks for reporting and tagging me. I can reproduce this error with builtin laml data
The following code can fix this issue, @PoisonAlien Could you replace and check it in more details?
Replace
subMaf[, Hugo_Symbol := factor(x = Hugo_Symbol, levels = g)]
in line 29 with:
subMaf[, `:=`(Hugo_Symbol, factor(x = Hugo_Symbol, levels = get("g", envir = parent.env(environment()))))]
@biosunsci Thanks for reporting and tagging me. I can reproduce this error with builtin laml data
The following code can fix this issue, @PoisonAlien Could you replace and check it in more details?
Replace
subMaf[, Hugo_Symbol := factor(x = Hugo_Symbol, levels = g)]
in line 29 with:subMaf[, `:=`(Hugo_Symbol, factor(x = Hugo_Symbol, levels = get("g", envir = parent.env(environment()))))]
Thanks, that helped a lot ~ I'll close the issue when the code is updated.
Hello @biosunsci , thanks for the issue and going through the code to investigate. @ShixiangWang as always, thanks for the solution :)
I am just thinking if this is the right way to address the issue. I will do a bit more digging and if nothing comes up, I will push the fix as described.
Hello @biosunsci , thanks for the issue and going through the code to investigate. @ShixiangWang as always, thanks for the solution :)
I am just thinking if this is the right way to address the issue. I will do a bit more digging and if nothing comes up, I will push the fix as described.
Thanks a lot, @PoisonAlien, when the code is settled, please let me know, I'll close the issue then.
This issue is stale because it has been open for 60 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.